From 414f3a49f9533cd705090f3becc64e0064eddde2 Mon Sep 17 00:00:00 2001 From: mdevolde Date: Sat, 20 Jun 2026 19:30:33 +0200 Subject: [PATCH] refactor: from flat layout to src layout --- .pre-commit-config.yaml | 1 - Makefile | 1 - make.bat | 3 --- pyproject.toml | 9 +++------ pytest.ini | 4 ++-- .../language_tool_python}/__init__.py | 0 .../language_tool_python}/__main__.py | 0 .../language_tool_python}/_internals/__init__.py | 0 .../language_tool_python}/_internals/api_types.py | 0 .../language_tool_python}/_internals/compat.py | 0 .../language_tool_python}/_internals/safe_zip.py | 0 .../language_tool_python}/_internals/utils.py | 0 .../language_tool_python}/_ressources/integrity.toml | 0 .../language_tool_python}/_ressources/logging.toml | 0 .../language_tool_python}/config_file.py | 0 .../language_tool_python}/download_lt.py | 0 .../language_tool_python}/exceptions.py | 0 .../language_tool_python}/language_tag.py | 0 .../language_tool_python}/match.py | 0 .../language_tool_python}/py.typed | 0 .../language_tool_python}/server.py | 0 .../language_tool_python}/utils.py | 0 22 files changed, 5 insertions(+), 13 deletions(-) rename {language_tool_python => src/language_tool_python}/__init__.py (100%) rename {language_tool_python => src/language_tool_python}/__main__.py (100%) rename {language_tool_python => src/language_tool_python}/_internals/__init__.py (100%) rename {language_tool_python => src/language_tool_python}/_internals/api_types.py (100%) rename {language_tool_python => src/language_tool_python}/_internals/compat.py (100%) rename {language_tool_python => src/language_tool_python}/_internals/safe_zip.py (100%) rename {language_tool_python => src/language_tool_python}/_internals/utils.py (100%) rename {language_tool_python => src/language_tool_python}/_ressources/integrity.toml (100%) rename {language_tool_python => src/language_tool_python}/_ressources/logging.toml (100%) rename {language_tool_python => src/language_tool_python}/config_file.py (100%) rename {language_tool_python => src/language_tool_python}/download_lt.py (100%) mode change 100755 => 100644 rename {language_tool_python => src/language_tool_python}/exceptions.py (100%) rename {language_tool_python => src/language_tool_python}/language_tag.py (100%) rename {language_tool_python => src/language_tool_python}/match.py (100%) rename {language_tool_python => src/language_tool_python}/py.typed (100%) rename {language_tool_python => src/language_tool_python}/server.py (100%) rename {language_tool_python => src/language_tool_python}/utils.py (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4f3464f..b40a5f7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,6 @@ repos: hooks: - id: mypy args: [--config-file=pyproject.toml] - files: ^(language_tool_python|tests)/ # Standard pre-commit hooks - repo: https://github.com/pre-commit/pre-commit-hooks diff --git a/Makefile b/Makefile index e749ff0..4f99b2b 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,6 @@ test: uvx --with defusedxml genbadge coverage --input-file coverage.xml --silent doc: - uv run --group docs --locked sphinx-apidoc -o docs/source/references language_tool_python uv run --group docs --locked sphinx-build -M html docs/source docs/build publish: diff --git a/make.bat b/make.bat index 356e3cc..74daffa 100644 --- a/make.bat +++ b/make.bat @@ -57,9 +57,6 @@ uvx --with defusedxml genbadge coverage --input-file coverage.xml --silent exit /b %errorlevel% :doc -call uv run --group docs --locked sphinx-apidoc -o docs\source\references language_tool_python -if errorlevel 1 exit /b %errorlevel% - call uv run --group docs --locked sphinx-build -M html docs/source docs/build exit /b %errorlevel% diff --git a/pyproject.toml b/pyproject.toml index 08f59d4..8e973b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,12 +72,9 @@ language_tool_python = "language_tool_python.__main__:main" requires = ["uv_build>=0.11.14,<0.12"] build-backend = "uv_build" -[tool.uv.build-backend] -module-root = "" # uv expects the code to be in a "src/" directory by default, but our code is in the the current dir - [tool.ruff] line-length = 88 -include = ["language_tool_python/*.py", "tests/*.py"] +include = ["src/**/*.py", "tests/**/*.py"] [tool.ruff.lint] select = [ @@ -144,10 +141,10 @@ ignore = [ "S101", # Need to use assert statements in tests "SLF001" # Need to use private members of the library for testing ] -"language_tool_python/__main__.py" = ["T201"] # Allow usage of print in the CLI entry point +"src/language_tool_python/__main__.py" = ["T201"] # Allow usage of print in the CLI entry point [tool.mypy] -files = ["language_tool_python", "tests"] +files = ["src", "tests"] disallow_any_decorated = true disallow_any_explicit = true disallow_any_expr = true diff --git a/pytest.ini b/pytest.ini index e1d0405..8170a2f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] -addopts = -vra --cov=language_tool_python --cov-report=html --cov-report=xml +addopts = -vra --cov=src --cov-report=html --cov-report=xml testpaths = tests [coverage:run] -source = language_tool_python +source = src diff --git a/language_tool_python/__init__.py b/src/language_tool_python/__init__.py similarity index 100% rename from language_tool_python/__init__.py rename to src/language_tool_python/__init__.py diff --git a/language_tool_python/__main__.py b/src/language_tool_python/__main__.py similarity index 100% rename from language_tool_python/__main__.py rename to src/language_tool_python/__main__.py diff --git a/language_tool_python/_internals/__init__.py b/src/language_tool_python/_internals/__init__.py similarity index 100% rename from language_tool_python/_internals/__init__.py rename to src/language_tool_python/_internals/__init__.py diff --git a/language_tool_python/_internals/api_types.py b/src/language_tool_python/_internals/api_types.py similarity index 100% rename from language_tool_python/_internals/api_types.py rename to src/language_tool_python/_internals/api_types.py diff --git a/language_tool_python/_internals/compat.py b/src/language_tool_python/_internals/compat.py similarity index 100% rename from language_tool_python/_internals/compat.py rename to src/language_tool_python/_internals/compat.py diff --git a/language_tool_python/_internals/safe_zip.py b/src/language_tool_python/_internals/safe_zip.py similarity index 100% rename from language_tool_python/_internals/safe_zip.py rename to src/language_tool_python/_internals/safe_zip.py diff --git a/language_tool_python/_internals/utils.py b/src/language_tool_python/_internals/utils.py similarity index 100% rename from language_tool_python/_internals/utils.py rename to src/language_tool_python/_internals/utils.py diff --git a/language_tool_python/_ressources/integrity.toml b/src/language_tool_python/_ressources/integrity.toml similarity index 100% rename from language_tool_python/_ressources/integrity.toml rename to src/language_tool_python/_ressources/integrity.toml diff --git a/language_tool_python/_ressources/logging.toml b/src/language_tool_python/_ressources/logging.toml similarity index 100% rename from language_tool_python/_ressources/logging.toml rename to src/language_tool_python/_ressources/logging.toml diff --git a/language_tool_python/config_file.py b/src/language_tool_python/config_file.py similarity index 100% rename from language_tool_python/config_file.py rename to src/language_tool_python/config_file.py diff --git a/language_tool_python/download_lt.py b/src/language_tool_python/download_lt.py old mode 100755 new mode 100644 similarity index 100% rename from language_tool_python/download_lt.py rename to src/language_tool_python/download_lt.py diff --git a/language_tool_python/exceptions.py b/src/language_tool_python/exceptions.py similarity index 100% rename from language_tool_python/exceptions.py rename to src/language_tool_python/exceptions.py diff --git a/language_tool_python/language_tag.py b/src/language_tool_python/language_tag.py similarity index 100% rename from language_tool_python/language_tag.py rename to src/language_tool_python/language_tag.py diff --git a/language_tool_python/match.py b/src/language_tool_python/match.py similarity index 100% rename from language_tool_python/match.py rename to src/language_tool_python/match.py diff --git a/language_tool_python/py.typed b/src/language_tool_python/py.typed similarity index 100% rename from language_tool_python/py.typed rename to src/language_tool_python/py.typed diff --git a/language_tool_python/server.py b/src/language_tool_python/server.py similarity index 100% rename from language_tool_python/server.py rename to src/language_tool_python/server.py diff --git a/language_tool_python/utils.py b/src/language_tool_python/utils.py similarity index 100% rename from language_tool_python/utils.py rename to src/language_tool_python/utils.py