Skip to content

Commit

Permalink
Improve type checking, move into dir, refactor into functions
Browse files Browse the repository at this point in the history
The module has been moved into a module directory, due to py.typed not
taking effect otherwise. The module has been refactored so that the work
is divided into more concise and atomic functions. This may improve
patching in the long term. Type annotations were revised and improved,
although there is still some room for improvement.
  • Loading branch information
sanjacob committed Jan 4, 2024
1 parent aa0a75b commit 446b9ff
Show file tree
Hide file tree
Showing 8 changed files with 415 additions and 470 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
pip install -r requirements.txt
- name: Run linter
run: flake8
run: flake8 tiny_api_client

- name: Run type checker
run: mypy tiny_api_client.py
run: mypy tiny_api_client

- name: Run test suite
run: pytest -vvvv
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "pypi"
requests = "*"

[dev-packages]
mypy = "*"
mypy = "1.8.0"
pytest = "*"
sphinx = "*"
build = "*"
Expand Down
319 changes: 97 additions & 222 deletions Pipfile.lock

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,4 @@ docs = ["sphinx", "sphinx-rtd-theme"]
"Bug Tracker" = "https://github.com/sanjacob/tiny-api-client/issues"

[tool.isort]
length_sort = true

[tool.flake8]
max-line-length = 88
no_sections = true
2 changes: 1 addition & 1 deletion tests/test_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def fetch_my_endpoint(self, response):
def test_session_member(mock_requests, example_url, example_note):
@api_client(example_url)
class MyClient:
def __init__(self, session: str):
def __init__(self, session: dict[str, str]):
self._session = session

@get('/my-endpoint')
Expand Down
240 changes: 0 additions & 240 deletions tiny_api_client.py

This file was deleted.

Loading

0 comments on commit 446b9ff

Please sign in to comment.