Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev chores #278

Merged
merged 8 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
53 changes: 53 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
- uses: actions/[email protected]
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/[email protected]
- uses: actions/[email protected]
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/[email protected]
- uses: actions/[email protected]
- 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/*
78 changes: 0 additions & 78 deletions .github/workflows/build.yaml

This file was deleted.

16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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]
8 changes: 6 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -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: .
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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)
*******************

Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -119,8 +119,8 @@ MIT licensed. See the bundled `LICENSE <https://github.com/marshmallow-code/flas
:target: https://pypi.org/project/flask-marshmallow/
:alt: Latest version

.. |build-status| image:: https://github.com/marshmallow-code/flask-marshmallow/workflows/build/badge.svg?event=push
:target: https://github.com/marshmallow-code/flask-marshmallow/actions?query=workflow%3Abuild
.. |build-status| image:: https://github.com/marshmallow-code/flask-marshmallow/actions/workflows/build-release.yml/badge.svg
:target: https://github.com/marshmallow-code/flask-marshmallow/actions/workflows/build-release.yml
:alt: Build status

.. |docs| image:: https://readthedocs.org/projects/flask-marshmallow/badge/
Expand Down
2 changes: 1 addition & 1 deletion docs/_templates/side-primary.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1><a href="{{ pathto(master_doc) }}">

<h3>Useful Links</h3>
<ul>
<li><a href="http://pypi.python.org/pypi/flask-marshmallow">Flask-Marshmallow @ PyPI</a></li>
<li><a href="https://pypi.org/project/flask-marshmallow/">Flask-Marshmallow @ PyPI</a></li>
<li><a href="http://github.com/marshmallow-code/flask-marshmallow">Flask-Marshmallow @ GitHub</a></li>
<li><a href="http://github.com/marshmallow-code/flask-marshmallow/issues">Issue Tracker</a></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/_templates/side-secondary.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1><a href="{{ pathto(master_doc) }}">

<h3>Useful Links</h3>
<ul>
<li><a href="http://pypi.python.org/pypi/flask-marshmallow">Flask-Marshmallow @ PyPI</a></li>
<li><a href="https://pypi.org/project/flask-marshmallow/">Flask-Marshmallow @ PyPI</a></li>
<li><a href="http://github.com/marshmallow-code/flask-marshmallow">Flask-Marshmallow @ GitHub</a></li>
<li><a href="http://github.com/marshmallow-code/flask-marshmallow/issues">Issue Tracker</a></li>
</ul>
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Flask-Marshmallow: Flask + marshmallow for beautiful APIs

:ref:`changelog <changelog>` //
`github <http://github.com/marshmallow-code/flask-marshmallow>`_ //
`pypi <http://pypi.python.org/pypi/flask-marshmallow>`_ //
`pypi <https://pypi.org/project/flask-marshmallow/>`_ //
`issues <http://github.com/marshmallow-code/flask-marshmallow/issues>`_


Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.black]
line-length = 88
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']
9 changes: 4 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down
13 changes: 6 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/flask_marshmallow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/markers.py
Original file line number Diff line number Diff line change
@@ -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"
)
3 changes: 0 additions & 3 deletions tests/test_sqla.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 8 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
[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]
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

Expand Down