Skip to content

Commit

Permalink
Add support for 3.12, drop 3.9
Browse files Browse the repository at this point in the history
Also bump package versions
  • Loading branch information
treykeown committed May 10, 2024
1 parent 1268ab7 commit c9f13c7
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: 3.11
python-version: 3.12

- name: Install dependencies
run: |
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ Install using `pip install arguably`. If you want to install using `conda`, plea

## Dependencies

All of `arguably` is built on top of `argparse`. It has two dependencies:
All of `arguably` is built on top of `argparse`. It has one dependency:

* `docstring-parser` for parsing function docstrings
* `typing-extensions` for `Annotated[]` support in Python 3.8 (only needed for that version)

## Contributing

Expand Down
6 changes: 1 addition & 5 deletions arguably/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@

from docstring_parser import parse as docparse

# Annotated is 3.9 and up
if sys.version_info >= (3, 9):
from typing import Annotated, get_type_hints, get_args, get_origin # noqa
else: # pragma: no cover
from typing_extensions import Annotated, get_type_hints, get_args, get_origin # noqa
from typing import Annotated, get_type_hints, get_args, get_origin # noqa

# UnionType is the new type for the `A | B` type syntax, which is 3.10 and up
if sys.version_info >= (3, 10):
Expand Down
8 changes: 4 additions & 4 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ If you want to invoke them manually, from the project root directory:
### Testing

Originally, tests were only conducted through directly running `pytest`. Now, in order to support multiple Python
versions, `nox` is used to automatically test Python 3.8 through 3.11. Running all the tests for all versions takes a
versions, `nox` is used to automatically test Python 3.9 through 3.12. Running all the tests for all versions takes a
bit of time, so during normal development I directly run `pytest` and only run `nox` at the very end, before pushing. To
invoke each, from the project root directory:

* `pytest test --cov arguably --cov-report html` (will put a coverage report in the `htmlcov/` directory)
* `nox` (automatically runs `noxfile.py`)

`nox` will require extra setup. You'll need to install Python versions 3.8 through 3.11 using `pyenv`:
`nox` will require extra setup. You'll need to install Python versions 3.9 through 3.12 using `pyenv`:

* `pyenv install 3.11 3.10 3.9 3.8`
* `pyenv global 3.11 3.10 3.9 3.8`
* `pyenv install 3.12 3.11 3.10 3.9`
* `pyenv global 3.12 3.11 3.10 3.9`

### Building Docs

Expand Down
3 changes: 1 addition & 2 deletions etc/pypi/PYPI_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ Install using `pip install arguably`. If you want to install using `conda`, plea

## Dependencies

All of `arguably` is built on top of `argparse`. It has two dependencies:
All of `arguably` is built on top of `argparse`. It has one dependency:

* `docstring-parser` for parsing function docstrings
* `typing-extensions` for `Annotated[]` support in Python 3.8 (only needed for that version)

## Contributing

Expand Down
7 changes: 1 addition & 6 deletions mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,11 @@
import os
import shutil
import subprocess
import sys
from contextlib import contextmanager
from pathlib import Path
from typing import Any, Tuple, Iterator, List

# Annotated is 3.9 and up
if sys.version_info >= (3, 9):
from typing import Annotated
else:
from typing_extensions import Annotated
from typing import Annotated

import arguably

Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
nox.options.sessions = ["test"]


@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
@nox.session(python=["3.9", "3.10", "3.11", "3.12"])
def test(session: nox.Session) -> None:
session.run("poetry", "install", external=True)
session.run("ruff", ".")
session.run("ruff", "check", ".")
session.run("mypy", "arguably/")
session.run("pytest", "test", "--cov", "arguably", "--cov-report", "html", "--cov-report", "json")

Expand Down
2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true
19 changes: 9 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@ homepage = "https://treykeown.github.io/arguably/"
repository = "https://github.com/treykeown/arguably"

[tool.poetry.dependencies]
python = "^3.8"
docstring-parser = "^0.15"
typing-extensions = {version = "^4.6.3", python = ">=3.8,<3.9" }
python = "^3.9"
docstring-parser = "^0.16"

[tool.poetry.group.dev.dependencies]
black = "^23.3.0"
black = "^24.4.2"
mypy = "^1.3.0"
ruff = "^0.0.263"
pre-commit = "^3.3.2"
pytest = "^7.3.1"
pytest-cov = "^4.1.0"
ruff = "^0.4.4"
pre-commit = "^3.7.0"
pytest = "^8.2.0"
pytest-cov = "^5.0.0"
pytest-randomly = "^3.12.0"
nox = "^2023.4.22"
nox = "^2024.4.15"

[tool.poetry.group.docs.dependencies]
mkdocs = "^1.4.3"
mkdocstrings = {extras = ["python"], version = "^0.22.0"}
mkdocstrings = {extras = ["python"], version = "^0.25.1"}
mkdocs-material = "^9.1.15"

[build-system]
Expand Down
6 changes: 1 addition & 5 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
import arguably
from . import MANUAL, Permissions, PermissionsAlt, HiBye

# Annotated is 3.9 and up
if sys.version_info >= (3, 9):
from typing import Annotated
else:
from typing_extensions import Annotated
from typing_extensions import Annotated


########################################################################################################################
Expand Down

0 comments on commit c9f13c7

Please sign in to comment.