Skip to content

Commit

Permalink
Merge pull request #223 from willkg/221-python312
Browse files Browse the repository at this point in the history
add support for python 3.12 (#221)
  • Loading branch information
willkg committed Oct 3, 2023
2 parents deff88f + 23ea240 commit ceb478e
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

name: Python ${{ matrix.python-version}}
steps:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test: ## Run tests, linting, and static typechecking
lint: ## Lint and black reformat files
# NOTE(willkg): Make sure this matches what's in tox.ini.
black src setup.py tests docs examples
tox -e py37-lint
tox -e py38-lint

.PHONY: clean
clean: ## Clean build artifacts
Expand Down
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ Run::

Some configuration environments require additional dependencies::


# For INI support
$ pip install 'everett[ini]'

# for YAML support
$ pip install 'everett[yaml]'

Additionally, if you want to use the Sphinx extension to document
your configuration, you need to add Sphinx::

# to use the Sphinx extension
$ pip install 'everett[sphinx]'

Quick start
===========
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ envlist =
py39
py310
py311
py312
py38-doctest
py38-lint
py38-typecheck
Expand All @@ -60,6 +61,7 @@ python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312
[testenv]
deps = -rrequirements-dev.txt
Expand All @@ -73,7 +75,7 @@ commands = pytest --doctest-modules src/
basepython = python3.8
changedir = {toxinidir}
commands =
black --check src setup.py tests docs examples
black --diff setup.py tests docs examples
ruff src setup.py tests docs examples
[testenv:py38-typecheck]
Expand Down
22 changes: 11 additions & 11 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Requirements file for developing on Everett.
-e .[ini,yaml]
-e .[ini,yaml,sphinx]

black==23.1.00
black==23.9.1
check-manifest==0.49
cogapp==3.3.0
mypy==1.1.1
pytest==7.2.2
ruff==0.0.262
tox==4.4.7
tox-gh-actions==3.1.0
mypy==1.5.1
pytest==7.4.2
ruff==0.0.292
tox==4.11.3
tox-gh-actions==3.1.3
twine==4.0.2
types-PyYAML==6.0.12.8
types-PyYAML==6.0.12.12

# These require Python 3.8+ before we can update them
Sphinx==5.3.0
sphinx_rtd_theme==1.0.0
# We need to drop support for Python 3.8 before we can update this further.
Sphinx==6.2.1
sphinx_rtd_theme==1.3.0
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def get_file(fn):

INSTALL_REQUIRES = []
EXTRAS_REQUIRE = {
"sphinx": ["sphinx"],
"ini": ["configobj"],
"yaml": ["PyYAML"],
}
Expand Down Expand Up @@ -56,6 +57,9 @@ def get_file(fn):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries :: Python Modules",
],
project_urls={
"Documentation": "https://everett.readthedocs.io/",
Expand Down
12 changes: 9 additions & 3 deletions src/everett/sphinxext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

"""Sphinx extension for auto-documenting components with configuration."""
"""Sphinx extension for auto-documenting components with configuration.
To use this, you must install the optional requirements::
$ pip install 'everett[sphinx]'
"""

import ast
from importlib import import_module
Expand Down Expand Up @@ -705,12 +711,12 @@ def extract_configuration(
# }
for key, val in zip(node.keys, node.values):
if (
isinstance(key, ast.Str)
isinstance(key, ast.Constant)
and isinstance(val, ast.Call)
and isinstance(val.func, ast.Name)
and val.func.id == variable_name
):
config_nodes.append((key.s, val))
config_nodes.append((key.value, val))

CONFIG_ARGS = [
"key",
Expand Down

0 comments on commit ceb478e

Please sign in to comment.