Skip to content

Commit

Permalink
Adds Python 3.13 support. Modernizes tooling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daverball committed Jan 15, 2025
1 parent ca2a967 commit df47d56
Show file tree
Hide file tree
Showing 10 changed files with 272 additions and 64 deletions.
16 changes: 0 additions & 16 deletions .bumpversion.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/python-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
python-version: [3.9, '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install tox tox-gh-actions tox-uv
- name: Test with tox without uploading coverage
run: tox
4 changes: 2 additions & 2 deletions .github/workflows/python-tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
python-version: [3.9, '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install tox tox-gh-actions tox-uv
- name: Test with tox and upload coverage results
run: tox -- --codecov --codecov-token=${{ secrets.CODECOV_TOKEN }}
13 changes: 9 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: '^(.bumpversion.cfg)$'
Expand All @@ -13,20 +13,25 @@ repos:
hooks:
- id: rst-linter
files: '^[A-Z]+\.rst$'
additional_dependencies:
- types_requests
- repo: https://github.com/seantis/pre-commit-hooks
rev: v1.1.0
hooks:
- id: nocheckin
exclude: .pre-commit-config.yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
hooks:
- id: ruff
args: [ "--fix" ]
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies:
- flake8-type-checking
files: '^(sedate/.*|tests/.*)\.py$'
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
rev: v1.14.1
hooks:
- id: mypy
files: '^sedate/.*\.py$'
Expand Down
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
---------

- Adds support for Python 3.13. Drops support for Python 3.8
[Daverball]

1.1.1 (2024-08-13)
~~~~~~~~~~~~~~~~~~~

Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ Run the Tests

Install tox and run it::

pip install tox
pip install tox tox-uv
tox

Limit the tests to a specific python version::

tox -e py37
tox -e py311

Conventions
-----------
Expand All @@ -59,9 +59,9 @@ Development

Setup your local development environment::

python3.8 -m venv venv
python3 -m venv venv
source venv/bin/activate
pip install .[dev]
pip install -e .[dev]
pre-commit install

License
Expand Down
226 changes: 212 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,32 @@ exclude_lines = [
"raise NotImplementedError"
]

[tool.bumpversion]
current_version = "1.1.1"
commit = true
message = "Release {new_version}"
tag = true
tag_message = "Release {new_version}"

[[tool.bumpversion.files]]
filename = "sedate/__init__.py"
search= "__version__ = '{current_version}'"
replace= "__version__ = '{new_version}'"

[[tool.bumpversion.files]]
filename = "HISTORY.rst"
search = """
---------
"""
replace = """
---------
{new_version} ({now:%d.%m.%Y})
~~~~~~~~~~~~~~~~~~~
"""

[tool.mypy]
python_version = 3.8
python_version = 3.9
follow_imports = "silent"
warn_redundant_casts = true
warn_unreachable = true
Expand All @@ -38,27 +62,192 @@ disallow_any_generics = true
disallow_untyped_defs = true
mypy_path = "$MYPY_CONFIG_FILE_DIR"

[[tool.mypy.overrides]]
module = []
ignore_missing_imports = true
[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
src = ["src", "tests"]
include = [
"pyproject.toml",
"sedate/**/*.py",
"tests/**/*.py",
"stubs/**/*.pyi"
]
line-length = 79
indent-width = 4
target-version = "py39"

[tool.ruff.lint]
select = [
"B0",
"B904",
"B909",
"C4",
"COM818",
"D2",
"D301",
"D4",
"E",
"F",
"FLY002",
"I002",
"ISC",
"N",
"PERF",
"PGH004",
"PIE",
"PYI",
"Q",
"RUF",
"SIM",
"SLOT",
"UP",
"W"
]
ignore = [
"B007",
"C420",
"D200",
"D201",
"D202",
"D204",
"D205",
"D209",
"D210",
"D211",
"D400",
"D401",
"D412",
"E226",
"E402",
"E711",
"E712",
"E741",
"N818",
"PYI019",
"PYI041",
"RUF012",
"RUF013",
"RUF021",
"RUF022",
"RUF023",
"RUF031",
"RUF052",
"RUF056",
"SIM103",
"SIM105",
"SIM108",
"SIM110",
"SIM118",
"SIM210",
"SIM910",
"UP009",
"UP012",
"UP032",
"UP038",
]
unfixable = []
external = ["TC"]
allowed-confusables = ["×"]
preview = true

[tool.ruff.lint.extend-per-file-ignores]
"tests/**/*.py" = [
"C4",
"D",
"FLY002",
"I002",
"ISC",
"N",
"Q",
"PERF",
"PGH",
"PIE",
"PYI",
"RUF",
"SIM",
"UP",
]

[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]

[tool.ruff.lint.pep8-naming]
extend-ignore-names = [
"afterFlowable",
"HSTORE",
"sortKey",
"URL",
"UUID"
]
classmethod-decorators = [
# NOTE: We can potentially get rid some of these with SQLAlchemy 2.0
# since they should cleanly combine with classmethod
"declared_attr",
"expression",
"comparator",
]

[tool.ruff.lint.pydocstyle]
convention = "pep257"
ignore-decorators = ["typing.overload"]

[tool.ruff.lint.flake8-quotes]
avoid-escape = true
docstring-quotes = "double"
inline-quotes = "single"
multiline-quotes = "double"

[tool.ruff.format]
quote-style = "single"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "lf"
docstring-code-format = true
docstring-code-line-length = "dynamic"

[tool.tox]
legacy_tox_ini = """
[tox]
isolated_build = True
envlist = py37,py38,py39,py310,lint,bandit,mypy
envlist = py39,py310,py311,py312,py313,lint,bandit,mypy
[gh-actions]
python =
3.8: py38,flake8,bandit,mypy
3.9: py39
3.10: py310
3.11: py310
3.12: py310
3.11: py311,flake8,bandit,mypy
3.12: py312
3.13: py313
[testenv]
setenv =
py{38,39,310,311,312}: COVERAGE_FILE = .coverage.{envname}
py{39,310,311,312,313}: COVERAGE_FILE = .coverage.{envname}
deps =
coverage[toml]
pytest
Expand All @@ -67,20 +256,29 @@ deps =
commands = py.test --cov={envsitepackagesdir}/sedate --cov-report= {posargs}
[testenv:lint]
basepython = python3.8
basepython = python3.11
deps =
flake8
commands = flake8 sedate/ tests/
flake8-type-checking
ruff
commands =
ruff check
flake8 sedate/ tests/
[testenv:mypy]
basepython = python3.8
basepython = python3.11
deps =
mypy
types-pytz
commands = mypy -p sedate
commands =
mypy -p sedate --python-version 3.9
mypy -p sedate --python-version 3.10
mypy -p sedate --python-version 3.11
mypy -p sedate --python-version 3.12
mypy -p sedate --python-version 3.13
[testenv:bandit]
basepython = python3.8
basepython = python3.11
deps =
bandit[toml]
commands = bandit -q -c pyproject.toml -r sedate/
Expand Down
Loading

0 comments on commit df47d56

Please sign in to comment.