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

build/use-setuptools-scm-for-versioning #52

Merged
merged 15 commits into from
Aug 2, 2022
14 changes: 0 additions & 14 deletions .bumpversion.cfg

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
Expand Down Expand Up @@ -78,7 +80,7 @@ jobs:
run: pre-commit run --all-files

publish:
if: "contains(github.event.head_commit.message, 'Bump version')"
if: "success() && startsWith(github.ref, 'refs/tags/')"
needs: [check-manifest, test, lint]
runs-on: ubuntu-latest

Expand All @@ -90,6 +92,7 @@ jobs:
python-version: 3.9
- name: Install Dependencies
run: |
git tag
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question: will this just show the single tag that is being deployed or the whole taglist?

python -m pip install --upgrade pip
pip install build wheel
- name: Build Package
Expand Down
16 changes: 10 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,17 @@ Ready to contribute? Here's how to set up `napari-aicsimageio` for local develop
## Deploying

A reminder for the maintainers on how to deploy.
Make sure all your changes are committed.
Then run:
Make sure the main branch is checked out and all desired changes
are merged. Then run:

```bash
$ bumpversion patch # possible: major / minor / patch
$ git push
$ git push --tags
$ git tag -a "vX.Y.Z" -m "vX.Y.Z"
$ git push upstream --follow-tags
```

This will release a new package version on Git + GitHub and publish to PyPI.
(The `-a` flag indicates an [annotated tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging))

The presence of a tag starting with "v" will trigger the `publish` step in the
main github workflow, which will build the package and upload it to PyPI. The
version will be injected into the package metadata by
[`setuptools-scm`](https://github.com/pypa/setuptools_scm)
Comment on lines +67 to +80
Copy link
Collaborator

Choose a reason for hiding this comment

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

😍

I may add a just command for this later

11 changes: 7 additions & 4 deletions napari_aicsimageio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# -*- coding: utf-8 -*-

"""Top-level package for napari-aicsimageio."""

from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version("napari-aicsimageio")
except PackageNotFoundError:
__version__ = "uninstalled"

__author__ = "Eva Maxfield Brown"
__email__ = "[email protected]"
# Do not edit this string manually, always use bumpversion
# Details in CONTRIBUTING.md
__version__ = "0.7.1"


def get_module_version() -> str:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you use this elsewhere?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not. Happy to remove

Expand Down
11 changes: 4 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# https://peps.python.org/pep-0517/
[build-system]
requires = ["setuptools>=45", "wheel"]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

# https://peps.python.org/pep-0621/
[project]
name = "napari-aicsimageio"
# Do not edit this string manually, always use bumpversion
# Details in CONTRIBUTING.rst
version = "0.7.1"
description = "AICSImageIO bindings for napari"
keywords = [
"aicsimageio",
Expand Down Expand Up @@ -44,7 +43,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Visualization",
"Topic :: Scientific/Engineering",
]
dynamic = []
dynamic = ["version"]
dependencies = [
"aicsimageio[all]>=4.6.3",
"fsspec[http]", # no version pin, we pull from aicsimageio
Expand Down Expand Up @@ -76,7 +75,6 @@ test = [
]
dev = [
"black>=19.10b0",
"bump2version>=1.0.1",
"coverage>=5.1",
"docutils>=0.10,<0.16",
"flake8-debugger>=3.2.1",
Expand Down Expand Up @@ -119,7 +117,6 @@ use_parentheses = true
# https://github.com/mgedmin/check-manifest#configuration
[tool.check-manifest]
ignore = [
".bumpversion.cfg",
".editorconfig",
".napari/**/*",
".pre-commit-config.yaml",
Expand Down