Skip to content

Commit

Permalink
Dev chores: migrate to GHA; update dev deps; drop 3.7; test 3.11 (#303)
Browse files Browse the repository at this point in the history
* Switch to github actions; drop python 3.7

* Switch to github actions; drop python 3.7; pre-commit autoupdate

* Drop 3.7 in setup.py

* Update deps in setup.py and pre-commit.yaml

* Update changelog

* Fix env name

* update badge

* remove invalid format specifier

* mypy precommit

* Update pre-commit

* Fix lint env

* Add classifier
  • Loading branch information
sloria authored Dec 15, 2023
1 parent f436546 commit 9b88b71
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 70 deletions.
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-marshmallow3 }
- { name: "3.11", python: "3.11", tox: py311-marshmallow3 }
- { name: "lowest", python: "3.8", tox: py38-marshmallowlowest }
- { name: "dev", python: "3.11", tox: py311-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/*
26 changes: 11 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/python/black
rev: 22.10.0
hooks:
- id: black
language_version: python3
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear==21.9.2]
additional_dependencies: [flake8-bugbear==23.11.28]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==22.1.0]
# Use a local hook to run mypy because the official hook runs mypy in a venv
# that doesn't have dependencies or their type annotations installed.
- repo: local
additional_dependencies: [black==22.10.0]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
hooks:
- id: mypy
name: mypy
entry: mypy
language: system
types: [python]
- id: mypy
additional_dependencies: ["marshmallow>=3,<4"]
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Changelog

## 9.6.0 (unreleased)
## 10.0.0 (unreleased)

Other changes:

- Drop support for EOL Python 3.6.
- _Backwards-incompatible_: Drop support for EOL Python 3.6 and 3.7.
- Test against Python 3.11.

## 9.5.0 (2022-01-30)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# environs: simplified environment variable parsing

[![Latest version](https://badgen.net/pypi/v/environs)](https://pypi.org/project/environs/)
[![Build Status](https://dev.azure.com/sloria/sloria/_apis/build/status/sloria.environs?branchName=master)](https://dev.azure.com/sloria/sloria/_build/latest?definitionId=12&branchName=master)
[![Build Status](https://github.com/marshmallow-code/marshmallow-sqlalchemy/actions/workflows/build-release.yml/badge.svg)](https://github.com/sloria/environs/actions/workflows/build-release.yml)
[![marshmallow 3 compatible](https://badgen.net/badge/marshmallow/3)](https://marshmallow.readthedocs.io/en/latest/upgrading.html)
[![Black code style](https://badgen.net/badge/code%20style/black/000)](https://github.com/ambv/black)

Expand Down
44 changes: 0 additions & 44 deletions azure-pipelines.yml

This file was deleted.

4 changes: 3 additions & 1 deletion environs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ def _preprocess_dict(
return value

if subcast_key:
warnings.warn("`subcast_key` is deprecated. Use `subcast_keys` instead.", DeprecationWarning)
warnings.warn(
"`subcast_key` is deprecated. Use `subcast_keys` instead.", DeprecationWarning, stacklevel=2
)
subcast_keys_instance: ma.fields.Field = _make_subcast_field(subcast_keys or subcast_key)(**kwargs)
subcast_values_instance: ma.fields.Field = _make_subcast_field(subcast_values)(**kwargs)

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
universal=1

[flake8]
ignore = E203, E266, E501, W503
ignore = E203, E266, E501, W503, B907
max-line-length = 110
max-complexity = 18
select = B,C,E,F,W,T4,B9
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
EXTRAS_REQUIRE = {
"django": DJANGO_REQUIRES,
"tests": ["pytest"] + DJANGO_REQUIRES,
"lint": ["flake8==4.0.1", "flake8-bugbear==21.9.2", "mypy==0.910", "pre-commit~=2.4"],
"lint": ["flake8==6.1.0", "flake8-bugbear==23.11.28", "mypy==0.910", "pre-commit~=3.6"],
}
EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["lint"] + ["tox"]
PYTHON_REQUIRES = ">=3.7"
PYTHON_REQUIRES = ">=3.8"


def find_version(fname):
Expand Down Expand Up @@ -55,10 +55,10 @@ def read(fname):
"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",
"Typing :: Typed",
],
project_urls={
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tox]
envlist=
lint
py{37,38,39,310}-marshmallow{3,lowest}
py310-marshmallowdev
py{38,39,310,311}-marshmallow{3,lowest}
py311-marshmallowdev

[testenv]
extras = tests
Expand All @@ -13,7 +13,8 @@ deps =
commands = pytest {posargs}

[testenv:lint]
extras = lint
deps = pre-commit~=3.6
skip_install = true
commands =
pre-commit run --all-files

Expand Down

0 comments on commit 9b88b71

Please sign in to comment.