Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- name: Set up cache
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- name: Pip Update
run: |
make -s update-pip
Expand Down
47 changes: 33 additions & 14 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,49 @@ on:
- main

jobs:
test:
# test:
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v3
# - name: Disable Logger Outputs
# run: |
# sed -i "s/log_cli = true/log_cli = false/" pyproject.toml
# - name: Install the latest version of rye
# uses: eifinger/setup-rye@v1
# with:
# enable-cache: true
# cache-prefix: 'rye-venv-cache'
# - name: Install the Project with Test Dependencies
# run: |
# rye sync --no-lock
# - name: Test the Project
# run: |
# python -m pytest -n auto

test_matrix:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
# os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ubuntu-22.04
python-version: ['3.11', '3.12']
os: [ubuntu-22.04] # windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Disable Logger Outputs
run: |
sed -i "s/log_cli = true/log_cli = false/" pyproject.toml
- name: Pip Update
- name: Install the latest version of rye
uses: eifinger/setup-rye@v1
with:
enable-cache: true
cache-prefix: 'rye-venv-cache'
- name: Pin Python Version - ${{ matrix.python-version }}
run: |
make -s update-pip
rye pin ${{ matrix.python-version }}
- name: Install the Project with Test Dependencies
run: |
make -s install-test
# - name: Show dependencies
# run: python -m pip list
rye sync --no-lock
- name: Test the Project
run: make -s test-parallel
run: |
python -m pytest -n auto
# - name: Publish code coverage
# uses: codecov/codecov-action@v3
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ stages:
- package
- doc

image: python:3.10
image: python:3.11

