-
Notifications
You must be signed in to change notification settings - Fork 24
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
CEP for specifying the location of site-packages in repodata #90
Conversation
https://github.com/conda/ceps/pull/86/files is working in the same space, to allow ABI3 packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to be in favor of putting the site-packages path in a separate file in python's info/, for example in link.json or paths.json where it would be possible to increment the version, and make it non-installable by incompatible condas.
cep-999.md
Outdated
"subdir": osx-arm64, | ||
"version": "3.13.0rc1", | ||
"sha256": "fa0ae22c13450fe6c30c754ee5efbd7fe7e7533b878d7be96e74de56211d19df", | ||
"python_site_packages_path": "lib/python3.13t/site-packages" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"python_site_packages_path": "lib/python3.13t/site-packages" | |
"python_site_packages": "lib/python3.13t/site-packages" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field specified in the CEP is python_site_packages_path
with _path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, suggestion is to rename without _path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to either name. Does anyone have a strong opinion one way or another?
Co-authored-by: Daniel Holth <[email protected]>
Co-authored-by: Daniel Holth <[email protected]>
I have put together a draft PR for conda-build that implements support for specifying this field in the build section of a recipe, see conda/conda-build#5502. With this I created sample packages that specify this metadata field for testing with downstream tools. They are available on anaconda.org in the There are three noarch packages with the following paths specified
|
conda/conda#14256 contains an rough draft of the change needed for conda to make use of this field. |
Should we fix the name for python in the shebang of entry-points in this CEP or a separate one? Currently there's a |
I'd suggest keeping it here TBH, since a whole CEP for a simple change like this may be overkill. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments, mostly just tweaks for readability
cep-999.md
Outdated
def is_valid(target_prefix: str, python_site_packages_path: str) -> bool: | ||
target_prefix = os.path.realpath(target_prefix) | ||
full_path = os.path.realpath(os.path.join(target_prefix, python_site_packages_path)) | ||
test_prefix = os.path.commonpath((target_prefix, full_path)) | ||
return test_prefix == target_prefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def is_valid(target_prefix: str, python_site_packages_path: str) -> bool: | |
target_prefix = os.path.realpath(target_prefix) | |
full_path = os.path.realpath(os.path.join(target_prefix, python_site_packages_path)) | |
test_prefix = os.path.commonpath((target_prefix, full_path)) | |
return test_prefix == target_prefix | |
from pathlib import Path | |
def is_valid(target_prefix: str, python_site_packages_path: str) -> bool: | |
target_prefix = Path(target_prefix).resolve() | |
full_path = (target_prefix / python_site_packages_path).resolve() | |
return target_prefix in full_path.parents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This style of check would require resolving target_prefix
as well as it needs to take into account symbolic links and various re-directs on Windows file systems.
The function as written in the CEP closely matches the filter used by by tarfile module in the CPython standard library for validating paths, https://github.com/python/cpython/blob/v3.13.0/Lib/tarfile.py#L816-L818
A bit of context about the python executable name. On Unix, CPython (upstream and conda) has python3.13 for freethreading and default builds. For freethreading python3.13 is a symlink to python 3.13t. On Unix, PyPy does the same On Windows, CPython upstream has python.exe for default build and python3.13t.exe for freethreading builds as there's only one installer. On conda-forge, python3.13.exe and python.exe is a copy of python3.13t.exe for freethreading builds. For noarch: packages, the entry-points right now uses python3.13 for unix and python.exe for windows. Do we want to keep using these or have a way for specifying the executable name? Note that it's straightforward to change the name in Unix as it's about changing the shebang, but it's hard on windows due to the need to create an executable. I'm okay with keeping the current status quo and requiring |
At least on macOS, Python virtual environment created using By default the path of the executable used to run pip is used when creating console entry-points in these environments. The Based on this I would be in favor of conda using |
The benefit of including the site-packages path in repodata is the ability to correct it with hotfixing after the package is built. This can be used to add this field to existing packages, like the PyPy and GraalPy packages in conda-forge, or correct mistakes in future packages. If functionality is not needed then the field could be moved to link.json or paths.json. Another benefit of including this is repodata is discoverability. Repodata can be examined without downloading and extracting the package itself. Incrementing the version would prevent the installation with incompatible version of condas but the user experience is not great. Specifically the environment would solve and the user would not be aware of a problem until the packages are downloaded, extracted and staged for linking. |
Co-authored-by: Jannis Leidel <[email protected]>
Co-authored-by: Jannis Leidel <[email protected]>
Co-authored-by: Jannis Leidel <[email protected]>
Co-authored-by: Jannis Leidel <[email protected]>
Co-authored-by: Jannis Leidel <[email protected]>
Co-authored-by: Jannis Leidel <[email protected]>
Co-authored-by: Jannis Leidel <[email protected]>
Co-authored-by: Jannis Leidel <[email protected]>
Co-authored-by: Jannis Leidel <[email protected]>
Another advantage of storing this information in the repodata is that that information is always readily available during installation, even for already installed records (even if the cache is cleared). |
Good question! I assumed it would be ignored except for the package that provides python. In rattler we currently assume that is the package called “python”. I wonder how conda does this. |
This field is only allowed on the conda package named Another way of thinking about this change is that instead of using the package with name |
In coordination with @jjhelmus, I post this request for a vote: This vote falls under the "Enhancement Proposal Approval" policy of the conda governance policy, It needs 60% of the Steering Council to vote To vote, please use the following form to vote. If you have questions concerning the proposal, you may also leave a comment or code review. This vote will end in one week on 2024-10-15, End of Day, Anywhere on Earth (AoE). @xhochy (Uwe Korn)
@CJ-Wright (Christopher J. 'CJ' Wright)
@mariusvniekerk (Marius van Niekerk)
@chenghlee (Cheng H. Lee)
@ocefpaf (Filipe Fernandes)
@marcelotrevisani (Marcelo Duarte Trevisani)
@msarahan (Michael Sarahan)
@mbargull (Marcel Bargull)
@jakirkham (John Kirkham)
@jezdez (Jannis Leidel)
@wolfv (Wolf Vollprecht)
@jaimergp (Jaime Rodríguez-Guerra)
@kkraus14 (Keith Kraus)
@baszalmstra (Bas Zalmstra)
@beckermr (Matthew R. Becker)
@Hind-M (Hind Montassif)
@trallard (Tania Allard)
|
When conda doesn't understand this field, does that Python package work? |
Yes, the current GraalPy, PyPy and free-threading CPython
|
Co-authored-by: jaimergp <[email protected]>
I just had one shower-thought: what if we would store a map for this, and could that help with It's been a long standing issue that we cannot support other languages with noarch packages as easily as Python for which each package manager needs to add some specific code. If we had a "noarch_map": {
"site-packages": "lib/python3.10/site-packages"
} And for Ruby it could read something like: "noarch_map": {
"gems": "lib/ruby5.3/gemfiles/gems"
} This would still leave open the question on pre-compiling The I think this might be worth it to revisit if we can afford it. I was trying to find some old references / issues, could only find one so far. |
I don't think we should introduce any other noarch types. |
But is that possible? Certainly, one interpretation of noarch-Python is that it's historic debt. But eliminating it would require patching the default path search behavior of python; and there is version-dependent byte compilation as well. In contrast, for R we are fortunate that the search path is platform and version-independent, but the byte compilation issue remains, which means that currently we have to rebuild many noarch packages with each major R release. I think it would be good to enumerate the additional languages being considered and the potential obstacles to the use of noarch-generic. If there are none, great, but at least for me I'm speaking from ignorance of these alternatives. |
@isuruf we wouldn't have to introduce any new noarch types. Just move the files in the right places and the noarch-map would take care of it :) |
Right, it would require a @wolfv, yes, but it's adding another layer of unnecessary behaviour when all we need to do is to make sure the packages end up in a version-independent path in the first place. You are producing more general technical debt in order to produce less technical debt for python specifics. |
@jezdez What is the status of this CEP? Did it pass or are there still discussions to be had? |
I'll update the PR in the coming week, currently out of office. |
Why make this a nested field when any individual package should only ever define one entry. A |
One could imagine multiple entries, such as:
and noarch packages that would have But yeah, idk, maybe not useful enough :) |
conda/rattler#909 has the beginnings of an implementation of this CEP in rattler. |
Awesome, that's great! :) |
The vote is closed, and we have the following result: Total voters: 17 (valid: 13 = 76.47%) Yes votes (13 / 100.00%):
No votes (0 / 0.00%)): Abstain votes (0 / 0.00%): Not voted (4):
Invalid votes (0): Thus we reached quorum and enough YES votes to mark this as accepted. 🎉 |
…ng noarch: python packages, CEP-17 (#909) ### Description Use the `python_site_packages_path` field from repodata to set the directory when `noarch: python` packages get installed as specified in [CEP-17](conda/ceps#90). This the start of an implementation. Wanted to get feedback on the approach before updating other crates and tests. --------- Co-authored-by: Bas Zalmstra <[email protected]>
This has been implemented in rattler (and thus in the next pixi release) and rattler-build ! |
Description
This CEP proposed to introduce an optional
python_site_packages_path
field in repodata thatpython
packages can use to explicitly specify the location of the site-packages directory. This allows fornoarch: python
packages to be linked into the correct location when this path does not match the on used by standard builds of CPython. This includes alternative implementation of the Python programming langauge (PyPy, GraalPy) and free-threading builds of CPython.The motivation and request for this CEP came from conda/conda#14053, which discusses
noarch: python
support in conda in environments with the experimental free-threading configuration of CPython 3.13.