Skip to content

Commit ea266be

Browse files
authored
Add rye. (#31)
1 parent 997776b commit ea266be

File tree

8 files changed

+186
-119
lines changed

8 files changed

+186
-119
lines changed

.github/workflows/main.yml

+30-28
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ concurrency:
55
group: ${{ github.head_ref || github.run_id }}
66
cancel-in-progress: true
77

8-
env:
9-
CONDA_EXE: mamba
10-
118
on:
129
push:
1310
branches:
@@ -18,6 +15,21 @@ on:
1815

1916
jobs:
2017

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

2335
name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
@@ -33,18 +45,12 @@ jobs:
3345
- uses: actions/checkout@v4
3446
- uses: r-lib/actions/setup-tinytex@v2
3547
if: runner.os != 'Windows'
36-
- uses: mamba-org/setup-micromamba@v1
48+
- uses: actions/setup-python@v5
3749
with:
38-
environment-name: gha-testing
39-
condarc: |
40-
channels:
41-
- nodefaults
42-
- conda-forge
43-
create-args: >-
44-
python=${{ matrix.python-version }}
45-
mamba
46-
tox-conda
47-
cache-environment: true
50+
python-version: ${{ matrix.python-version }}
51+
cache: pip
52+
allow-prereleases: true
53+
- run: pip install tox-uv
4854

4955
- name: Install MacOS dependencies.
5056
if: runner.os == 'macOS'
@@ -56,26 +62,22 @@ jobs:
5662
shell: bash -l {0}
5763
run: tlmgr install import epstopdf biblatex biber
5864

59-
- name: Install core dependencies.
60-
shell: bash -l {0}
61-
run: conda install -c conda-forge tox-conda coverage
62-
6365
# Unit, integration, and end-to-end tests.
6466

6567
- name: Run unit tests and doctests.
6668
shell: bash -l {0}
67-
run: tox -e pytest -- src tests -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto
69+
run: tox -e test -- src tests -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml
6870

69-
- name: Upload coverage report for unit tests and doctests.
70-
if: runner.os == 'Linux' && matrix.python-version == '3.10'
71-
shell: bash -l {0}
72-
run: bash <(curl -s https://codecov.io/bash) -F unit -c
71+
- name: Upload unit test coverage reports to Codecov with GitHub Action
72+
uses: codecov/codecov-action@v4
73+
with:
74+
flags: unit
7375

7476
- name: Run end-to-end tests.
7577
shell: bash -l {0}
76-
run: tox -e pytest -- src tests -m end_to_end --cov=./ --cov-report=xml -n auto
78+
run: tox -e test -- src tests -m end_to_end --cov=./ --cov-report=xml
7779

78-
- name: Upload coverage reports of end-to-end tests.
79-
if: runner.os == 'Linux' && matrix.python-version == '3.10'
80-
shell: bash -l {0}
81-
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c
80+
- name: Upload end_to_end test coverage reports to Codecov with GitHub Action
81+
uses: codecov/codecov-action@v4
82+
with:
83+
flags: end_to_end

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

+73-18
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/latex-dependency-scanner
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

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ repos:
44
hooks:
55
- id: check-added-large-files
66
args: ['--maxkb=25']
7+
- id: check-case-conflict
78
- id: check-merge-conflict
9+
- id: check-vcs-permalinks
810
- id: check-yaml
911
- id: debug-statements
1012
- id: end-of-file-fixer
13+
- id: fix-byte-order-marker
14+
- id: mixed-line-ending
15+
- id: no-commit-to-branch
16+
args: [--branch, main]
17+
- id: trailing-whitespace
1118
- repo: https://github.com/pre-commit/pygrep-hooks
1219
rev: v1.10.0
1320
hooks:
@@ -36,12 +43,6 @@ repos:
3643
rev: v2.2.6
3744
hooks:
3845
- id: codespell
39-
- repo: https://github.com/mgedmin/check-manifest
40-
rev: "0.49"
41-
hooks:
42-
- id: check-manifest
43-
args: [--no-build-isolation]
44-
additional_dependencies: [setuptools-scm, wheel, toml]
4546
- repo: meta
4647
hooks:
4748
- id: check-hooks-apply

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12.2

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
This is a record of all past latex-dependency-scanner releases and what went into them
44
in reverse chronological order. Releases follow [semantic versioning](https://semver.org/) and all releases are available on [PyPI](https://pypi.org/project/latex-dependency-scanner) and [Anaconda.org](https://anaconda.org/pytask/latex-dependency-scanner).
55

6+
## 0.1.3 - 2024-xx-xx
7+
8+
- {pull}`31` adds rye.
9+
610
## 0.1.2 - 2023-10-02
711

812
- {pull}`21` updates the readme and other infrastructure files.

pyproject.toml

+61-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,66 @@
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

5-
[tool.setuptools_scm]
6-
write_to = "src/latex_dependency_scanner/_version.py"
5+
[project]
6+
name = "latex_dependency_scanner"
7+
description = "Scan LaTeX documents for their dependencies."
8+
classifiers = [
9+
"Development Status :: 3 - Alpha",
10+
"License :: OSI Approved :: MIT License",
11+
"Operating System :: OS Independent",
12+
"Programming Language :: Python :: 3",
13+
"Programming Language :: Python :: 3 :: Only",
14+
]
15+
requires-python = ">=3.8"
16+
dynamic = ["version"]
17+
18+
[[project.authors]]
19+
name = "Tobias Raabe"
20+
21+
22+
[project.readme]
23+
file = "README.md"
24+
content-type = "text/markdown"
25+
26+
[project.license]
27+
text = "MIT"
28+
29+
[project.urls]
30+
Homepage = "https://github.com/pytask-dev/latex-dependency-scanner"
31+
Changelog = "https://github.com/pytask-dev/latex-dependency-scanner/blob/main/CHANGES.md"
32+
Documentation = "https://github.com/pytask-dev/latex-dependency-scanner"
33+
Github = "https://github.com/pytask-dev/latex-dependency-scanner"
34+
Tracker = "https://github.com/pytask-dev/latex-dependency-scanner/issues"
35+
36+
[project.optional-dependencies]
37+
typing = [
38+
"mypy>=1.10.0",
39+
]
40+
test = [
41+
"pytest>=8.1.1",
42+
"pytest-cov>=5.0.0",
43+
]
44+
45+
[tool.rye]
46+
managed = true
47+
48+
[tool.hatch.build.hooks.vcs]
49+
version-file = "src/latex_dependency_scanner/_version.py"
50+
51+
[tool.hatch.build.targets.sdist]
52+
exclude = ["tests"]
53+
only-packages = true
54+
55+
[tool.hatch.build.targets.wheel]
56+
exclude = ["tests"]
57+
only-packages = true
58+
59+
[tool.hatch.version]
60+
source = "vcs"
61+
62+
[tool.hatch.metadata]
63+
allow-direct-references = true
764

865
[tool.mypy]
966
files = ["src", "tests"]

setup.cfg

-35
This file was deleted.

tox.ini

+10-28
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,15 @@
11
[tox]
2-
envlist = pytest
2+
requires = tox>=4
3+
envlist = test, typing
34

45
[testenv]
5-
usedevelop = true
6+
passenv = CI
7+
package = editable
68

7-
[testenv:pytest]
8-
conda_channels =
9-
conda-forge
10-
conda_deps =
11-
pytest
12-
pytest-cov
13-
pytest-xdist
14-
sphinx
15-
commands =
16-
pytest {posargs}
9+
[testenv:typing]
10+
extras = typing
11+
commands = mypy
1712

18-
[pytest]
19-
testpaths =
20-
src
21-
tests
22-
addopts = --doctest-modules
23-
filterwarnings =
24-
ignore: the imp module is deprecated in favour of importlib
25-
ignore: Using or importing the ABCs from 'collections' instead of from
26-
markers =
27-
wip: Tests that are work-in-progress.
28-
unit: Flag for unit tests which target mainly a single function.
29-
integration: Flag for integration tests which may comprise of multiple unit tests.
30-
end_to_end: Flag for tests that cover the whole program.
31-
norecursedirs =
32-
.idea
33-
.tox
13+
[testenv:test]
14+
extras = test
15+
commands = pytest {posargs}

0 commit comments

Comments
 (0)