diff --git a/.github/workflows/python-code-style.yml b/.github/workflows/python-code-style.yml index ab3fb94..39769a7 100644 --- a/.github/workflows/python-code-style.yml +++ b/.github/workflows/python-code-style.yml @@ -17,10 +17,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.13" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml index 4cc679c..a00e294 100644 --- a/.github/workflows/python-lint.yml +++ b/.github/workflows/python-lint.yml @@ -17,10 +17,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.13" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-quality.yml b/.github/workflows/python-quality.yml index 5fae30a..fcc57e4 100644 --- a/.github/workflows/python-quality.yml +++ b/.github/workflows/python-quality.yml @@ -17,10 +17,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.13" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index b222f17..8335564 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + version: ["3.9", "3.10", "3.11", "3.12", "3.13"] os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/python-typing.yml b/.github/workflows/python-typing.yml index adc79b9..d92e04e 100644 --- a/.github/workflows/python-typing.yml +++ b/.github/workflows/python-typing.yml @@ -17,10 +17,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.13" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d217030..2812e19 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,10 +17,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.13" - name: Install dependencies run: | diff --git a/.github/workflows/reusable-github-pages.yml b/.github/workflows/reusable-github-pages.yml index 02bbfd7..26794b3 100644 --- a/.github/workflows/reusable-github-pages.yml +++ b/.github/workflows/reusable-github-pages.yml @@ -39,10 +39,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.13" # Here we want to install the current package in editable mode, # in case mkdocs needs the package (i.e. we are building a mkdocs plugin). diff --git a/README.md b/README.md index 966f4f1..14e4e24 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # bootstrap-python-package -![Static Badge](https://img.shields.io/badge/Python-3.8_%7C_3.9_%7C_3.10_%7C_3.11_%7C_3.12-blue?logo=python&logoColor=white) +![Static Badge](https://img.shields.io/badge/Python-3.9_%7C_3.10_%7C_3.11_%7C_3.12_%7C_3.13-blue?logo=python&logoColor=white) [![Stable Version](https://img.shields.io/pypi/v/bootstrap-python-package?color=blue)](https://pypi.org/project/bootstrap-python-package/) [![stability-beta](https://img.shields.io/badge/stability-beta-33bbff.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#beta) diff --git a/docs/index.md b/docs/index.md index 966f4f1..f8c4caf 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,87 +1 @@ -# bootstrap-python-package -![Static Badge](https://img.shields.io/badge/Python-3.8_%7C_3.9_%7C_3.10_%7C_3.11_%7C_3.12-blue?logo=python&logoColor=white) -[![Stable Version](https://img.shields.io/pypi/v/bootstrap-python-package?color=blue)](https://pypi.org/project/bootstrap-python-package/) -[![stability-beta](https://img.shields.io/badge/stability-beta-33bbff.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#beta) - -[![Python tests](https://github.com/febus982/bootstrap-python-package/actions/workflows/python-tests.yml/badge.svg?branch=main)](https://github.com/febus982/bootstrap-python-package/actions/workflows/python-tests.yml) -[![Maintainability](https://api.codeclimate.com/v1/badges/593e78ec96ed5ebb0dd3/maintainability)](https://codeclimate.com/github/febus982/bootstrap-python-package/maintainability) -[![Test Coverage](https://api.codeclimate.com/v1/badges/593e78ec96ed5ebb0dd3/test_coverage)](https://codeclimate.com/github/febus982/bootstrap-python-package/test_coverage) - -[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/) -[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit) - -This template repository provides the boilerplate to create a python package. -It is configured with all the following features: - -* Test suite using [tox](https://tox.wiki/en/latest/index.html) and [pytest](https://docs.pytest.org/en/7.4.x/) -* Typing using [mypy](https://mypy.readthedocs.io/en/stable/) -* Linting, security and code format using [ruff](https://github.com/astral-sh/ruff) (using [black](https://pypi.org/project/black/) - code style and [bandit](https://github.com/PyCQA/bandit) security rules) -* Integration with CodeClimate for code quality and coverage checks -* CI pipeline supporting: - * testing against multiple python versions - * releases on [PyPI](https://pypi.org) - * GitHub pages documentation using [mkdocs](https://www.mkdocs.org) -* PyCharm profile basic configuration - -## How to use this repository template to create a new package - -* Create your github repository using this template. (The big green `Use this template` button) -* Rename the `bootstrap_python_package` directory -* Search and replace all the occurrences of `bootstrap-python-package` and `bootstrap_python_package` -* Configure a pending trusted publisher on [pypi](https://pypi.org/manage/account/publishing) using the following values: - * PyPI Project Name: The github repository name (in this case `bootstrap-python-package`) - * Owner: The github repository owner (in this case `febus982`) - * Repository name: The github repository name (in this case `bootstrap-python-package`) - * Workflow name: `release.yml` -* Create a GitHub Actions secret named `CODECLIMATE_REPORTER_ID` (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/secrets/actions`) - containing the codeclimate reporter id (you can find it at `https://codeclimate.com/repos/YOUR_REPO_ID/settings/test_reporter`). - If you don't want to use CodeClimate just delete `workflows/python-quality.yml`. -* Update the badges in `README.md`! (check [shields.io](https://shields.io/) for extra badges) -* Update the PyCharm Copyright profile in the IDE settings: Editor | Copyright | Copyright Profiles (if you want to use it) -* Setup local development: - * Clone the repository - * Install poetry `pip install poetry` - * Install dev dependencies with `make dev-dependencies` - * (optional) It is strongly recommended to install [pre-commit](https://pre-commit.com/#installation) - and run `pre-commit install` so that formatting and linting are automatically executed during `git commit`. -* Setup GitHub pages (this need local development setup): - * Initialise documentation branch `poetry run mike deploy dev latest --update-aliases --push` - * Configure GitHub Pages to deploy from the `gh-pages` branch (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/pages`) - * Add the `main` branch and the `v*.*.*` tag rules to the "deployment branches and tags" list in the `gh-pages` environment (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/environments`) - -**IMPORTANT:** The repository is configured to deploy on the [test PyPI repository](https://test.pypi.org/). -It's strongly recommended to create the project in the [test PyPI repository](https://test.pypi.org/) and test -the deployment pipeline. When you're happy with the result, create the project on the official [PyPI repository](https://pypi.org/) -and remove the marked lines in `workflows/release.yml`. - -## Package release - -This setup uses [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning). -This means it's not necessary to commit the version in the code but the CI pipeline -will infer it from the git tag. - -To release a new version, just create a new release and tag in the GitHub repository, to: - -* Build and deploy the python package to PyPI -* Build and deploy a new version of the documentation to GitHub pages - -**IMPORTANT:** The default configuration requires the release name and the tag to follow -the convention `vX.X.X` (semantic versioning preceded by lowercase `v`). It will publish -the correct version on Pypi, omitting the `v` (ie. `v1.0.0` will publish `1.0.0`). - -This format can be customized, refer to [poetry-dynamic-versioning docs](https://github.com/mtkennerly/poetry-dynamic-versioning) - -## Commands for development - -All the common commands used during development can be run using make targets: - -* `make dev-dependencies`: Install dev requirements -* `make update-dependencies`: Update dev requirements -* `make fix`: Run code style and lint automatic fixes (where possible) -* `make test`: Run test suite against system python version -* `make check`: Run tests against all available python versions, code style and lint checks -* `make type`, `make format`, `make lint`, `make bandit`: Run the relevant check -* `make docs`: Render the mkdocs website locally +--8<-- "./README.md" diff --git a/pyproject.toml b/pyproject.toml index f0b9cd0..fecb142 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,11 +19,11 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Typing :: Typed" ] @@ -39,7 +39,7 @@ build-backend = "poetry_dynamic_versioning.backend" ############################ [tool.poetry.dependencies] -python = ">=3.8,<3.13" +python = ">=3.9,<3.14" [tool.poetry.group.dev] optional = true @@ -83,10 +83,11 @@ exclude_also = [ [tool.mypy] files = "bootstrap_python_package" -python_version = "3.8" +python_version = "3.9" [tool.pytest.ini_options] asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "function" minversion = "6.0" addopts = "-n auto --cov-report=term-missing" testpaths = [ @@ -95,7 +96,7 @@ testpaths = [ [tool.ruff] extend-exclude = ["docs", ".tox"] -target-version = "py38" +target-version = "py39" [tool.ruff.lint] select = [ diff --git a/tox.ini b/tox.ini index fda9829..ff1c841 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,11 @@ [tox] min_version = 4.0 env_list = + py313 py312 py311 py310 py39 - py38 typing lint format @@ -22,7 +22,7 @@ deps = commands = pytest -[testenv:py312] +[testenv:py313] ; Run with coverage in one python version to check coverage percentage commands = pytest --cov