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

custom pypi index #1094

Closed
zen-xu opened this issue Apr 1, 2024 · 22 comments
Closed

custom pypi index #1094

zen-xu opened this issue Apr 1, 2024 · 22 comments
Labels
enhancement New feature or request pypi Issue related to PyPI dependencies uv Related to the uv integration

Comments

@zen-xu
Copy link
Contributor

zen-xu commented Apr 1, 2024

Problem description

I use self-hosted pypi within the company, and uv can set the pypi index through environment variables.

export UV_INDEX_URL=xxxx
export UV_EXTRA_INDEX_URL=xxxx

Since pixi uses uv to install pip-related packages, I hope this can be supported.

@zen-xu zen-xu added the enhancement New feature or request label Apr 1, 2024
@olivier-lacroix
Copy link
Contributor

olivier-lacroix commented Apr 1, 2024

Yes, supporting index options would be great.

We would need to create the following struct to pass it to uv

pub struct IndexLocations {
    index: Option<IndexUrl>,
    extra_index: Vec<IndexUrl>,
    flat_index: Vec<FlatIndexLocation>,
    no_index: bool,
}

@tdejager , what would be your preference in terms of TOML configuration? a pypi-index-location table? or maybe a pypi-options table? as I am sure there will be more coming (e.g. build isolation, etc.)

@zen-xu
Copy link
Contributor Author

zen-xu commented Apr 1, 2024

I think it can be placed directly under the pypi table.

@gzm55
Copy link

gzm55 commented Apr 1, 2024

does this related with #906?

@baszalmstra baszalmstra changed the title Support UV environments custom pypi index Apr 2, 2024
@baszalmstra
Copy link
Contributor

Also related: #588

@vigneshmanick
Copy link
Contributor

also related to #1058

@tdejager
Copy link
Contributor

tdejager commented Apr 8, 2024

@olivier-lacroix @gzm55 @zen-xu @vigneshmanick Would it be fine to have this on the level of project similar to channels?

@vigneshmanick
Copy link
Contributor

I am fine with the project level definition, but it would also be good if it can be defined per package similar to how the conda dependencies are mentioned in the current documentation .

[dependencies]
vtk-osmesa = { version = "~=9.3", channel = "conda-forge" }

similar way for pypi should be

[pypi-dependencies]
vtk-osmesa = { version = "~=9.3", extra-index-url= "wheels.vtk.org" }

@gzm55
Copy link

gzm55 commented Apr 8, 2024

@olivier-lacroix @gzm55 @zen-xu @vigneshmanick Would it be fine to have this on the level of project similar to channels?

LGTM. both index-url and extra index-urls need to be set separately.

@tdejager
Copy link
Contributor

tdejager commented Apr 8, 2024

I am fine with the project level definition, but it would also be good if it can be defined per package similar to how the conda dependencies are mentioned in the current documentation .

[dependencies]
vtk-osmesa = { version = "~=9.3", channel = "conda-forge" }

similar way for pypi should be

[pypi-dependencies]
vtk-osmesa = { version = "~=9.3", extra-index-url= "wheels.vtk.org" }

That would be awesome I agree, I'm afraid that's technically more difficult because uv does not support such fine-grained selection (yet). We could do it on a feature level, like only use an extra-index-url for a specific feature.

@olivier-lacroix
Copy link
Contributor

@tdejager project/ feature level settings mirroring the UV struct would be sufficient yes.

@zachcp
Copy link

zachcp commented Apr 9, 2024

Thank you @tdejager . Looking forward to this. ( its the primary blocker for uptake in my company. )

@tdejager
Copy link
Contributor

tdejager commented Apr 11, 2024

I'm now just thinking, all of these optional

[project]
# other config
[pypi-options]
# When not used, will use uv default which is just pypi
primary-index = "pypi.org/simple"
extra-indices = ["foo", "bar"]
flat-indices = ["path/to/index"]

@ruben-arts and others in-thread WDYT?

@vigneshmanick
Copy link
Contributor

this looks good and should cover my usecase

@ruben-arts
Copy link
Contributor

That should be fine! It should be part of the feature table so you can define it per feature right?

@tdejager
Copy link
Contributor

@ruben-arts Ideally yes, how does this work for channels now because part of it also at a project level, but you can redefine per feature? Also the primary-index should overwrite, because it can only have one value.

@ruben-arts
Copy link
Contributor

The platforms and channels are special cases where they are part of the feature definition and the project.

Should we just use index for the primary-index? Also what is the difference in code path between the index and extra_index in uv?

@tdejager
Copy link
Contributor

tdejager commented Apr 11, 2024

  1. If you have no primary-index but only extra indices it will use pypi.org/simple and the extra ones.
  2. If you only have a primary-index it will use only that.

I'm fine with naming it index I thought naming it primary-index would avoid the confusion about the above statements. But it seems this is not the case 😆

@tdejager
Copy link
Contributor

Started on this: #1225

@gzm55
Copy link

gzm55 commented Apr 25, 2024

Started on this: #1225

@tdejager can we also set the pypi index urls in global configuration? or fallback to pip.conf?

@ruben-arts ruben-arts added pypi Issue related to PyPI dependencies uv Related to the uv integration labels Apr 29, 2024
@zachcp
Copy link

zachcp commented Apr 30, 2024

...( excitedly waits for the release ).....

@tdejager
Copy link
Contributor

tdejager commented May 7, 2024

Started on this: #1225

@tdejager can we also set the pypi index urls in global configuration? or fallback to pip.conf?

In the current version you can set them in the global config, they will be automatically added on init. But they are still required in the manifest file. This was chosen because otherwise the installs are not reproducible across systems.

@tdejager
Copy link
Contributor

tdejager commented May 7, 2024

This feature should now be included in the latest release (with some basic ways of authenticating, through uv's keyring or netrc features).

See documentation: https://pixi.sh/latest/reference/configuration/#the-pypi-options-table

I will be closing this issue for now, feel free to make a new issue if there are any problems.

@tdejager tdejager closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pypi Issue related to PyPI dependencies uv Related to the uv integration
Projects
None yet
Development

No branches or pull requests

8 participants