Repository navigation
[python-package] publish nightlies to pypi.anaconda.org - #7245
Conversation
| run: | | ||
| anaconda upload \ | ||
| --package lightgbm \ | ||
| --force \ |
There was a problem hiding this comment.
The --force is important... it's how we can keep replacing packages with the same version (e.g. 4.6.0.99) on every new merge to master.
I think this is simpler as a starting point than doing something like publishing dev versions with a commit distance, e.g. 4.6.0.dev451.
If we did that, we'd have to also set up some kind of cleanup job to delete older packages, or risk quickly exceeding the free-tier storage limit.
| run-id: ${{ github.run_id }} | ||
| - name: upload to anaconda.org | ||
| env: | ||
| ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN_LIGHTGBM_PACKAGES }} |
There was a problem hiding this comment.
I've added this secret to the repo and scoped it to this nightly-python-uploads environment, so only that jobs running in that environment can access it.
The environment has configuration limiting which branches jobs for it can run on, further restricting access.
|
Docs builds are still broken (they'll be fixed by #7268), but otherwise this is working and ready for review. |
borchero
left a comment
There was a problem hiding this comment.
Have you made previous experiences with nightly uploads to anaconda? I have two thoughts/concerns:
- How is this related to
conda-forge? It seems entirely separate? - Does this work correctly? On
conda-forge, PyPI wheels are never uploaded directly because they potentially use a different toolchain, causing compatibility issues for users. Is this a concern here as well?
|
Thanks for looking and for the thoughtful review!
Yep! I have extensive experience with this. RAPIDS (
In my day job, I interact with that index every day and help to administer it. Scientific Python projects like
In my experience, it works just like
It shares some of the same backing infrastructure like the same CDN (probably?), same root domain ( But otherwise, entirely separate.
You're right to be skeptical about mixing wheels and conda packages because of different toolchains, but that doesn't apply here. The package files are EXACTLY the same wheels we upload to pip download \
--no-deps \
--index-url https://pypi.anaconda.org/lightgbm-packages/simple \
'lightgbm>=4.6.0a0'If you look at the diff of this PR again, you'll see it's just taking the exact same wheel CI artifacts LightGBM has been building for a while and uploading them unmodified to this service. |
borchero
left a comment
There was a problem hiding this comment.
Neat, thanks for the extensive explanations @jameslamb, let's go then! :)
|
Thanks! I've merged in |
|
Docs build completed successfully and they're looking good! Queuing this for auto-merge. |
Closes #7227
Proposed publishing nightly Python packages (wheels and sdists) to https://anaconda.org/lightgbm-packages.
Installable like this:
pip install \ --no-deps \ --index-url https://pypi.anaconda.org/lightgbm-packages/simple \ 'lightgbm>=4.6.0a0'Notes for Reviewers
How I tested this
Temporarily turned off the limitations on the
nightly-python-uploadsGitHub environment to allow publishing from this PR's branch commented out the "only publish frommaster" check in code.Saw uploads succeed:
Also triggered a docs build to see how these docs render:
This is free
As long as we stay under 5GB total project size (compressed), which shouldn't be a problem because:
lightgbmwheels total around 10 MB (https://pypi.org/project/lightgbm/#files)4.6.0.99)This took some manual setup
I manually created the following:
lightgbm-packagesorganization on anaconda.orgnightly-python-uploadsGitHub "environment", to limit where that secret can be accessed (see the GitHub docs for more)I'm the only one with access right now
Please contact me in the private maintainer chat with your Anaconda username and I will add you as an owner of
lightgbm-packagesorganization on anaconda.org. We should have multiple owners for this.References
Many other projects use anaconda.org PyPI support for this purpose, including
numpy,pandas,pyarrow,scipy, and all of RAPIDS. In my experience, it works as advertised and requires minimal additional effort for users (just an--extra-index-url/--index-urlinpip installcalls, mostly).