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

Add poetry dynamic versioning and update release process #132

Merged
merged 10 commits into from
Dec 20, 2023
Merged
11 changes: 11 additions & 0 deletions .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Setup Environment and Cache
description: |
Setup poetry for use with GitHub Actions workflows.
Note: presumes pre-installed Python.
runs:
using: "composite"
steps:
- name: Setup poetry and poetry-dynamic-versioning
shell: bash
run: |
python -m pip install poetry poetry-dynamic-versioning
6 changes: 2 additions & 4 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.6.1"
- name: Setup for poetry
uses: ./.github/actions/setup-poetry
- name: poetry deps
run: poetry install
- name: Build documentation
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.6.1"
- name: Setup for poetry
uses: ./.github/actions/setup-poetry
- name: poetry deps
run: poetry install
- name: poetry build distribution content
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Install poetry
run: pip install poetry
- name: Setup for poetry
uses: ./.github/actions/setup-poetry
- name: Install environment
run: poetry install --no-interaction --no-ansi
- name: Run sphinx-docs build test
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ default_language_version:
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-toml
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
exclude: >
Expand All @@ -29,37 +29,37 @@ repos:
- mdformat-myst
- mdformat-gfm
- repo: https://github.com/adrienverge/yamllint
rev: v1.32.0
rev: v1.33.0
hooks:
- id: yamllint
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.12.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.7.6
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/jendrikseipp/vulture
rev: v2.9.1
rev: v2.10
hooks:
- id: vulture
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.7.1
hooks:
- id: mypy
- repo: https://github.com/PyCQA/pylint
rev: v3.0.0a7
rev: v3.0.3
hooks:
- id: pylint
name: pylint
Expand Down
4 changes: 4 additions & 0 deletions cytotable/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""
__init__.py for cytotable
"""

# note: version data is maintained by poetry-dynamic-versioning
__version__ = "0.0.0"

from .convert import convert
from .exceptions import (
CytoTableException,
Expand Down
9 changes: 6 additions & 3 deletions docs/source/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,16 @@ We utilize [semantic versioning](https://en.wikipedia.org/wiki/Software_versioni
We publish source code by using [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) available [here](https://github.com/cytomining/CytoTable/releases).
We publish Python packages through the [Python Packaging Index (PyPI)](https://pypi.org/) available [here](https://pypi.org/project/cytotable/).

### Publishing Process
### Release Publishing Process

There are several manual and automated steps involved with publishing CytoTable releases.
See below for an overview of how this works.

1. Prepare a release in a code contribution which utilizes the command [`poetry version ...`](https://python-poetry.org/docs/cli/#version) to update the version (this updates `pyproject.toml` with automatically incremented versions under `version = "..."`).
Notes about [semantic version](https://en.wikipedia.org/wiki/Software_versioning#Semantic_versioning) (semver) specifications:
CytoTable semvers are controlled through [`poetry-dynamic-versioning`](https://github.com/mtkennerly/poetry-dynamic-versioning) which leverages [`dunamai`](https://github.com/mtkennerly/dunamai) to create version data based on [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) and and commits.
CytoTable release git tags are automatically applied through [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) and related inferred changes from [`release-drafter`](https://github.com/release-drafter/release-drafter).

1. Open a pull request and use a repository label for `release-<semver release type>` to label the pull request for visibility with [`release-drafter`](https://github.com/release-drafter/release-drafter) (for example, see [CytoTable#108](https://github.com/cytomining/CytoTable/pull/108) as a reference of a semver patch update).
1. On merging the pull request for the release, a [GitHub Actions workflow](https://docs.github.com/en/actions/using-workflows) defined in `draft-release.yml` leveraging [`release-drafter`](https://github.com/release-drafter/release-drafter) will draft a release for maintainers to modify.
1. On merging the pull request for the release, a [GitHub Actions workflow](https://docs.github.com/en/actions/using-workflows) defined in `draft-release.yml` leveraging [`release-drafter`](https://github.com/release-drafter/release-drafter) will draft a release for maintainers to modify as needed (double checking on the prepared git tag and content).
1. Make modifications as necessary to the draft GitHub release, then publish the release.
1. On publishing the release, another GitHub Actions workflow defined in `publish-pypi.yml` will run to build and deploy the Python package to PyPI (utilizing the earlier modified `pyproject.toml` semantic version reference for labeling the release).
20 changes: 15 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tool.poetry]
name = "CytoTable"
version = "0.0.3"
# note: version data is maintained by poetry-dynamic-versioning
version = "0.0.0"
description = "Transform CellProfiler and DeepProfiler data for processing image-based profiling readouts with Pycytominer and other Cytomining tools."
authors = ["Cytomining Community"]
license = "BSD-3-Clause License"
Expand All @@ -10,12 +11,22 @@ repository = "https://github.com/cytomining/CytoTable"
documentation = "https://cytomining.github.io/CytoTable/"
keywords = ["python", "cellprofiler","single-cell-analysis", "way-lab"]

[tool.poetry-dynamic-versioning]
enable = true
style = "pep440"
vcs = "git"

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry.dependencies]
python = ">=3.8,<3.13"
pyarrow = ">=13.0.0"
cloudpathlib = {extras = ["all"], version = "^0.15.0"}
duckdb = ">=0.8.0"
parsl = ">=2023.9.25"
dunamai = "^1.19.0"

[tool.poetry.dev-dependencies]
pytest = "^7.4.0"
Expand All @@ -28,9 +39,7 @@ cffconvert = "^2.0.0"
cytominer-database = "^0.3.4"
pycytominer = { git = "https://github.com/cytomining/pycytominer.git", rev = "09b2c79aa94908e3520f0931a844db4fba7fd3fb" }

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"


[tool.vulture]
min_confidence = 80
Expand Down