Skip to content

Commit 3d009cc

Browse files
authored
Merge branch 'main' into support_oxford_comma
2 parents 11b4488 + f72bece commit 3d009cc

File tree

10 files changed

+430
-252
lines changed

10 files changed

+430
-252
lines changed

.github/workflows/constraints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
nox==2024.10.9
12
pip==24.3.1
23
virtualenv==20.29.0

.github/workflows/release-dev.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Release
22

33
on:
44
push:
5-
tags:
6-
- "v[0-9]+.[0-9]+.[0-9]+"
5+
branches:
6+
- main
77

88
jobs:
99
release:
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up Python
2222
uses: actions/setup-python@v5
2323
with:
24-
python-version: "3.12"
24+
python-version: "3.13"
2525

2626
- name: Upgrade pip
2727
run: |
@@ -33,9 +33,30 @@ jobs:
3333
pip install --constraint=.github/workflows/hatch-constraints.txt hatch
3434
hatch --version
3535
36+
- name: Check if there is a parent commit
37+
id: check-parent-commit
38+
run: |
39+
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
40+
41+
- name: Detect and tag new version
42+
id: check-version
43+
if: steps.check-parent-commit.outputs.sha
44+
uses: salsify/action-detect-and-tag-new-version@v2
45+
with:
46+
version-command: |
47+
bash -o pipefail -c "hatch version"
48+
49+
- name: Bump version for developmental release
50+
if: "! steps.check-version.outputs.tag"
51+
run: |
52+
hatch version b
53+
54+
- name: Install UV
55+
uses: astral-sh/setup-uv@v5
56+
3657
- name: Build package
3758
run: |
38-
hatch build
59+
uv build
3960
4061
- name: Publish package on PyPI
4162
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/tests.yml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
include:
15-
- { python: "3.12", os: "ubuntu-latest", session: "pre-commit" }
16-
- { python: "3.12", os: "ubuntu-latest", session: "safety" }
15+
- { python: "3.13", os: "ubuntu-latest", session: "pre-commit" }
16+
- { python: "3.13", os: "ubuntu-latest", session: "mypy" }
1717
- { python: "3.12", os: "ubuntu-latest", session: "mypy" }
1818
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
1919
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
2020
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
21+
- { python: "3.13", os: "ubuntu-latest", session: "tests" }
2122
- { python: "3.12", os: "ubuntu-latest", session: "tests" }
2223
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
2324
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
2425
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
25-
- { python: "3.12", os: "windows-latest", session: "tests" }
26-
- { python: "3.12", os: "macos-latest", session: "tests" }
27-
- { python: "3.12", os: "ubuntu-latest", session: "typeguard" }
28-
- { python: "3.12", os: "ubuntu-latest", session: "xdoctest" }
29-
- { python: "3.12", os: "ubuntu-latest", session: "docs-build" }
26+
- { python: "3.13", os: "windows-latest", session: "tests" }
27+
- { python: "3.13", os: "macos-latest", session: "tests" }
28+
- { python: "3.13", os: "ubuntu-latest", session: "typeguard" }
29+
- { python: "3.13", os: "ubuntu-latest", session: "xdoctest" }
30+
- { python: "3.13", os: "ubuntu-latest", session: "docs-build" }
3031

3132
steps:
3233
- name: Check out the repository
@@ -42,10 +43,12 @@ jobs:
4243
pip install --constraint=.github/workflows/constraints.txt pip
4344
pip --version
4445
45-
- name: Install Hatch
46+
- name: Install UV
47+
uses: astral-sh/setup-uv@v5
48+
49+
- name: Install Nox
4650
run: |
47-
pipx install --pip-args=--constraint=.github/workflows/hatch-constraints.txt hatch
48-
hatch --version
51+
uv sync --all-extras --frozen
4952
5053
- name: Compute pre-commit cache key
5154
if: matrix.session == 'pre-commit'
@@ -71,9 +74,9 @@ jobs:
7174
restore-keys: |
7275
${{ steps.pre-commit-cache.outputs.result }}-
7376
74-
- name: Run Hatch
77+
- name: Run Nox
7578
run: |
76-
hatch run +python=${{ matrix.python }} sessions:run-${{ matrix.session }}
79+
uv run nox -s tests --force-color --python=${{ matrix.python }}
7780
7881
- name: Upload coverage data
7982
if: always() && matrix.session == 'tests' && matrix.os == 'ubuntu-latest'
@@ -100,33 +103,32 @@ jobs:
100103
- name: Set up Python
101104
uses: actions/setup-python@v5
102105
with:
103-
python-version: "3.12"
106+
python-version: "3.13"
104107

