Skip to content

Commit b722bcd

Browse files
authored
Merge pull request #37 from cachedjdk/build-modern
Use uv (Hatch) for build; support Python 3.10-14
2 parents 0d77df5 + 8ae7ff1 commit b722bcd

File tree

12 files changed

+2631
-108
lines changed

12 files changed

+2631
-108
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,36 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
runner: [ubuntu-latest, macos-latest, windows-latest]
3130
include:
32-
# Only test with Python versions available on the runners.
31+
# All Python versions on Ubuntu
3332
- runner: ubuntu-latest
34-
py_versions: 3.9 3.10 3.11 3.12 3.13
33+
python: "3.10"
34+
- runner: ubuntu-latest
35+
python: "3.11"
36+
- runner: ubuntu-latest
37+
python: "3.12"
38+
- runner: ubuntu-latest
39+
python: "3.13"
40+
- runner: ubuntu-latest
41+
python: "3.14"
42+
# Oldest and newest Python on other platforms
3543
- runner: macos-latest
36-
py_versions: 3.11 3.12 3.13
44+
python: "3.10"
45+
- runner: macos-latest
46+
python: "3.14"
47+
- runner: windows-latest
48+
python: "3.10"
3749
- runner: windows-latest
38-
py_versions: 3.9 3.10 3.11 3.12 3.13
39-
name: test-${{ matrix.runner }}
50+
python: "3.14"
51+
name: test-${{ matrix.runner }}-py${{ matrix.python }}
4052
runs-on: ${{ matrix.runner }}
4153
steps:
4254
- uses: actions/checkout@v3
4355
with:
44-
fetch-depth: 0 # Full history needed for setuptools_scm
45-
- uses: fjwillemsen/setup-nox2@v3.0.0
46-
- run: nox -p ${{ matrix.py_versions }}
56+
fetch-depth: 0 # Full history needed for hatch-vcs
57+
- uses: astral-sh/setup-uv@v5
58+
- name: Run tests
59+
run: uv run --python ${{ matrix.python }} --group test pytest
4760

4861
docs:
4962
needs:
@@ -57,16 +70,12 @@ jobs:
5770
steps:
5871
- uses: actions/checkout@v3
5972
with:
60-
fetch-depth: 0 # Full history needed for setuptools_scm
61-
- uses: actions/setup-python@v4
62-
with:
63-
python-version: "3.x"
64-
- name: Install tools
65-
run: |
66-
python -m pip install --user --upgrade pip setuptools nox
73+
fetch-depth: 0 # Full history needed for hatch-vcs
74+
- uses: astral-sh/setup-uv@v5
6775
- name: Build docs
68-
run: |
69-
python -m nox -s docs
76+
run: uv run --group docs jb build docs/
77+
env:
78+
CJDK_HIDE_PROGRESS_BARS: "1"
7079
- name: Publish to gh-pages (latest)
7180
if: >-
7281
github.repository == 'cachedjdk/cjdk' &&
@@ -108,16 +117,10 @@ jobs:
108117
steps:
109118
- uses: actions/checkout@v3
110119
with:
111-
fetch-depth: 0 # Full history needed for setuptools_scm
112-
- uses: actions/setup-python@v4
113-
with:
114-
python-version: "3.9"
115-
- name: Install tools
116-
run: |
117-
python -m pip install --user --upgrade pip setuptools build
120+
fetch-depth: 0 # Full history needed for hatch-vcs
121+
- uses: astral-sh/setup-uv@v5
118122
- name: Build sdist and wheel
119-
run: |
120-
python -m build --sdist --wheel --outdir dist .
123+
run: uv build
121124
- name: Publish on PyPI
122125
if: >-
123126
github.repository == 'cachedjdk/cjdk' &&

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ dist/
1515
*.ipynb
1616
.ipynb_checkpoints/
1717

18-
# Generated by setuptools_scm
18+
# Generated by hatch-vcs
1919
src/cjdk/_version.py

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ does not require a Java runtime to bootstrap.
4141

4242
## Installing
4343

44-
**cjdk** requires Python 3.9.
44+
**cjdk** requires Python 3.10.
4545

4646
```sh
4747
pip install cjdk

docs/development.md

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,24 @@ git clone https://github.com/cachedjdk/cjdk.git
1313
cd cjdk
1414
```
1515

