From a7f94c8354f1cf2bab215035c6585adcfe9228c0 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Thu, 13 Apr 2023 10:59:57 +0100 Subject: [PATCH] Redo as a package to fix mypy issues (#215) * Demo the mypy types issue * Redo as a package * Update setup.py --------- Co-authored-by: Matt Seymour --- .flake8 | 2 +- .github/workflows/test.yml | 10 ++++++++-- MANIFEST.in | 1 - dj_database_url.py => dj_database_url/__init__.py | 0 py.typed => dj_database_url/py.typed | 0 setup.py | 6 ++++-- tests/__init__.py | 0 .../test_dj_database_url.py | 0 8 files changed, 13 insertions(+), 6 deletions(-) delete mode 100644 MANIFEST.in rename dj_database_url.py => dj_database_url/__init__.py (100%) rename py.typed => dj_database_url/py.typed (100%) create mode 100644 tests/__init__.py rename test_dj_database_url.py => tests/test_dj_database_url.py (100%) diff --git a/.flake8 b/.flake8 index 5c86e2d..a98c929 100644 --- a/.flake8 +++ b/.flake8 @@ -2,4 +2,4 @@ max-line-length = 88 extend-ignore = E203 per-file-ignores= - test_dj_database_url.py: E501, E265 + tests/test_dj_database_url.py: E501, E265 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91d002e..85cd03b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,13 +37,19 @@ jobs: - name: Run mypy run: | - python -m mypy dj_database_url.py + python -m mypy dj_database_url - name: Run Tests run: | echo "$(python --version) / Django $(django-admin --version)" - coverage run --source=dj_database_url --branch -m unittest discover + coverage run --source=dj_database_url --branch -m unittest discover -v coverage report coverage xml - uses: codecov/codecov-action@v3 + + - name: Check mypy types installation + run: | + pip install . + cd tests + python -m mypy . diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 13c250a..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include py.typed diff --git a/dj_database_url.py b/dj_database_url/__init__.py similarity index 100% rename from dj_database_url.py rename to dj_database_url/__init__.py diff --git a/py.typed b/dj_database_url/py.typed similarity index 100% rename from py.typed rename to dj_database_url/py.typed diff --git a/setup.py b/setup.py index 6ad3673..e967a7c 100644 --- a/setup.py +++ b/setup.py @@ -13,10 +13,12 @@ setup( description="Use Database URLs in your Django Application.", long_description=readme, long_description_content_type="text/x-rst", - py_modules=["dj_database_url"], + packages=["dj_database_url"], install_requires=["Django>=3.2", "typing_extensions >= 3.10.0.0"], - zip_safe=False, include_package_data=True, + package_data={ + "dj_database_url": ["py.typed"], + }, platforms="any", project_urls={ "GitHub": "https://github.com/jazzband/dj-database-url/", diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_dj_database_url.py b/tests/test_dj_database_url.py similarity index 100% rename from test_dj_database_url.py rename to tests/test_dj_database_url.py