Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on "run exports" to install zlib at runtime #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jdblischak
Copy link
Member

I recently had a colleague get confused about "run exports" after reading the documentation page on migrating to conda build v3. I think the explanation of how to handle the zlib requirement is confusing.

Currently the text contains this explanation:

The second major advance in conda-build 3 is the the concept of "run exports".
The idea here is to specify that any time a dependency (``zlib``, in our running example)
is used as a build dependency, it should also be automatically be installed as
a run dependency without having to explicitly add it as such in the recipe.
This specification is done in the ``zlib`` recipe itself (which is hosted by
conda-forge), so in general bioconda collaborators can just add ``zlib`` as
a build dependency.

The first thing I noticed is that zlib shouldn't be added to build, since it doesn't have "strong run exports". Instead it should be added to host.

Then in the example recipe, zlib is still added in run, which contradicts the paragraph about run exports

host:
- python
- zlib
run:
- python
- zlib

I suspect that part of the confusion is that zlib is itself a complex example of "run exports", which I will explain below. For documentation purposes, it might be better to simply include a more straight-forward example, and then tackle zlib since it is such a common requirement for bioconda recipes.

Here is why I think zlib is a complex example to demonstrate the concept of "run exports"

Lastly, I'd note that there are many existing bioconda recipes that include zlib in the run requirements (https://github.com/search?q=repo%3Abioconda%2Fbioconda-recipes+zlib+language%3AYAML&type=code&l=YAML). If it's a bioconda convention to include zlib in run (perhaps to avoid the complexity I noted above), then I definitely think a different example should be chosen to demonstrate the concept of "run exports"

@jdblischak
Copy link
Member Author

Lastly, I'd note that there are many existing bioconda recipes that include zlib in the run requirements

Note that 3 weeks ago, @jmarshall removed zlib (and other shared libraries that use run exports) from the htslib recipe in PR bioconda/bioconda-recipes#44774. I think this is the correct approach and similar recipe updates should be encouraged

a different example should be chosen to demonstrate the concept of "run exports"

And I still think a different or additional example would be useful. The zlib "run exports" continues to behave unexpectedly at times, as noted in bioconda/bioconda-recipes#44774 (comment)

@jdblischak jdblischak mentioned this pull request Jan 8, 2024
5 tasks
@jdblischak
Copy link
Member Author

Bump. I think these minor changes would clarify the current bioconda documentation on run exports. Any potential larger changes can wait for a future PR

@jdblischak
Copy link
Member Author

Closing because the file source/contributor/cb3.rst was deleted in the recently merged #16 ☹️

@daler
Copy link
Member

daler commented Mar 5, 2024

It was migrated to https://bioconda.github.io/faqs.html#what-are-the-host-and-build-sections-of-a-recipe (and here in the source), is there anything that should be changed in that section?

@jdblischak
Copy link
Member Author

It was migrated to https://bioconda.github.io/faqs.html#what-are-the-host-and-build-sections-of-a-recipe (and here in the source), is there anything that should be changed in that section?

I like the explanation of build/host/run in that section. The only missing aspect I would add is that the shared libraries in host don't need to be duplicated in run because of "run exports".

However, the current guidance for writing recipes still recommends explicitly adding zlib to the run requirements even though this shouldn't be necessary in most cases due to the zlib recipe's use of run exports. Furthermore, one the example recipes, samtools, no longer includes the unnecessary zlib. Also, the distinction between build and host isn't as clear here as it is in the FAQ entry you shared.

Conda distinguishes between dependencies needed for building (the ``build`` section),
and dependencies needed during build time (the ``host`` section).
For example, the following
.. code:: yaml
requirements:
build:
- {{ compiler('c') }}
host:
- zlib
run:
- zlib
specifies that a recipe needs the C compiler to build, and zlib present during
building and running.
For two examples see:
- example requiring ``autoconf``: `srprism
<https://github.com/bioconda/bioconda-recipes/tree/master/recipes/srprism>`_
- simple example: `samtools
<https://github.com/bioconda/bioconda-recipes/tree/master/recipes/samtools>`_
If the package uses ``zlib``, then please see the :ref:`troubleshooting section on zlib <zlib>`.

If you're interested, I'm happy to send PR(s) to update either of the above points.

@daler
Copy link
Member

daler commented Mar 5, 2024

Ah, yes, PR/PRs would be wonderful -- thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants