Merge pull request #717 from henryiii/henryiii/style/config
This commit is contained in:
@@ -37,7 +37,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -e ".[dev]"
|
||||
python -m pip install ".[test]"
|
||||
|
||||
- name: Sample build
|
||||
if: "contains(github.event.pull_request.labels.*.name, 'CI: Sample build')"
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
- uses: actions/setup-python@v2
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -r requirements-dev.txt
|
||||
python -m pip install ".[test]"
|
||||
|
||||
- name: Set up QEMU
|
||||
id: qemu
|
||||
|
||||
+18
-7
@@ -14,7 +14,7 @@ repos:
|
||||
- id: trailing-whitespace
|
||||
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.19.1
|
||||
rev: v2.19.4
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
name: PyUpgrade 3.6+
|
||||
@@ -31,7 +31,7 @@ repos:
|
||||
- id: isort
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 21.5b2
|
||||
rev: 21.6b0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
@@ -42,17 +42,28 @@ repos:
|
||||
stages: [manual]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.812
|
||||
rev: v0.902
|
||||
hooks:
|
||||
- id: mypy
|
||||
exclude: ^(bin/|cibuildwheel/resources/).*py$
|
||||
additional_dependencies: [packaging]
|
||||
args: ["--python-version=3.6", "--ignore-missing-imports", "--scripts-are-modules"]
|
||||
args: ["--python-version=3.6", "--scripts-are-modules"]
|
||||
additional_dependencies:
|
||||
- packaging
|
||||
- types-jinja2
|
||||
- types-certifi
|
||||
- types-toml
|
||||
- id: mypy
|
||||
name: mypy 3.7+ on bin/
|
||||
files: ^bin/.*py$
|
||||
additional_dependencies: [packaging]
|
||||
args: ["--python-version=3.7", "--ignore-missing-imports", "--scripts-are-modules"]
|
||||
args: ["--python-version=3.7", "--scripts-are-modules"]
|
||||
additional_dependencies:
|
||||
- packaging
|
||||
- rich
|
||||
- types-jinja2
|
||||
- types-pyyaml
|
||||
- types-click
|
||||
- types-requests
|
||||
- types-toml
|
||||
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 3.9.2
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ class Project:
|
||||
print(f"Broken: {self.stars_repo}")
|
||||
raise
|
||||
|
||||
self.num_stars = repo.stargazers_count
|
||||
self.num_stars: int = repo.stargazers_count
|
||||
self.pushed_at = repo.pushed_at
|
||||
if not self.notes:
|
||||
notes = repo.description
|
||||
|
||||
@@ -122,7 +122,7 @@ class PyPyVersions:
|
||||
self.arch = arch_str
|
||||
|
||||
def get_arch_file(self, release: dict[str, Any]) -> str:
|
||||
urls = [
|
||||
urls: list[str] = [
|
||||
rf["download_url"]
|
||||
for rf in release["files"]
|
||||
if "" in rf["platform"] == f"win{self.arch}"
|
||||
@@ -131,7 +131,7 @@ class PyPyVersions:
|
||||
|
||||
def update_version_windows(self, spec: Specifier) -> ConfigWinCP:
|
||||
releases = [r for r in self.releases if spec.contains(r["python_version"])]
|
||||
releases = sorted(releases, key=lambda r: r["pypy_version"])
|
||||
releases = sorted(releases, key=lambda r: r["pypy_version"]) # type: ignore
|
||||
releases = [r for r in releases if self.get_arch_file(r)]
|
||||
|
||||
if not releases:
|
||||
@@ -156,7 +156,7 @@ class PyPyVersions:
|
||||
raise RuntimeError("Other archs not supported yet on macOS")
|
||||
|
||||
releases = [r for r in self.releases if spec.contains(r["python_version"])]
|
||||
releases = sorted(releases, key=lambda r: r["pypy_version"])
|
||||
releases = sorted(releases, key=lambda r: r["pypy_version"]) # type: ignore
|
||||
|
||||
if not releases:
|
||||
raise RuntimeError(f"PyPy macOS {self.arch} not found for {spec}!")
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ def update_pins(session):
|
||||
"""
|
||||
Update the python and docker pins version inplace.
|
||||
"""
|
||||
session.install("-e", ".[dev]")
|
||||
session.install("-e", ".[bin]")
|
||||
session.run("python", "bin/update_pythons.py", "--force")
|
||||
session.run("python", "bin/update_docker.py")
|
||||
|
||||
@@ -58,7 +58,7 @@ def update_proj(session):
|
||||
"""
|
||||
Update the README inplace.
|
||||
"""
|
||||
session.install("-e", ".[dev]")
|
||||
session.install("-e", ".[bin]")
|
||||
session.run("./bin/projects.py", "docs/data/projects.yml", "--readme=README.md")
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,62 @@ requires = [
|
||||
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
|
||||
[tool.black]
|
||||
line-length = 100
|
||||
target-version = ['py36', 'py37', 'py38', 'py39']
|
||||
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
multi_line_output = 3
|
||||
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
minversion = 6.0
|
||||
junit_family = "xunit2"
|
||||
testpaths = [
|
||||
"test",
|
||||
"unit_test",
|
||||
]
|
||||
|
||||
|
||||
[tool.mypy]
|
||||
python_version = 3.7
|
||||
files = [
|
||||
"cibuildwheel/*.py",
|
||||
"test/**/*.py",
|
||||
"unit_test/**/*.py",
|
||||
"bin/*.py"
|
||||
]
|
||||
warn_unused_configs = true
|
||||
warn_redundant_casts = true
|
||||
no_implicit_reexport = true
|
||||
strict_equality = true
|
||||
warn_unused_ignores = true
|
||||
check_untyped_defs = true
|
||||
|
||||
disallow_subclassing_any = true
|
||||
disallow_any_generics = true
|
||||
warn_return_any = true
|
||||
no_implicit_optional = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "cibuildwheel.*"
|
||||
disallow_untyped_defs = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_untyped_decorators = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = [
|
||||
"setuptools",
|
||||
"pytest", # ignored in pre-commit to speed up check
|
||||
"bashlex",
|
||||
"toml.encoder", # encoder missing from stub package
|
||||
"bracex",
|
||||
"importlib_resources",
|
||||
"nox",
|
||||
"github",
|
||||
]
|
||||
ignore_missing_imports = true
|
||||
|
||||
@@ -65,57 +65,3 @@ exclude =
|
||||
env??/,
|
||||
.venv/,
|
||||
site/
|
||||
|
||||
[tool:pytest]
|
||||
junit_family = xunit2
|
||||
testpaths =
|
||||
test
|
||||
unit_test
|
||||
|
||||
[mypy]
|
||||
python_version = 3.7
|
||||
files = cibuildwheel/*.py,test/**/*.py,unit_test/**/*.py,bin/*.py
|
||||
warn_unused_configs = True
|
||||
warn_redundant_casts = True
|
||||
|
||||
[mypy-test.*,mypy-unit_test.*]
|
||||
check_untyped_defs = True
|
||||
|
||||
[mypy-cibuildwheel.*]
|
||||
disallow_any_generics = True
|
||||
disallow_subclassing_any = True
|
||||
disallow_untyped_calls = True
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
check_untyped_defs = True
|
||||
disallow_untyped_decorators = True
|
||||
no_implicit_optional = True
|
||||
warn_unused_ignores = True
|
||||
warn_return_any = True
|
||||
no_implicit_reexport = True
|
||||
strict_equality = True
|
||||
|
||||
[mypy-setuptools.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
# Ignored for pre-commit to speed up check
|
||||
# Not ignored if manually running and pytest installed
|
||||
[mypy-pytest.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-bashlex.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
# Has type stubs, but no pyproject.toml or .pyi files in the wheel.
|
||||
[mypy-toml.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-bracex.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-importlib_resources.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[tool:isort]
|
||||
profile = black
|
||||
multi_line_output = 3
|
||||
|
||||
@@ -8,24 +8,38 @@ extras = {
|
||||
],
|
||||
"test": [
|
||||
"jinja2",
|
||||
"pytest>=4",
|
||||
"pytest>=6",
|
||||
"pytest-timeout",
|
||||
],
|
||||
"dev": [
|
||||
"bin": [
|
||||
"click",
|
||||
"ghapi",
|
||||
"mypy>=0.800",
|
||||
"packaging>=20.8",
|
||||
"pip-tools",
|
||||
"pygithub",
|
||||
"pyyaml",
|
||||
"requests",
|
||||
"rich>=9.6",
|
||||
"typing-extensions",
|
||||
"packaging>=20.8",
|
||||
],
|
||||
"mypy": [
|
||||
"mypy>=0.901",
|
||||
"types-jinja2",
|
||||
"types-certifi",
|
||||
"types-toml",
|
||||
"types-jinja2",
|
||||
"types-pyyaml",
|
||||
"types-click",
|
||||
"types-requests",
|
||||
"types-toml",
|
||||
],
|
||||
}
|
||||
|
||||
extras["dev"] = [
|
||||
*extras["mypy"],
|
||||
*extras["test"],
|
||||
*extras["bin"],
|
||||
]
|
||||
|
||||
extras["all"] = sum(extras.values(), [])
|
||||
extras["dev"] += extras["test"]
|
||||
|
||||
setup(extras_require=extras)
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
from .base import TestProject # noqa
|
||||
from .c import new_c_project # noqa
|
||||
from .base import TestProject
|
||||
from .c import new_c_project
|
||||
|
||||
__all__ = ("TestProject", "new_c_project")
|
||||
|
||||
@@ -11,7 +11,7 @@ def test_compare_configs():
|
||||
|
||||
dict_txt = toml.loads(txt)
|
||||
|
||||
new_txt = toml.dumps(dict_txt, encoder=InlineArrayDictEncoder())
|
||||
new_txt = toml.dumps(dict_txt, encoder=InlineArrayDictEncoder()) # type: ignore
|
||||
print(new_txt)
|
||||
|
||||
assert new_txt == txt
|
||||
@@ -35,6 +35,6 @@ python_configurations = [
|
||||
]
|
||||
"""
|
||||
|
||||
output = toml.dumps(example, encoder=InlineArrayDictEncoder())
|
||||
output = toml.dumps(example, encoder=InlineArrayDictEncoder()) # type: ignore
|
||||
print(output)
|
||||
assert output == result
|
||||
|
||||
@@ -63,6 +63,7 @@ def test_container_removed():
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True,
|
||||
).stdout
|
||||
assert container.name is not None
|
||||
assert container.name in docker_containers_listing
|
||||
old_container_name = container.name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user