Skip to content

Commit e584fbb

Browse files
authored
Maintenance updates 2021 08 (#7)
* added test publish on tag * use build and publish action * added lint and check_build * converted README to md * moved code to src * added pyproject.toml * moved settings to setup.cfg * moved code to src * README.rst -> README.md * added various configs * added docstrings * v1.0.1 * formatted with black
1 parent eabf438 commit e584fbb

File tree

17 files changed

+874
-178
lines changed

17 files changed

+874
-178
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
41
name: Upload Python Package
52

63
on:
@@ -10,7 +7,6 @@ on:
107
jobs:
118
deploy:
129
runs-on: ubuntu-latest
13-
1410
steps:
1511
- uses: actions/checkout@v2
1612
- name: Set up Python
@@ -20,11 +16,12 @@ jobs:
2016
- name: Install dependencies
2117
run: |
2218
python -m pip install --upgrade pip
23-
pip install setuptools wheel twine
24-
- name: Build and publish
25-
env:
26-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
27-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
19+
pip install setuptools wheel twine build
20+
- name: Build Dists
2821
run: |
29-
python setup.py sdist bdist_wheel
30-
twine upload dist/*
22+
python -m build
23+
- name: Publish to PyPI
24+
uses: pypa/gh-action-pypi-publish@release/v1
25+
with:
26+
user: __token__
27+
password: ${{ secrets.PYPI_API_TOKEN }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Test Upload Python Package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: "3.x"
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install setuptools wheel twine build
21+
- name: Build Dists
22+
run: |
23+
python -m build
24+
- name: Publish to PyPI
25+
uses: pypa/gh-action-pypi-publish@release/v1
26+
with:
27+
user: __token__
28+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
29+
repository_url: https://test.pypi.org/legacy/

.github/workflows/python-ci.yml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,23 @@ name: Python CI
66
on: [push, pull_request]
77

88
jobs:
9-
build:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check Out
13+
uses: actions/checkout@v2
14+
- name: Black
15+
uses: psf/black@stable
16+
- name: Pylint
17+
uses: cclauss/[email protected]
18+
with:
19+
args: pip install .; pylint src/**/*.py
20+
21+
test:
1022
runs-on: ubuntu-latest
1123
strategy:
1224
matrix:
1325
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
14-
1526
steps:
1627
- uses: actions/checkout@v2
1728
- name: Set up Python ${{ matrix.python-version }}
@@ -24,14 +35,25 @@ jobs:
2435
- name: Install module
2536
run: |
2637
pip install -e .
27-
- name: Lint with flake8
28-
run: |
29-
pip install flake8
30-
# stop the build if there are Python syntax errors or undefined names
31-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
32-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
33-
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3438
- name: Test with pytest
3539
run: |
3640
pip install pytest
3741
pytest
42+
43+
check_build:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Check Out
47+
uses: actions/checkout@v2
48+
- name: Set up Python
49+
uses: actions/setup-python@v2
50+
with:
51+
python-version: "3.x"
52+
- name: Install dependencies
53+
run: |
54+
python -m pip install --upgrade pip
55+
pip install setuptools wheel twine build
56+
- name: Build
57+
run: python -m build
58+
- name: Check
59+
run: twine check dist/*

.markdownlint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MD034: false # no-bare-urls: Bare URL used
2+
MD024: false # no-duplicate-heading/no-duplicate-header: Multiple headings with the same content

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"proseWrap": "always",
3+
"trailingComma": "all"
4+
}

0 commit comments

Comments
 (0)