diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 76f4340..3a21864 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,10 +3,5 @@ updates: - package-ecosystem: pip directory: "/" schedule: - interval: daily + interval: weekly open-pull-requests-limit: 10 - ignore: - - dependency-name: flake8-bugbear - versions: - - 21.3.1 - - 21.3.2 diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..1d154b0 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,53 @@ +name: build +on: + push: + pull_request: +jobs: + tests: + name: ${{ matrix.name }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - { name: "3.8", python: "3.8", tox: py38 } + - { name: "3.12", python: "3.12", tox: py312 } + - { name: "lowest", python: "3.8", tox: py38-lowest } + - { name: "dev", python: "3.12", tox: py312-marshmallowdev } + steps: + - uses: actions/checkout@v3.1.0 + - uses: actions/setup-python@v4.3.0 + with: + python-version: ${{ matrix.python }} + - run: python -m pip install --upgrade pip + - run: python -m pip install tox + - run: python -m tox -e${{ matrix.tox }} + # this duplicates pre-commit.ci, so only run it on tags + # it guarantees that linting is passing prior to a release + lint-pre-release: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.1.0 + - uses: actions/setup-python@v4.3.0 + with: + python-version: "3.11" + - run: python -m pip install --upgrade pip + - run: python -m pip install tox + - run: python -m tox -elint + release: + needs: [tests, lint-pre-release] + name: PyPI release + if: startsWith(github.ref, 'refs/tags') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.1.0 + - uses: actions/setup-python@v4.3.0 + - name: install requirements + run: python -m pip install build twine + - name: build dists + run: python -m build + - name: check package metadata + run: twine check dist/* + - name: publish + run: twine upload -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} dist/* diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index e973e20..0000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,78 +0,0 @@ -name: build -on: - push: - pull_request: - schedule: # nightly build - - cron: '0 0 * * *' - -jobs: -# enable the following mypy job once it is added to tox -# -# mypy: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v2 -# - uses: actions/setup-python@v2 -# - run: python -m pip install tox -# - run: python -m tox -e mypy - - test: - strategy: - matrix: - tox-env: ["py"] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - include: - - python-version: "3.11" - tox-env: "lint" - name: "lint" - - python-version: "3.8" # match readthedocs - tox-env: "docs" - name: "docs" - - python-version: "3.11" - tox-env: "py-marshmallowdev" - name: "test marshmallow 'dev' on py3.11" - - python-version: "3.7" - tox-env: "py-mindeps" - name: "test mindeps on py3.7" - name: "${{ matrix.name || format('test py{0}', matrix.python-version ) }}" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - run: python -m pip install tox - - run: python -m tox -e ${{ matrix.tox-env }} - -# TODO: -# the following config is copied from the webargs release process and should be applicable here -# however, it needs credentials in the project repo to publish, and it may be possible to refine -# this into something even better -# -# -# # this duplicates pre-commit.ci, so only run it on tags -# # it guarantees that linting is passing prior to a release -# lint-pre-release: -# if: startsWith(github.ref, 'refs/tags') -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v2 -# - uses: actions/setup-python@v2 -# - run: python -m pip install tox -# - run: python -m tox -e lint -# -# release: -# needs: [mypy, test, lint-pre-release] -# runs-on: ubuntu-latest -# if: startsWith(github.ref, 'refs/tags') -# steps: -# - uses: actions/checkout@v2 -# - uses: actions/setup-python@v2 -# - name: install requirements -# run: python -m pip install build twine -# - name: build dists -# run: python -m build -# - name: check package metadata -# run: twine check dist/* -# - name: publish -# run: twine upload -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} dist/* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aabb0ae..0444532 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,26 +1,26 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.15.0 hooks: - id: pyupgrade - args: [--py37-plus] + args: [--py38-plus] - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.21.0 + rev: 0.27.3 hooks: - id: check-github-workflows - id: check-readthedocs - repo: https://github.com/python/black - rev: 23.1.0 + rev: 23.12.1 hooks: - id: black language_version: python3 - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 7.0.0 hooks: - id: flake8 - additional_dependencies: [flake8-bugbear==23.1.20] + additional_dependencies: [flake8-bugbear==23.12.2] - repo: https://github.com/asottile/blacken-docs - rev: 1.13.0 + rev: 1.16.0 hooks: - id: blacken-docs - additional_dependencies: [black==23.1.0] + additional_dependencies: [black==23.12.1] diff --git a/.readthedocs.yml b/.readthedocs.yml index 695e9b5..4bab202 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,9 +1,13 @@ version: 2 sphinx: configuration: docs/conf.py -formats: all +formats: + - pdf +build: + os: ubuntu-22.04 + tools: + python: "3.11" python: - version: "3.8" install: - method: pip path: . diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ece9d06..df4ee88 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,15 @@ Changelog ========= +0.16.0 (unreleased) +******************* + +Support: + +* Support marshmallow-sqlalchemy>=0.29.0. +* Test against Python 3.12. +* Drop support for Python 3.7. + 0.15.0 (2023-04-05) ******************* diff --git a/README.rst b/README.rst index 8464038..0dec822 100644 --- a/README.rst +++ b/README.rst @@ -103,7 +103,7 @@ Project Links - Docs: https://flask-marshmallow.readthedocs.io/ - Changelog: http://flask-marshmallow.readthedocs.io/en/latest/changelog.html -- PyPI: https://pypi.python.org/pypi/flask-marshmallow +- PyPI: https://pypi.org/project/flask-marshmallow/ - Issues: https://github.com/marshmallow-code/flask-marshmallow/issues License @@ -119,8 +119,8 @@ MIT licensed. See the bundled `LICENSE

Useful Links

diff --git a/docs/_templates/side-secondary.html b/docs/_templates/side-secondary.html index 07daff3..640bbe9 100644 --- a/docs/_templates/side-secondary.html +++ b/docs/_templates/side-secondary.html @@ -18,7 +18,7 @@

Useful Links

diff --git a/docs/index.rst b/docs/index.rst index b803607..3c7484b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,7 @@ Flask-Marshmallow: Flask + marshmallow for beautiful APIs :ref:`changelog ` // `github `_ // -`pypi `_ // +`pypi `_ // `issues `_ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4c6215c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.black] +line-length = 88 +target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] diff --git a/setup.cfg b/setup.cfg index 2f78e75..1d9ccbf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,11 +1,10 @@ -[bdist_wheel] -universal = 1 +[metadata] +license_files = LICENSE [flake8] -ignore = E203, E266, E501, W503, B907 -max-line-length = 110 +max-line-length = 90 max-complexity = 18 -select = B,C,E,F,W,T4,B9 +extend-ignore = E203, E266, E501, E731, B903 [tool:pytest] filterwarnings = diff --git a/setup.py b/setup.py index a62d631..1e01dde 100644 --- a/setup.py +++ b/setup.py @@ -5,12 +5,12 @@ EXTRAS_REQUIRE = { "sqlalchemy": [ "flask-sqlalchemy>=3.0.0", - "marshmallow-sqlalchemy>=0.28.2", + "marshmallow-sqlalchemy>=0.29.0", ], - "docs": ["marshmallow-sqlalchemy>=0.13.0", "Sphinx==7.1.2", "sphinx-issues==3.0.1"], + "docs": ["marshmallow-sqlalchemy>=0.19.0", "Sphinx==7.2.6", "sphinx-issues==3.0.1"], } -EXTRAS_REQUIRE["tests"] = EXTRAS_REQUIRE["sqlalchemy"] + ["pytest", "mock"] -EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + ["tox", "pre-commit"] +EXTRAS_REQUIRE["tests"] = EXTRAS_REQUIRE["sqlalchemy"] + ["pytest"] +EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + ["tox", "pre-commit~=3.5"] REQUIRES = ["Flask", "marshmallow>=3.0.0", "packaging>=17.0"] @@ -54,19 +54,18 @@ def read(fname): license="MIT", zip_safe=False, keywords="flask-marshmallow", - python_requires=">=3.7", + python_requires=">=3.8", classifiers=[ - "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "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", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", ], test_suite="tests", diff --git a/src/flask_marshmallow/__init__.py b/src/flask_marshmallow/__init__.py index ad7a2f2..c034768 100755 --- a/src/flask_marshmallow/__init__.py +++ b/src/flask_marshmallow/__init__.py @@ -24,7 +24,8 @@ except ImportError: warnings.warn( "Flask-SQLAlchemy integration requires " - "marshmallow-sqlalchemy to be installed." + "marshmallow-sqlalchemy to be installed.", + stacklevel=2, ) else: has_sqla = True diff --git a/tests/markers.py b/tests/markers.py index ffc32d2..04201a7 100644 --- a/tests/markers.py +++ b/tests/markers.py @@ -1,9 +1,9 @@ import pytest -import flask +import importlib.metadata from packaging.version import Version -flask_version = Version(flask.__version__) +flask_version = Version(importlib.metadata.version("flask")) flask_1_req = pytest.mark.skipif( flask_version < Version("0.11"), reason="flask 0.11 or higher required" ) diff --git a/tests/test_sqla.py b/tests/test_sqla.py index f6730a6..694e45e 100644 --- a/tests/test_sqla.py +++ b/tests/test_sqla.py @@ -174,9 +174,6 @@ class Meta: # this is triggered by marshmallow-sqlalchemy on sqlalchemy v1.4.x on the current version # it should be fixed in an upcoming marshmallow-sqlalchemy release @requires_sqlalchemyschema - @pytest.mark.filterwarnings( - "ignore:Deprecated API features detected:sqlalchemy.exc.LegacyAPIWarning" - ) def test_hyperlink_related_field(self, extma, models, db, extapp): class BookSchema(extma.SQLAlchemySchema): class Meta: diff --git a/tox.ini b/tox.ini index 731e7b8..ebb40b9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,9 @@ [tox] envlist= lint - py{37,38,39,310,311} - py37-lowest - py311-marshmallowdev + py{38,39,310,311,312} + py312-marshmallowdev + py38-lowest docs [testenv] @@ -11,11 +11,14 @@ extras = tests deps = marshmallowdev: https://github.com/marshmallow-code/marshmallow/archive/dev.tar.gz lowest: marshmallow==3.0.0 - lowest: marshmallow-sqlalchemy==0.24.0 + lowest: marshmallow-sqlalchemy==0.29.0 + lowest: flask-sqlalchemy==3.0.0 + ; lowest version supported by marshmallow-sqlalchemy + lowest: sqlalchemy==1.4.40 commands = pytest {posargs} [testenv:lint] -deps = pre-commit~=2.4 +deps = pre-commit~=3.5 skip_install = true commands = pre-commit run --all-files