Skip to content

Commit 939d865

Browse files
authored
63 adopt uv builds (#67)
* use uv to create virtual environment and update README * specify python version in uv venv creation * update supported Python versions to 3.11, 3.12, 3.13 * switch to uv build and update license in pyproject.toml
1 parent 2fd0c0e commit 939d865

File tree

4 files changed

+43
-29
lines changed

4 files changed

+43
-29
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
strategy:
5151
fail-fast: false
5252
matrix:
53-
python-version: ["3.10", "3.11", "3.12"]
53+
python-version: ["3.11", "3.12", "3.13"]
5454

5555
steps:
5656
- uses: actions/checkout@v4

Makefile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ endif
1212
SHELL:=zsh -eu -o pipefail -o null_glob
1313
SELF:=$(firstword $(MAKEFILE_LIST))
1414

15-
VE_DIR=venv
15+
VE_DIR:=venv
16+
PY_VERSION:=3.13
1617

1718
TEST_DIRS:=tests
1819
DOC_TESTS:=src ./README.md
@@ -40,27 +41,23 @@ devready:
4041

4142
#=> venv: make a Python 3 virtual environment
4243
${VE_DIR}:
43-
python3 --version
44-
python3 -mvenv $@; \
45-
source $@/bin/activate; \
46-
python3 -m ensurepip --upgrade; \
47-
pip install --upgrade pip setuptools wheel
48-
44+
uv venv --python ${PY_VERSION} $@
45+
4946
#=> develop: install package in develop mode
5047
.PHONY: develop
5148
develop:
52-
pip install -e ".[dev,tests]"
49+
uv pip install -e ".[dev,tests]"
5350
pre-commit install
5451

5552
#=> install: install package
5653
.PHONY: install
5754
install:
58-
pip install "."
55+
uv pip install "."
5956

6057
#=> build: make sdist and wheel
6158
.PHONY: build
6259
build: %:
63-
python -m build
60+
uv build
6461

6562

6663
############################################################################

README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![codecov](https://codecov.io/gh/biocommons/biocommons.example/graph/badge.svg?token=CCUMQQV5R6)](https://codecov.io/gh/biocommons/biocommons.example)
44

5+
---
6+
57
This repo provides a template for biocommons Python packages. Here's how to use it:
68

79
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
1113
1. Remove this header.
1214
1. Commit and push.
1315

16+
Delete this section in your generated template.
17+
18+
---
19+
1420
## Installation
1521

1622
To install from pypi: ```pip install biocommons.example```
1723

1824
## Developer Setup
1925

20-
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.
26+
### Prerequisites
2127

22-
Setup like this:
28+
- [GNU make](https://www.gnu.org/software/make/): Current mechanism for consistent invocation of developer tools.
29+
- Mac: [Install brew](https://brew.sh/), then [install make](https://formulae.brew.sh/formula/make)
30+
- Ubuntu: `sudo apt install make`
31+
- [uv](https://docs.astral.sh/uv/): An extremely fast Python package and project manager, written in Rust.
32+
- All platforms: See the [uv installation instructions](https://docs.astral.sh/uv/getting-started/installation/).
33+
- [zsh](https://www.zsh.org/): Shell used by the Makefile
34+
- Mac: included by default
35+
- Ubuntu: `sudo apt install zsh`
36+
37+
### One-time developer setup
38+
39+
Create a Python virtual environment and install dependencies:
2340

2441
make devready
42+
43+
### Development
44+
45+
Activate your environment:
46+
2547
source venv/bin/activate
2648

2749
Code reformatting:
2850

2951
make reformat
3052

31-
Install pre-commit hook:
32-
33-
# included in `make devready`, not necessary for new installations
34-
pre-commit install
35-
3653
Test:
3754

3855
make test # for current environment
@@ -77,7 +94,3 @@ Try it:
7794

7895
* Quality tools: Code linting and reformatting with Ruff
7996
* GitHub Actions for testing and packaging
80-
81-
## ToDo
82-
83-
* Add devcontainer support

pyproject.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,35 @@ name = "biocommons.example"
33
authors = [
44
{ name = "biocommons contributors", email = "[email protected]" },
55
]
6-
description = "Example Package"
6+
description = "biocommons.example Package"
77
readme = "README.md"
8-
license = { file = "LICENSE.txt" }
9-
requires-python = ">=3.10"
8+
license = "Apache-2.0"
9+
# license_files = [ "LICENSE.txt" ]
10+
# requires-python = ">=3.11"
1011
classifiers = [
1112
"Programming Language :: Python :: 3",
13+
"Programming Language :: Python :: 3.9",
14+
"Programming Language :: Python :: 3.10",
1215
"Programming Language :: Python :: 3.11",
1316
"Programming Language :: Python :: 3.12",
1417
"Programming Language :: Python :: 3.13",
15-
"License :: OSI Approved :: MIT License",
1618
"Operating System :: OS Independent",
1719
]
1820
dynamic = ["version"]
19-
dependencies = ["coloredlogs ~= 15.0", "pyyaml ~= 6.0"]
21+
dependencies = [
22+
"coloredlogs ~= 15.0",
23+
"pyyaml ~= 6.0",
24+
]
2025

2126
[project.optional-dependencies]
2227
dev = [
2328
"build ~= 0.8",
2429
"ipython ~= 8.4",
25-
"pre-commit ~= 3.4",
30+
"pre-commit>=3.8.0",
2631
"ruff == 0.4.4",
2732
]
2833
tests = [
2934
"pytest-cov ~= 4.1",
30-
"pytest-optional-tests",
3135
"pytest ~= 7.1",
3236
"vcrpy",
3337
"tox ~= 4.15",

0 commit comments

Comments
 (0)