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: add a rattler_pypi_interop crate #1054

Open
wants to merge 70 commits into
base: main
Choose a base branch
from

Conversation

travishathaway
Copy link
Contributor

@travishathaway travishathaway commented Feb 6, 2025

Description

Fixes: #1044

This is still a draft and so far, I have just copied over the rattler_installs_package crate from rip. I'm initially planning to prune this crate and remove some unnecessary pieces. So far, this consists of the pieces of the code which perform solving of pypi dependencies. This would presumably be most things in the src/resolve directory of this crate.

@baszalmstra
Copy link
Collaborator

I really hope you can trim it down to the bare essentials. This is a lot of code to maintain.

@iamthebot
Copy link
Contributor

As a suggestion... since this may still be a lot of code even after pruning, this might be easier to submit as a sequence of PRs that incrementally adds the needed functionality. That'll be easier to review + merge as well.

@travishathaway travishathaway changed the title Add a rattler_pypi_interop crate feat: add a rattler_pypi_interop crate Feb 17, 2025
@travishathaway
Copy link
Contributor Author

travishathaway commented Feb 17, 2025

@iamthebot,

I'll explore that. I recently removed a bunch of modules we initially won't need, but if that's too much still, I'll come up with a game plan for making this review (and maybe more) more manageable.

@travishathaway travishathaway marked this pull request as ready for review February 25, 2025 21:48
wolfv and others added 27 commits February 26, 2025 07:08
Add `RunExportsCache` entity for storing run_exports.json

This PR introduces a new `RunExportsCache` entity that stores `run_exports.json` files on disk. 
This will allow rattler-build to access only the `run_exports.json` from archives instead of 
unpacking entire packages, which resolves issues on Windows.

Implementation details:
- Used in prefix-dev/rattler-build@main/src/run_exports.rs#L99
- Provides URL fetching with retry policy (similar to PackageCache)
- Focuses only on run_exports.json retrieval (unlike PackageCache)
- Uses atomic file replacement via NamedTempFile::persist, eliminating need for filesystem locks

Future benefit: Optimizes package handling by avoiding full package extraction when only 
run_exports.json is needed.
Co-authored-by: Bas Zalmstra <zalmstra.bas@gmail.com>
Bumps [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi) from 0.8.2 to 0.8.3.
- [Release notes](https://github.com/prefix-dev/setup-pixi/releases)
- [Commits](prefix-dev/setup-pixi@v0.8.2...v0.8.3)

---
updated-dependencies:
- dependency-name: prefix-dev/setup-pixi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix: compiling with pixi on linux

I mostly had to switch from native-tls to rust-tls.

Annoyingly, I didn't manage to convince the build-process to find libclang needed to compile libsolv so I skip that test for now

* Update pixi.toml
---------

Co-authored-by: Bas Zalmstra <bas@prefix.dev>
Co-authored-by: Julian Hofer <julianhofer@gnome.org>
Co-authored-by: Ruben Arts <ruben.arts@hotmail.com>
@tdejager
Copy link
Collaborator

Hey @travishathaway, excellent initial work on the first steps so far. I still feel as @iamthebot said, that it might be better to split up the parts into different pypi-* crates that we could review better and integrate better. Browsing through the PR now, its quite hard to have a high quality review, and I even helped write some of that code.

I think a structure could potentially be:

  • pypi-types: containing artifact types and such.
  • pypi-gateway: for working with the PyPI indexes.
  • python-env (not sure about this name) for inspecting the python environment.

We might need to also write down the goals for the crates. AFAIK from your current work you need to mostly translate an existing environment into a locked down version, in which case you would I think only need to hit the PyPI index for a simple request or not at all. That said having functionality to hit the index, cache the results, and build wheels might be interesting for other use cases. So I'd guess its just a matter of what we want in rattler not really sure if thats been written down yet? Like what actual functionality do we actually require in rattler.

We might also want a test that verifies if the metadata can be correctly retrieved for the 500 most popular python projects ore something.

A last note, not sure if I'm reading the code correctly, but it seems that with the current code we won't be able to retrieve metadata for sdists that do not have these statically available right?

Feel free to chime in @baszalmstra @wolfv

@travishathaway
Copy link
Contributor Author

Hi @tdejager,

To answer you first question, the code that retrieved sdist metadata from the index relied on building to the sdist in order to get it. I think this is because it needed to do that in order to transform the sdist into a wheel. I could go back and look at this and see how I could re-write the code in order to make that not necessary.

I do like your idea about coming up with a design document for this as something that would give us a high level overview of these crates and what they are meant to be used for. I would be happy to write something like this. Is there a particular format you prefer for this? I usually use hackmd.io

Regarding the adding additional crates, I'm not opposed to it, but I'm also not sure if it's necessary. I could create a series of separate pull requests though. I'll just have to do it in the right order because the modules within the crates depend on each other.

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.

Add a rattler_pypi_interop crate
10 participants