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

feat: use python_site_packages_path field when available for installing noarch: python packages, CEP-17 #909

Merged
merged 8 commits into from
Nov 4, 2024

Conversation

jjhelmus
Copy link
Contributor

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.

This the start of an implementation. Wanted to get feedback on the approach before updating other crates and tests.

The IndexJson and PackageRecord struct include an optional
python_site_packages_path field as specified in CEP-17.
When specified in the packages repodata entry, use the
"python_site_packages_path" field for the location of the
site_packages_path.
@jjhelmus jjhelmus changed the title Use python_site_packages_path field when available for installing noarch: python packages, CEP-17 feat: use python_site_packages_path field when available for installing noarch: python packages, CEP-17 Oct 21, 2024
@baszalmstra
Copy link
Collaborator

This totally seems like the right approach! 👍

@baszalmstra
Copy link
Collaborator

I took the liberty to continue your work, bring it up to date and add python bindings.

@baszalmstra
Copy link
Collaborator

Its a bit hard to test because there doesnt appear to be a python package yet that has this field set. Im relatively sure that it will work so Im going to go ahead and merge this when CI turns green. If we encounter bugs we can fix them in a seperate PR.

@baszalmstra baszalmstra enabled auto-merge (squash) November 4, 2024 16:15
@baszalmstra baszalmstra merged commit 671f801 into conda:main Nov 4, 2024
15 checks passed
@baszalmstra baszalmstra mentioned this pull request Nov 4, 2024
@jjhelmus
Copy link
Contributor Author

jjhelmus commented Nov 4, 2024

Thanks much for taking over this change @baszalmstra.

There are three test packages in the jjhelmus/label/sp_pathchannel on anaconda.org that contain this field. They were created as part of conda/conda-build#5502.

I checked with the sample packages with valid paths and got the expected result with this change.
For example:

❯ pixi run rattler create -c jjhelmus/label/sp_path -c conda-forge python=3.99.90 imagesize
✨ Pixi task (rattler in default): cargo run --bin rattler --release -- create -c jjhelmus/label/sp_path -c conda-forge python=3.99.90 imagesize
    Finished `release` profile [optimized] target(s) in 0.22s
     Running `target/release/rattler create -c jjhelmus/label/sp_path -c conda-forge python=3.99.90 imagesize`
Target prefix: /Users/jhelmus/workspace/rattler/.prefix
Installing for platform: OsxArm64
Loaded 180 records in 279.544ms
Virtual packages:
  - __unix=0=0
  - __osx=14.6.1=0
  - __archspec=1=m1

⠁ solving                                                                                                                                                                      INFO resolvo::solver: ╒══ Install imagesize=1.4.1=pyhd8ed1ab_0 at level 1 (derived from Requires(<root>(InternalSolvableId(0)), imagesize *))
 INFO resolvo::solver: ╘══ Propagation completed
 INFO rattler::install::clobber_registry: Unclobbering 0 files
✔ validate cache       2 packages in 0s
✔ installing packages  took 2ms                                                                                                                                               ✔ Successfully updated the environment in 3.471209ms
+ python 3.99.90 0
+ imagesize 1.4.1 pyhd8ed1ab_0
rattler on  main [$?] via 🦀 1.81.0-aarch64-apple-darwin via 🅒 base took 2s
❯ tree .prefix
.prefix
├── conda-meta
│   ├── imagesize-1.4.1-pyhd8ed1ab_0.json
│   └── python-3.99.90-0.json
└── sample_path
    └── from_the_file
        └── index_json
            ├── imagesize
            │   ├── __init__.py
            │   └── imagesize.py
            └── imagesize-1.4.1.dist-info
                ├── INSTALLER
                ├── LICENSE.rst
                ├── METADATA
                ├── RECORD
                ├── REQUESTED
                ├── WHEEL
                ├── direct_url.json
                └── top_level.txt

7 directories, 12 files

@baszalmstra
Copy link
Collaborator

Awesome! Thanks for testing!

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.

3 participants