From 0816ac65db7c4383a8a76511bba5f9e1190901d5 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Thu, 16 Feb 2023 07:39:51 +0100 Subject: [PATCH] Improvements in packaging. The ziffers.lark file is not included in the installed package. This was preventing users from importing the ziffers package from elsewhere. --- MANIFEST.in | 3 +++ pyproject.toml | 19 +++++++++++++++++-- ziffers/__init__.py | 1 + ziffers/parser.py | 5 +++-- ziffers/spec/__init__.py | 0 ziffers/{ => spec}/ziffers.lark | 0 6 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 MANIFEST.in create mode 100644 ziffers/spec/__init__.py rename ziffers/{ => spec}/ziffers.lark (100%) diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..c59580f --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include ziffers/* +include ziffers/spec/* +global-include *.lark diff --git a/pyproject.toml b/pyproject.toml index bd57430..f70b3f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,21 @@ documentation = "https://github.com/Bubobubobubobubo/ziffers-python" repository = "https://github.com/Bubobubobubobubo/ziffers-python" [tool.black] -line-length = 88 -target_version = ['py310'] +target_version = ['py311'] include = '\.pyi?$' +exclude = ''' +( + /( + \.eggs # exclude a few common directories in the + | \.git # root of the project + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + )/ +) +''' diff --git a/ziffers/__init__.py b/ziffers/__init__.py index 36bf3c6..b8243f4 100644 --- a/ziffers/__init__.py +++ b/ziffers/__init__.py @@ -5,3 +5,4 @@ from .common import * from .defaults import * from .scale import * from .converters import * +from .spec import * diff --git a/ziffers/parser.py b/ziffers/parser.py index 1b83122..d185d13 100644 --- a/ziffers/parser.py +++ b/ziffers/parser.py @@ -6,10 +6,11 @@ from .mapper import ZiffersTransformer grammar_path = Path(__file__).parent -grammar = grammar_path / "ziffers.lark" +grammar_folder = Path.joinpath(grammar_path, "spec") +grammar_file = Path.joinpath(grammar_folder, "ziffers.lark") ziffers_parser = Lark.open( - grammar, + str(grammar_file), rel_to=__file__, start="root", parser="lalr", diff --git a/ziffers/spec/__init__.py b/ziffers/spec/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ziffers/ziffers.lark b/ziffers/spec/ziffers.lark similarity index 100% rename from ziffers/ziffers.lark rename to ziffers/spec/ziffers.lark