Skip to content

Commit 2655786

Browse files
committed
change build system to hatch
1 parent 5657586 commit 2655786

File tree

10 files changed

+63
-27
lines changed

10 files changed

+63
-27
lines changed

.github/workflows/Tests.yaml

+19-20
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,31 @@ 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_repl-*.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_repl
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@v4
@@ -43,6 +38,10 @@ jobs:
4338
env:
4439
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4540

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

.gitignore

+1
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/

pyproject.toml

+43-7
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,46 @@ Bugtracker = "https://github.com/Deric-W/lambda_repl/issues"
3434
lambda-repl = "lambda_repl.main:main_cli"
3535

3636
[build-system]
37-
requires = ["setuptools >= 61.0.0"]
38-
build-backend = "setuptools.build_meta"
37+
requires = ["hatchling"]
38+
build-backend = "hatchling.build"
3939

40-
[tool.setuptools.package-data]
41-
lambda_repl = [
42-
"py.typed",
43-
"grammar.lark"
40+
[tool.hatch.envs.test]
41+
dependencies = [
42+
"coverage[toml] == 7.*"
43+
]
44+
45+
[tool.hatch.envs.test.scripts]
46+
test = "python -m unittest discover {args}"
47+
cov-run = "coverage run -m unittest discover {args}"
48+
cov-report = [
49+
"- coverage combine",
50+
"coverage report"
51+
]
52+
cov = [
53+
"cov-run",
54+
"cov-report"
55+
]
56+
57+
[[tool.hatch.envs.test.matrix]]
58+
python = ["3.10", "3.11", "3.12"]
59+
60+
[tool.hatch.envs.lint]
61+
dependencies = [
62+
"mypy >= 1.0.0",
63+
"pylint >= 2.12.2",
64+
"flake8 >= 5.0.0",
65+
"isort >= 5.10.1"
66+
]
67+
68+
[tool.hatch.envs.lint.scripts]
69+
typecheck = "mypy -p lambda_repl"
70+
release = [
71+
"typecheck"
4472
]
4573

74+
[tool.hatch.build.targets.sdist]
75+
exclude = ["/.github"]
76+
4677
[tool.mypy]
4778
disallow_any_unimported = true
4879
disallow_any_generics = true
@@ -52,4 +83,9 @@ strict_optional = true
5283
warn_redundant_casts = true
5384
warn_unused_ignores = true
5485
warn_return_any = true
55-
warn_unreachable = true
86+
warn_unreachable = true
87+
88+
[tool.coverage.run]
89+
source_pkgs = ["lambda_repl"]
90+
branch = true
91+
parallel = true
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)