Skip to content

Commit

Permalink
Merge pull request #8 from Deric-W/hatch
Browse files Browse the repository at this point in the history
change build system to Hatch
  • Loading branch information
Deric-W authored Dec 15, 2023
2 parents a230924 + 684b036 commit 40e1c4b
Show file tree
Hide file tree
Showing 20 changed files with 86 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 100
extend-ignore = E221,E501
39 changes: 19 additions & 20 deletions .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,42 @@ on: [push, workflow_dispatch]

jobs:
Test:
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install test dependencies
run: python -m pip install mypy coverage build

- name: Build wheel
run: python -m build
python-version: |
3.10
3.11
3.12
- name: Install wheel
run: python -m pip install --no-cache-dir dist/lambda_calculus-*.whl
- name: Install Hatch
run: python -m pip install hatch

- name: Perform release check
run: hatch run lint:release

- name: Run MyPy
run: python -m mypy -p lambda_calculus
- name: Run tests
run: hatch run test:cov --verbose

- name: Run tests and generate report
run: coverage run -m unittest discover --verbose
- name: Generate report
run: hatch env run -e test.py3.12 coverage xml

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
flags: ${{ runner.os }}
verbose: true

- name: Build wheel
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: hatch build

- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ celerybeat.pid
# Environments
.env
.venv
.direnv
env/
venv/
ENV/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# lambda_calculus

[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
![Tests](https://github.com/Deric-W/lambda_calculus/actions/workflows/Tests.yaml/badge.svg)
[![codecov](https://codecov.io/gh/Deric-W/lambda_calculus/branch/main/graph/badge.svg?token=SU3982mC17)](https://codecov.io/gh/Deric-W/lambda_calculus)
[![Documentation Status](https://readthedocs.org/projects/lambda-calculus/badge/?version=stable)](https://lambda-calculus.readthedocs.io/en/stable/?badge=stable)
Expand Down
64 changes: 60 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,59 @@ Documentation = "http://lambda-calculus.readthedocs.io/"
Bugtracker = "https://github.com/Deric-W/lambda_calculus/issues"

[build-system]
requires = ["setuptools >= 61.0.0"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.setuptools.package-data]
lambda_calculus = ["py.typed"]
[tool.hatch.envs.test]
dependencies = [
"coverage[toml] == 7.*"
]

[tool.hatch.envs.test.scripts]
test = "python -m unittest discover {args}"
cov-run = "coverage run -m unittest discover {args}"
cov-report = [
"- coverage combine",
"coverage report"
]
cov = [
"cov-run",
"cov-report"
]

[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12"]

[tool.hatch.envs.lint]
dependencies = [
"mypy >= 1.0.0",
"pylint >= 2.12.2",
"flake8 >= 5.0.0",
"isort >= 5.10.1"
]

[tool.hatch.envs.lint.scripts]
lint = [
"- flake8 src/lambda_calculus",
"- pylint src/lambda_calculus"
]
typecheck = "mypy -p lambda_calculus"
release = [
"typecheck"
]

[tool.hatch.envs.docs]
dependencies = [
"sphinx ~= 5.2.0",
"sphinx-pyproject ~= 0.1.0",
"sphinx-rtd-theme ~= 1.0.0"
]

[tool.hatch.envs.docs.scripts]
build = "sphinx-build {args} docs docs/_build"

[tool.hatch.build.targets.sdist]
exclude = ["/.github"]

[tool.mypy]
disallow_any_unimported = true
Expand All @@ -45,6 +93,14 @@ warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true

[tool.pylint]
max-line-length = 100

[tool.coverage.run]
source_pkgs = ["lambda_calculus"]
branch = true
parallel = true

[tool.sphinx-pyproject]
project = "lambda_calculus"
copyright = "2022 Eric Wolf"
Expand Down
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.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BetaNormalisingVisitor(Visitor[Iterator[Step], str]):
def skip_intermediate(self, term: terms.Term[str]) -> terms.Term[str]:
"""
Calculate the beta normal form directly.
:param term: term which should be transformed into ist beta normal form
:return: new term representing the beta normal form if it exists
"""
Expand Down Expand Up @@ -77,7 +77,7 @@ def visit_abstraction(self, abstraction: terms.Abstraction[str]) -> Iterator[Ste
def beta_reducation(self, abstraction: terms.Abstraction[str], argument: terms.Term[str]) -> Generator[Step, None, terms.Term[str]]:
"""
Perform beta reduction of an application.
:param abstraction: abstraction of the application
:param argument: argument of the application
:return: Generator yielding steps and returning the reduced term
Expand Down
File renamed without changes.

0 comments on commit 40e1c4b

Please sign in to comment.