Skip to content

Commit a314b56

Browse files
committed
add files
1 parent 4f2b3e0 commit a314b56

31 files changed

+2653
-1
lines changed

.darglint

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[darglint]
2+
strictness = long

.flake8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
select = B,B9,C,D,DAR,E,F,N,RST,S,W
3+
ignore = E203,E501,RST201,RST203,RST301,W503
4+
max-line-length = 80
5+
max-complexity = 10
6+
docstring-convention = google
7+
per-file-ignores = tests/*:S101
8+
rst-roles = class,const,func,meth,mod,ref
9+
rst-directives = deprecated

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/dependabot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: pip
8+
directory: "/.github/workflows"
9+
schedule:
10+
interval: daily
11+
- package-ecosystem: pip
12+
directory: "/docs"
13+
schedule:
14+
interval: daily
15+
- package-ecosystem: pip
16+
directory: "/"
17+
schedule:
18+
interval: daily
19+
versioning-strategy: lockfile-only
20+
allow:
21+
- dependency-type: "all"

.github/labels.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
# Labels names are important as they are used by Release Drafter to decide
3+
# regarding where to record them in changelog or if to skip them.
4+
#
5+
# The repository labels will be automatically configured using this file and
6+
# the GitHub Action https://github.com/marketplace/actions/github-labeler.
7+
- name: breaking
8+
description: Breaking Changes
9+
color: bfd4f2
10+
- name: bug
11+
description: Something isn't working
12+
color: d73a4a
13+
- name: build
14+
description: Build System and Dependencies
15+
color: bfdadc
16+
- name: ci
17+
description: Continuous Integration
18+
color: 4a97d6
19+
- name: dependencies
20+
description: Pull requests that update a dependency file
21+
color: 0366d6
22+
- name: documentation
23+
description: Improvements or additions to documentation
24+
color: 0075ca
25+
- name: duplicate
26+
description: This issue or pull request already exists
27+
color: cfd3d7
28+
- name: enhancement
29+
description: New feature or request
30+
color: a2eeef
31+
- name: github_actions
32+
description: Pull requests that update Github_actions code
33+
color: "000000"
34+
- name: good first issue
35+
description: Good for newcomers
36+
color: 7057ff
37+
- name: help wanted
38+
description: Extra attention is needed
39+
color: 008672
40+
- name: invalid
41+
description: This doesn't seem right
42+
color: e4e669
43+
- name: performance
44+
description: Performance
45+
color: "016175"
46+
- name: python
47+
description: Pull requests that update Python code
48+
color: 2b67c6
49+
- name: question
50+
description: Further information is requested
51+
color: d876e3
52+
- name: refactoring
53+
description: Refactoring
54+
color: ef67c4
55+
- name: removal
56+
description: Removals and Deprecations
57+
color: 9ae7ea
58+
- name: style
59+
description: Style
60+
color: c120e5
61+
- name: testing
62+
description: Testing
63+
color: b1fc6f
64+
- name: wontfix
65+
description: This will not be worked on
66+
color: ffffff

.github/release-drafter.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
categories:
2+
- title: ":boom: Breaking Changes"
3+
label: "breaking"
4+
- title: ":rocket: Features"
5+
label: "enhancement"
6+
- title: ":fire: Removals and Deprecations"
7+
label: "removal"
8+
- title: ":beetle: Fixes"
9+
label: "bug"
10+
- title: ":racehorse: Performance"
11+
label: "performance"
12+
- title: ":rotating_light: Testing"
13+
label: "testing"
14+
- title: ":construction_worker: Continuous Integration"
15+
label: "ci"
16+
- title: ":books: Documentation"
17+
label: "documentation"
18+
- title: ":hammer: Refactoring"
19+
label: "refactoring"
20+
- title: ":lipstick: Style"
21+
label: "style"
22+
- title: ":package: Dependencies"
23+
labels:
24+
- "dependencies"
25+
- "build"
26+
template: |
27+
## Changes
28+
29+
$CHANGES

.github/workflows/constraints.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pip==22.1.2
2+
nox==2022.1.7
3+
nox-poetry==1.0.0
4+
poetry==1.1.13
5+
virtualenv==20.15.0

.github/workflows/labeler.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Labeler
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
9+
jobs:
10+
labeler:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out the repository
14+
uses: actions/checkout@v3
15+
16+
- name: Run Labeler
17+
uses: crazy-max/[email protected]
18+
with:
19+
skip-delete: true

.github/workflows/release.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
9+
jobs:
10+
release:
11+
name: Release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out the repository
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 2
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: "3.10"
23+
24+
- name: Upgrade pip
25+
run: |
26+
pip install --constraint=.github/workflows/constraints.txt pip
27+
pip --version
28+
29+
- name: Install Poetry
30+
run: |
31+
pip install --constraint=.github/workflows/constraints.txt poetry
32+
poetry --version
33+
34+
- name: Check if there is a parent commit
35+
id: check-parent-commit
36+
run: |
37+
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
38+
39+
- name: Detect and tag new version
40+
id: check-version
41+
if: steps.check-parent-commit.outputs.sha
42+
uses: salsify/[email protected]
43+
with:
44+
version-command: |
45+
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"
46+
47+
- name: Bump version for developmental release
48+
if: "! steps.check-version.outputs.tag"
49+
run: |
50+
poetry version patch &&
51+
version=$(poetry version | awk '{ print $2 }') &&
52+
poetry version $version.dev.$(date +%s)
53+
54+
- name: Build package
55+
run: |
56+
poetry build --ansi
57+
58+
- name: Publish package on PyPI
59+
if: steps.check-version.outputs.tag
60+
uses: pypa/[email protected]
61+
with:
62+
user: __token__
63+
password: ${{ secrets.PYPI_TOKEN }}
64+
65+
- name: Publish package on TestPyPI
66+
if: "! steps.check-version.outputs.tag"
67+
uses: pypa/[email protected]
68+
with:
69+
user: __token__
70+
password: ${{ secrets.TEST_PYPI_TOKEN }}
71+
repository_url: https://test.pypi.org/legacy/
72+
73+
- name: Publish the release notes
74+
uses: release-drafter/[email protected]
75+
with:
76+
publish: ${{ steps.check-version.outputs.tag != '' }}
77+
tag: ${{ steps.check-version.outputs.tag }}
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: Tests
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
tests:
9+
name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- { python: "3.10", os: "ubuntu-latest", session: "pre-commit" }
16+
- { python: "3.10", os: "ubuntu-latest", session: "safety" }
17+
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
18+
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
19+
- { python: "3.8", os: "ubuntu-latest", session: "mypy" }
20+
- { python: "3.7", os: "ubuntu-latest", session: "mypy" }
21+
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
22+
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
23+
- { python: "3.8", os: "ubuntu-latest", session: "tests" }
24+
- { python: "3.7", os: "ubuntu-latest", session: "tests" }
25+
- { python: "3.10", os: "windows-latest", session: "tests" }
26+
- { python: "3.10", os: "macos-latest", session: "tests" }
27+
- { python: "3.10", os: "ubuntu-latest", session: "typeguard" }
28+
- { python: "3.10", os: "ubuntu-latest", session: "xdoctest" }
29+
- { python: "3.10", os: "ubuntu-latest", session: "docs-build" }
30+
31+
env:
32+
NOXSESSION: ${{ matrix.session }}
33+
FORCE_COLOR: "1"
34+
PRE_COMMIT_COLOR: "always"
35+
36+
steps:
37+
- name: Check out the repository
38+
uses: actions/checkout@v3
39+
40+
- name: Set up Python ${{ matrix.python }}
41+
uses: actions/setup-python@v3
42+
with:
43+
python-version: ${{ matrix.python }}
44+
45+
- name: Upgrade pip
46+
run: |
47+
pip install --constraint=.github/workflows/constraints.txt pip
48+
pip --version
49+
50+
- name: Upgrade pip in virtual environments
51+
shell: python
52+
run: |
53+
import os
54+
import pip
55+
56+
with open(os.environ["GITHUB_ENV"], mode="a") as io:
57+
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
58+
59+
- name: Install Poetry
60+
run: |
61+
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
62+
poetry --version
63+
64+
- name: Install Nox
65+
run: |
66+
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
67+
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
68+
nox --version
69+
70+
- name: Compute pre-commit cache key
71+
if: matrix.session == 'pre-commit'
72+
id: pre-commit-cache
73+
shell: python
74+
run: |
75+
import hashlib
76+
import sys
77+
78+
python = "py{}.{}".format(*sys.version_info[:2])
79+
payload = sys.version.encode() + sys.executable.encode()
80+
digest = hashlib.sha256(payload).hexdigest()
81+
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8])
82+
83+
print("::set-output name=result::{}".format(result))
84+
85+
- name: Restore pre-commit cache
86+
uses: actions/cache@v3
87+
if: matrix.session == 'pre-commit'
88+
with:
89+
path: ~/.cache/pre-commit
90+
key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }}
91+
restore-keys: |
92+
${{ steps.pre-commit-cache.outputs.result }}-
93+
94+
- name: Run Nox
95+
run: |
96+
nox --python=${{ matrix.python }}
97+
98+
- name: Upload coverage data
99+
if: always() && matrix.session == 'tests'
100+
uses: "actions/upload-artifact@v3"
101+
with:
102+
name: coverage-data
103+
path: ".coverage.*"
104+
105+
- name: Upload documentation
106+
if: matrix.session == 'docs-build'
107+
uses: actions/upload-artifact@v3
108+
with:
109+
name: docs
110+
path: docs/_build
111+
112+
coverage:
113+
runs-on: ubuntu-latest
114+
needs: tests
115+
steps:
116+
- name: Check out the repository
117+
uses: actions/checkout@v3
118+
119+
- name: Set up Python
120+
uses: actions/setup-python@v3
121+
with:
122+
python-version: "3.10"
123+
124+
- name: Upgrade pip
125+
run: |
126+
pip install --constraint=.github/workflows/constraints.txt pip
127+
pip --version
128+
129+
- name: Install Poetry
130+
run: |
131+
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
132+
poetry --version
133+
134+
- name: Install Nox
135+
run: |
136+
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
137+
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
138+
nox --version
139+
140+
- name: Download coverage data
141+
uses: actions/download-artifact@v3
142+
with:
143+
name: coverage-data
144+
145+
- name: Combine coverage data and display human readable report
146+
run: |
147+
nox --session=coverage
148+
149+
- name: Create coverage report
150+
run: |
151+
nox --session=coverage -- xml
152+
153+
- name: Upload coverage report
154+
uses: codecov/[email protected]

0 commit comments

Comments
 (0)