-
Notifications
You must be signed in to change notification settings - Fork 43
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
PyPI deployment (so micro-sam can be listed on napari-hub) #606
PyPI deployment (so micro-sam can be listed on napari-hub) #606
Conversation
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@constantinpape will need to set up the PYPI_USERNAME
and PYPI_PASSWORD
github secrets before we can merge this PR. These should be new API tokens for PyPI, not your personal username and password.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @GenevieveBuckley!
I have added secrets for PYPI_USERNAME
and PYPI_PASSWORD
now. Can we test if it works in the PR or should I go ahead and merge it?
It might be simplest to merge it, and then try a |
More options: pypi_test_upload script (click to expand)name: pypi_test_upload
on:
workflow_dispatch: # manual triggers with workflow_dispatch only work *after* the workflow is merged into the main repository branch
permissions:
contents: read
jobs:
deploy:
# This will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
#
# This job will run when you have tagged a commit, starting with "v*"
# or created a release in GitHub which includes a tag starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
needs: []
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
python -m build
twine upload --repository testpypi dist/*
I made this test workflow. Essentially it's a copy of the new part of this PR, aimed at Test PyPI using But I found out you can only manually trigger github actions with |
Thanks for the feedback! I will go ahead and merge this later, then create a new post release to check if it works. |
069347c
into
computational-cell-analytics:master
Closes #530
The napari-hub discovers napari plugins by scraping PyPI, looking for the napari framework classifier. When it finds a package with the napari classifier, it will automatically populate a page on the napari-hub for that plugin.
This PR:
deploy
job to therelease_drafter.yml
github workflow. This job runs every time the release drafter workflow runs and theupdate_release_draft
job finishes.requirements-dev.txt
to includebuild
andtwine
dependencies (this is not required for therelease_drafter.yml
action to work, but they are nice to have if you are testing the build locally)micro-sam
with pip. As previously discussed here and here, if userspip install micro-sam
then not all of the dependencies will be correctly installed. Some of our dependencies, like affogato are only available from conda-forge. However, we think the benefit of being searchable on napari-hub outweighs this downside.Still to do:
@constantinpape will need to
PYPI_USERNAME
andPYPI_PASSWORD
in the settings of this repository, see https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository