Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions MANIFEST.in

This file was deleted.

28 changes: 15 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
test: lint pytest documentation examples
test: lint documentation examples pytest


pytest: clean
pytest --cov
pytest -v --cov


documentation: sphinx
Expand Down Expand Up @@ -32,7 +32,7 @@ ruff:

mypy:
-@ pip install -q -U mypy
mypy --ignore-missing-imports . --exclude dist
mypy --install-types --exclude dist .


clean:
Expand All @@ -47,20 +47,22 @@ clean:
rm -rf .tox


release_check: clean documentation
tox
checks: clean documentation
-@ pip install -qU hatch
hatch run --force-continue test:checks
@echo version `python -m tatsu --version`


build: clean
pip install -U build
python -m build
build: cleanhatch
-@ pip install -qU hatch
hatch build


test_upload: build
pip install -U twine
twine upload --repository test dist/*
test_publish: build
-@ pip install -qU hatch
hatch publish --repo test


upload: release_check build
twine upload dist/*
publish: checks build
pip install -U hatch
hatch publish
2 changes: 1 addition & 1 deletion tox.ini → deprecated/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ whitelist_externals =

commands =
ruff check --preview tatsu test examples
mypy --ignore-missing-imports --exclude "parsers|docs|tmp|build|dist" .
mypy --ignore-missing-imports --exclude "parsers|docs|tmp|build|dist" .
pytest

deps =
Expand Down
86 changes: 73 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools>=46.4", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "TatSu"
Expand All @@ -12,7 +12,7 @@ description = "TatSu takes a grammar in a variation of EBNF as input, and output
readme = "README.rst"
requires-python = ">=3.10"
keywords = []
license = {file = "LICENSE.TXT"}
license = {file = "LICENSE.txt"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: BSD License",
Expand Down Expand Up @@ -47,24 +47,84 @@ Repository = "https://github.com/neogeny/TatSu"
Documentation = "https://tatsu.readthedocs.io/en/stable/"
Questions = "https://stackoverflow.com/questions/tagged/tatsu"

[tool.setuptools]
include-package-data = false
[tool.hatch.version]
path = "tatsu/_version.py"

[tool.setuptools.dynamic]
version = {attr = "tatsu._version.__version__"}
[tool.hatch.build.targets.wheel]
packages = ["tatsu"]

[tool.setuptools.packages.find]
include = ["tatsu*"]
[tool.hatch.build.targets.sdist]
include = [
"/tatsu",
"/test",
"/grammar",
"/examples",
"*.yaml",
]
excludee = ["deprecated"]

[tool.hatch.envs.hatch-test]
default-args = ["test"]
dependencies = [
"pytest",
"pytest-cov",
"pytest-xdist", # For parallel execution
]

# Set default arguments for the pytest command
extra-args = ["-v", "--cov"]

[tool.blue]
target-version = ["py310"]
line-length=79
skip-magic-trailing-comma=true
# Enable built-in features
randomize = false # Randomize test order
parallel = false # Run tests in parallel
retries = 0

[tool.pytest.ini_options]
# minversion = "6.0"
#addopts = "-ra -q"
addopts = "-q"
testpaths = [
"test",
]
[tool.mypy]
python_version = 3.14
#ignore_missing_imports = true
exclude = "parsers|docs|dist|build|tmp"

[tool.ruff]
line-length = 88

# The minimum Python version to support
# target-version = "py311"

# Files or directories to exclude from linting/formatting
exclude = [
".git",
"__pycache__",
"dist",
]

[tool.coverage.run]
omit = [
"test/*",
"tatsu/diagrams.py",
]
data_file = ".cache/coverage/.coverage"
parallel = false

[tool.hatch.envs.test]
dependencies = ["pytest", "mypy", "ruff"]

[tool.hatch.envs.test.scripts]
lint = "ruff check -q --preview tatsu test examples"
types = "mypy --install-types --exclude 'parsers|docs|tmp|build|dist' ."
tests = "pytest"

checks = [
"lint",
"types",
"tests"
]

[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r requirements-test.txt
auto-changelog
git-pylint-commit-hook
hatch
ipython
pip
psutil
twine
auto-changelog
3 changes: 1 addition & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ docutils
mypy
pytest
pytest-cov
pytest-flake8
pytest-mypy
pytest-xdist
rich
rst2html5
ruff
setuptools
sphinx
sphinx-rtd-theme
tox
3 changes: 1 addition & 2 deletions test/grammar/parameter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,12 @@ def rule_all(self, ast, p1, k1):
self.assertEqual(['a', 'b', 'c'], ast)

code = codegen(m)
import codecs
module_name = 'tc36unicharstest'
temp_dir = pathlib.Path(tempfile.mkdtemp()) / module_name
temp_dir.mkdir(exist_ok=True)
py_file_path = temp_dir / f'{module_name}.py'

with codecs.open(py_file_path, 'w', 'utf-8') as f:
with pathlib.Path(py_file_path).open('w') as f:
f.write(code)
try:
sys.path.append(str(temp_dir))
Expand Down
2 changes: 1 addition & 1 deletion test/grammar/syntax_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,5 +418,5 @@ def test_deprecated_comments_override_failures(comment, option):
{comment}
a
"""
with pytest.raises(AttributeError, match=""):
with pytest.raises(AttributeError):
tool.parse(grammar, text, **option)