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

Noarch variant blog post #2332

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions blog/2024-10-15-python-noarch-variants.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
authors:
- isuruf
tags: [infrastructure]
---

# Noarch variant packages for python packages on conda-forge
isuruf marked this conversation as resolved.
Show resolved Hide resolved

jaimergp marked this conversation as resolved.
Show resolved Hide resolved
conda-forge packages have always been batteries included. When
a package has some build options turned off by default to reduce
dependencies we have enabled these options to give the most
isuruf marked this conversation as resolved.
Show resolved Hide resolved
functionality and performance to our users.

In the python world, some packages are written in C/C++/Cython
isuruf marked this conversation as resolved.
Show resolved Hide resolved
to get the most performance out of a package. However these packages
have reference implementation written in python. The python
isuruf marked this conversation as resolved.
Show resolved Hide resolved
reference implementation is a good way to check the C/C++/Cython
code against a much simpler python implementation and is also
useful for platforms like PyPy where the C/C++/Cython implementation
can be slower than the python reference implementation due to the
isuruf marked this conversation as resolved.
Show resolved Hide resolved
emulation of the Python C/C++ API by PyPy. For eg: for the Cython
isuruf marked this conversation as resolved.
Show resolved Hide resolved
package, setting `CYTHON_NO_COMPILE` environment variable
when building the cython wheel itself, it will use the python reference
isuruf marked this conversation as resolved.
Show resolved Hide resolved
implementation.

To support platforms like PyPy, Some packages build wheels with
compiled extensions for the platforms that are
known to be more performant with the compiled extension, but also
provide a universal pure python wheel for the other platforms.
isuruf marked this conversation as resolved.
Show resolved Hide resolved
This also provides a way for new python versions and variants
isuruf marked this conversation as resolved.
Show resolved Hide resolved
like the freethreading python build to use these packages by the
isuruf marked this conversation as resolved.
Show resolved Hide resolved
early adpoters of these python versions.
isuruf marked this conversation as resolved.
Show resolved Hide resolved

On conda-forge we usually have compiled python packages, but provide
isuruf marked this conversation as resolved.
Show resolved Hide resolved
no reference implementation. This makes early adpoters of new python
isuruf marked this conversation as resolved.
Show resolved Hide resolved
versions to wait for the conda-forge bot managed by @conda-forge/bot
team to start the migration and rebuild the packages. For eg: the
freethreading python 3.13 build is still not under way because
isuruf marked this conversation as resolved.
Show resolved Hide resolved
conda-forge has decided to wait until the default (GIL enabled)
python 3.13 build has migrated enough and upstream packages have added
isuruf marked this conversation as resolved.
Show resolved Hide resolved
support for freethreading builds.
isuruf marked this conversation as resolved.
Show resolved Hide resolved
Another issue is that some packages have cyclic dependencies at build
or test time and this requires manual handling to reduce dependencies
before the migration and add the dependencies later on.
isuruf marked this conversation as resolved.
Show resolved Hide resolved

We have been adding `noarch: python` variants for some feedstocks
so that the compiled extension has higher priority and the pure
python extension has lower priority which makes the conda solver
isuruf marked this conversation as resolved.
Show resolved Hide resolved
use the `noarch: python` variant. One issue is that the linter
might not like selectors on noarch recipes. We added an option

```yaml
linter:
skip:
- lint_noarch_selectors
```

to `conda-forge.yml` that will make the linter skip this warning/error.

We list some PRs here as a reference for conda-forge maintainers who
want to help out with this effort.

- [coverage](https://github.com/conda-forge/coverage-feedstock/pull/123)
- [cython](https://github.com/conda-forge/cython-feedstock/pull/147)
- [aiohttp](https://github.com/conda-forge/aiohttp-feedstock/pull/99)
Comment on lines +68 to +73
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice for readers to include an example from a simple one in the blogpost itself. Perhaps could use a diff format to highlight relevant changes