Skip to content

Commit

Permalink
chore: upgrade template (#13)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
fubuloubu authored Apr 13, 2021
1 parent 5f78bc9 commit c97874c
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install -e .[release]
- name: Build
run: python setup.py sdist bdist_wheel
Expand All @@ -29,4 +29,4 @@ jobs:
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
run: twine upload dist/* --verbose
17 changes: 17 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ jobs:
- name: Run flake8
run: flake8 ./tokenlists ./tests ./setup.py

type-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install Dependencies
run: pip install .[lint]

- name: Run MyPy
run: mypy -p tokenlists

functional:
runs-on: ubuntu-latest

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# setuptools-scm
version.py
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: check-yaml

- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.8.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 20.8b0
hooks:
- id: black
name: black

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.800
hooks:
- id: mypy


default_language_version:
python: python3
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[build-system]
requires = ["setuptools>=51.1.1", "wheel", "setuptools_scm[toml]>=5.0"]

[tool.setuptools_scm]
write_to = "tokenlists/version.py"

# NOTE: you have to use single-quoted strings in TOML for regular expressions.
# It's the equivalent of r-strings in Python. Multiline strings are treated as
# verbose regular expressions by Black. Use [ ] to denote a significant space
Expand Down
23 changes: 15 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": [
"pytest==5.4.1",
"pytest-xdist",
"pytest-coverage",
"pytest-cov",
"PyGithub>=1.54,<2.0",
"hypothesis<6.0",
"hypothesis-jsonschema==0.19.0",
Expand All @@ -17,17 +17,23 @@
"flake8==3.8.4",
"isort>=5.7.0,<6",
"mypy==0.790",
"pydocstyle>=5.1.1,<6",
],
"doc": ["Sphinx>=3.4.3,<4", "sphinx_rtd_theme>=0.5.1"],
"dev": ["pytest-watch>=4.2.0,<5", "wheel", "twine", "ipython"],
"release": [
"setuptools",
"setuptools-scm",
"wheel",
"twine",
],
"dev": ["pytest-watch", "IPython", "ipdb"],
}

extras_require["dev"] = (
extras_require["dev"]
+ extras_require["test"] # noqa: W504
+ extras_require["lint"] # noqa: W504
+ extras_require["doc"] # noqa: W504
+ extras_require["test"]
+ extras_require["lint"]
+ extras_require["release"]
+ extras_require["doc"]
)

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

setup(
name="tokenlists",
version="0.1.0-alpha.1",
use_scm_version=True,
setup_requires=["setuptools_scm"],
author="Ben Hauser",
author_email="[email protected]",
description="",
description="Python implementation of Uniswaps' tokenlists",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/ApeWorX/py-tokenlists",
Expand Down

0 comments on commit c97874c

Please sign in to comment.