mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-11 06:21:58 +08:00
* Move mypy version upper bound to a [compatible-mypy] extra Due to a bug in mypy 0.940 (#870), we made two changes in #871: • pinned mypy==0.931 in requirements.txt (for running our tests); • bounded mypy<0.940 in setup.py (for downstream users). After the mypy bug was quickly fixed upstream in 0.941, our setup.py bound has been repeatedly raised but not removed (#886, #939, #973). The only changes in those commits have been to the precise wording of error messages expected in our tests. Those wording changes don’t impact compatibility for downstream users, so it should be safe to go back to allowing them to upgrade mypy independently. Since mypy doesn’t yet guarantee backwards compatibility in the plugin API (although in practice it has rarely been an issue), add a django-stubs[compatible-mypy] extra for users who prefer a known-good version of mypy even if it’s a little out of date. Signed-off-by: Anders Kaseorg <andersk@mit.edu> * Update setup.py Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
73 lines
1.9 KiB
Python
73 lines
1.9 KiB
Python
import os
|
|
from typing import List
|
|
|
|
from setuptools import find_packages, setup
|
|
|
|
|
|
def find_stub_files(name: str) -> List[str]:
|
|
result = []
|
|
for root, _dirs, files in os.walk(name):
|
|
for file in files:
|
|
if file.endswith(".pyi"):
|
|
if os.path.sep in root:
|
|
sub_root = root.split(os.path.sep, 1)[-1]
|
|
file = os.path.join(sub_root, file)
|
|
result.append(file)
|
|
return result
|
|
|
|
|
|
with open("README.md") as f:
|
|
readme = f.read()
|
|
|
|
dependencies = [
|
|
"mypy>=0.930",
|
|
"django",
|
|
"django-stubs-ext>=0.4.0",
|
|
"tomli",
|
|
# Types:
|
|
"typing-extensions",
|
|
"types-pytz",
|
|
"types-PyYAML",
|
|
]
|
|
|
|
extras_require = {
|
|
"compatible-mypy": ["mypy>=0.930,<0.970"],
|
|
}
|
|
|
|
setup(
|
|
name="django-stubs",
|
|
version="1.11.1",
|
|
description="Mypy stubs for Django",
|
|
long_description=readme,
|
|
long_description_content_type="text/markdown",
|
|
license="MIT",
|
|
url="https://github.com/typeddjango/django-stubs",
|
|
author="Maksim Kurnikov",
|
|
author_email="maxim.kurnikov@gmail.com",
|
|
py_modules=[],
|
|
python_requires=">=3.7",
|
|
install_requires=dependencies,
|
|
extras_require=extras_require,
|
|
packages=["django-stubs", *find_packages(exclude=["scripts"])],
|
|
package_data={
|
|
"django-stubs": find_stub_files("django-stubs"),
|
|
"mypy_django_plugin": ["py.typed"],
|
|
},
|
|
classifiers=[
|
|
"License :: OSI Approved :: MIT License",
|
|
"Operating System :: OS Independent",
|
|
"Programming Language :: Python :: 3.7",
|
|
"Programming Language :: Python :: 3.8",
|
|
"Programming Language :: Python :: 3.9",
|
|
"Typing :: Typed",
|
|
"Framework :: Django",
|
|
"Framework :: Django :: 2.2",
|
|
"Framework :: Django :: 3.0",
|
|
"Framework :: Django :: 3.1",
|
|
"Framework :: Django :: 3.2",
|
|
],
|
|
project_urls={
|
|
"Release notes": "https://github.com/typeddjango/django-stubs/releases",
|
|
},
|
|
)
|