mamba-org / mamba

The Fast Cross-Platform Package Manager
https://mamba.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.97k stars 359 forks source link

feat: Support for optional `python_site_packages_path` in repodata #3579

Open jjhelmus opened 3 weeks ago

jjhelmus commented 3 weeks ago

Add support for the optional python_site_packages_path field that can appear in repodata for python packages as a means to specify the location of the site-packages directory.

This optional field is defined in CEP-17.

partial implementation for #3558

Please be kind as this is my first contribution to mamba and the first time digging into the source.

jjhelmus commented 3 weeks ago

This is likely not a complete implementation for CEP-17 in mamba but may be enough to unblock libmamba-conda-solver (see conda/conda-libmamba-solver#560).

This is rough and likely needs some work to finish things up but was hoping for initial feedback (or someone else to take over :smile:).

With these changes I was able to get the field to show up in the output of repoquery search:

./build/micromamba/mamba repoquery search -c jjhelmus/label/sp_path python=3.99.99  --json | jq .result.pkgs
[
  {
    "build": "0",
    "build_number": 0,
    "build_string": "0",
    "channel": "jjhelmus",
    "constrains": [],
    "depends": [
      "pip"
    ],
    "fn": "python-3.99.99-0.tar.bz2",
    "license": "",
    "md5": "2570015e0cb5829cbdfa9780b4564db9",
    "name": "python",
    "noarch": "generic",
    "python_site_packages_path": "lib/python3.99t/site-packages",
    "sha256": "a2be7c56f9ce3d6fc25220a49185894d02cf03b832bb9fb55122e6a662bde910",
    "size": 2912,
    "subdir": "noarch",
    "timestamp": 1726861043,
    "track_features": "",
    "url": "https://conda.anaconda.org/t/jj-80e459ed-f2bc-4975-ae2e-68f8e339b666/jjhelmus/label/sp_path/noarch/python-3.99.99-0.tar.bz2",
    "version": "3.99.99"
  }
]
JohanMabille commented 1 week ago

Hi, thanks for tackling this! The implementation is neat and looks good to me, can you add some test to check this is correctly working?

Also running pre-commit run --all-files should fix the linter.