Skip to content

Commit

Permalink
chore: upgrade pyyaml and lints (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Aug 22, 2022
1 parent cb9dd99 commit 2683b6a
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ labels: 'bug'
### Environment information

* Python Version: x.x.x
* OS: osx/linux/win
* OS: macOS/linux/win

Python environment

Expand Down
12 changes: 8 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
### What I did
<!-- Create a summary of the changes -->

Related issue: #
<!-- The `fixes:` field denotes an issue that will be marked resolved by merging this PR -->
fixes: #

### How I did it
<!-- Discuss the thought process behind the change -->

### How to verify it
<!-- Discuss any methods that should be used to verify the change -->

### Checklist
<!-- All PRs must complete the following checklist before being merged -->

- [ ] Passes all linting checks (pre-commit and CI jobs)
- [ ] New test cases have been added and are passing
- [ ] All changes are completed
- [ ] New test cases have been added
- [ ] Documentation has been updated
- [ ] PR title follows [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) standard (will be automatically included in the changelog)
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
*.swp
.DS_Store

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
13 changes: 4 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,27 @@ repos:
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.10.1
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.6.0
hooks:
- id: black
name: black

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

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

additional_dependencies: [types-requests]

default_language_version:
python: python3
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Dependencies

* [python3](https://www.python.org/downloads/release/python-368/) version 3.6 or greater, python3-dev
* [python3](https://www.python.org/downloads/release/python-368/) version 3.7.2 or greater, python3-dev

## Installation

Expand Down Expand Up @@ -42,7 +42,9 @@ python3 setup.py install

## Development

This project is in early development and should be considered an alpha. Things might not work, breaking changes are likely. Comments, questions, criticisms and pull requests are welcomed.
This project is in early development and should be considered an alpha.
Things might not work, breaking changes are likely.
Comments, questions, criticisms and pull requests are welcomed.

## License

Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[build-system]
[build-system]
requires = ["setuptools>=51.1.1", "wheel", "setuptools_scm[toml]>=5.0"]

[tool.mypy]
Expand Down Expand Up @@ -36,7 +36,5 @@ markers = "fuzzing: Run Hypothesis fuzz test suite"
line_length = 100
force_grid_wrap = 0
include_trailing_comma = true
known_third_party = ["click", "github", "hypothesis", "hypothesis_jsonschema", "pydantic", "pytest", "requests", "semantic_version", "setuptools"]
known_first_party = ["tokenlists"]
multi_line_output = 3
use_parentheses = true
25 changes: 14 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@

extras_require = {
"test": [ # `test` GitHub Action jobs uses this
"pytest>=6.0,<7.0", # Core testing package
"pytest>=6.0", # Core testing package
"pytest-xdist", # multi-process runner
"pytest-cov", # Coverage analyzer plugin
"hypothesis>=6.2.0,<7.0", # Strategy-based fuzzer
"PyGithub>=1.54,<2.0", # Necessary to pull official schema from github
"hypothesis>=6.2.0,<7", # Strategy-based fuzzer
"PyGithub>=1.54,<2", # Necessary to pull official schema from github
"hypothesis-jsonschema==0.19.0", # Fuzzes based on a json schema
],
"lint": [
"black>=22.3.0,<23.0", # auto-formatter and linter
"mypy>=0.950,<1.0", # Static type analyzer
"flake8>=4.0.1,<5.0", # Style linter
"isort>=5.10.1,<6.0", # Import sorting linter
"black>=22.6.0,<23", # auto-formatter and linter
"mypy>=0.971,<1", # Static type analyzer
"types-requests", # Needed due to mypy typeshed
"flake8>=4.0.1,<5", # Style linter
"isort>=5.10.1,<6", # Import sorting linter
],
"doc": [
"Sphinx>=3.4.3,<4", # Documentation generator
Expand Down Expand Up @@ -48,6 +49,7 @@
with open("./README.md") as readme:
long_description = readme.read()


setup(
name="tokenlists",
use_scm_version=True,
Expand All @@ -62,10 +64,11 @@
python_requires=">=3.7.2,<3.11",
install_requires=[
"importlib-metadata ; python_version<'3.8'",
"click>=8.0.1",
"pydantic>=1.9.0,<2.0.0",
"pyyaml>=6.0,<7.0",
"semantic-version>=2.9.0,<3",
"click>=8.1.3,<9",
"pydantic>=1.9.2,<2",
"pyyaml>=6.0,<7",
"semantic-version>=2.10.0,<3",
"requests>=2.28.1,<3",
],
entry_points={"console_scripts": ["tokenlists=tokenlists._cli:cli"]},
extras_require=extras_require,
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_schema_fuzzing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
import requests # type: ignore
import requests
from hypothesis import HealthCheck, given, settings
from hypothesis_jsonschema import from_schema
from pydantic import ValidationError
Expand Down
12 changes: 9 additions & 3 deletions tests/functional/test_uniswap_examples.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import os

import github
import pytest # type: ignore
import requests # type: ignore
import pytest
import requests
from pydantic import ValidationError

from tokenlists import TokenList

# NOTE: Must export GITHUB_ACCESS_TOKEN
UNISWAP_REPO = github.Github(os.environ["GITHUB_ACCESS_TOKEN"]).get_repo("Uniswap/token-lists")

UNISWAP_RAW_URL = "https://raw.githubusercontent.com/Uniswap/token-lists/master/test/schema/"


Expand All @@ -20,6 +19,13 @@
def test_uniswap_tokenlists(token_list_name):
token_list = requests.get(UNISWAP_RAW_URL + token_list_name).json()

if token_list_name in (
"example-crosschain.tokenlist.json",
"extensions-valid-object.tokenlist.json",
):
# TODO: Unskip once can handle object extensions
pytest.skip("https://github.com/ApeWorX/py-tokenlists/issues/20")

if "invalid" not in token_list_name:
assert TokenList.parse_obj(token_list).dict() == token_list

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

import pytest # type: ignore
import pytest
from click.testing import CliRunner

from tokenlists import _cli, config
Expand Down
6 changes: 1 addition & 5 deletions tokenlists/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def choices(self):
return list(TokenListManager().available_tokenlists())


@click.group()
@click.group(short_help="Work with token lists")
@click.version_option(message="%(version)s", package_name="tokenlists")
def cli():
"""
Expand All @@ -41,25 +41,21 @@ def _list():
@click.argument("uri")
def install(uri):
manager = TokenListManager()

manager.install_tokenlist(uri)


@cli.command(short_help="Remove an existing tokenlist")
@click.argument("name", type=TokenlistChoice())
def remove(name):
manager = TokenListManager()

manager.remove_tokenlist(name)


@cli.command(short_help="Set the default tokenlist")
@click.argument("name", type=TokenlistChoice())
def set_default(name):
manager = TokenListManager()

manager.set_default_tokenlist(name)

click.echo(f"Default tokenlist is now: '{manager.default_tokenlist}'")


Expand Down
2 changes: 1 addition & 1 deletion tokenlists/manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Iterator, List, Optional

import requests # type: ignore
import requests

from tokenlists import config
from tokenlists.typing import ChainId, TokenInfo, TokenList, TokenSymbol
Expand Down

0 comments on commit 2683b6a

Please sign in to comment.