Skip to content

Commit

Permalink
Modernize package devtools (#105)
Browse files Browse the repository at this point in the history
* repo: add code of conduct and contribution guidelines

* repo: update .gitignore

* repo: .gitattributes

* update README

* add .pre-commit-config.yaml

* use setup.cfg and update pyproject.toml

* upath: versioning via setuptools_scm

* update noxfile

* ci: update workflows

* pre-commit: update hooks and fix newlines

* pre-commit: fix all linting errors

* bump test tools versions

* ci: don't test on pypy

* update .gitignore

* lint: ignore pylint for now

* tests: skip azure tests if no docker is available

* move flake8 config to .flake8

* setup.cfg: use license-files

* add MANIFEST.in to exclude git related files from sdist

* setup.cfg: update package discovery

* pyproject.toml: remove not needed coverage setting

* setup.cfg: include py.typed in wheel

* ci: remove codecov upload for now

let's first figure out if the org wants to use the action
  • Loading branch information
ap-- authored Jun 20, 2023
1 parent 6727e92 commit 07c151d
Show file tree
Hide file tree
Showing 37 changed files with 879 additions and 284 deletions.
18 changes: 15 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
[flake8]
max-line-length = 80
ignore=
# Whitespace before ':'
E203
# Too many leading '#' for block comment
E266
# Line break occurred before a binary operator
W503
# unindexed parameters in the str.format, see:
# https://pypi.org/project/flake8-string-format/
P1
max_line_length = 88
max-complexity = 15
select = B,C,E,F,W,T4,B902,T,P
show_source = true
count = true
per-file-ignores =
upath/__init__.py: F401
exclude =
Expand All @@ -10,5 +24,3 @@ exclude =
.github,
.gitignore,
.pytest_cache,


1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2

updates:
- directory: "/"
package-ecosystem: "pip"
schedule:
interval: "weekly"
labels:
- "maintenance"
# Update via cruft
ignore:
- dependency-name: "mkdocs*"
- dependency-name: "pytest*"
- dependency-name: "pylint"
- dependency-name: "mypy"

- directory: "/"
package-ecosystem: "github-actions"
schedule:
interval: "weekly"
labels:
- "maintenance"
# Update via cruft
ignore:
- dependency-name: "actions/checkout"
- dependency-name: "actions/setup-python"
- dependency-name: "pypa/gh-action-pypi-publish"
- dependency-name: "codecov/codecov-action"
67 changes: 0 additions & 67 deletions .github/workflows/python.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
release:
types: [published]
workflow_dispatch:

env:
FORCE_COLOR: "1"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Upgrade pip and nox
run: |
pip install --upgrade pip nox
pip --version
nox --version
- name: Build package
run: nox -s build

- name: Upload package
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.UPATH_GIT_REPO }}
verbose: true
skip_existing: true
90 changes: 90 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Tests

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

env:
FORCE_COLOR: "1"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
tests:
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
pyv: ['3.8', '3.9', '3.10', '3.11']

steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.pyv }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pyv }}

- name: Upgrade pip and nox
run: |
python -m pip install --upgrade pip nox
pip --version
nox --version
- name: Run tests
run: nox -s tests-${{ matrix.nox_pyv || matrix.pyv }} -- --cov-report=xml

lint:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.pyv }}
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Upgrade pip and nox
run: |
python -m pip install --upgrade pip nox
pip --version
nox --version
- name: Lint code and check dependencies
run: nox -s lint safety

build:
needs: [tests, lint]
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.pyv }}
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip nox
pip --version
nox --version
- name: Build package
run: nox -s build
Loading

0 comments on commit 07c151d

Please sign in to comment.