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

PyPI deployment (so micro-sam can be listed on napari-hub) #606

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions .github/workflows/release_drafter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand Down Expand Up @@ -56,4 +56,33 @@ jobs:
publish: "${{ steps.tag-version.outputs.new_tag != '' }}"
tag: "${{ steps.tag-version.outputs.new_tag }}"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

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: [update_release_draft]
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:
Copy link
Collaborator Author

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.

TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload dist/*
8 changes: 5 additions & 3 deletions doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ Having a GPU will significantly speed up the annotation tools and especially the

### 5. I am missing a few packages (eg. `ModuleNotFoundError: No module named 'elf.io`). What should I do?
With the latest release 1.0.0, the installation from mamba and source should take care of this and install all the relevant packages for you.
So please reinstall `micro_sam`.

So please reinstall `micro_sam`, following [the installation guide](#installation).

### 6. Can I install `micro_sam` using pip?
The installation is not supported via pip.
We do *not* recommend installing `micro-sam` with pip. It has several dependencies that are only avaoiable from conda-forge, which will not install correctly via pip.

Please see [the installation guide](#installation) for the recommended way to install `micro-sam`.

The PyPI page for `micro-sam` exists only so that the [napari-hub](https://www.napari-hub.org/) can find it.

### 7. I get the following error: `importError: cannot import name 'UNETR' from 'torch_em.model'`.
It's possible that you have an older version of `torch-em` installed. Similar errors could often be raised from other libraries, the reasons being: a) Outdated packages installed, or b) Some non-existent module being called. If the source of such error is from `micro_sam`, then `a)` is most likely the reason . We recommend installing the latest version following the [installation instructions](https://github.com/constantinpape/torch-em?tab=readme-ov-file#installation).
Expand Down
2 changes: 2 additions & 0 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ There are three ways to install `micro_sam`:

You can find more information on the installation and how to troubleshoot it in [the FAQ section](#installation-questions).

We do *not* recommend installing `micro-sam` with pip.

## From mamba

[mamba](https://mamba.readthedocs.io/en/latest/) is a drop-in replacement for conda, but much faster.
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
coverage
line-profiler
pdoc
Expand All @@ -6,3 +7,4 @@ pytest-cov
pytest-qt
snakeviz
tabulate
twine
Loading