Skip to content

Commit

Permalink
Version 7.3.0 (#283)
Browse files Browse the repository at this point in the history
* Adding tests and Cython releases for Python 3.13
* Fixing #281 consistent error message about missing YAML parser (thanks to J vanBemmel)
* Removing support for Python 3.8 as it is EOL

---------

Co-authored-by: J vanBemmel <jvb127@gmail.com>
  • Loading branch information
cdgriffith and jbemmel authored Dec 10, 2024
1 parent a23451d commit 37b9181
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 45 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'

- name: Install Dependencies
run: |
Expand All @@ -38,8 +38,8 @@ jobs:
deploy-cython:
strategy:
matrix:
os: [macos-11, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine Cython==3.0.0 --upgrade
pip install setuptools wheel twine Cython>=3.0.11 --upgrade
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand All @@ -64,20 +64,21 @@ jobs:
runs-on: ubuntu-latest
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: Build wheels
run: |
python -m pip install --upgrade pip
pip install cibuildwheel setuptools wheel
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64
CIBW_BEFORE_BUILD: pip install Cython==3.0.0
CIBW_BEFORE_TEST: pip install -r requirements.txt -r requirements-test.txt setuptools wheel twine
CIBW_BUILD: cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64
CIBW_BEFORE_BUILD: pip install Cython>=3.0.11 setuptools wheel
CIBW_BEFORE_TEST: pip install -r requirements.txt -r requirements-test.txt setuptools wheel twine Cython>=3.0.11
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_COMMAND: pytest {package}/test -vv

- name: Publish
Expand Down
47 changes: 24 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ jobs:
package-checks:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8"]
os: [ubuntu-latest, macos-11, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: package-check-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
# - uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: package-check-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
pip install coveralls flake8 flake8-print mypy setuptools wheel twine Cython==3.0.0
pip install coveralls flake8 flake8-print mypy setuptools wheel twine Cython>=3.0.11
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors, undefined names or print statements
Expand Down Expand Up @@ -67,25 +67,26 @@ jobs:
runs-on: ubuntu-latest
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"

- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: package-manylinux-check-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
# - uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: package-manylinux-check-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}

- name: Build wheels
run: |
python -m pip install --upgrade pip
pip install cibuildwheel
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64
CIBW_BEFORE_BUILD: pip install Cython==3.0.0
CIBW_BEFORE_TEST: pip install -r requirements.txt -r requirements-test.txt setuptools wheel twine
CIBW_BUILD: cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64
CIBW_BEFORE_BUILD: pip install Cython>=3.0.11 setuptools wheel
CIBW_BEFORE_TEST: pip install -r requirements.txt -r requirements-test.txt setuptools wheel twine Cython>=3.0.11
CIBW_BUILD_VERBOSITY: 1
CIBW_TEST_COMMAND: pytest {package}/test -vv

- name: Upload wheel artifact
Expand All @@ -97,25 +98,25 @@ jobs:
test:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-11, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: test-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
# - uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: test-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
pip install setuptools wheel Cython==3.0.0
pip install setuptools wheel Cython>=3.0.11
python setup.py build_ext --inplace
- name: Test with pytest
env:
Expand Down
6 changes: 3 additions & 3 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:
# Identify invalid files
- id: check-ast
Expand Down Expand Up @@ -29,7 +29,7 @@ repos:
exclude: ^test/data/.+

- repo: https://github.com/ambv/black
rev: 24.4.2
rev: 24.10.0
hooks:
- id: black
args: [--config=.black.toml]
Expand All @@ -51,7 +51,7 @@ repos:
always_run: true

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.10.0'
rev: 'v1.13.0'
hooks:
- id: mypy
types: [python]
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

Version 7.3.0
-------------

* Adding tests and Cython releases for Python 3.13
* Fixing #281 consistent error message about missing YAML parser (thanks to J vanBemmel)
* Removing support for Python 3.8 as it is EOL

Version 7.2.0
-------------

Expand Down
2 changes: 1 addition & 1 deletion box/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

__author__ = "Chris Griffith"
__version__ = "7.2.0"
__version__ = "7.3.0"

from box.box import Box
from box.box_list import BoxList
Expand Down
10 changes: 6 additions & 4 deletions box/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
except ImportError:
pyyaml_available = False

MISSING_PARSER_ERROR = "No YAML Parser available, please install ruamel.yaml>=0.17 or PyYAML"

toml_read_library: Optional[Any] = None
toml_write_library: Optional[Any] = None
toml_decode_error: Optional[Callable] = None
Expand Down Expand Up @@ -196,7 +198,7 @@ def _to_yaml(
elif pyyaml_available:
return yaml.dump(obj, stream=f, default_flow_style=default_flow_style, **yaml_kwargs)
else:
raise BoxError("No YAML Parser available, please install ruamel.yaml>0.17 or PyYAML")
raise BoxError(MISSING_PARSER_ERROR)

else:
if ruamel_available:
Expand All @@ -210,7 +212,7 @@ def _to_yaml(
elif pyyaml_available:
return yaml.dump(obj, default_flow_style=default_flow_style, **yaml_kwargs)
else:
raise BoxError("No YAML Parser available, please install ruamel.yaml>0.17 or PyYAML")
raise BoxError(MISSING_PARSER_ERROR)


def _from_yaml(
Expand All @@ -237,7 +239,7 @@ def _from_yaml(
kwargs["Loader"] = yaml.SafeLoader
data = yaml.load(f, **kwargs)
else:
raise BoxError("No YAML Parser available, please install ruamel.yaml>0.15 or PyYAML")
raise BoxError(MISSING_PARSER_ERROR)
elif yaml_string:
if ruamel_available:
yaml_loader = YAML(typ=ruamel_typ)
Expand All @@ -249,7 +251,7 @@ def _from_yaml(
kwargs["Loader"] = yaml.SafeLoader
data = yaml.load(yaml_string, **kwargs)
else:
raise BoxError("No YAML Parser available, please install ruamel.yaml>0.17 or PyYAML")
raise BoxError(MISSING_PARSER_ERROR)
else:
raise BoxError("from_yaml requires a string or filename")
return data
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Files needed for pre-commit hooks
black>=23.1.0
Cython==3.0.0
Cython>=3.0.11
mypy>=1.0.1
pre-commit>=2.21.0
setuptools>=75.6.0
4 changes: 2 additions & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
coverage>=5.0.4
coverage>=7.6.9
msgpack>=1.0
pytest>=7.1.3
pytest-cov>=2.8.1
pytest-cov<6.0.0
ruamel.yaml>=0.17
tomli>=1.2.3; python_version < '3.11'
tomli-w>=1.0.0
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@
py_modules=["box"],
packages=["box"],
ext_modules=extra,
python_requires=">=3.8",
python_requires=">=3.9",
include_package_data=True,
platforms="any",
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
Expand Down

0 comments on commit 37b9181

Please sign in to comment.