Skip to content

Commit 81fbe41

Browse files
committed
Add pre-commit config, format and lint files
1 parent bdbf6d5 commit 81fbe41

File tree

129 files changed

+3428
-2624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+3428
-2624
lines changed

.flake8

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[flake8]
2+
min_python_version = 3.7.0
3+
max-line-length = 88
4+
ban-relative-imports = true
5+
# flake8-use-fstring: https://github.com/MichaelKim0407/flake8-use-fstring#--percent-greedy-and---format-greedy
6+
format-greedy = 1
7+
inline-quotes = double
8+
enable-extensions = TC, TC1
9+
type-checking-exempt-modules = typing, typing-extensions
10+
eradicate-whitelist-extend = ^-.*;
11+
extend-ignore =
12+
# E203: Whitespace before ':' (pycqa/pycodestyle#373)
13+
E203,
14+
# SIM106: Handle error-cases first
15+
SIM106,
16+
# ANN101: Missing type annotation for self in method
17+
ANN101,
18+
# ANN102: Missing type annotation for cls in classmethod
19+
ANN102,
20+
F401,
21+
F403,
22+
I252,
23+
SIM115,
24+
N806,
25+
N803,
26+
B007,
27+
E501,
28+
C408,
29+
SIM113,
30+
N802,
31+
N400,
32+
E501,
33+
E802,
34+
E800,
35+
B001,
36+
B006,
37+
B020,
38+
C414,
39+
C416,
40+
E402,
41+
E711,
42+
E712,
43+
E722,
44+
E741,
45+
F405,
46+
F541,
47+
F811,
48+
F821,
49+
F841,
50+
FS001,
51+
FS002,
52+
I250,
53+
N801,
54+
N804,
55+
N812,
56+
N816,
57+
Q002,
58+
SIM102,
59+
SIM105,
60+
SIM111,
61+
SIM114,
62+
SIM118,
63+
SIM201,
64+
SIM203,
65+
SIM300,
66+
SIM401,
67+
TC002
68+
69+
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,42 @@
1-
# https://github.com/marketplace/actions/manylinux-wheel-builder
21
name: pypi deployer
3-
on:
4-
workflow_dispatch
5-
# push
6-
# push:
7-
# tags:
8-
# - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
2+
true: workflow_dispatch
93
jobs:
104
Linux-build:
11-
runs-on: ubuntu-latest
125
env:
13-
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
14-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
6+
TWINE_PASSWORD: '${{ secrets.TWINE_PASSWORD }}'
7+
TWINE_USERNAME: '${{ secrets.TWINE_USERNAME }}'
8+
runs-on: ubuntu-latest
159
steps:
1610
- uses: actions/checkout@v2
1711
- name: build and upload manylinux wheels
18-
# cSpell:disable
1912
uses: Niraj-Kamdar/manylinux-wheel-builder@master
20-
# cSpell:enable
2113
Matrix-build:
22-
runs-on: ${{ matrix.os }}
2314
env:
24-
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
25-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
26-
strategy:
27-
matrix:
28-
python-version: [3.6, 3.7, 3.8, 3.9]
29-
os: [macos-latest, windows-latest]
15+
TWINE_PASSWORD: '${{ secrets.TWINE_PASSWORD }}'
16+
TWINE_USERNAME: '${{ secrets.TWINE_USERNAME }}'
17+
runs-on: '${{ matrix.os }}'
3018
steps:
3119
- uses: actions/checkout@v2
3220
- name: Set up Python
3321
uses: actions/setup-python@v2
3422
with:
35-
python-version: ${{ matrix.python-version }}
23+
python-version: '${{ matrix.python-version }}'
3624
- name: build wheel
3725
run: |
3826
pip install wheel
3927
python setup.py bdist_wheel
40-
- name: upload wheel
28+
- continue-on-error: true
29+
name: upload wheel
4130
run: |
4231
pip install twine
4332
twine upload dist/*
44-
continue-on-error: true
33+
strategy:
34+
matrix:
35+
os:
36+
- macos-latest
37+
- windows-latest
38+
python-version:
39+
- 3.6
40+
- 3.7
41+
- 3.8
42+
- 3.9
+13-27
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,27 @@
11
name: Build and Publish to PyPI (macOS)
2-
3-
# on: push
4-
# disabled on push cuz Error: Container action is only supported on Linux
5-
# no solution found yet
6-
on: workflow_dispatch
7-
2+
true: workflow_dispatch
83
jobs:
94
build-n-publish:
10-
# name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
115
name: Build and publish Python 🐍 distributions 📦 to PyPI
12-
# runs-on: ubuntu-latest
136
runs-on: macos-latest
14-
strategy:
15-
matrix:
16-
python-version: ["3.6", "3.7", "3.8", "3.9"]
177
steps:
188
- uses: actions/checkout@v2
19-
- name: Set up Python ${{ matrix.python-version }}
9+
- name: 'Set up Python ${{ matrix.python-version }}'
2010
uses: actions/setup-python@v2
2111
with:
22-
python-version: ${{ matrix.python-version }}
12+
python-version: '${{ matrix.python-version }}'
2313
- name: Install pypa/build
24-
run: >-
25-
python -m
26-
pip install
27-
build
28-
--user
14+
run: python -m pip install build --user
2915
- name: Build a binary wheel and a source tarball
30-
run: >-
31-
python -m
32-
build
33-
--sdist
34-
--wheel
35-
--outdir dist/
36-
.
16+
run: python -m build --sdist --wheel --outdir dist/ .
3717
- name: Publish distribution 📦 to PyPI
38-
# if: startsWith(github.ref, 'refs/tags')
3918
uses: pypa/gh-action-pypi-publish@master
4019
with:
41-
password: ${{ secrets.PYPI_API_TOKEN }}
20+
password: '${{ secrets.PYPI_API_TOKEN }}'
21+
strategy:
22+
matrix:
23+
python-version:
24+
- 3.6
25+
- 3.7
26+
- 3.8
27+
- 3.9
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,16 @@
11
name: Build and Publish to PyPI (manylinux)
2-
3-
on: workflow_dispatch
4-
2+
true: workflow_dispatch
53
jobs:
64
build-n-publish:
7-
# name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
85
name: Build and publish Python 🐍 distributions 📦 to PyPI
9-
# runs-on: ubuntu-latest
106
runs-on: ubuntu-latest
11-
# strategy:
12-
# matrix:
13-
# python-version: ["3.6", "3.7", "3.8", "3.9"]
147
steps:
158
- uses: actions/checkout@v2
16-
# - name: Set up Python ${{ matrix.python-version }}
17-
# uses: actions/setup-python@v2
18-
# with:
19-
# python-version: ${{ matrix.python-version }}
20-
# - name: Install pypa/build
21-
# run: >-
22-
# python -m
23-
# pip install
24-
# build
25-
# --user
26-
# - name: Build a binary wheel and a source tarball
27-
# run: >-
28-
# python -m
29-
# build
30-
# --sdist
31-
# --wheel
32-
# --outdir dist/
33-
# .
34-
# cSpell:disable
359
- name: Build on manylinux
3610
uses: RalfG/python-wheels-manylinux-build@v0.4.2-manylinux2014_x86_64
37-
# cSpell:enable
3811
with:
39-
python-versions: "cp36-cp36m cp37-cp37m cp38-cp38m cp39-cp39m"
40-
# build-requirements: "cython numpy"
41-
# system-packages: "lrzip-devel zlib-devel"
42-
# pre-build-command: "sh pre-build-script.sh"
43-
# package-path: "my_project"
44-
# pip-wheel-args: "-w ./dist --no-deps"
45-
# pip-wheel-args: "--sdist --wheel --outdir dist/"
12+
python-versions: cp36-cp36m cp37-cp37m cp38-cp38m cp39-cp39m
4613
- name: Publish distribution 📦 to PyPI
47-
# if: startsWith(github.ref, 'refs/tags')
4814
uses: pypa/gh-action-pypi-publish@master
4915
with:
50-
password: ${{ secrets.PYPI_API_TOKEN }}
16+
password: '${{ secrets.PYPI_API_TOKEN }}'
+21-108
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,46 @@
11
name: Build and upload to PyPI
2-
3-
# Build on every branch push, tag push, and pull request change:
4-
# on: [push, pull_request]
5-
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
6-
# on:
7-
# push:
8-
# pull_request:
9-
# release:
10-
# types:
11-
# - published
12-
on:
2+
true:
133
workflow_dispatch:
14-
# workflow_run:
15-
# workflows: ["Test the package with pytest"]
16-
# branches: [master]
17-
# types:
18-
# - completed
19-
204
jobs:
21-
build_wheels:
22-
name: Build wheels on ${{ matrix.os }}
23-
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
24-
runs-on: ${{ matrix.os }}
25-
strategy:
26-
matrix:
27-
os: [ubuntu-20.04, windows-2019, macos-10.15]
28-
29-
steps:
30-
- uses: actions/checkout@v2
31-
32-
- name: Build wheels
33-
uses: pypa/cibuildwheel@v2.3.1
34-
35-
- uses: actions/upload-artifact@v2
36-
with:
37-
path: ./wheelhouse/*.whl
38-
395
build_sdist:
406
name: Build source distribution
41-
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
427
runs-on: ubuntu-latest
438
steps:
449
- uses: actions/checkout@v2
45-
4610
- name: Build sdist
4711
run: pipx run build --sdist
48-
4912
- uses: actions/upload-artifact@v2
5013
with:
5114
path: dist/*.tar.gz
52-
53-
# verify_installation:
54-
# name: Test if the latest release on Test PyPI installs and works
55-
# needs: [build_wheels, build_sdist, upload_test_pypi]
56-
# # if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
57-
# # if: startsWith(github.event.ref, 'refs/tags/v')
58-
# runs-on: ${{ matrix.os }}
59-
# strategy:
60-
# matrix:
61-
# os: [ubuntu-20.04, windows-2019, macos-10.15]
62-
# python-version: ["3.6", "3.7", "3.8", "3.9"]
63-
# # python-version: ["3.8", "3.9"]
64-
65-
# steps:
66-
# - uses: actions/checkout@v2
67-
# - name: Set up Python ${{ matrix.python-version }}
68-
# uses: actions/setup-python@v2
69-
# with:
70-
# python-version: ${{ matrix.python-version }}
71-
# - name: Install easygraph
72-
# run: |
73-
# python -m pip install --upgrade pip
74-
# # pip install flake8 pytest
75-
76-
# # install deps from PyPI, and EG from TestPyPI
77-
78-
# python setup.py egg_info
79-
# pip install -r *.egg-info/requires.txt
80-
81-
# pip install --index-url https://test.pypi.org/simple/ --no-deps python-easygraph
82-
83-
# - name: Check if the installation works
84-
# run: python "${{ github.workspace }}/scripts/check_installation.py"
85-
86-
# upload_test_pypi:
87-
# name: Upload to Test PyPI
88-
# needs: [build_wheels, build_sdist]
89-
# runs-on: ubuntu-latest
90-
# # upload to PyPI on every tag starting with 'v'
91-
# # if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
92-
# # if: startsWith(github.event.ref, 'refs/tags/v')
93-
# # alternatively, to publish when a GitHub Release is created, use the following rule:
94-
# # if: github.event_name == 'release' && github.event.action == 'published'
95-
# steps:
96-
# - uses: actions/download-artifact@v2
97-
# with:
98-
# name: artifact
99-
# path: dist
100-
101-
# - uses: pypa/gh-action-pypi-publish@v1.4.2
102-
# with:
103-
# user: __token__
104-
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
105-
# # To test: repository_url: https://test.pypi.org/legacy/
106-
# repository_url: https://test.pypi.org/legacy/
107-
# verbose: true
108-
# # print_hash: true
109-
15+
build_wheels:
16+
name: 'Build wheels on ${{ matrix.os }}'
17+
runs-on: '${{ matrix.os }}'
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Build wheels
21+
uses: pypa/cibuildwheel@v2.3.1
22+
- uses: actions/upload-artifact@v2
23+
with:
24+
path: ./wheelhouse/*.whl
25+
strategy:
26+
matrix:
27+
os:
28+
- ubuntu-20.04
29+
- windows-2019
30+
- macos-10.15
11031
upload_pypi:
111-
# name: Upload to PyPI if the latest release on Test PyPI passes the checks
11232
name: Upload to PyPI
113-
# needs: [build_wheels, build_sdist, upload_test_pypi, verify_installation]
114-
needs: [build_wheels, build_sdist]
33+
needs:
34+
- build_wheels
35+
- build_sdist
11536
runs-on: ubuntu-latest
116-
# upload to PyPI on every tag starting with 'v'
117-
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
118-
# if: startsWith(github.event.ref, 'refs/tags/v')
119-
# alternatively, to publish when a GitHub Release is created, use the following rule:
120-
# if: github.event_name == 'release' && github.event.action == 'published'
12137
steps:
12238
- uses: actions/download-artifact@v2
12339
with:
12440
name: artifact
12541
path: dist
126-
12742
- uses: pypa/gh-action-pypi-publish@v1.4.2
12843
with:
44+
password: '${{ secrets.PYPI_API_TOKEN }}'
12945
user: __token__
130-
password: ${{ secrets.PYPI_API_TOKEN }}
131-
# To test: repository_url: https://test.pypi.org/legacy/
13246
verbose: true
133-
# print_hash: true

0 commit comments

Comments
 (0)