Skip to content

Commit

Permalink
Bump linters, drop 3.6 support
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
  • Loading branch information
gaborbernat committed Dec 29, 2021
1 parent eb6221a commit f038adf
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 148 deletions.
85 changes: 45 additions & 40 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,49 @@ concurrency:
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0

test:
name: test ${{ matrix.py }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- Ubuntu
- Windows
- MacOs
py:
- 3.10.0-rc.2
- 3.9
- 3.8
- 3.7
- pypy-3.7-v7.3.5
- "3.10"
- "pypy-3.7-v7.3.7" # ahead to start it earlier because takes longer
- "3.9"
- "3.8"
- "3.7"
os:
- ubuntu-20.04
- windows-2022
- macos-10.15

steps:
- name: Setup python for tox
uses: actions/setup-python@v2
with:
python-version: 3.10.0-rc.2
python-version: "3.10"
- name: Install tox
run: python -m pip install tox
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
- name: Pick environment to run
run: |
import subprocess; import json; import os
major, minor, impl = json.loads(subprocess.check_output(["python", "-c", "import json; import sys; import platform; print(json.dumps([sys.version_info[0], sys.version_info[1], platform.python_implementation()]));"], universal_newlines=True))
with open(os.environ["GITHUB_ENV"], "a") as file_handler:
file_handler.write("TOXENV=" + (f'py{major}{minor}' if impl == "CPython" else f'pypy{major}{minor}') + "\n")
import codecs
import os
import platform
import sys
cpy = platform.python_implementation() == "CPython"
base =("{}{}{}" if cpy else "{}{}").format("py" if cpy else "pypy", *sys.version_info[0:2])
env = "TOXENV={}\n".format(base)
print("Picked:\n{}for{}".format(env, sys.version))
with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler:
file_handler.write(env)
shell: python
- name: Setup test suite
run: tox -vv --notest
Expand All @@ -61,47 +63,50 @@ jobs:
CI_RUN: "yes"

check:
name: check ${{ matrix.tox_env }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
name: tox env ${{ matrix.tox_env }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- Ubuntu
- Windows
- ubuntu-20.04
- windows-2022
tox_env:
- type
- dev
- pkg_desc
- type
- readme
exclude:
- { os: Windows, tox_env: pkg_desc }

- { os: windows-2022, tox_env: readme }
steps:
- uses: actions/checkout@v2
- name: Setup python
with:
fetch-depth: 0
- name: Setup Python "3.10"
uses: actions/setup-python@v2
with:
python-version: 3.10.0-rc.2
python-version: "3.10"
- name: Install tox
run: python -m pip install tox
- name: Run check for ${{ matrix.tox_env }}
run: python -m tox -e ${{ matrix.tox_env }}
env:
UPGRADE_ADVISORY: "yes"
- name: Setup test suite
run: tox -vv --notest -e ${{ matrix.tox_env }}
- name: Run test suite
run: tox --skip-pkg-install -e ${{ matrix.tox_env }}

publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [check, test, pre-commit]
needs: [ check, test ]
runs-on: ubuntu-latest
steps:
- name: Setup python to build package
uses: actions/setup-python@v2
with:
python-version: 3.10.0-rc.2
python-version: "3.10"
- name: Install build
run: python -m pip install 'build>=0.4'
run: python -m pip install build
- uses: actions/checkout@v2
- name: Build package
with:
fetch-depth: 0
- name: Build sdist and wheel
run: python -m build -s -w . -o dist
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@master
Expand Down
36 changes: 18 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
rev: v2.30.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
args: [ "--py36-plus" ]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
Expand All @@ -24,35 +24,35 @@ repos:
rev: 21.12b0
hooks:
- id: black
args: [ --safe ]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
hooks:
- id: blacken-docs
additional_dependencies: [ black==21.9b0 ]
additional_dependencies: [ black==21.12b0 ]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: rst-backticks
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.0
hooks:
- id: setup-cfg-fmt
args: [--min-py3-version, "3.6", "--max-py-version", "3.10"]
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "0.5.1"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
args: [ "-p", "fix" ]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.0
hooks:
- id: setup-cfg-fmt
args: [ --min-py3-version, "3.7", "--max-py-version", "3.10" ]
- repo: https://github.com/PyCQA/flake8
rev: "4.0.1"
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==21.9.2
- flake8-comprehensions==3.6.1
- flake8-pytest-style==1.5
- flake8-spellcheck==0.24
- flake8-unused-arguments==0.0.6
- flake8-noqa==1.1.0
- flake8-eradicate==1.1.0
- pep8-naming==0.12.1
- flake8-bugbear==21.11.29
- flake8-comprehensions==3.7
- flake8-pytest-style==1.6
- flake8-spellcheck==0.24
- flake8-unused-arguments==0.0.9
- flake8-noqa==1.2.1
- pep8-naming==0.12.1
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

## [0.1](https://github.com/gaborbernat/devpi-process/tree/0.1) (2021-06-17)
## 0.2 (2021-12-29)

[Full Changelog](https://github.com/gaborbernat/devpi-process/compare/7a3226e048c90b86d7902c373b364a9b16e51a48...0.1)
* Drop 3.6 support and bump linters
* Index URL now ends with `/` to avoid redirect when sending a GET

## 0.1 (2021-06-17)


\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
* First release
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/devpi-process?style=flat-square)](https://pypi.org/project/devpi-process)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/devpi-process?style=flat-square)](https://pypistats.org/packages/devpi-process)
[![PyPI - License](https://img.shields.io/pypi/l/devpi-process?style=flat-square)](https://opensource.org/licenses/MIT)
[![check](https://github.com/gaborbernat/devpi-process/workflows/check/badge.svg)](https://github.com/gaborbernat/devpi-process/actions?query=workflow%3Acheck)
[![check](https://github.com/tox-dev/devpi-process/workflows/check/badge.svg)](https://github.com/tox-dev/devpi-process/actions?query=workflow%3Acheck)
[![Code style:
black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)

Expand Down
72 changes: 21 additions & 51 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = devpi_process
description = devpi process provides a programmatic API to create and use a devpi server process
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/gaborbernat/devpi_process
url = https://github.com/tox-dev/devpi-process
maintainer = Bernat Gabor
maintainer_email = gaborjbernat@gmail.com
license = MIT
Expand All @@ -18,7 +18,6 @@ classifiers =
Operating System :: POSIX
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Expand All @@ -27,15 +26,15 @@ classifiers =
Topic :: Utilities
keywords = devpi, programmatic
project_urls =
Source=https://github.com/gaborbernat/devpi-process
Tracker=https://github.com/gaborbernat/devpi-process
Source=https://github.com/tox-dev/devpi-process
Tracker=https://github.com/tox-dev/devpi-process

[options]
packages = find:
install_requires =
devpi-client>=5.2
devpi-server>=6
python_requires = >=3.6
python_requires = >=3.7
include_package_data = True
package_dir =
=src
Expand All @@ -46,9 +45,10 @@ where = src

[options.extras_require]
test =
coverage>=5
covdefaults>=2
httpx>=0.18
pytest>=6
pytest-cov>=3

[options.package_data]
devpi_process = py.typed
Expand All @@ -66,55 +66,25 @@ ignore =
E203 # whitespace before :

[coverage:run]
source =
${_COVERAGE_SRC}
${_COVERAGE_TEST}
parallel = True
branch = True
dynamic_context = test_function

[coverage:report]
fail_under = 100
skip_covered = true
show_missing = true

[coverage:html]
show_contexts = True
skip_covered = False
skip_empty = False
plugins = covdefaults
parallel = true

[coverage:paths]
source =
src =
src
.tox*/*/lib/python*/site-packages
.tox*/pypy*/site-packages
.tox*\*\Lib\site-packages\
.tox/*/lib/python*/site-packages
.tox/pypy*/site-packages
.tox\*\Lib\site-packages\
*/src
*\src
other =
.
*/devpi-process
*\devpi-process

[tool:pytest]
addopts = -ra --showlocals
testpaths = tests
junit_family = xunit2

[mypy]
python_version = 3.7
disallow_any_generics = True
disallow_subclassing_any = True
disallow_untyped_calls = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
disallow_untyped_decorators = True
show_error_codes = True
no_implicit_optional = True
warn_redundant_casts = True
warn_unused_ignores = False
warn_no_return = True
warn_return_any = True
implicit_reexport = False
strict_equality = True
warn_unused_configs = True
pretty = True
[coverage:report]
fail_under = 100

[mypy-httpx.*]
ignore_missing_imports = True
[coverage:html]
show_contexts = true
skip_covered = false
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from setuptools import setup

setup()
4 changes: 2 additions & 2 deletions src/devpi_process/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, base_url: str, name: str, user: str, client_cmd_base: list[st

@property
def url(self) -> str:
return f"{self._server_url}/{self.name}/+simple"
return f"{self._server_url}/{self.name}/+simple/"

def use(self) -> None:
check_call(self._client_cmd_base + ["use", f"{self.user}/{self.name}"], stdout=PIPE, stderr=PIPE)
Expand All @@ -51,7 +51,7 @@ def __init__(self, path: Path, with_root_pypi: bool = False, start_args: Sequenc
raise RuntimeError("could not get scripts folder of host interpreter") # pragma: no cover

def _exe(name: str) -> str:
return str(Path(cast(str, scripts_dir)) / f"{name}{'.exe' if sys.platform == 'win32' else ''}")
return str(Path(scripts_dir) / f"{name}{'.exe' if sys.platform == 'win32' else ''}")

self._init: str = _exe("devpi-init")
self._server: str = _exe("devpi-server")
Expand Down
Loading

0 comments on commit f038adf

Please sign in to comment.