diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e511102..c2083db 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -50,7 +50,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 diff --git a/Makefile b/Makefile index bbcce4d..ea6378b 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,8 @@ endif SHELL:=zsh -eu -o pipefail -o null_glob SELF:=$(firstword $(MAKEFILE_LIST)) -VE_DIR=venv +VE_DIR:=venv +PY_VERSION:=3.13 TEST_DIRS:=tests DOC_TESTS:=src ./README.md @@ -40,27 +41,23 @@ devready: #=> venv: make a Python 3 virtual environment ${VE_DIR}: - python3 --version - python3 -mvenv $@; \ - source $@/bin/activate; \ - python3 -m ensurepip --upgrade; \ - pip install --upgrade pip setuptools wheel - + uv venv --python ${PY_VERSION} $@ + #=> develop: install package in develop mode .PHONY: develop develop: - pip install -e ".[dev,tests]" + uv pip install -e ".[dev,tests]" pre-commit install #=> install: install package .PHONY: install install: - pip install "." + uv pip install "." #=> build: make sdist and wheel .PHONY: build build: %: - python -m build + uv build ############################################################################ diff --git a/README.md b/README.md index 212e681..87525ea 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![codecov](https://codecov.io/gh/biocommons/biocommons.example/graph/badge.svg?token=CCUMQQV5R6)](https://codecov.io/gh/biocommons/biocommons.example) +--- + This repo provides a template for biocommons Python packages. Here's how to use it: 1. Click the [Use this template](https://github.com/biocommons/example/generate) @@ -11,28 +13,43 @@ This repo provides a template for biocommons Python packages. Here's how to use 1. Remove this header. 1. Commit and push. +Delete this section in your generated template. + +--- + ## Installation To install from pypi: ```pip install biocommons.example``` ## Developer Setup -Developers must install zsh, which is required by the Makefile. zsh is included by default in MacOS, and is readily available on all modern Linux distributions. +### Prerequisites -Setup like this: +- [GNU make](https://www.gnu.org/software/make/): Current mechanism for consistent invocation of developer tools. + - Mac: [Install brew](https://brew.sh/), then [install make](https://formulae.brew.sh/formula/make) + - Ubuntu: `sudo apt install make` +- [uv](https://docs.astral.sh/uv/): An extremely fast Python package and project manager, written in Rust. + - All platforms: See the [uv installation instructions](https://docs.astral.sh/uv/getting-started/installation/). +- [zsh](https://www.zsh.org/): Shell used by the Makefile + - Mac: included by default + - Ubuntu: `sudo apt install zsh` + +### One-time developer setup + +Create a Python virtual environment and install dependencies: make devready + +### Development + +Activate your environment: + source venv/bin/activate Code reformatting: make reformat -Install pre-commit hook: - - # included in `make devready`, not necessary for new installations - pre-commit install - Test: make test # for current environment @@ -77,7 +94,3 @@ Try it: * Quality tools: Code linting and reformatting with Ruff * GitHub Actions for testing and packaging - -## ToDo - -* Add devcontainer support diff --git a/pyproject.toml b/pyproject.toml index 4ccdb79..de2b403 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,31 +3,35 @@ name = "biocommons.example" authors = [ { name = "biocommons contributors", email = "biocommons-dev@googlegroups.com" }, ] -description = "Example Package" +description = "biocommons.example Package" readme = "README.md" -license = { file = "LICENSE.txt" } -requires-python = ">=3.10" +license = "Apache-2.0" +# license_files = [ "LICENSE.txt" ] +# requires-python = ">=3.11" classifiers = [ "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", - "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] dynamic = ["version"] -dependencies = ["coloredlogs ~= 15.0", "pyyaml ~= 6.0"] +dependencies = [ + "coloredlogs ~= 15.0", + "pyyaml ~= 6.0", +] [project.optional-dependencies] dev = [ "build ~= 0.8", "ipython ~= 8.4", - "pre-commit ~= 3.4", + "pre-commit>=3.8.0", "ruff == 0.4.4", ] tests = [ "pytest-cov ~= 4.1", - "pytest-optional-tests", "pytest ~= 7.1", "vcrpy", "tox ~= 4.15",