Skip to content

Commit 90536cf

Browse files
authored
Add rye. (#75)
1 parent 9fe1dce commit 90536cf

File tree

8 files changed

+135
-97
lines changed

8 files changed

+135
-97
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ on:
1818

1919
jobs:
2020

21+
run-type-checking:
22+
23+
name: Run tests for type-checking
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-python@v5
29+
with:
30+
python-version-file: .python-version
31+
allow-prereleases: true
32+
cache: pip
33+
- run: pip install tox-uv
34+
- run: tox -e typing
35+
2136
run-tests:
2237

2338
name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}

.github/workflows/publish-to-pypi.yml

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,91 @@
1-
name: PyPI
1+
name: Publish Python 🐍 distribution 📦 to PyPI
22

33
on: push
44

55
jobs:
6-
build-n-publish:
7-
name: Build and publish Python 🐍 distributions 📦 to PyPI
6+
build:
7+
name: Build distribution 📦
88
runs-on: ubuntu-latest
9+
910
steps:
1011
- uses: actions/checkout@v4
11-
12-
- name: Set up Python 3.8
12+
- name: Set up Python
1313
uses: actions/setup-python@v5
1414
with:
15-
python-version: 3.8
16-
15+
python-version: "3.x"
1716
- name: Install pypa/build
1817
run: >-
19-
python -m
18+
python3 -m
2019
pip install
2120
build
2221
--user
23-
2422
- name: Build a binary wheel and a source tarball
25-
run: >-
26-
python -m
27-
build
28-
--sdist
29-
--wheel
30-
--outdir dist/
23+
run: python3 -m build
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: python-package-distributions
28+
path: dist/
3129

