Skip to content

Commit 150e493

Browse files
committed
fix: remove --require-hashes mode
Due to issues with pytype not pinning dependency versions, I'm removing the explicit version checking semantics. See also: * google/pytype#731 * cjolowicz/hypermodern-python#174
1 parent 934da90 commit 150e493

File tree

2 files changed

+23
-33
lines changed

2 files changed

+23
-33
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# hypermodern-python-seed
22

3-
Generate python seed apps based on [hypermodern-python][1].
3+
Generate python seed apps based on `cjolowicz's` [hypermodern-python][1]. Note
4+
that `cjolowicz` has also created a [seed][3] repo. I prefer this one b/c I only
5+
pulled in the ideas that are relevant to the projects I build, today.
46

57
## Dependencies
68

79
* [cookiecutter](https://github.com/cookiecutter/cookiecutter)
810

9-
See [hypermodern-python][1] for installation instructions for these:
11+
See [hypermodern-python][1] for further installation instructions. You'll need
12+
these:
1013

1114
* poetry
1215
* pyenv
@@ -20,6 +23,11 @@ See [hypermodern-python][1] for installation instructions for these:
2023

2124
nox
2225

26+
## Notes
27+
28+
* Not using --require-hashes mode due to [pytype issue 731][2]
2329

2430
# Links
2531
[1]: https://cjolowicz.github.io/posts/hypermodern-python-01-setup/
32+
[2]: https://github.com/google/pytype/issues/731
33+
[3]: https://github.com/cjolowicz/cookiecutter-hypermodern-python
Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,26 @@
1-
"""project_name Nox sessions."""
2-
3-
import tempfile
4-
from typing import Any
1+
"""{{cookiecutter.project_name}} Nox sessions."""
52

63
import nox
74
from nox.sessions import Session
85

96
locations = "src", "tests", "noxfile.py", "docs/conf.py"
107
nox.options.sessions = "lint", "mypy", "pytype", "tests"
11-
_versions = ["3.7"]
12-
13-
14-
def install_with_constraints(session: Session, *args: str, **kwargs: Any) -> None:
15-
"""Install application dependencies using constraints."""
16-
with tempfile.NamedTemporaryFile() as requirements:
17-
session.run(
18-
"poetry",
19-
"export",
20-
"--dev",
21-
"--format=requirements.txt",
22-
f"--output={requirements.name}",
23-
external=True,
24-
)
25-
session.install(f"--constraint={requirements.name}", *args, **kwargs)
8+
_versions = ["3.7", "3.8"]
269

2710

2811
@nox.session(python=_versions)
2912
def lint(session: Session) -> None:
3013
"""Run the code linters."""
3114
args = session.posargs or locations
32-
install_with_constraints(
33-
session,
15+
session.install(
16+
"darglint",
3417
"flake8",
3518
"flake8-annotations",
3619
"flake8-black",
37-
"flake8-isort",
3820
"flake8-docstrings",
39-
"darglint",
21+
"flake8-isort",
22+
"flake8-rst-docstrings",
23+
"flake8_sphinx_links",
4024
)
4125
session.run("flake8", *args)
4226

@@ -46,9 +30,7 @@ def tests(session: Session) -> None:
4630
"""Run tests."""
4731
args = session.posargs or ["--cov", "--xdoctest"]
4832
session.run("poetry", "install", "--no-dev", external=True)
49-
install_with_constraints(
50-
session, "coverage[toml]", "pytest", "pytest-cov", "xdoctest"
51-
)
33+
session.install("coverage[toml]", "pytest", "pytest-cov", "xdoctest")
5234
session.run("pytest", *args)
5335

5436

@@ -63,37 +45,37 @@ def format(session: Session) -> None:
6345
def isort(session: Session) -> None:
6446
"""Run the import re-orderer (isort)."""
6547
args = session.posargs or locations
66-
install_with_constraints(session, "flake8-isort")
48+
session.install("flake8-isort")
6749
session.run("isort", *args)
6850

6951

7052
@nox.session(python=_versions)
7153
def black(session: Session) -> None:
7254
"""Run the code reformatter (black)."""
7355
args = session.posargs or locations
74-
install_with_constraints(session, "black")
56+
session.install("black")
7557
session.run("black", *args)
7658

7759

7860
@nox.session(python=_versions)
7961
def mypy(session: Session) -> None:
8062
"""Run the static type checker (mypy))."""
8163
args = session.posargs or locations
82-
install_with_constraints(session, "mypy")
64+
session.install("mypy")
8365
session.run("mypy", *args)
8466

8567

8668
@nox.session(python=_versions)
8769
def pytype(session: Session) -> None:
8870
"""Run the static type checker (pytype)."""
8971
args = session.posargs or ["--disable=import-error", *locations]
90-
install_with_constraints(session, "pytype")
72+
session.install("pytype")
9173
session.run("pytype", *args)
9274

9375

9476
@nox.session(python=_versions)
9577
def docs(session: Session) -> None:
9678
"""Build the documentation."""
9779
session.run("poetry", "install", "--no-dev", external=True)
98-
install_with_constraints(session, "sphinx", "sphinx-autodoc-typehints")
80+
session.install("sphinx", "sphinx-autodoc-typehints")
9981
session.run("sphinx-build", "docs", "docs/_build")

0 commit comments

Comments
 (0)