Skip to content

Commit 069347c

Browse files
PyPI deployment (so micro-sam can be listed on napari-hub) (computational-cell-analytics#606)
Add PyPI upload step to release_drafter.yml workflow
1 parent 8482b0c commit 069347c

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

.github/workflows/release_drafter.yaml

+31-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Check out the repository
30-
uses: actions/checkout@v3
30+
uses: actions/checkout@v4
3131
with:
3232
fetch-depth: 2
3333

@@ -56,4 +56,33 @@ jobs:
5656
publish: "${{ steps.tag-version.outputs.new_tag != '' }}"
5757
tag: "${{ steps.tag-version.outputs.new_tag }}"
5858
env:
59-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
59+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
60+
61+
deploy:
62+
# This will upload a Python Package using Twine when a release is created
63+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
64+
#
65+
# This job will run when you have tagged a commit, starting with "v*"
66+
# or created a release in GitHub which includes a tag starting with "v*"
67+
# and requires that you have put your twine API key in your
68+
# github secrets (see readme for details)
69+
needs: [update_release_draft]
70+
runs-on: ubuntu-latest
71+
if: contains(github.ref, 'tags')
72+
steps:
73+
- uses: actions/checkout@v4
74+
- name: Set up Python
75+
uses: actions/setup-python@v5
76+
with:
77+
python-version: '3.x'
78+
- name: Install dependencies
79+
run: |
80+
python -m pip install --upgrade pip
81+
python -m pip install build twine
82+
- name: Build and publish
83+
env:
84+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
85+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
86+
run: |
87+
python -m build
88+
twine upload dist/*

doc/faq.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ Having a GPU will significantly speed up the annotation tools and especially the
4141

4242
### 5. I am missing a few packages (eg. `ModuleNotFoundError: No module named 'elf.io`). What should I do?
4343
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.
44-
So please reinstall `micro_sam`.
45-
44+
So please reinstall `micro_sam`, following [the installation guide](#installation).
4645

4746
### 6. Can I install `micro_sam` using pip?
48-
The installation is not supported via pip.
47+
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.
48+
49+
Please see [the installation guide](#installation) for the recommended way to install `micro-sam`.
4950

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

5153
### 7. I get the following error: `importError: cannot import name 'UNETR' from 'torch_em.model'`.
5254
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).

doc/installation.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ There are three ways to install `micro_sam`:
77

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

10+
We do *not* recommend installing `micro-sam` with pip.
11+
1012
## From mamba
1113

1214
[mamba](https://mamba.readthedocs.io/en/latest/) is a drop-in replacement for conda, but much faster.

requirements-dev.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
build
12
coverage
23
line-profiler
34
pdoc
@@ -6,3 +7,4 @@ pytest-cov
67
pytest-qt
78
snakeviz
89
tabulate
10+
twine

0 commit comments

Comments
 (0)