Skip to content

[python-package] publish nightlies to pypi.anaconda.org - #7245

Merged
jameslamb merged 15 commits into
masterfrom
python/nightly-packages
May 17, 2026
Merged

jameslamb merged 15 commits into
masterfrom
python/nightly-packages

Conversation

@jameslamb

@jameslamb jameslamb commented Apr 28, 2026 •

Copy link
Copy Markdown
Member

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-uploads GitHub environment to allow publishing from this PR's branch commented out the "only publish from master" 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:

  1. all lightgbm wheels total around 10 MB (https://pypi.org/project/lightgbm/#files)
  2. every upload will overwrite the previous files because the version number isn't changing (e.g. 4.6.0.99)

This took some manual setup

I manually created the following:

  1. lightgbm-packages organization on anaconda.org
  2. narrowly-scoped auth token for uploading to it (expires April 28, 2027)
  3. GitHub secret (only in this repo) with that token
  4. nightly-python-uploads GitHub "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-packages organization 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-url in pip install calls, mostly).

@jameslamb
jameslamb had a problem deploying to nightly-python-uploads April 29, 2026 01:38 — with GitHub Actions Failure
@jameslamb
jameslamb temporarily deployed to nightly-python-uploads April 29, 2026 01:41 — with GitHub Actions Inactive
@jameslamb
jameslamb temporarily deployed to nightly-python-uploads May 1, 2026 03:05 — with GitHub Actions Inactive
run: |
anaconda upload \
--package lightgbm \
--force \

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }}

@jameslamb jameslamb May 1, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jameslamb jameslamb changed the title WIP: [python-package] publish nightlies to pypi.anaconda.org [python-package] publish nightlies to pypi.anaconda.org May 15, 2026
@jameslamb

Copy link
Copy Markdown
Member Author

Docs builds are still broken (they'll be fixed by #7268), but otherwise this is working and ready for review.

@jameslamb
jameslamb marked this pull request as ready for review May 15, 2026 15:41
@jameslamb
jameslamb requested a review from guolinke as a code owner May 15, 2026 15:41

@borchero borchero left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@jameslamb

Copy link
Copy Markdown
Member Author

Thanks for looking and for the thoughtful review!

Have you made previous experiences with nightly uploads to anaconda?

Yep! I have extensive experience with this.

RAPIDS (cudf, cuml, cuvs, etc.) has been publishing nightlies this way for years:

In my day job, I interact with that index every day and help to administer it.

Scientific Python projects like numpy, pandas, and scikit-learn also use this service, and LightGBM's CI has been pip installing from it for about 2 years

In my experience, it works just like pypi.org or https://download.pytorch.org/whl.

How is this related to conda-forge? It seems entirely separate?

It shares some of the same backing infrastructure like the same CDN (probably?), same root domain (anaconda.org), and same company providing the service (Anaconda).

But otherwise, entirely separate. pypi.anaconda.org does not host conda packages, just wheels and sdists like pypi.org.

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?

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 pypi.org. Try downloading a wheel and checking if you'd like:

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 borchero left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, thanks for the extensive explanations @jameslamb, let's go then! :)

@jameslamb

Copy link
Copy Markdown
Member Author

Thanks! I've merged in master, I want to check what the updated docs look like on readthedocs. I'll merge this when I've done that and CI has passed.

@jameslamb

Copy link
Copy Markdown
Member Author

Docs build completed successfully and they're looking good! Queuing this for auto-merge.

@jameslamb
jameslamb enabled auto-merge (squash) May 17, 2026 03:09
@jameslamb
jameslamb merged commit a3734ed into master May 17, 2026
82 of 84 checks passed
@jameslamb
jameslamb deleted the python/nightly-packages branch May 17, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[python-package] Host nightly packages in easier-to-install places

2 participants