Skip to content

Commit c97874c

Browse files
authored
chore: upgrade template (#13)
* test: add mypy type checking * chore: add setuptools-scm for version management from git * fix: wrong coverage plugin * refactor: fix up deps * chore: add pre-commit hook
1 parent 5f78bc9 commit c97874c

File tree

6 files changed

+78
-10
lines changed

6 files changed

+78
-10
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install dependencies
2121
run: |
2222
python -m pip install --upgrade pip
23-
pip install setuptools wheel twine
23+
pip install -e .[release]
2424
2525
- name: Build
2626
run: python setup.py sdist bdist_wheel
@@ -29,4 +29,4 @@ jobs:
2929
env:
3030
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
3131
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
32-
run: twine upload dist/*
32+
run: twine upload dist/* --verbose

.github/workflows/test.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@ jobs:
2929
- name: Run flake8
3030
run: flake8 ./tokenlists ./tests ./setup.py
3131

32+
type-check:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v2
37+
38+
- name: Setup Python
39+
uses: actions/setup-python@v2
40+
with:
41+
python-version: 3.8
42+
43+
- name: Install Dependencies
44+
run: pip install .[lint]
45+
46+
- name: Run MyPy
47+
run: mypy -p tokenlists
48+
3249
functional:
3350
runs-on: ubuntu-latest
3451

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,6 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
# setuptools-scm
132+
version.py

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.1.0
4+
hooks:
5+
- id: check-yaml
6+
7+
- repo: https://github.com/asottile/seed-isort-config
8+
rev: v2.2.0
9+
hooks:
10+
- id: seed-isort-config
11+
12+
- repo: https://github.com/pre-commit/mirrors-isort
13+
rev: v5.8.0
14+
hooks:
15+
- id: isort
16+
17+
- repo: https://github.com/psf/black
18+
rev: 20.8b0
19+
hooks:
20+
- id: black
21+
name: black
22+
23+
- repo: https://gitlab.com/pycqa/flake8
24+
rev: 3.8.3
25+
hooks:
26+
- id: flake8
27+
28+
- repo: https://github.com/pre-commit/mirrors-mypy
29+
rev: v0.800
30+
hooks:
31+
- id: mypy
32+
33+
34+
default_language_version:
35+
python: python3

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
[build-system]
2+
requires = ["setuptools>=51.1.1", "wheel", "setuptools_scm[toml]>=5.0"]
3+
4+
[tool.setuptools_scm]
5+
write_to = "tokenlists/version.py"
6+
17
# NOTE: you have to use single-quoted strings in TOML for regular expressions.
28
# It's the equivalent of r-strings in Python. Multiline strings are treated as
39
# verbose regular expressions by Black. Use [ ] to denote a significant space

setup.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": [
88
"pytest==5.4.1",
99
"pytest-xdist",
10-
"pytest-coverage",
10+
"pytest-cov",
1111
"PyGithub>=1.54,<2.0",
1212
"hypothesis<6.0",
1313
"hypothesis-jsonschema==0.19.0",
@@ -17,17 +17,23 @@
1717
"flake8==3.8.4",
1818
"isort>=5.7.0,<6",
1919
"mypy==0.790",
20-
"pydocstyle>=5.1.1,<6",
2120
],
2221
"doc": ["Sphinx>=3.4.3,<4", "sphinx_rtd_theme>=0.5.1"],
23-
"dev": ["pytest-watch>=4.2.0,<5", "wheel", "twine", "ipython"],
22+
"release": [
23+
"setuptools",
24+
"setuptools-scm",
25+
"wheel",
26+
"twine",
27+
],
28+
"dev": ["pytest-watch", "IPython", "ipdb"],
2429
}
2530

2631
extras_require["dev"] = (
2732
extras_require["dev"]
28-
+ extras_require["test"] # noqa: W504
29-
+ extras_require["lint"] # noqa: W504
30-
+ extras_require["doc"] # noqa: W504
33+
+ extras_require["test"]
34+
+ extras_require["lint"]
35+
+ extras_require["release"]
36+
+ extras_require["doc"]
3137
)
3238

3339
with open("README.md", "r") as fp:
@@ -36,10 +42,11 @@
3642

3743
setup(
3844
name="tokenlists",
39-
version="0.1.0-alpha.1",
45+
use_scm_version=True,
46+
setup_requires=["setuptools_scm"],
4047
author="Ben Hauser",
4148
author_email="ben@hauser.id",
42-
description="",
49+
description="Python implementation of Uniswaps' tokenlists",
4350
long_description=long_description,
4451
long_description_content_type="text/markdown",
4552
url="https://github.com/ApeWorX/py-tokenlists",

0 commit comments

Comments
 (0)