Skip to content

Commit c278949

Browse files
committed
By the power of grayskull!
1 parent 21a1782 commit c278949

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

content/packaging.rst

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -254,42 +254,44 @@ Building a conda package and share it
254254

255255
.. callout:: Prerequisites
256256

257-
To create a conda package, `conda-build` package is required. You may install it with **Anaconda Navigator** or from the command line::
257+
To generate a conda build recipe, the package ``grayskull`` and
258+
to build it, the package ``conda-build`` are required.
259+
You may install these with **Anaconda Navigator** or from the command line::
258260

259-
$ conda install conda-build
261+
$ conda install -n base grayskull conda-build
260262

261263

262264
The simplest way for creating a conda package for your python script is to
263265
first publish it in `PyPI <https://pypi.org/>`__ following the steps explained
264266
above.
265267

266268

267-
Building a python package with conda skeleton pypi
268-
***************************************************
269+
Building a python package with grayskull and conda-build
270+
********************************************************
269271

270272
Once build, the conda package can be installed locally. For this example, we
271273
will use `runtest <https://pypi.org/project/runtest/>`__. `runtest
272274
<https://github.com/bast/runtest>`__ is a numerically tolerant end-to-end test
273275
library for research software.
274276

275-
1. Create pypi skeleton::
277+
1. Generate the *recipe* by executing (``grayskull`` or ``conda grayskull``)::
276278

277-
$ conda skeleton pypi runtest
279+
$ conda grayskull pypi runtest
278280

279-
The command above will create a new folder called `runtest` containing a file `meta.yaml`, the conda recipe for `runtest`.
281+
The command above will create a new folder called `runtest` containing a file `meta.yaml`,
282+
the conda recipe for building the `runtest` package.
280283

281-
2. Edit `meta.yaml` and update requirements:
284+
2. View the contents of `meta.yaml` and ensure requirements :
282285

283286
.. code-block:: yaml
284287
285288
requirements:
286289
host:
287-
- pip
288290
- python
289-
- flit
291+
- flit-core >=2,<4
292+
- pip
290293
run:
291294
- python
292-
- flit
293295
294296
In the requirements above, we specified what is required for the `host <https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#host>`__ and for `running <https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#run>`__ the package.
295297

@@ -303,7 +305,7 @@ library for research software.
303305

304306
Your package is now ready to be build with conda::
305307

306-
$ conda-build runtest
308+
$ conda build runtest
307309

308310

309311
.. callout:: Conda package location
@@ -312,11 +314,15 @@ library for research software.
312314

313315
.. code-block:: none
314316
315-
~/anaconda3/conda-bld/win-64/runtest-2.2.1-py38_0.tar.bz2
317+
/home/username/miniforge3/conda-bld/noarch/runtest-2.3.4-py_0.tar.bz2
316318
317-
The prefix `~/anaconda3/` may be different on your machine and depending on your operating system (Linux, Mac-OSX or Windows) the sub-folder `win-64` differs too (for instance `linux-64` on Linux machines).
319+
The prefix ``/home/username/miniforge3/`` may be different on your machine.
320+
depending on your operating system (Linux, Mac-OSX or Windows). The sub-folder is named ``noarch`` since
321+
it is a pure-python package and the recipe indicates the same.
318322

319-
The conda package we have created is specific to your platform (here `win-64`). It can be converted to other platforms using `conda convert <https://docs.conda.io/projects/conda-build/en/latest/user-guide/tutorials/build-pkgs.html#converting-a-package-for-use-on-all-platforms>`__.
323+
If package contained compiled code then the sub-folder would have been named ``win-64`` or ``linux-64``.
324+
It could then be converted to other platforms using
325+
`conda convert <https://docs.conda.io/projects/conda-build/en/latest/user-guide/tutorials/build-pkgs.html#converting-a-package-for-use-on-all-platforms>`__.
320326

321327
4. Check within new environment
322328

@@ -341,7 +347,10 @@ library for research software.
341347
342348
.. callout:: Building a conda package from scratch
343349

344-
It is possible to build a conda package from scratch without using conda skeleton. We recommend you to check the `conda-build documentation <https://docs.conda.io/projects/conda-build/en/latest/user-guide/tutorials/build-pkgs.html>`__ for more information.
350+
It is possible to build a conda package from scratch without using conda grayskull.
351+
We recommend you to check the
352+
`conda-build documentation <https://docs.conda.io/projects/conda-build/en/latest/user-guide/tutorials/build-pkgs.html>`__
353+
for more information.
345354

346355
To be able to share and install your local conda package anywhere (on other platforms), you would need to upload it to a `conda channel <https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/channels.html>`__ (see below).
347356

@@ -350,15 +359,13 @@ To be able to share and install your local conda package anywhere (on other plat
350359
Publishing a python package
351360
***************************
352361

353-
- Upload your package to *Anaconda.org*: see instructions `here
354-
<https://docs.conda.io/projects/conda-build/en/latest/user-guide/tutorials/build-pkgs-skeleton.html#optional-uploading-packages-to-anaconda-org>`__.
355-
Please note that you will have to create an account on Anaconda.
356-
357362
- Upload your package to `conda-forge <https://conda-forge.org/>`__:
358363
conda-forge is a conda channel: it contains community-led collection of
359364
recipes, build infrastructure and distributions for the conda package
360-
manager. Anyone can public conda packages to conda-forge if certain
361-
`guidelines <https://conda-forge.org/docs/>`__ are respected.
365+
manager. Anyone can
366+
`publish conda packages to conda-forge <https://conda-forge.org/docs/maintainer/adding_pkgs/>`__
367+
if certain
368+
`guidelines <https://conda-forge.org/docs/maintainer/guidelines/>`__ are respected.
362369

363370
- Upload your package to `bioconda <https://bioconda.github.io/>`_: bioconda is
364371
a very popular channel for the conda package manager specializing in

0 commit comments

Comments
 (0)