105108
- name: Upgrade pip
106109
run: |
107110
pip install --constraint=.github/workflows/constraints.txt pip
108111
pip --version
109112
110-
- name: Install Hatch
111-
run: |
112-
pipx install --pip-args=--constraint=.github/workflows/hatch-constraints.txt hatch
113-
hatch --version
113+
- name: Install UV
114+
uses: astral-sh/setup-uv@v5
114115

115116
- name: Download coverage data
116117
uses: actions/download-artifact@v4
117118

118119
- name: Combine coverage data and display human readable report
119120
run: |
120121
shopt -s dotglob
122+
mv coverage-data-3.13-ubuntu-latest/* .
121123
mv coverage-data-3.12-ubuntu-latest/* .
122124
mv coverage-data-3.11-ubuntu-latest/* .
123125
mv coverage-data-3.10-ubuntu-latest/* .
124126
mv coverage-data-3.9-ubuntu-latest/* .
125-
hatch run coverage:run
127+
uv run nox --force-color --session=coverage
126128
127129
- name: Create coverage report
128130
run: |
129-
hatch run coverage:run-xml
131+
uv run nox --force-color --session=coverage -- xml
130132
131133
- name: Upload coverage report
132134
uses: codecov/codecov-action@v5

CONTRIBUTING.md

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,42 +39,29 @@ Request features on the [Issue Tracker].
3939

4040
You need Python 3.9+ and the following tools:
4141

42-
- [Hatch]
42+
- [UV]
4343

4444
Install the package with development requirements:
4545

46-
```console
47-
$ hatch env create
46+
```sh
47+
$ uv sync --all-extras --frozen
4848
```
4949

50-
You can now run an interactive Python session:
51-
52-
```console
53-
$ hatch shell
54-
import human_readable
55-
```
56-
57-
[hatch]: https://hatch.pypa.io/
50+
[uv]: https://docs.astral.sh/uv/
5851

5952
## How to test the project
6053

6154
Run the full test suite:
6255

63-
```console
64-
$ hatch run all
65-
```
66-
67-
List the available Hatch env scripts:
68-
69-
```console
70-
$ hatch env show
56+
```sh
57+
$ uv run nox
7158
```
7259

73-
You can run a specific Hatch env script.
60+
You can run a specific Nox session.
7461
For example, invoke the unit test suite like this:
7562

76-
```console
77-
$ hatch run tests:run
63+
```sh
64+
$ uv run nox -s tests
7865
```
7966

8067
Unit tests are located in the `tests` directory,
@@ -84,13 +71,13 @@ and are written using the [pytest] testing framework.
8471

8572
Make sure you have installed a PO Editor, you can easily install that on a Debian-based system with:
8673

87-
```console
74+
```sh
8875
apt install poedit
8976
```
9077

9178
To add a new locale you need to execute:
9279

93-
```console
80+
```sh
9481
xgettext --from-code=UTF-8 -o human_readable.pot -k'_' -k'N_' -k'P_:1c,2' -l python src/human_readable/*.py # extract new phrases
9582
msginit -i human_readable.pot -o human_readable/locale/<locale name>/LC_MESSAGES/human_readable.po --locale <locale name>
9683
```
@@ -99,7 +86,7 @@ Then edit your .po file in the locale folder that got created.
9986

10087
If possible, add tests to `tests/functional/new_locale`. Run them with:
10188

102-
```console
89+
```sh
10390
nox -s tests
10491
```
10592

@@ -117,7 +104,7 @@ Feel free to submit early, though—we can always iterate on this.
117104

118105
To run linting and code formatting checks before commiting your change, you can install pre-commit as a Git hook by running the following command:
119106

120-
```console
107+
```sh
121108
$ nox --session=pre-commit -- install
122109
```
123110

codecov.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)