lint:
stage: lint
Expand All @@ -26,7 +26,7 @@ tests:
echo "*********** Pip Update ***********"
make -s update-pip
echo "*********** Install the Project with Test Dependencies ***********"
make -s install-test
make -s install
echo "*********** Test the Project ***********"
make -s test-parallel
only:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
- id: python-use-type-annotations

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.3
rev: v0.1.11
hooks:
# Run the Ruff linter.
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10.11
3.11.6
10 changes: 8 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
// "source.fixAll": true,
"source.organizeImports.ruff": true,
// "source.fixAll": "always",
"source.organizeImports.ruff": "explicit",
},
"editor.rulers": [
{
Expand All @@ -22,4 +22,10 @@
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
// "python.testing.pytestArgs": [],
"notebook.formatOnSave.enabled": true,
"notebook.codeActionsOnSave": {
// "source.fixAll.ruff": "always",
"source.organizeImports.ruff": "explicit",
},
"evenBetterToml.formatter.reorderKeys": true,
}
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SHELL=/bin/bash
ROOT_DIR=python-template
PACKAGE=src/python_template
PYTHON = python
PYTHON_VERSION=3.10
PYTHON_VERSION=3.11
DOC_DIR=./docs
TEST_DIR=./tests
TEST_MARKER=placeholder
Expand Down Expand Up @@ -46,6 +46,7 @@ install-base: ## Installs only package dependencies
rye sync --no-dev --no-lock

install: ## Installs the development version of the package
$(MAKE) install-rye
rye sync --no-lock
$(MAKE) install-precommit

Expand All @@ -59,7 +60,7 @@ install-precommit: ## Install pre-commit hooks
pre-commit install

install-lint:
pip install ruff==0.1.3
pip install ruff==0.1.11

install-doc:
pip install mkdocs mkdocs-material mkdocstrings[python]
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_BASE_IMAGE=3.10-slim-bookworm
ARG PYTHON_BASE_IMAGE=3.11-slim-bookworm
ARG APP_NAME=python_template

#
Expand Down
2 changes: 1 addition & 1 deletion docs/poetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ poetry add <package>
- Add package with specific version constraint

```bash
poetry add ruff==0.1.3
poetry add ruff==0.1.11
```

- Add package from git
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
description = "Python Template"

# NOTE: Overwrites .python-version
# requires-python = ">=3.9,<3.12"
# requires-python = ">=3.11,<3.13"

authors = [
{name = "template", email = "template@github.com"},
Expand All @@ -29,9 +29,8 @@ classifiers = [
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

dependencies = []
Expand All @@ -40,7 +39,7 @@ dependencies = []
managed = true
dev-dependencies = [
"pre-commit",
"ruff==0.1.3",
"ruff==0.1.11",
"mypy",
"scalene~=1.5.21.2",
## DOCS
Expand Down Expand Up @@ -89,7 +88,7 @@ log_cli_date_format = "%Y-%m-%d %H:%M:%S"

[tool.ruff]
target-version = "py310"
# required-version = "0.1.3"
# required-version = "0.1.11"
line-length = 88
src = ["src"]
select = [
Expand Down Expand Up @@ -119,6 +118,7 @@ unfixable = [
]
ignore-init-module-imports = true
# ignore = []
extend-include = ["*.ipynb"]
extend-ignore = [
"E501", # Line too long, handled by ruff formatter
"D107", # "Missing docstring in __init__",
Expand Down
66 changes: 32 additions & 34 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,66 +7,64 @@
# all-features: false

-e file:.
babel==2.13.1
certifi==2023.7.22
babel==2.14.0
certifi==2023.11.17
cfgv==3.4.0
charset-normalizer==3.3.1
charset-normalizer==3.3.2
click==8.1.7
cloudpickle==3.0.0
colorama==0.4.6
coverage==7.3.2
distlib==0.3.7
exceptiongroup==1.1.3
coverage==7.4.0
distlib==0.3.8
execnet==2.0.2
filelock==3.12.4
filelock==3.13.1
ghp-import==2.1.0
griffe==0.36.7
identify==2.5.30
idna==3.4
griffe==0.38.1
identify==2.5.33
idna==3.6
iniconfig==2.0.0
jinja2==3.1.2
markdown==3.5
markdown==3.5.1
markdown-it-py==3.0.0
markupsafe==2.1.3
mdurl==0.1.2
mergedeep==1.3.4
mkdocs==1.5.3
mkdocs-autorefs==0.5.0
mkdocs-material==9.4.6
mkdocs-material-extensions==1.3
mkdocstrings==0.23.0
mkdocstrings-python==1.7.3
mypy==1.6.1
mkdocs-material==9.5.3
mkdocs-material-extensions==1.3.1
mkdocstrings==0.24.0
mkdocstrings-python==1.7.5
mypy==1.8.0
mypy-extensions==1.0.0
nodeenv==1.8.0
packaging==23.2
paginate==0.5.6
pathspec==0.11.2
platformdirs==3.11.0
pathspec==0.12.1
platformdirs==4.1.0
pluggy==1.3.0
pre-commit==3.5.0
psutil==5.9.6
pygments==2.16.1
pymdown-extensions==10.3.1
pre-commit==3.6.0
psutil==5.9.7
pygments==2.17.2
pymdown-extensions==10.7
pynvml==11.4.1
pytest==7.4.2
pytest==7.4.4
pytest-cov==4.1.0
pytest-rerunfailures==12.0
pytest-xdist==3.3.1
pytest-rerunfailures==13.0
pytest-xdist==3.5.0
python-dateutil==2.8.2
pyyaml==6.0.1
pyyaml-env-tag==0.1
regex==2023.10.3
regex==2023.12.25
requests==2.31.0
rich==13.6.0
ruff==0.1.3
rich==13.7.0
ruff==0.1.11
scalene==1.5.21.4
six==1.16.0
tomli==2.0.1
typing-extensions==4.8.0
urllib3==2.0.7
virtualenv==20.24.6
typing-extensions==4.9.0
urllib3==2.1.0
virtualenv==20.25.0
watchdog==3.0.0
wheel==0.41.2
wheel==0.42.0
# The following packages are considered to be unsafe in a requirements file:
setuptools==68.2.2
setuptools==69.0.3
4 changes: 2 additions & 2 deletions src/python_template/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Python template package."""
import pkg_resources # type: ignore
from importlib.metadata import version

# Fetches the version of the package as defined in pyproject.toml
__version__ = pkg_resources.get_distribution("python_template").version
__version__ = version("python_template")
10 changes: 4 additions & 6 deletions src/python_template/placeholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
- `divide(a, b)` - Returns the quotient of two numbers.
"""

from typing import Union


def add(a: Union[float, int], b: Union[float, int]) -> float:
def add(a: float | int, b: float | int) -> float:
"""Compute and return the sum of two numbers.

Examples:
Expand All @@ -44,7 +42,7 @@ def add(a: Union[float, int], b: Union[float, int]) -> float:
return float(a + b)


def subtract(a: Union[float, int], b: Union[float, int]) -> float:
def subtract(a: float | int, b: float | int) -> float:
"""Compute and return the substaction of two numbers.

Examples:
Expand All @@ -63,7 +61,7 @@ def subtract(a: Union[float, int], b: Union[float, int]) -> float:
return float(a - b)


def multiply(a: Union[float, int], b: Union[float, int]) -> float:
def multiply(a: float | int, b: float | int) -> float:
"""Compute and return the multiplication of two numbers.

Examples:
Expand All @@ -82,7 +80,7 @@ def multiply(a: Union[float, int], b: Union[float, int]) -> float:
return float(a * b)


def divide(a: Union[float, int], b: Union[float, int]) -> float:
def divide(a: float | int, b: float | int) -> float:
"""Compute and return the division of two numbers.

Examples:
Expand Down