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..f8f9438 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,50 @@ +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>=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 + hooks: + - id: check-yaml + - id: check-toml + - id: end-of-file-fixer + exclude: \.ipynb$ + - id: trailing-whitespace + exclude: \.ipynb$ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..c1e3f16 --- /dev/null +++ b/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/README.md b/README.md index 5c96fb6..eea9688 100644 --- a/README.md +++ b/README.md @@ -1 +1,47 @@ -# AlphaPulse \ No newline at end of file +# 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/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4ccc975 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,151 @@ +[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.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/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" + +[tool.hatch.envs.default] +installer = "uv" +features = ["dev"] + +[tool.hatch.envs.default.scripts] +lint = [ + "ruff check src tests", + "ruff format --check .", +] +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 = [] + +[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/src/alphapulse/__about__.py b/src/alphapulse/__about__.py new file mode 100644 index 0000000..9c3e020 --- /dev/null +++ b/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/src/alphapulse/__init__.py b/src/alphapulse/__init__.py new file mode 100644 index 0000000..7cd0f4e --- /dev/null +++ b/src/alphapulse/__init__.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2025-present jakub.szulc +# +# SPDX-License-Identifier: MIT diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..7cd0f4e --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2025-present jakub.szulc +# +# SPDX-License-Identifier: MIT