30+
publish-to-pypi:
31+
name: Publish Python 🐍 distribution 📦 to PyPI
32+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
33+
needs:
34+
- build
35+
runs-on: ubuntu-latest
36+
environment:
37+
name: pypi
38+
url: https://pypi.org/p/pytask-latex
39+
permissions:
40+
id-token: write # IMPORTANT: mandatory for trusted publishing
41+
42+
steps:
43+
- name: Download all the dists
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: python-package-distributions
47+
path: dist/
3248
- name: Publish distribution 📦 to PyPI
33-
if: startsWith(github.ref, 'refs/tags')
34-
uses: pypa/gh-action-pypi-publish@master
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
51+
github-release:
52+
name: >-
53+
Sign the Python 🐍 distribution 📦 with Sigstore
54+
and upload them to GitHub Release
55+
needs:
56+
- publish-to-pypi
57+
runs-on: ubuntu-latest
58+
59+
permissions:
60+
contents: write # IMPORTANT: mandatory for making GitHub Releases
61+
id-token: write # IMPORTANT: mandatory for sigstore
62+
63+
steps:
64+
- name: Download all the dists
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: python-package-distributions
68+
path: dist/
69+
- name: Sign the dists with Sigstore
70+
uses: sigstore/[email protected]
3571
with:
36-
password: ${{ secrets.PYPI_API_TOKEN }}
72+
inputs: >-
73+
./dist/*.tar.gz
74+
./dist/*.whl
75+
- name: Create GitHub Release
76+
env:
77+
GITHUB_TOKEN: ${{ github.token }}
78+
run: >-
79+
gh release create
80+
'${{ github.ref_name }}'
81+
--repo '${{ github.repository }}'
82+
--notes ""
83+
- name: Upload artifact signatures to GitHub Release
84+
env:
85+
GITHUB_TOKEN: ${{ github.token }}
86+
# Upload to GitHub Release using the `gh` CLI. `dist/` contains the built
87+
# packages, and the sigstore-produced signatures and certificates.
88+
run: >-
89+
gh release upload
90+
'${{ github.ref_name }}' dist/**
91+
--repo '${{ github.repository }}'

.pre-commit-config.yaml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
args: [--branch, main]
1818
- id: trailing-whitespace
1919
- repo: https://github.com/pre-commit/pygrep-hooks
20-
rev: v1.10.0 # Use the ref you want to point at
20+
rev: v1.10.0
2121
hooks:
2222
- id: python-check-blanket-noqa
2323
- id: python-check-mock-methods
@@ -48,24 +48,6 @@ repos:
4848
hooks:
4949
- id: codespell
5050
args: [-L als, -L falsy]
51-
- repo: https://github.com/pre-commit/mirrors-mypy
52-
rev: 'v1.9.0'
53-
hooks:
54-
- id: mypy
55-
additional_dependencies: [
56-
attrs>=21.3.0,
57-
click,
58-
pytask>=0.4.0,
59-
types-PyYAML,
60-
types-setuptools
61-
]
62-
pass_filenames: false
63-
- repo: https://github.com/mgedmin/check-manifest
64-
rev: "0.49"
65-
hooks:
66-
- id: check-manifest
67-
args: [--no-build-isolation]
68-
additional_dependencies: [setuptools-scm, toml, wheel]
6951
- repo: meta
7052
hooks:
7153
- id: check-hooks-apply

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12.2

CHANGES.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ This is a record of all past pytask-latex releases and what went into them in re
44
chronological order. Releases follow [semantic versioning](https://semver.org/) and all
55
releases are available on [Anaconda.org](https://anaconda.org/conda-forge/pytask-latex).
66

7-
## 0.4.2 - 2023-xx-xx
7+
## 0.4.3 - 2024-xx-xx
8+
9+
- {pull}`75` adds rye.
10+
11+
## 0.4.2 - 2023-11-30
812

913
- {pull}`65` simplifies dependency management.
1014
- {pull}`66` removes using `MetaNode`.
11-
- {pull}`72` updates syntax of tests.
15+
- {pull}`72` updates the syntax of tests.
1216

1317
## 0.4.1 - 2023-10-12
1418

@@ -26,7 +30,7 @@ releases are available on [Anaconda.org](https://anaconda.org/conda-forge/pytask
2630

2731
## 0.2.1 - 2022-04-19
2832

29-
- {pull}`40` fixes the error message which advises user to transition to the new
33+
- {pull}`40` fixes the error message which advises the user to transition to the new
3034
interface.
3135

3236
## 0.2.0 - 2022-04-16

environment.yml

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

pyproject.toml

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling", "hatch-vcs"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "pytask_latex"
@@ -10,13 +10,17 @@ classifiers = [
1010
"License :: OSI Approved :: MIT License",
1111
"Operating System :: OS Independent",
1212
"Programming Language :: Python :: 3",
13-
"Programming Language :: Python :: 3 :: Only"
13+
"Programming Language :: Python :: 3 :: Only",
1414
]
1515
requires-python = ">=3.8"
16-
dependencies = [ "latex-dependency-scanner>=0.1.1", "pluggy>=1.0.0", "pytask>=0.4.0"]
17-
dynamic = [ "version" ]
18-
authors = [ { name = "Tobias Raabe", email = "[email protected]"} ]
19-
readme = { file = "README.md", content-type = "text/markdown"}
16+
dependencies = [
17+
"latex-dependency-scanner>=0.1.3",
18+
"pluggy>=1.0.0",
19+
"pytask>=0.4.0",
20+
]
21+
dynamic = ["version"]
22+
authors = [{ name = "Tobias Raabe", email = "[email protected]" }]
23+
readme = { file = "README.md", content-type = "text/markdown" }
2024
license = { text = "MIT" }
2125

2226
[project.urls]
@@ -28,28 +32,32 @@ Tracker = "https://github.com/pytask-dev/pytask-latex/issues"
2832

2933
[project.optional-dependencies]
3034
test = ["pytest", "pytest-cov", "pytest-xdist"]
31-
32-
[tool.setuptools]
33-
include-package-data = true
34-
zip-safe = false
35-
platforms = [ "any",]
36-
license-files = [ "LICENSE" ]
37-
38-
[tool.check-manifest]
39-
ignore = ["src/pytask_latex/_version.py"]
35+
typing = [
36+
"mypy>=1.10.0",
37+
]
4038

4139
[project.entry-points.pytask]
4240
pytask_latex = "pytask_latex.plugin"
4341

44-
[tool.setuptools.package-dir]
45-
"" = "src"
42+
[tool.rye]
43+
managed = true
44+
45+
[tool.hatch.build.hooks.vcs]
46+
version-file = "src/pytask_latex/_version.py"
47+
48+
[tool.hatch.build.targets.sdist]
49+
exclude = ["tests"]
50+
only-packages = true
51+
52+
[tool.hatch.build.targets.wheel]
53+
exclude = ["tests"]
54+
only-packages = true
4655

47-
[tool.setuptools.packages.find]
48-
where = [ "src" ]
49-
namespaces = false
56+
[tool.hatch.version]
57+
source = "vcs"
5058

51-
[tool.setuptools_scm]
52-
write_to = "src/pytask_latex/_version.py"
59+
[tool.hatch.metadata]
60+
allow-direct-references = true
5361

5462
[tool.mypy]
5563
files = ["src", "tests"]
@@ -73,9 +81,9 @@ unsafe-fixes = true
7381

7482
[tool.ruff.lint]
7583
extend-ignore = [
76-
"ANN401", # Allow typing.Any.
77-
"COM812", # Comply with ruff-format
78-
"ISC001", # Comply with ruff-format
84+
"ANN401", # Allow typing.Any.
85+
"COM812", # Comply with ruff-format
86+
"ISC001", # Comply with ruff-format
7987
]
8088
select = ["ALL"]
8189

@@ -89,7 +97,6 @@ force-single-line = true
8997
convention = "numpy"
9098

9199
[tool.pytest.ini_options]
92-
# Do not add src since it messes with the loading of pytask-parallel as a plugin.
93100
testpaths = ["src", "tests"]
94101
markers = [
95102
"wip: Tests that are work-in-progress.",

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ passenv = CI
99
extras = test
1010
commands =
1111
pytest {posargs}
12+
13+
[testenv:typing]
14+
extras = typing
15+
commands = mypy

0 commit comments

Comments
 (0)