Skip to content

Commit

Permalink
build/use-setuptools-scm-for-versioning (#52)
Browse files Browse the repository at this point in the history
* convert to pyproject

* update tests

* update pyproject

* working build

* update test run line

* rename build main

* fix typo

* update lint

* build/use-setuptools-scm-for-versioning

* clarify comment

* delete bumpversion config

* lint

* another comment
  • Loading branch information
tlambert03 authored Aug 2, 2022
1 parent fec56e9 commit a7aad09
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 32 deletions.
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
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)
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:
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

0 comments on commit a7aad09

Please sign in to comment.