From 2449ca4412bcc8ecb69b20c3a75add8a0287a6b4 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Fri, 16 May 2025 12:19:03 +0200 Subject: [PATCH 01/28] Add new targets to Makefile and an example env file --- .gitignore | 1 + Makefile | 16 ++++++++++++++++ env.example | 1 + 3 files changed, 18 insertions(+) create mode 100644 env.example diff --git a/.gitignore b/.gitignore index fdf870e..42481a6 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,4 @@ site/ # Miscellaneous files and directories to ignore # Add any additional file patterns a directory names that should be ignored down here +.env diff --git a/Makefile b/Makefile index ab070da..edb2730 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,13 @@ # Generic Makefile for Python projects +# Load environment variables from .env file +ifneq (,$(wildcard ./.env)) + include .env + export $(shell sed 's/=.*//' .env) +else + $(warning .env file not found. Environment variables not loaded.) +endif + # Variables PYTHON ?= python3 PIP ?= pip3 @@ -48,6 +56,14 @@ format: ## Format code typecheck: ## Typecheck code $(DEP_MNGR) run mypy . +.PHONY: precommit +precommit: ## Run pre-commit hooks + $(DEP_MNGR) run pre-commit run --all-files + +.PHONY: precommit-install +precommit-install: ## Install pre-commit hooks + $(DEP_MNGR) run pre-commit install + # Documentation .PHONY: docs docs: ## Build documentation diff --git a/env.example b/env.example new file mode 100644 index 0000000..9b97295 --- /dev/null +++ b/env.example @@ -0,0 +1 @@ +DEBUG_MODE=True From aed38ff5ca25063a83fab38dc8feeb968e9f0abe Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Fri, 16 May 2025 12:20:11 +0200 Subject: [PATCH 02/28] Remove Poetry dependency for building and publishing the docs --- .github/workflows/docs.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a49800b..2953a91 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -28,21 +28,7 @@ jobs: with: python-version: '3.11' - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v4 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - - name: Install Dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: | make setup make install From 70f41914e88f0d448d3cf05996df59b887d991cb Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Fri, 16 May 2025 12:22:27 +0200 Subject: [PATCH 03/28] WIP --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5e30bef..9443a6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,9 @@ classifiers = [ ] requires-python = ">=3.10,<4.0" -dependencies = [] +dependencies = [ + "python-dotenv (>=1.1.0,<2.0.0)" +] [project.optional-dependencies] dev = [ From 70015f9a26470cc6f71572f661d89780edebfaba Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Wed, 21 May 2025 20:10:38 +0200 Subject: [PATCH 04/28] WIP --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 9443a6f..f69d16e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ Documentation = "https://github.com/habedi/template-python-library/blob/main/doc [tool.poetry] include = ["README.md"] packages = [{ include = "library" }] +package-mode = true [build-system] requires = ["poetry-core"] From 5765ac1e4ff43ff6e79e69f5f774ac8a2c49f879 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Thu, 29 May 2025 19:10:14 +0200 Subject: [PATCH 05/28] Fix library versioning info --- library/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/__init__.py b/library/__init__.py index 2d3023f..503c516 100644 --- a/library/__init__.py +++ b/library/__init__.py @@ -1,12 +1,13 @@ -import importlib import logging +from importlib.metadata import version, PackageNotFoundError from package import DummyClass _logger = logging.getLogger(__name__) + try: - __version__ = importlib.metadata.version("template-python-library") -except importlib.metadata.PackageNotFoundError: + __version__ = version("template-python-library") +except PackageNotFoundError: __version__ = "0.0.0-unknown" _logger.warning( "Could not determine package version using importlib.metadata. " From 62452cd271d2cc98c3668b8d3b805c371d888b3b Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Thu, 29 May 2025 23:28:07 +0200 Subject: [PATCH 06/28] Improve the precommit file --- .pre-commit-config.yaml | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad9e202..2b5f94d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,42 @@ +default_stages: [pre-commit, pre-push] +default_language_version: + python: python3.11 +fail_fast: false + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] - id: end-of-file-fixer + - id: mixed-line-ending + - id: check-merge-conflict + - id: check-added-large-files + - id: detect-private-key - id: check-yaml - id: check-toml - - id: check-added-large-files - - id: check-merge-conflict + - id: check-json + - id: check-docstring-first + - id: pretty-format-json + args: [--autofix, --no-sort-keys] + + - repo: local + hooks: + - id: format + name: format + entry: make format + language: system + pass_filenames: false + + - id: lint + name: lint + entry: make lint + language: system + pass_filenames: false + + - id: typecheck + name: typecheck + entry: make typecheck + language: system + pass_filenames: false From 0f78f86d7fb26167a8b0076f328932b245b69085 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 3 Jun 2025 14:19:25 +0200 Subject: [PATCH 07/28] Improve project metadata --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f69d16e..ea55470 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ keywords = ["template", "python", "library"] classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", + "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", @@ -21,7 +22,9 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Libraries", - "Topic :: Software Development :: Libraries :: Python Modules" + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Artificial Intelligence" ] requires-python = ">=3.10,<4.0" From 714f999f512c37169d5f7753483f6dd3b72b55e8 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Mon, 23 Jun 2025 12:25:29 +0200 Subject: [PATCH 08/28] WIP --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index edb2730..8b460d7 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ typecheck: ## Typecheck code $(DEP_MNGR) run mypy . .PHONY: precommit -precommit: ## Run pre-commit hooks +precommit: ## Run pre-commit hooks manually $(DEP_MNGR) run pre-commit run --all-files .PHONY: precommit-install From 3bfe4d0460a7c06f5a44bbd436ca64547ba8de63 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Thu, 17 Jul 2025 18:12:15 +0200 Subject: [PATCH 09/28] WIP --- .pre-commit-config.yaml | 13 ++++++++++--- library/__init__.py | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b5f94d..e065071 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -default_stages: [pre-commit, pre-push] +default_stages: [ pre-commit, pre-push ] default_language_version: python: python3.11 fail_fast: false @@ -8,7 +8,7 @@ repos: rev: v5.0.0 hooks: - id: trailing-whitespace - args: [--markdown-linebreak-ext=md] + args: [ --markdown-linebreak-ext=md ] - id: end-of-file-fixer - id: mixed-line-ending - id: check-merge-conflict @@ -19,7 +19,7 @@ repos: - id: check-json - id: check-docstring-first - id: pretty-format-json - args: [--autofix, --no-sort-keys] + args: [ --autofix, --no-sort-keys ] - repo: local hooks: @@ -40,3 +40,10 @@ repos: entry: make typecheck language: system pass_filenames: false + + - id: test + name: test + entry: make test + language: system + pass_filenames: false + stages: [ pre-commit ] diff --git a/library/__init__.py b/library/__init__.py index 503c516..8b73560 100644 --- a/library/__init__.py +++ b/library/__init__.py @@ -1,5 +1,5 @@ import logging -from importlib.metadata import version, PackageNotFoundError +from importlib.metadata import PackageNotFoundError, version from package import DummyClass From 17b66df6f09cd12893d537cbb8f01e89ebc82be8 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Sun, 20 Jul 2025 22:03:26 +0200 Subject: [PATCH 10/28] WIP --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8b460d7..be913a1 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ TMP_DIRS = site .PHONY: help help: ## Show help for all targets - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | \ awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' # Setup & Installation From 4597471f4b35b12b39d6863ca172d848e173fd58 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Sun, 20 Jul 2025 22:10:16 +0200 Subject: [PATCH 11/28] WIP --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index be913a1..869bdf8 100644 --- a/Makefile +++ b/Makefile @@ -23,9 +23,9 @@ TMP_DIRS = site .DEFAULT_GOAL := help .PHONY: help -help: ## Show help for all targets - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | \ - awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' +help: ## Show help messages for all available targets + @grep -E '^[a-zA-Z_-]+:.*## .*$$' Makefile | \ + awk 'BEGIN {FS = ":.*## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' # Setup & Installation .PHONY: setup From 18d627e2160b5f2a10377abce9b532c4d9f94446 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Wed, 23 Jul 2025 21:21:52 +0200 Subject: [PATCH 12/28] WIP --- .pre-commit-config.yaml | 3 +-- Makefile | 14 ++++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e065071..14e7e42 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -default_stages: [ pre-commit, pre-push ] +default_stages: [ pre-push ] default_language_version: python: python3.11 fail_fast: false @@ -46,4 +46,3 @@ repos: entry: make test language: system pass_filenames: false - stages: [ pre-commit ] diff --git a/Makefile b/Makefile index 869bdf8..bf5e066 100644 --- a/Makefile +++ b/Makefile @@ -56,14 +56,16 @@ format: ## Format code typecheck: ## Typecheck code $(DEP_MNGR) run mypy . -.PHONY: precommit -precommit: ## Run pre-commit hooks manually +.PHONY: setup-hooks +setup-hooks: ## Install all pre-commit hooks (pre-commit and pre-push) + $(DEP_MNGR) run pre-commit install --hook-type pre-commit + $(DEP_MNGR) run pre-commit install --hook-type pre-push + $(DEP_MNGR) run pre-commit install-hooks + +.PHONY: test-hooks +test-hooks: ## Test pre-commit hooks on all files $(DEP_MNGR) run pre-commit run --all-files -.PHONY: precommit-install -precommit-install: ## Install pre-commit hooks - $(DEP_MNGR) run pre-commit install - # Documentation .PHONY: docs docs: ## Build documentation From 5ed318a0e805b3f6729f4d19a7fc49af9577181f Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Wed, 23 Jul 2025 21:22:41 +0200 Subject: [PATCH 13/28] WIP --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bf5e066..9a83d45 100644 --- a/Makefile +++ b/Makefile @@ -57,13 +57,13 @@ typecheck: ## Typecheck code $(DEP_MNGR) run mypy . .PHONY: setup-hooks -setup-hooks: ## Install all pre-commit hooks (pre-commit and pre-push) +setup-hooks: ## Install Git hooks (pre-commit and pre-push) $(DEP_MNGR) run pre-commit install --hook-type pre-commit $(DEP_MNGR) run pre-commit install --hook-type pre-push $(DEP_MNGR) run pre-commit install-hooks .PHONY: test-hooks -test-hooks: ## Test pre-commit hooks on all files +test-hooks: ## Test Git hooks on all files $(DEP_MNGR) run pre-commit run --all-files # Documentation From a1c5b01829dcec2be243c7ac32955eca8cc999c8 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Sun, 3 Aug 2025 23:55:55 +0200 Subject: [PATCH 14/28] WIP --- .github/workflows/docs.yml | 2 +- .github/workflows/lints.yml | 2 +- .github/workflows/tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2953a91..7d76e71 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: false jobs: - deploy: + deploy_docs: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index 36bae0a..9108beb 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -10,7 +10,7 @@ permissions: contents: read jobs: - build: + lints: runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5f29f61..66cb82e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ permissions: contents: read jobs: - build: + tests: runs-on: ubuntu-latest strategy: From 778fe26ef6d0325d2ef96c49e228497394cbeb08 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Mon, 4 Aug 2025 22:45:36 +0200 Subject: [PATCH 15/28] WIP --- .pre-commit-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14e7e42..0a4124a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,21 +28,25 @@ repos: entry: make format language: system pass_filenames: false + stages: [ pre-commit ] - id: lint name: lint entry: make lint language: system pass_filenames: false + stages: [ pre-commit ] - id: typecheck name: typecheck entry: make typecheck language: system pass_filenames: false + stages: [ pre-commit ] - id: test name: test entry: make test language: system pass_filenames: false + stages: [ pre-push ] From ad032d6a770750f1bd891cc028951aacd81e6bd9 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:12:35 +0100 Subject: [PATCH 16/28] Update a few files --- .pre-commit-config.yaml | 12 +++++------- CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 28 ++++++++++++++-------------- LICENSE | 2 +- poetry.toml | 2 -- 5 files changed, 21 insertions(+), 25 deletions(-) delete mode 100644 poetry.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a4124a..ef5a8f7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,6 @@ default_stages: [ pre-push ] -default_language_version: - python: python3.11 fail_fast: false +exclude: '(^external/|^docs/)' repos: - repo: https://github.com/pre-commit/pre-commit-hooks @@ -24,29 +23,28 @@ repos: - repo: local hooks: - id: format - name: format + name: Format Code entry: make format language: system pass_filenames: false stages: [ pre-commit ] - id: lint - name: lint + name: Run Linter Checks entry: make lint language: system pass_filenames: false stages: [ pre-commit ] - id: typecheck - name: typecheck + name: Run Typechecks entry: make typecheck language: system pass_filenames: false stages: [ pre-commit ] - id: test - name: test + name: Run Tests entry: make test language: system pass_filenames: false - stages: [ pre-push ] diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index e0f169f..e19a328 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,3 +1,3 @@ -# Code of Conduct +## Code of Conduct We adhere to the [Python Software Foundation Code of Conduct](https://policies.python.org/python.org/code-of-conduct). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eae1e4e..8b9ddad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,25 +1,25 @@ -# Contribution Guidelines +## Contribution Guidelines Thank you for considering contributing to this project! Contributions are always welcome and appreciated. -## How to Contribute +### How to Contribute Please check the [issue tracker](https://github.com/habedi/template-python-library/issues) to see if there is an issue you would like to work on or if it has already been resolved. -### Reporting Bugs +#### Reporting Bugs 1. Open an issue on the [issue tracker](https://github.com/habedi/template-python-library/issues). 2. Include information such as steps to reproduce the observed behavior and relevant logs or screenshots. -### Suggesting Features +#### Suggesting Features 1. Open an issue on the [issue tracker](https://github.com/habedi/template-python-library/issues). 2. Provide details about the feature, its purpose, and potential implementation ideas. -## Submitting Pull Requests +### Submitting Pull Requests - Make sure all tests pass before submitting a pull request. - Write a clear description of the changes you made and the reasons behind them. @@ -27,36 +27,36 @@ would like to work on or if it has already been resolved. > [!IMPORTANT] > It's assumed that by submitting a pull request, you agree to license your contributions under the project's license. -## Development Workflow +### Development Workflow -### Prerequisites +#### Prerequisites Install GNU Make if it's not already installed on your system. ```shell -# For Debian-based systems like Debian, Ubuntu, etc. +## For Debian-based systems like Debian, Ubuntu, etc. sudo apt-get install make ``` - Use the `make setup` command to install the development dependencies. - Use the `make install` command to install the Python dependencies. -### Code Style +#### Code Style - Use the `make format` command to format the code. -### Running Tests +#### Running Tests - Use the `make test` command to run the tests. -### Running Linter Checks +#### Running Linter Checks - Use the `make lint` command to run the linter checks. -### See Available Commands +#### See Available Commands - Run `make help` to see all available commands for managing different tasks. -## Code of Conduct +### Code of Conduct -We adhere to the [Python Software Foundation Code of Conduct](https://policies.python.org/python.org/code-of-conduct). +We adhere to the project's [Code of Conduct](CODE_OF_CONDUCT.md). diff --git a/LICENSE b/LICENSE index a2559ba..d899227 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Hassan Abedi +Copyright (c) 2026 Hassan Abedi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/poetry.toml b/poetry.toml deleted file mode 100644 index ab1033b..0000000 --- a/poetry.toml +++ /dev/null @@ -1,2 +0,0 @@ -[virtualenvs] -in-project = true From 3f4f1ff38821220fa71ec05f52de96a40d019ce7 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:13:42 +0100 Subject: [PATCH 17/28] WIP --- .gitattributes | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 38f567d..de9ef06 100644 --- a/.gitattributes +++ b/.gitattributes @@ -65,3 +65,4 @@ # Exclude files from language stats (GitHub Linguist) *.ipynb linguist-vendored +Makefile linguist-vendored diff --git a/pyproject.toml b/pyproject.toml index ea55470..0f33316 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "template-python-library" -version = "0.1.0a1" +version = "0.1.0-alpha.1" description = "A template for developing Python libraries" readme = "README.md" license = { text = "MIT" } From 6720fb36d77bbe8dbfea51679075f2668a11fb0c Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:20:36 +0100 Subject: [PATCH 18/28] WIP --- pyproject.toml | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0f33316..96194b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ authors = [ maintainers = [ { name = "Hassan Abedi", email = "hassan.abedi.t@gmail.com" } ] -keywords = ["template", "python", "library"] +keywords = ["template", "python", "library", "package"] classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -21,6 +21,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Scientific/Engineering", @@ -34,32 +35,31 @@ dependencies = [ [project.optional-dependencies] dev = [ - "pytest>=8.0.1", - "pytest-cov>=6.0.0", - "pytest-mock>=3.14.0", - "pytest-asyncio (>=0.26.0,<0.27.0)", - "mypy>=1.11.1", - "ruff>=0.9.3", + "omni-nli[huggingface]", + "pytest (>=8.0.1,<10.0.0)", + "pytest-cov (>=6.0.0,<8.0.0)", + "pytest-mock (>=3.14.0,<4.0.0)", + "pytest-asyncio (>=1.1.0,<2.0.0)", + "mypy (>=1.11.1,<2.0.0)", + "ruff (>=0.9.3,<1.0.0)", "pre-commit (>=4.2.0,<5.0.0)", - "griffe (>=1.7.3,<2.0.0)", + "asgi-lifespan[dev] (>=2.1.0,<3.0.0)", "mkdocs (>=1.6.1,<2.0.0)", + "mkdocs-material (>=9.6.12,<10.0.0)", "mkdocstrings-python (>=1.16.10,<2.0.0)", - "mkdocs-material (>=9.6.14,<10.0.0)", - "types-requests (>=2.32.0.20250515,<3.0.0.0)" + "pyyaml (>=6.0.1,<7.0.0)", + "rundoc (>=0.2.3,<0.3.0)", + "hypothesis (>=6.150.2,<7.0.0)", + "griffe (>=1.7.3,<2.0.0)", ] [project.urls] Repository = "https://github.com/habedi/template-python-library" Documentation = "https://github.com/habedi/template-python-library/blob/main/docs/index.md" -[tool.poetry] -include = ["README.md"] -packages = [{ include = "library" }] -package-mode = true - [build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling>=1.20", "build>=1.0"] +build-backend = "hatchling.build" [tool.pytest.ini_options] pythonpath = ["library"] @@ -105,8 +105,7 @@ exclude = [ ".bzr", ".direnv", ".eggs", ".git", ".git-rewrite", ".hg", ".mypy_cache", ".nox", ".pants.d", ".pytype", ".ruff_cache", ".svn", ".tox", ".venv", "__pypackages__", "_build", "buck-out", "build", "dist", "node_modules", - "venv", - "tests" + "venv", "tests" ] line-length = 100 indent-width = 4 From f319ae2bb513a4ff8b9ef815d1f447da2f2c95dc Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:25:44 +0100 Subject: [PATCH 19/28] Improve Actions workflows --- .github/workflows/docs.yml | 16 +++++++++------- .github/workflows/lints.yml | 18 ++++++++++++++---- .github/workflows/publish.yml | 9 +++++---- .github/workflows/tests.yml | 12 ++++++++++-- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7d76e71..5f66595 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,19 +2,21 @@ name: Build and Deploy Docs on: workflow_dispatch: + push: + branches: + - main + tags: + - "v*" permissions: - contents: read - pages: write - id-token: write + contents: write -# Only allow one deployment at a time running concurrency: - group: "pages" - cancel-in-progress: false + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - deploy_docs: + publish-docs: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index 9108beb..12918dd 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -2,21 +2,31 @@ name: Run Linter Checks on: workflow_dispatch: + pull_request: + branches: + - main + paths-ignore: + - '**.md' + - 'docs/**' push: - tags: - - 'v*' + branches: + - main permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: - lints: + lint: runs-on: ubuntu-latest strategy: matrix: # Define the Python versions check against - python-version: [ "3.10", "3.11", "3.12", "3.13" ] + python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] steps: - name: Checkout Repository diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d8a83a0..c793c26 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,14 +9,15 @@ on: permissions: contents: read -jobs: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true - # Run tests before publishing +jobs: call_tests: uses: ./.github/workflows/tests.yml - # Try to publish if only tests pass - publish_to_pypi: + publish-to-pypi: runs-on: ubuntu-latest needs: call_tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 66cb82e..358a1eb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,21 +4,29 @@ on: workflow_dispatch: workflow_call: pull_request: + branches: + - main + paths-ignore: + - '**.md' + - 'docs/**' + push: branches: - main - develop + tags: + - "v*" permissions: contents: read jobs: - tests: + test: runs-on: ubuntu-latest strategy: matrix: # Define the Python versions to test against - python-version: [ "3.10", "3.11", "3.12", "3.13" ] + python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] steps: - name: Checkout Repository From 1e83927edf3c8f6eb8a8a2363da925488ae61672 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:28:26 +0100 Subject: [PATCH 20/28] Add issue templates --- .github/FUNDING.yml | 1 + .github/ISSUE_TEMPLATE/bug_report.md | 25 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 +++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..e68f584 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [ habedi ] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..db16dc5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,25 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Logs** +If applicable, add logs to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3b844d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Discussions + url: https://github.com/habedi/template-python-library/discussions + about: Please ask and answer general questions here diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..11fc491 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From bc7b65473ef510a2bc96b807fbc72fc5e63063bb Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:29:53 +0100 Subject: [PATCH 21/28] WIP --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 96194b5..e3c69d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,6 @@ dependencies = [ [project.optional-dependencies] dev = [ - "omni-nli[huggingface]", "pytest (>=8.0.1,<10.0.0)", "pytest-cov (>=6.0.0,<8.0.0)", "pytest-mock (>=3.14.0,<4.0.0)", From 0292efed4bf6163366c44d20d80172c2bd688df9 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:35:01 +0100 Subject: [PATCH 22/28] WIP --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9a83d45..3d24eb9 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,8 @@ setup: ## Install system dependencies and dependency manager (e.g., Poetry) .PHONY: install install: ## Install Python dependencies - $(DEP_MNGR) install --all-extras --no-interaction + $(DEP_MNGR) install --all-extras --no-interaction --no-root # For Poetry + #(DEP_MNGR) sync --all-extras # For uv # Quality & Testing .PHONY: test From 398a10d385b968c7041d6273ff7a36fcad435066 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:37:49 +0100 Subject: [PATCH 23/28] WIP --- poetry.toml | 2 ++ pyproject.toml | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 poetry.toml diff --git a/poetry.toml b/poetry.toml new file mode 100644 index 0000000..ab1033b --- /dev/null +++ b/poetry.toml @@ -0,0 +1,2 @@ +[virtualenvs] +in-project = true diff --git a/pyproject.toml b/pyproject.toml index e3c69d9..a9f1185 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,6 +56,10 @@ dev = [ Repository = "https://github.com/habedi/template-python-library" Documentation = "https://github.com/habedi/template-python-library/blob/main/docs/index.md" +[tool.poetry] +include = ["README.md"] +packages = [{ include = "library" }] + [build-system] requires = ["hatchling>=1.20", "build>=1.0"] build-backend = "hatchling.build" From 1d49dbeb683e7338ced6c933ec5c3cbb6e1b59e8 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:40:32 +0100 Subject: [PATCH 24/28] WIP --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3d24eb9..36ce3fc 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ help: ## Show help messages for all available targets # Setup & Installation .PHONY: setup -setup: ## Install system dependencies and dependency manager (e.g., Poetry) +setup: ## Install system dependencies and dependency manager (default: Poetry) sudo apt-get update sudo apt-get install -y python3-pip $(PIP) install --upgrade pip @@ -37,7 +37,7 @@ setup: ## Install system dependencies and dependency manager (e.g., Poetry) .PHONY: install install: ## Install Python dependencies - $(DEP_MNGR) install --all-extras --no-interaction --no-root # For Poetry + $(DEP_MNGR) install --all-extras --no-interaction # For Poetry #(DEP_MNGR) sync --all-extras # For uv # Quality & Testing From bb34ca9f588d002bba02fbceaa9fd26fe634966d Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:42:04 +0100 Subject: [PATCH 25/28] WIP --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 36ce3fc..6dd12a3 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ help: ## Show help messages for all available targets @grep -E '^[a-zA-Z_-]+:.*## .*$$' Makefile | \ awk 'BEGIN {FS = ":.*## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -# Setup & Installation +# Setup and Installation .PHONY: setup setup: ## Install system dependencies and dependency manager (default: Poetry) sudo apt-get update @@ -40,7 +40,7 @@ install: ## Install Python dependencies $(DEP_MNGR) install --all-extras --no-interaction # For Poetry #(DEP_MNGR) sync --all-extras # For uv -# Quality & Testing +# Quality and Testing .PHONY: test test: ## Run tests $(DEP_MNGR) run pytest @@ -72,7 +72,7 @@ test-hooks: ## Test Git hooks on all files docs: ## Build documentation $(DEP_MNGR) run mkdocs build -# Build & Publish +# Build and Publish .PHONY: build build: ## Build distributions $(DEP_MNGR) build From 6faee2fa810142566e7c0d1e85ddfb4beee40ff2 Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:47:54 +0100 Subject: [PATCH 26/28] WIP --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a9f1185..b6238cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dev = [ "mypy (>=1.11.1,<2.0.0)", "ruff (>=0.9.3,<1.0.0)", "pre-commit (>=4.2.0,<5.0.0)", - "asgi-lifespan[dev] (>=2.1.0,<3.0.0)", + "icecream (>=2.1.4,<3.0.0)", "mkdocs (>=1.6.1,<2.0.0)", "mkdocs-material (>=9.6.12,<10.0.0)", "mkdocstrings-python (>=1.16.10,<2.0.0)", From 73fbe4741df809751fd8bd39691901e0cc0a353b Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:50:35 +0100 Subject: [PATCH 27/28] Polish main `README.md` --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index f0aec2c..a1df963 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,9 @@ [![Code Coverage](https://img.shields.io/codecov/c/github/habedi/template-python-library?style=flat&label=coverage&labelColor=333333&logo=codecov&logoColor=white)](https://codecov.io/gh/habedi/template-python-library) [![Code Quality](https://img.shields.io/codefactor/grade/github/habedi/template-python-library?style=flat&label=code%20quality&labelColor=333333&logo=codefactor&logoColor=white)](https://www.codefactor.io/repository/github/habedi/template-python-library) [![PyPI Version](https://img.shields.io/pypi/v/template-python-library-placeholder.svg?style=flat&label=pypi&labelColor=333333&logo=pypi&logoColor=white&color=3775a9)](https://pypi.org/project/template-python-library-placeholder/) -[![Downloads](https://img.shields.io/pypi/dm/template-python-library-placeholder.svg?style=flat&label=downloads&labelColor=333333&logo=pypi&logoColor=white&color=cc8400)](https://pypi.org/project/template-python-library-placeholder/) [![Python Version](https://img.shields.io/badge/python-%3E=3.10-3776ab?style=flat&labelColor=333333&logo=python&logoColor=white)](https://github.com/habedi/template-python-library) [![Documentation](https://img.shields.io/badge/docs-latest-8ca0d7?style=flat&labelColor=333333&logo=read-the-docs&logoColor=white)](https://github.com/habedi/template-python-library/blob/main/docs) [![License](https://img.shields.io/badge/license-MIT-00acc1?style=flat&labelColor=333333&logo=open-source-initiative&logoColor=white)](https://github.com/habedi/template-python-library/blob/main/LICENSE) -[![Managed with Poetry](https://img.shields.io/badge/managed%20with-Poetry-60A5FA?style=flat&logo=poetry&labelColor=333333&logoColor=white)](https://python-poetry.org/) -[![Managed with uv](https://img.shields.io/badge/managed%20with-uv-000000?style=flat&logo=uv&labelColor=333333&logoColor=white)](https://astral.sh/uv) -[![Makefile](https://img.shields.io/badge/managed%20with-Makefile-000000?style=flat&logo=gnu&labelColor=333333&logoColor=white)](https://www.gnu.org/software/make/) --- From 38748863a0af7cac632388269958ab4e4b926c2f Mon Sep 17 00:00:00 2001 From: Hassan Abedi Date: Tue, 17 Feb 2026 16:52:35 +0100 Subject: [PATCH 28/28] WIP --- .editorconfig | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.editorconfig b/.editorconfig index ac98278..1a83fe3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,29 +1,24 @@ -# EditorConfig is awesome: https://EditorConfig.org +# https://EditorConfig.org -# Top-most EditorConfig file root = true -# Global settings (applicable to all files unless overridden) [*] -charset = utf-8 # Default character encoding -end_of_line = lf # Use LF for line endings (Unix-style) -indent_style = space # Use spaces for indentation -indent_size = 4 # Default indentation size -insert_final_newline = true # Make sure files end with a newline -trim_trailing_whitespace = true # Remove trailing whitespace +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true -[*.py] +[*.{py,pyi}] max_line_length = 100 -# Markdown files [*.md] -max_line_length = 120 +max_line_length = 150 trim_trailing_whitespace = false -# Bash scripts [*.sh] indent_size = 2 -# YAML files [*.{yml,yaml}] indent_size = 2