diff --git a/.gitignore b/.gitignore index 2351a89..64a4c57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -.lazy.lua -/target +target/ # Byte-compiled / optimized / DLL files __pycache__/ @@ -13,20 +12,6 @@ __pycache__/ .venv/ dist/ -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.cache -nosetests.xml -coverage.xml - -.DS_Store - -# Sphinx documentation -/docs/_build/ -/docs/generated/ - # PyCharm .idea/ diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 0d0620c..10baa42 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -3,11 +3,9 @@ version: 2 build: os: ubuntu-24.04 - tools: - python: "3.12" commands: - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain none --profile minimal - asdf plugin add uv - asdf install uv latest - asdf global uv latest - - . "$HOME/.cargo/env" && uv run --no-dev --group docs --frozen -v make BUILDDIR="$READTHEDOCS_OUTPUT" O="-T" -C docs html + - . "$HOME/.cargo/env" && uv run --no-dev --group docs --frozen -v make BUILDDIR="$READTHEDOCS_OUTPUT" O="-T" -C python/docs html diff --git a/README.md b/README.md index a418c04..d157f9a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Docs are hosted on [Read the Docs](http://bosing.readthedocs.io/) ## Usage -Examples can be found in `examples`. +Examples can be found in `python/examples`. ```python import matplotlib.pyplot as plt @@ -46,7 +46,7 @@ plt.show() ## Performance -`examples/schedule_stress.py` (0.15 s) vs `benches/naive.py` (1.4 s) +`python/examples/schedule_stress.py` (0.15 s) vs `python/benches/naive.py` (1.4 s) CPU: AMD Ryzen 5 5600 diff --git a/pyproject.toml b/pyproject.toml index db72ebf..0e9ca3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ Issues = "https://github.com/kahojyun/Bosing/issues" Source = "https://github.com/kahojyun/Bosing" [tool.maturin] -python-source = "python" +python-source = "python/src" module-name = "bosing._bosing" manifest-path = "bosing-py/Cargo.toml" features = ["pyo3/extension-module"] @@ -69,39 +69,18 @@ test = "task test_py && task test_rs" test_py = "pytest" test_rs = "cargo test --workspace" stubtest = "stubtest bosing --allowlist stubtest-allowlist.txt" -makedocs = "sphinx-build -M html docs docs/_build" -cleandocs = "sphinx-build -M clean docs docs/_build && rm -r docs/generated" +makedocs = "sphinx-build -M html python/docs python/docs/_build" +cleandocs = "sphinx-build -M clean python/docs python/docs/_build && rm -r python/docs/generated" -[tool.ruff.lint] -select = ["ALL"] -ignore = [ - # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules - "COM812", # Missing trailing comma - "ISC001", # implicit string concatenation -] -[tool.ruff.lint.per-file-ignores] -"{examples,benches}/*.py" = [ - "T201", # Use of print -] -"tests/*.py" = [ - "S101", # Use of assert -] -"!python/*.py" = [ - "I002", # Missing required imports - "D", # Dosctring - "INP001", # Implicit namespace package -] -[tool.ruff.lint.pydocstyle] -convention = "google" -[tool.ruff.lint.isort] -known-first-party = ["bosing"] -required-imports = ["from __future__ import annotations"] +[tool.pytest.ini_options] +testpaths = ["python/tests"] +addopts = "--import-mode=importlib" [tool.basedpyright] -include = ["examples", "tests", "docs", "benches", "python"] -exclude = ["**/node_modules", "**/__pycache__", "docs/_build"] +include = ["python"] +exclude = ["**/node_modules", "**/__pycache__", "**/docs/_build"] [[tool.basedpyright.executionEnvironments]] -root = "examples" +root = "python/examples" reportAny = "none" reportMissingTypeStubs = "none" reportUnknownArgumentType = "none" diff --git a/benches/naive.py b/python/benches/naive.py similarity index 100% rename from benches/naive.py rename to python/benches/naive.py diff --git a/python/docs/.gitignore b/python/docs/.gitignore new file mode 100644 index 0000000..b802843 --- /dev/null +++ b/python/docs/.gitignore @@ -0,0 +1,2 @@ +_build/ +generated/ diff --git a/docs/Makefile b/python/docs/Makefile similarity index 100% rename from docs/Makefile rename to python/docs/Makefile diff --git a/docs/_templates/autosummary/class.rst b/python/docs/_templates/autosummary/class.rst similarity index 100% rename from docs/_templates/autosummary/class.rst rename to python/docs/_templates/autosummary/class.rst diff --git a/docs/_templates/autosummary/module.rst b/python/docs/_templates/autosummary/module.rst similarity index 100% rename from docs/_templates/autosummary/module.rst rename to python/docs/_templates/autosummary/module.rst diff --git a/docs/api.rst b/python/docs/api.rst similarity index 100% rename from docs/api.rst rename to python/docs/api.rst diff --git a/docs/conf.py b/python/docs/conf.py similarity index 100% rename from docs/conf.py rename to python/docs/conf.py diff --git a/docs/index.rst b/python/docs/index.rst similarity index 100% rename from docs/index.rst rename to python/docs/index.rst diff --git a/docs/instruction.rst b/python/docs/instruction.rst similarity index 100% rename from docs/instruction.rst rename to python/docs/instruction.rst diff --git a/docs/make.bat b/python/docs/make.bat similarity index 100% rename from docs/make.bat rename to python/docs/make.bat diff --git a/docs/quickstart.rst b/python/docs/quickstart.rst similarity index 100% rename from docs/quickstart.rst rename to python/docs/quickstart.rst diff --git a/docs/schedule.rst b/python/docs/schedule.rst similarity index 100% rename from docs/schedule.rst rename to python/docs/schedule.rst diff --git a/examples/flexible.py b/python/examples/flexible.py similarity index 100% rename from examples/flexible.py rename to python/examples/flexible.py diff --git a/examples/flexible_length.py b/python/examples/flexible_length.py similarity index 100% rename from examples/flexible_length.py rename to python/examples/flexible_length.py diff --git a/examples/hann.py b/python/examples/hann.py similarity index 100% rename from examples/hann.py rename to python/examples/hann.py diff --git a/examples/interp.py b/python/examples/interp.py similarity index 100% rename from examples/interp.py rename to python/examples/interp.py diff --git a/examples/overlap.py b/python/examples/overlap.py similarity index 100% rename from examples/overlap.py rename to python/examples/overlap.py diff --git a/examples/plot.py b/python/examples/plot.py similarity index 100% rename from examples/plot.py rename to python/examples/plot.py diff --git a/examples/schedule.py b/python/examples/schedule.py similarity index 100% rename from examples/schedule.py rename to python/examples/schedule.py diff --git a/examples/schedule_stress.py b/python/examples/schedule_stress.py similarity index 100% rename from examples/schedule_stress.py rename to python/examples/schedule_stress.py diff --git a/python/ruff.toml b/python/ruff.toml new file mode 100644 index 0000000..540b75c --- /dev/null +++ b/python/ruff.toml @@ -0,0 +1,24 @@ +[lint] +select = ["ALL"] +ignore = [ + # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules + "COM812", # Missing trailing comma + "ISC001", # implicit string concatenation +] +[lint.per-file-ignores] +"{examples,benches}/**/*.py" = [ + "T201", # Use of print +] +"tests/**/*.py" = [ + "S101", # Use of assert +] +"!src/**/*.py" = [ + "I002", # Missing required imports + "D", # Dosctring + "INP001", # Implicit namespace package +] +[lint.pydocstyle] +convention = "google" +[lint.isort] +known-first-party = ["bosing"] +required-imports = ["from __future__ import annotations"] diff --git a/python/bosing/__init__.py b/python/src/bosing/__init__.py similarity index 100% rename from python/bosing/__init__.py rename to python/src/bosing/__init__.py diff --git a/python/bosing/_bosing.pyi b/python/src/bosing/_bosing.pyi similarity index 100% rename from python/bosing/_bosing.pyi rename to python/src/bosing/_bosing.pyi diff --git a/python/bosing/_plot.py b/python/src/bosing/_plot.py similarity index 100% rename from python/bosing/_plot.py rename to python/src/bosing/_plot.py diff --git a/python/bosing/py.typed b/python/src/bosing/py.typed similarity index 100% rename from python/bosing/py.typed rename to python/src/bosing/py.typed diff --git a/tests/__init__.py b/python/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to python/tests/__init__.py diff --git a/tests/test_basic.py b/python/tests/test_basic.py similarity index 100% rename from tests/test_basic.py rename to python/tests/test_basic.py diff --git a/tests/test_plot.py b/python/tests/test_plot.py similarity index 100% rename from tests/test_plot.py rename to python/tests/test_plot.py