diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fdb2063..a1b9019 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 @@ -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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4054fe8..eb1a3cc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 diff --git a/.gitignore b/.gitignore index b6e4761..c4c3591 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ dmypy.json # Pyre type checker .pyre/ + +# setuptools-scm +version.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..592c432 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 64e6cba..5d92d33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/setup.py b/setup.py index 0606750..5560f0d 100644 --- a/setup.py +++ b/setup.py @@ -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", @@ -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: @@ -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="ben@hauser.id", - description="", + description="Python implementation of Uniswaps' tokenlists", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/ApeWorX/py-tokenlists",