Skip to content

Commit 40e1c4b

Browse files
authored
Merge pull request #8 from Deric-W/hatch
change build system to Hatch
2 parents a230924 + 684b036 commit 40e1c4b

File tree

20 files changed

+86
-26
lines changed

20 files changed

+86
-26
lines changed

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 100
3+
extend-ignore = E221,E501

.github/workflows/Tests.yaml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,42 @@ on: [push, workflow_dispatch]
44

55
jobs:
66
Test:
7-
strategy:
8-
matrix:
9-
python-version: ["3.10", "3.11", "3.12"]
10-
os: [ubuntu-latest]
11-
12-
runs-on: ${{ matrix.os }}
7+
runs-on: ubuntu-latest
138

149
steps:
1510
- name: Checkout Repository
1611
uses: actions/checkout@v4
1712

18-
- name: Set up Python ${{ matrix.python-version }}
13+
- name: Set up Python
1914
uses: actions/setup-python@v5
2015
with:
21-
python-version: ${{ matrix.python-version }}
22-
23-
- name: Install test dependencies
24-
run: python -m pip install mypy coverage build
25-
26-
- name: Build wheel
27-
run: python -m build
16+
python-version: |
17+
3.10
18+
3.11
19+
3.12
2820
29-
- name: Install wheel
30-
run: python -m pip install --no-cache-dir dist/lambda_calculus-*.whl
21+
- name: Install Hatch
22+
run: python -m pip install hatch
23+
24+
- name: Perform release check
25+
run: hatch run lint:release
3126

32-
- name: Run MyPy
33-
run: python -m mypy -p lambda_calculus
27+
- name: Run tests
28+
run: hatch run test:cov --verbose
3429

35-
- name: Run tests and generate report
36-
run: coverage run -m unittest discover --verbose
30+
- name: Generate report
31+
run: hatch env run -e test.py3.12 coverage xml
3732

3833
- name: Upload coverage
3934
uses: codecov/codecov-action@v3
4035
with:
4136
flags: ${{ runner.os }}
4237
verbose: true
4338

39+
- name: Build wheel
40+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
41+
run: hatch build
42+
4443
- name: Publish package
4544
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
4645
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ celerybeat.pid
122122
# Environments
123123
.env
124124
.venv
125+
.direnv
125126
env/
126127
venv/
127128
ENV/

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# lambda_calculus
22

3+
[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
34
![Tests](https://github.com/Deric-W/lambda_calculus/actions/workflows/Tests.yaml/badge.svg)
45
[![codecov](https://codecov.io/gh/Deric-W/lambda_calculus/branch/main/graph/badge.svg?token=SU3982mC17)](https://codecov.io/gh/Deric-W/lambda_calculus)
56
[![Documentation Status](https://readthedocs.org/projects/lambda-calculus/badge/?version=stable)](https://lambda-calculus.readthedocs.io/en/stable/?badge=stable)

pyproject.toml

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,59 @@ Documentation = "http://lambda-calculus.readthedocs.io/"
2828
Bugtracker = "https://github.com/Deric-W/lambda_calculus/issues"
2929

3030
[build-system]
31-
requires = ["setuptools >= 61.0.0"]
32-
build-backend = "setuptools.build_meta"
31+
requires = ["hatchling"]
32+
build-backend = "hatchling.build"
3333

34-
[tool.setuptools.package-data]
35-
lambda_calculus = ["py.typed"]
34+
[tool.hatch.envs.test]
35+
dependencies = [
36+
"coverage[toml] == 7.*"
37+
]
38+
39+
[tool.hatch.envs.test.scripts]
40+
test = "python -m unittest discover {args}"
41+
cov-run = "coverage run -m unittest discover {args}"
42+
cov-report = [
43+
"- coverage combine",
44+
"coverage report"
45+
]
46+
cov = [
47+
"cov-run",
48+
"cov-report"
49+
]
50+
51+
[[tool.hatch.envs.test.matrix]]
52+
python = ["3.10", "3.11", "3.12"]
53+
54+
[tool.hatch.envs.lint]
55+
dependencies = [
56+
"mypy >= 1.0.0",
57+
"pylint >= 2.12.2",
58+
"flake8 >= 5.0.0",
59+
"isort >= 5.10.1"
60+
]
61+
62+
[tool.hatch.envs.lint.scripts]
63+
lint = [
64+
"- flake8 src/lambda_calculus",
65+
"- pylint src/lambda_calculus"
66+
]
67+
typecheck = "mypy -p lambda_calculus"
68+
release = [
69+
"typecheck"
70+
]
71+
72+
[tool.hatch.envs.docs]
73+
dependencies = [
74+
"sphinx ~= 5.2.0",
75+
"sphinx-pyproject ~= 0.1.0",
76+
"sphinx-rtd-theme ~= 1.0.0"
77+
]
78+
79+
[tool.hatch.envs.docs.scripts]
80+
build = "sphinx-build {args} docs docs/_build"
81+
82+
[tool.hatch.build.targets.sdist]
83+
exclude = ["/.github"]
3684

3785
[tool.mypy]
3886
disallow_any_unimported = true
@@ -45,6 +93,14 @@ warn_unused_ignores = true
4593
warn_return_any = true
4694
warn_unreachable = true
4795

96+
[tool.pylint]
97+
max-line-length = 100
98+
99+
[tool.coverage.run]
100+
source_pkgs = ["lambda_calculus"]
101+
branch = true
102+
parallel = true
103+
48104
[tool.sphinx-pyproject]
49105
project = "lambda_calculus"
50106
copyright = "2022 Eric Wolf"

0 commit comments

Comments
 (0)