16-
As usual, it is best to do all development in a virtual environment:
17-
18-
```sh
19-
python -m venv venv
20-
echo '*' >venv/.gitignore # Make Git ignore your venv directory
21-
source venv/bin/activate # Use venv/Scripts/activate on Windows
22-
python -m pip install --upgrade pip setuptools
23-
```
24-
2516
Make sure to enable the [pre-commit](https://pre-commit.com/) Git hooks:
2617

2718
```sh
28-
pip install pre-commit
19+
uv tool install pre-commit
20+
# Or: pipx install pre-commit
2921
pre-commit install
3022
```
3123

32-
To run the tests using an editable install:
33-
34-
```sh
35-
pip install -e .[testing]
36-
pytest
37-
```
38-
39-
To run the tests as they are run by CI, use [Nox](https://nox.thea.codes/):
24+
To run the tests:
4025

4126
```sh
42-
pip install nox
43-
nox
27+
uv run test pytest
4428
```
4529

4630
To build the documentation with [Jupyter Book](https://jupyterbook.org/):
4731

4832
```sh
49-
pip install -r docs/requirements.txt
50-
CJDK_HIDE_PROGRESS_BARS=1 jb build docs
33+
CJDK_HIDE_PROGRESS_BARS=1 uv run --group docs jb build docs/
5134
# Now view docs/_build/html/index.html
5235
```
5336

@@ -62,13 +45,6 @@ New notebook pages can be added by first creating the notebook (`.ipynb`) in
6245
Jupyter Lab, then running `jupytext mypage.ipynb --to myst`. Delete the
6346
`.ipynb` file so that the MyST (`.md`) file is the single source of truth.
6447

65-
To build the documentation as done by CI:
66-
67-
```sh
68-
rm -rf docs/_build
69-
nox -s docs
70-
```
71-
7248
(versioning-scheme)=
7349

7450
## Versioning

docs/install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SPDX-License-Identifier: MIT
99
**cjdk** is a pure Python package and does not require a pre-installed JDK or
1010
JRE.
1111

12-
Python 3.9 or later is required.
12+
Python 3.10 or later is required.
1313

1414
```sh
1515
pip install cjdk

docs/requirements.txt

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

noxfile.py

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

pyproject.toml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,15 @@
33
# SPDX-License-Identifier: MIT
44

55
[build-system]
6-
requires = [
7-
"setuptools>=43",
8-
"setuptools_scm[toml]>=6.2",
9-
]
10-
build-backend = "setuptools.build_meta"
6+
requires = ["hatchling", "hatch-vcs"]
7+
build-backend = "hatchling.build"
118

129
[project]
1310
name = "cjdk"
1411
dynamic = ["version"]
1512
description = "Auto-download JDK or JRE and run Java apps from Python or CLI"
1613
readme = "README.md"
17-
requires-python = ">=3.9"
14+
requires-python = ">=3.10"
1815
license = "MIT"
1916
license-files = ["LICENSE.txt"]
2017
keywords = ["Java", "JDK", "JRE", "JVM"]
@@ -23,6 +20,11 @@ authors = [
2320
]
2421
classifiers = [
2522
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
"Programming Language :: Python :: 3.13",
27+
"Programming Language :: Python :: 3.14",
2628
"Programming Language :: Java",
2729
"Topic :: Software Development",
2830
]
@@ -33,22 +35,35 @@ dependencies = [
3335
"requests >= 2.24",
3436
]
3537

36-
[project.optional-dependencies]
37-
testing = [
38-
"flask >= 2.0",
39-
"pytest >= 7.0",
40-
"werkzeug >= 2.0",
41-
]
42-
4338
[project.urls]
4439
Documentation = "https://cachedjdk.github.io/cjdk/latest"
4540
Repository = "https://github.com/cachedjdk/cjdk"
4641

4742
[project.scripts]
4843
cjdk = "cjdk.__main__:main"
4944

50-
[tool.setuptools_scm]
51-
write_to = "src/cjdk/_version.py"
45+
[dependency-groups]
46+
test = [
47+
"flask >= 2.0",
48+
"pytest >= 7.0",
49+
"werkzeug >= 2.0",
50+
]
51+
dev = [
52+
{include-group = "test"},
53+
]
54+
docs = [
55+
"jgo >= 1.0",
56+
"jupyter-book >= 0.13, < 2.0",
57+
"jupyterlab >= 3.4",
58+
"jupytext >= 1.13",
59+
"sphinxcontrib-programoutput >= 0.17",
60+
]
61+
62+
[tool.hatch.version]
63+
source = "vcs"
64+
65+
[tool.hatch.build.hooks.vcs]
66+
version-file = "src/cjdk/_version.py"
5267

5368
[tool.pytest.ini_options]
5469
testpaths = ["tests"]
@@ -62,5 +77,5 @@ select = ["E", "F", "UP", "B", "SIM", "I"]
6277
ignore = ["B006", "B007", "B011", "B017", "E501"]
6378

6479
[tool.uv]
65-
# setuptools_scm compatibility
80+
# hatch-vcs compatibility
6681
cache-keys = [{file = "pyproject.toml"}, {git = {commit = true, tags = true}}]

setup.cfg

Whitespace-only changes.

src/cjdk/_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
from . import _cache, _conf, _index, _install, _jdk
1313

1414
if TYPE_CHECKING:
15-
from collections.abc import Iterator
15+
from collections.abc import Callable, Iterator
1616
from pathlib import Path
17-
from typing import Any, Callable, Unpack
17+
from typing import Any, Unpack
1818

1919
from ._conf import ConfigKwargs
2020

0 commit comments

Comments
 (0)