From 6dd6636410f9b1d846d3b5577b384b575f302e93 Mon Sep 17 00:00:00 2001 From: "jakub.szulc" Date: Sun, 7 Sep 2025 10:58:05 +0200 Subject: [PATCH 1/7] Setup dev tooling: Hatch/uv, pre-commit, ruff/black/mypy, README updates --- .gitignore | 4 +- .pre-commit-config.yaml | 28 +++++ README.md | 2 +- alphapulse/LICENSE.txt | 9 ++ alphapulse/README.md | 47 ++++++++ alphapulse/pyproject.toml | 149 +++++++++++++++++++++++++ alphapulse/src/alphapulse/__about__.py | 4 + alphapulse/src/alphapulse/__init__.py | 3 + alphapulse/tests/__init__.py | 3 + 9 files changed, 246 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 alphapulse/LICENSE.txt create mode 100644 alphapulse/README.md create mode 100644 alphapulse/pyproject.toml create mode 100644 alphapulse/src/alphapulse/__about__.py create mode 100644 alphapulse/src/alphapulse/__init__.py create mode 100644 alphapulse/tests/__init__.py diff --git a/.gitignore b/.gitignore index b7faf40..09be0ef 100644 --- a/.gitignore +++ b/.gitignore @@ -182,9 +182,9 @@ cython_debug/ .abstra/ # Visual Studio Code -# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore +# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore -# and can be added to the global gitignore or merged into this file. However, if you prefer, +# and can be added to the global gitignore or merged into this file. However, if you prefer, # you could uncomment the following to ignore the entire vscode folder # .vscode/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..9c83a72 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.12.12 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format + + - repo: https://github.com/psf/black + rev: 25.1.0 + hooks: + - id: black + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.17.1 + hooks: + - id: mypy + additional_dependencies: + - types-requests + - types-PyYAML + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-yaml + - id: check-toml + - id: end-of-file-fixer + - id: trailing-whitespace diff --git a/README.md b/README.md index 5c96fb6..b24fcd7 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# AlphaPulse \ No newline at end of file +# AlphaPulse diff --git a/alphapulse/LICENSE.txt b/alphapulse/LICENSE.txt new file mode 100644 index 0000000..c1e3f16 --- /dev/null +++ b/alphapulse/LICENSE.txt @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2025-present jakub.szulc + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/alphapulse/README.md b/alphapulse/README.md new file mode 100644 index 0000000..eea9688 --- /dev/null +++ b/alphapulse/README.md @@ -0,0 +1,47 @@ +# AlphaPulse + +[![PyPI - Version](https://img.shields.io/pypi/v/alphapulse.svg)](https://pypi.org/project/alphapulse) +[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/alphapulse.svg)](https://pypi.org/project/alphapulse) + +----- + +## Table of Contents + +- [Installation](#installation) +- [License](#license) + +## Installation + +```console +pip install alphapulse +``` + +## Local development setup + +Requirements: Python 3.11+, Git, Hatch, uv. + +```bash +# install Hatch and uv (once) +python -m pip install --user hatch uv + +# create and enter the dev environment +hatch env create +hatch shell + +# install Git hooks and run once across the repo +pre-commit install +pre-commit run --all-files +``` + +Common checks: + +```bash +hatch run lint +hatch run format +hatch run types +hatch run all +``` + +## License + +`alphapulse` is distributed under the terms of the MIT license. diff --git a/alphapulse/pyproject.toml b/alphapulse/pyproject.toml new file mode 100644 index 0000000..6bb83c1 --- /dev/null +++ b/alphapulse/pyproject.toml @@ -0,0 +1,149 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "alphapulse" +dynamic = ["version"] +description = "" +readme = "README.md" +requires-python = ">=3.11" +license = "MIT" +keywords = [] +authors = [ + { name = "jakub.szulc", email = "szulcak05@gmail.com" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +dependencies = [] + +[project.urls] +Documentation = "https://github.com/jakub.szulc/alphapulse#readme" +Issues = "https://github.com/jakub.szulc/alphapulse/issues" +Source = "https://github.com/jakub.szulc/alphapulse" + +[tool.hatch.version] +path = "src/alphapulse/__about__.py" + +[tool.hatch.envs.default] +installer = "uv" +features = ["dev"] +dependencies = [ + "pre-commit>=3.7.0", + "ruff>=0.5.0", + "black>=24.4.0", + "mypy>=1.10.0", + "types-requests>=2.32.0.20240521", + "types-PyYAML>=6.0.12.20240808", +] + +[tool.hatch.envs.default.scripts] +lint = [ + "ruff check src tests", + "black --check --quiet .", +] +format = [ + "ruff check --select I --fix src tests", + "ruff format .", +] +types = "mypy --install-types --non-interactive src/alphapulse tests" +all = [ + "ruff check src tests", + "ruff format --check .", + "mypy src/alphapulse tests", +] + +[tool.hatch.envs.types] +extra-dependencies = [ + "mypy>=1.0.0", +] + +[tool.hatch.envs.types.scripts] +check = "mypy --install-types --non-interactive {args:src/alphapulse tests}" + +[tool.coverage.run] +source_pkgs = ["alphapulse", "tests"] +branch = true +parallel = true +omit = [ + "src/alphapulse/__about__.py", +] + +[tool.coverage.paths] +alphapulse = ["src/alphapulse", "*/alphapulse/src/alphapulse"] +tests = ["tests", "*/alphapulse/tests"] + +[tool.coverage.report] +exclude_lines = [ + "no cov", + "if __name__ == .__main__.:", + "if TYPE_CHECKING:", +] + +[tool.ruff] +line-length = 88 +target-version = "py311" +extend-exclude = ["build", "dist", ".venv", ".eggs"] +src = ["src", "tests"] + +[tool.ruff.lint] +select = [ + "E","F","W", + "I", + "UP", + "B", + "ASYNC", + "S", + "C4", + "PIE", + "T20", + "PLE", + "PLW", +] +ignore = [ + "S101", +] + +[tool.ruff.lint.per-file-ignores] +"tests/**" = ["S101", "T20"] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +line-ending = "auto" +docstring-code-format = true + +[tool.black] +line-length = 88 +target-version = ["py311"] + +[tool.mypy] +python_version = "3.11" +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_return_any = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_optional = true +check_untyped_defs = true +show_error_codes = true +pretty = true +exclude = [ + '^build/.*', + '^dist/.*', + '^\.venv/.*', +] + +[[tool.mypy.overrides]] +module = [ + "requests.*", + "yaml.*", +] +ignore_missing_imports = true diff --git a/alphapulse/src/alphapulse/__about__.py b/alphapulse/src/alphapulse/__about__.py new file mode 100644 index 0000000..9c3e020 --- /dev/null +++ b/alphapulse/src/alphapulse/__about__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2025-present jakub.szulc +# +# SPDX-License-Identifier: MIT +__version__ = "0.0.1" diff --git a/alphapulse/src/alphapulse/__init__.py b/alphapulse/src/alphapulse/__init__.py new file mode 100644 index 0000000..7cd0f4e --- /dev/null +++ b/alphapulse/src/alphapulse/__init__.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2025-present jakub.szulc +# +# SPDX-License-Identifier: MIT diff --git a/alphapulse/tests/__init__.py b/alphapulse/tests/__init__.py new file mode 100644 index 0000000..7cd0f4e --- /dev/null +++ b/alphapulse/tests/__init__.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2025-present jakub.szulc +# +# SPDX-License-Identifier: MIT From 9221863c1856be9063d6f091e1ba172c8c9e5c2a Mon Sep 17 00:00:00 2001 From: "jakub.szulc" Date: Sun, 7 Sep 2025 17:19:47 +0200 Subject: [PATCH 2/7] Move to root src layout + enable Hatch extras dev; tooling ready --- .pre-commit-config.yaml | 26 +++++++++- alphapulse/LICENSE.txt => LICENSE.txt | 0 README.md | 46 ++++++++++++++++++ alphapulse/README.md | 47 ------------------- alphapulse/pyproject.toml => pyproject.toml | 17 +++---- .../src => src}/alphapulse/__about__.py | 0 .../src => src}/alphapulse/__init__.py | 0 {alphapulse/tests => tests}/__init__.py | 0 8 files changed, 79 insertions(+), 57 deletions(-) rename alphapulse/LICENSE.txt => LICENSE.txt (100%) delete mode 100644 alphapulse/README.md rename alphapulse/pyproject.toml => pyproject.toml (94%) rename {alphapulse/src => src}/alphapulse/__about__.py (100%) rename {alphapulse/src => src}/alphapulse/__init__.py (100%) rename {alphapulse/tests => tests}/__init__.py (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9c83a72..f8f9438 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,8 +16,28 @@ repos: hooks: - id: mypy additional_dependencies: - - types-requests - - types-PyYAML + - types-requests>=2.32 + - types-PyYAML>=6.0 + + - repo: https://github.com/nbQA-dev/nbQA + rev: 1.9.1 + hooks: + - id: nbqa-ruff + additional_dependencies: + - "ruff>=0.12" + args: [--fix] + files: \.ipynb$ + - id: nbqa-black + additional_dependencies: + - "black>=24" + args: [--nbqa-mutate] + files: \.ipynb$ + - id: nbqa-mypy + additional_dependencies: + - "mypy>=1.10" + - "types-requests>=2.32" + - "types-PyYAML>=6.0" + files: \.ipynb$ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 @@ -25,4 +45,6 @@ repos: - id: check-yaml - id: check-toml - id: end-of-file-fixer + exclude: \.ipynb$ - id: trailing-whitespace + exclude: \.ipynb$ diff --git a/alphapulse/LICENSE.txt b/LICENSE.txt similarity index 100% rename from alphapulse/LICENSE.txt rename to LICENSE.txt diff --git a/README.md b/README.md index b24fcd7..eea9688 100644 --- a/README.md +++ b/README.md @@ -1 +1,47 @@ # AlphaPulse + +[![PyPI - Version](https://img.shields.io/pypi/v/alphapulse.svg)](https://pypi.org/project/alphapulse) +[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/alphapulse.svg)](https://pypi.org/project/alphapulse) + +----- + +## Table of Contents + +- [Installation](#installation) +- [License](#license) + +## Installation + +```console +pip install alphapulse +``` + +## Local development setup + +Requirements: Python 3.11+, Git, Hatch, uv. + +```bash +# install Hatch and uv (once) +python -m pip install --user hatch uv + +# create and enter the dev environment +hatch env create +hatch shell + +# install Git hooks and run once across the repo +pre-commit install +pre-commit run --all-files +``` + +Common checks: + +```bash +hatch run lint +hatch run format +hatch run types +hatch run all +``` + +## License + +`alphapulse` is distributed under the terms of the MIT license. diff --git a/alphapulse/README.md b/alphapulse/README.md deleted file mode 100644 index eea9688..0000000 --- a/alphapulse/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# AlphaPulse - -[![PyPI - Version](https://img.shields.io/pypi/v/alphapulse.svg)](https://pypi.org/project/alphapulse) -[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/alphapulse.svg)](https://pypi.org/project/alphapulse) - ------ - -## Table of Contents - -- [Installation](#installation) -- [License](#license) - -## Installation - -```console -pip install alphapulse -``` - -## Local development setup - -Requirements: Python 3.11+, Git, Hatch, uv. - -```bash -# install Hatch and uv (once) -python -m pip install --user hatch uv - -# create and enter the dev environment -hatch env create -hatch shell - -# install Git hooks and run once across the repo -pre-commit install -pre-commit run --all-files -``` - -Common checks: - -```bash -hatch run lint -hatch run format -hatch run types -hatch run all -``` - -## License - -`alphapulse` is distributed under the terms of the MIT license. diff --git a/alphapulse/pyproject.toml b/pyproject.toml similarity index 94% rename from alphapulse/pyproject.toml rename to pyproject.toml index 6bb83c1..10196f9 100644 --- a/alphapulse/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,15 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] dependencies = [] +optional-dependencies = { dev = [ + "pre-commit>=3.7.0", + "ruff>=0.12", + "black>=24", + "mypy>=1.10", + "types-requests>=2.32", + "types-PyYAML>=6.0", + "nbqa>=1.9.1", +] } [project.urls] Documentation = "https://github.com/jakub.szulc/alphapulse#readme" @@ -34,14 +43,6 @@ path = "src/alphapulse/__about__.py" [tool.hatch.envs.default] installer = "uv" features = ["dev"] -dependencies = [ - "pre-commit>=3.7.0", - "ruff>=0.5.0", - "black>=24.4.0", - "mypy>=1.10.0", - "types-requests>=2.32.0.20240521", - "types-PyYAML>=6.0.12.20240808", -] [tool.hatch.envs.default.scripts] lint = [ diff --git a/alphapulse/src/alphapulse/__about__.py b/src/alphapulse/__about__.py similarity index 100% rename from alphapulse/src/alphapulse/__about__.py rename to src/alphapulse/__about__.py diff --git a/alphapulse/src/alphapulse/__init__.py b/src/alphapulse/__init__.py similarity index 100% rename from alphapulse/src/alphapulse/__init__.py rename to src/alphapulse/__init__.py diff --git a/alphapulse/tests/__init__.py b/tests/__init__.py similarity index 100% rename from alphapulse/tests/__init__.py rename to tests/__init__.py From 5a73f5383fcfa126b847447501b7fba8fde7463f Mon Sep 17 00:00:00 2001 From: "jakub.szulc" Date: Mon, 8 Sep 2025 09:32:08 +0200 Subject: [PATCH 3/7] Delete duplicated mypy dependency --- pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 10196f9..01664a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,9 +61,7 @@ all = [ ] [tool.hatch.envs.types] -extra-dependencies = [ - "mypy>=1.0.0", -] +extra-dependencies = [] [tool.hatch.envs.types.scripts] check = "mypy --install-types --non-interactive {args:src/alphapulse tests}" From 6fb0f195c33ad2dc87a739b2b4984f16869ba694 Mon Sep 17 00:00:00 2001 From: Jakub Szulc <30904370+Palamabron@users.noreply.github.com> Date: Mon, 8 Sep 2025 09:38:40 +0200 Subject: [PATCH 4/7] Update pyproject.toml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 01664a1..c1e80d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,7 +93,7 @@ src = ["src", "tests"] [tool.ruff.lint] select = [ - "E","F","W", + "E", "F", "W", "I", "UP", "B", From a670414f00dfec3772d23394fc93d46acb5dd153 Mon Sep 17 00:00:00 2001 From: "jakub.szulc" Date: Mon, 8 Sep 2025 09:40:32 +0200 Subject: [PATCH 5/7] Refactor pyproject.toml --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c1e80d5..8cec864 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,9 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] dependencies = [] -optional-dependencies = { dev = [ + +[project.optional-dependencies] +dev = [ "pre-commit>=3.7.0", "ruff>=0.12", "black>=24", @@ -30,7 +32,8 @@ optional-dependencies = { dev = [ "types-requests>=2.32", "types-PyYAML>=6.0", "nbqa>=1.9.1", -] } +] + [project.urls] Documentation = "https://github.com/jakub.szulc/alphapulse#readme" From 2ec36bd291acc1cc899b86ef9e3fbaf717516463 Mon Sep 17 00:00:00 2001 From: "jakub.szulc" Date: Mon, 8 Sep 2025 10:00:13 +0200 Subject: [PATCH 6/7] Refactor pyproject.toml --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8cec864..03844f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,9 +36,9 @@ dev = [ [project.urls] -Documentation = "https://github.com/jakub.szulc/alphapulse#readme" -Issues = "https://github.com/jakub.szulc/alphapulse/issues" -Source = "https://github.com/jakub.szulc/alphapulse" +Documentation = "https://github.com/Palamabron/AlphaPulse/blob/main/README.md" +Issues = "https://github.com/Palamabron/AlphaPulse/issues" +Source = "https://github.com/Palamabron/AlphaPulse" [tool.hatch.version] path = "src/alphapulse/__about__.py" From 326be51400d3c26f7566b5ff5c748306cb0f82e8 Mon Sep 17 00:00:00 2001 From: Jakub Szulc <30904370+Palamabron@users.noreply.github.com> Date: Mon, 8 Sep 2025 10:00:53 +0200 Subject: [PATCH 7/7] Update pyproject.toml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 03844f5..4ccc975 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ features = ["dev"] [tool.hatch.envs.default.scripts] lint = [ "ruff check src tests", - "black --check --quiet .", + "ruff format --check .", ] format = [ "ruff check --select I --fix src tests",