Skip to content

Commit

Permalink
Dropped flit+devtools in favour of hatchling+pdm (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
francis-clairicia authored Mar 18, 2023
1 parent 7eb65b2 commit fecb262
Show file tree
Hide file tree
Showing 15 changed files with 911 additions and 181 deletions.
9 changes: 0 additions & 9 deletions .devtools.cfg

This file was deleted.

13 changes: 3 additions & 10 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ extend-exclude =
.pytest_cache,
.venv,
.vscode,
devtools,
demo_resources,
dist,
requirements,
site-packages
doctest = true
max-line-length = 130
Expand All @@ -26,12 +23,8 @@ per-file-ignores =
# F401: 'module' imported but unused
# F403: 'from module import *' used; unable to detect undefined names
# F405: 'name' may be undefined, or defined from star imports: 'module'
# DALL001: There is no __all__ defined
src/easynetwork/__init__.py:F401,F403,F405
src/easynetwork/*/__init__.py:F401,F403,F405


[flake8:local-plugins]
extension =
DAL = flake8_extensions.dunder_all:DunderAll
paths =
./devtools/linting
tests/*.py:DALL001
.github/*.py:DALL001
29 changes: 11 additions & 18 deletions .github/actions/setup-tox/action.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
name: 'Setup tox'
description: 'Install tox and restore cache'
outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found.'
value: ${{ steps.cache.outputs.cache-hit }}
inputs:
python-version:
description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax."
required: false
default: '3.x'

runs:
using: 'composite'
steps:
- name: Compile requirements
run: python -m devtools --no-venv repo --no-sync
shell: bash
- uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ inputs.python-version }}
cache: true
cache-dependency-path: './pdm.lock'
- name: Install dependencies
run: pip install tox -c requirements-dev.txt
run: pdm sync --global --project=. --no-self --dev --group=tox
shell: bash
- name: Get python info
id: python
run: echo "checksum=$(python -VV | (sha256sum || shasum -a 256) | awk '{ print $1 }')" >> $GITHUB_OUTPUT
shell: bash
- name: Restore tox environment
id: cache
uses: actions/cache@v3
with:
path: .tox
key: tox|${{ runner.os }}|${{ github.workflow }}|${{ github.job }}|${{ steps.python.outputs.checksum }}|${{ hashFiles( 'tox.ini' , 'requirements*.txt') }}
- name: Disable tox parallel spinner by default
run: echo "TOX_PARALLEL_NO_SPINNER=1" >> $GITHUB_ENV
shell: bash
13 changes: 2 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,10 @@ jobs:
SOURCE_DATE_EPOCH: ${{ inputs.SOURCE_DATE_EPOCH }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Setup tox
uses: ./.github/actions/setup-tox
- name: Check source distribution consistency
if: github.event_name != 'workflow_call'
run: tox run -e check-build-sdist
- name: Post-check cleanup
if: always()
run: rm -rf .tox/check-build-sdist
with:
python-version: '3.10'
- name: Compute SOURCE_DATE_EPOCH from commit date
if: env.SOURCE_DATE_EPOCH == ''
run: |
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- 'tests/**.pyi?'
- 'tox.ini'
- 'pyproject.toml'
- 'requirements/*.in'
- 'pdm.lock'
- '.github/actions/setup-tox/**'
- '.github/workflows/lint.yml'
push:
Expand All @@ -27,7 +27,7 @@ on:
- 'tests/**.pyi?'
- 'tox.ini'
- 'pyproject.toml'
- 'requirements/*.in'
- 'pdm.lock'
- '.github/actions/setup-tox/**'
- '.github/workflows/lint.yml'

Expand All @@ -46,13 +46,9 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
id: setup-python
with:
python-version: '3.10'
- name: Setup tox
uses: ./.github/actions/setup-tox
with:
python-version: '3.10'
- name: Launch checks
run: tox run-parallel -f mypy
13 changes: 4 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- '!**.pyi'
- 'tox.ini'
- 'pyproject.toml'
- 'requirements/*.in'
- 'pdm.lock'
- '.github/actions/setup-tox/**'
- '.github/workflows/test.yml'
push:
Expand All @@ -29,7 +29,7 @@ on:
- '!**.pyi'
- 'tox.ini'
- 'pyproject.toml'
- 'requirements/*.in'
- 'pdm.lock'
- '.github/actions/setup-tox/**'
- '.github/workflows/test.yml'

Expand All @@ -51,14 +51,9 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Python ${{ matrix.python_version }}
id: setup-python
uses: actions/setup-python@v4
- name: Setup tox (python ${{ matrix.python_version }})
uses: ./.github/actions/setup-tox
with:
python-version: ${{ matrix.python_version }}
- name: Setup tox
uses: ./.github/actions/setup-tox
- name: Launch tests
run: tox run -f py$(echo ${{ matrix.python_version }} | tr -d .)
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ __pycache__/
*.py[cod]
*$py.class

# pdm
.pdm.toml

# C extensions
*.so

Expand Down
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

11 changes: 7 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ minimum_pre_commit_version: '2.20.0'

ci:
skip: [mypy]
submodules: true

repos:
- repo: local
Expand All @@ -26,19 +25,19 @@ repos:
require_serial: true
pass_filenames: false
- repo: https://github.com/PyCQA/isort
rev: '5.12.0' # Keep in sync with requirements-dev.txt
rev: '5.12.0'
hooks:
- id: isort
exclude: ^(devtools|\.github)/
args: ['--filter-files', '--settings-file', 'pyproject.toml']
- repo: https://github.com/psf/black
rev: '23.1.0' # Keep in sync with requirements-dev.txt
rev: '23.1.0'
hooks:
- id: black
exclude: ^(devtools|\.github)/
args: ['--config', 'pyproject.toml']
- repo: https://github.com/PyCQA/flake8
rev: '6.0.0' # Keep in sync with requirements-dev.txt
rev: '6.0.0'
hooks:
- id: flake8
exclude: ^(devtools|\.github)/
Expand All @@ -55,6 +54,10 @@ repos:
exclude: ^(devtools|\.github)/
types: [] # Overwrite with empty in order to fallback to types_or
types_or: [python, pyi]
- repo: https://github.com/pdm-project/pdm
rev: '2.4.9'
hooks:
- id: pdm-lock-check
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
hooks:
Expand Down
1 change: 0 additions & 1 deletion devtools
Submodule devtools deleted from eabc2c
Loading

0 comments on commit fecb262

Please sign in to comment.