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

Bump linters, drop codecov and python 3.6 #52

Merged
merged 2 commits into from Dec 26, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
123 changes: 76 additions & 47 deletions .github/workflows/check.yml
@@ -1,13 +1,7 @@
name: check
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
schedule:
- cron: "0 8 * * *"

Expand All @@ -16,117 +10,152 @@ concurrency:
cancel-in-progress: true

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

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.1"
- "3.10"
- "pypy-3.7-v7.3.7" # ahead to start it earlier because takes longer
- "3.9"
- "3.8"
- "3.7"
- "3.6"
- "pypy-3.6"
- "pypy-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.9"
python-version: "3.10"
- name: Install tox
run: python -m pip install tox
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install tox
run: python -m pip install tox
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
- name: Pick environment to run
run: |
import json
import codecs
import os
import subprocess
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=' + ("py" if impl == "CPython" else "pypy") + ("{}{}".format(major, minor) if impl == "CPython" else "3") + "\n")
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
- name: Run test suite
run: tox --skip-pkg-install
env:
PYTEST_ADDOPTS: "-vv --durations=20"
CI_RUN: "yes"
- name: Rename coverage report file
run: |
import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml')
run: import os; import sys; os.rename(f".tox/.coverage.{os.environ['TOXENV']}", f".tox/.coverage.{os.environ['TOXENV']}-{sys.platform}")
shell: python
- uses: codecov/codecov-action@v1
- name: Upload coverage data
uses: actions/upload-artifact@v2
with:
name: coverage-data
path: ".tox/.coverage.*"

coverage:
name: Combine coverage
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
with:
file: ./.tox/coverage.xml
flags: tests
name: ${{ matrix.py }} - ${{ matrix.os }}
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install tox
run: python -m pip install tox
- name: Setup coverage tool
run: tox -e coverage --notest
- name: Install package builder
run: python -m pip install build
- name: Build package
run: pyproject-build --wheel .
- name: Download coverage data
uses: actions/download-artifact@v2
with:
name: coverage-data
path: .tox
- name: Combine and report coverage
run: tox -e coverage
- name: Upload HTML report
uses: actions/upload-artifact@v2
with:
name: html-report
path: .tox/htmlcov

check:
name: check ${{ matrix.tox_env }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
name: ${{ matrix.tox_env }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- Windows
- Ubuntu
- ubuntu-latest
- windows-latest
tox_env:
- dev
- pkg_check
- type
- docs
- readme
exclude:
- { os: windows, tox_env: pkg_check }
- { os: windows-latest, tox_env: readme }
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Python 3.9
- name: Setup Python "3.10"
uses: actions/setup-python@v2
with:
python-version: "3.9"
python-version: "3.10"
- name: Install tox
run: python -m pip install tox
- name: Run check for ${{ matrix.tox_env }}
run: 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, coverage, lint ]
runs-on: ubuntu-latest
steps:
- name: Setup python to build package
uses: actions/setup-python@v2
with:
python-version: "3.9"
python-version: "3.10"
- name: Install build
run: python -m pip install build
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build package
run: pyproject-build . -o dist
- name: Build sdist and wheel
run: python -m build -s -w . -o dist
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@master
with:
Expand Down
48 changes: 31 additions & 17 deletions .pre-commit-config.yaml
@@ -1,44 +1,58 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: check-merge-conflict
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v2.25.0
rev: v2.29.1
hooks:
- id: pyupgrade
args: [ "--py36-plus" ]
- repo: https://github.com/PyCQA/isort
rev: 5.9.3
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 21.8b0
rev: 21.12b0
hooks:
- id: black
args: [--safe]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.17.0
args: [ --safe ]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
hooks:
- id: setup-cfg-fmt
args: ["--max-py-version", "3.10"]
- id: blacken-docs
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/tox-dev/tox-ini-fmt
rev: "0.5.1"
hooks:
- id: tox-ini-fmt
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: "3.9.2"
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [
"flake8-bugbear == 21.4.3",
"flake8-unused-arguments == 0.0.6",
"flake8-comprehensions == 3.5.0",
"flake8-spellcheck == 0.24.0",
"flake8-pytest-style == 1.5.0",
]
additional_dependencies:
- 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
4 changes: 4 additions & 0 deletions CHANGES.rst
@@ -1,6 +1,10 @@
platformdirs Changelog
======================

platformdirs 2.3.1
------------------
- Drop python 3.6 support

platformdirs 2.3.0
------------------
- Add ``user_runtime_dir`` and its path-returning equivalent (#37)
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -117,7 +117,7 @@ On Linux:
'/run/user/{os.getuid()}/SuperApp'
>>> site_config_dir(appname)
'/etc/xdg/SuperApp'
>>> os.environ['XDG_CONFIG_DIRS'] = '/etc:/usr/local/etc'
>>> os.environ["XDG_CONFIG_DIRS"] = "/etc:/usr/local/etc"
>>> site_config_dir(appname, multipath=True)
'/etc/SuperApp:/usr/local/etc/SuperApp'

Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from platformdirs.version import __version__

author = "The platformdirs team"
Expand Down
7 changes: 5 additions & 2 deletions setup.cfg
Expand Up @@ -16,7 +16,6 @@ classifiers =
Programming Language :: Python
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 @@ -32,7 +31,7 @@ project_urls =

[options]
packages = find:
python_requires = >=3.6
python_requires = >=3.7
package_dir =
=src
zip_safe = True
Expand Down Expand Up @@ -76,6 +75,10 @@ source =
.tox\*\Lib\site-packages\
*/src
*\src
other =
.
*/platformdirs
*\platformdirs

[coverage:run]
branch = true
Expand Down
2 changes: 2 additions & 0 deletions setup.py
@@ -1,3 +1,5 @@
from __future__ import annotations

from setuptools import setup

setup()