diff --git a/copier/errors.py b/copier/errors.py index cb3bdf830..2b62378bf 100644 --- a/copier/errors.py +++ b/copier/errors.py @@ -9,7 +9,8 @@ from .types import PathSeq if TYPE_CHECKING: # always false - from .user_data import AnswersMap, Question, Template + from .template import Template + from .user_data import AnswersMap, Question # Errors diff --git a/copier/main.py b/copier/main.py index 13b8f23d4..c788f6bd4 100644 --- a/copier/main.py +++ b/copier/main.py @@ -10,7 +10,7 @@ from itertools import chain from pathlib import Path from shutil import rmtree -from typing import Callable, List, Mapping, Optional, Sequence +from typing import Callable, Iterable, List, Mapping, Optional, Sequence from unicodedata import normalize import pathspec @@ -41,7 +41,8 @@ try: from functools import cached_property except ImportError: - from backports.cached_property import cached_property + # HACK https://github.com/python/mypy/issues/1153#issuecomment-558556828 + from backports.cached_property import cached_property # type: ignore @dataclass @@ -131,7 +132,7 @@ class Worker: """ src_path: Optional[str] = None - dst_path: Path = field(default=".") + dst_path: Path = field(default=Path(".")) answers_file: Optional[RelativePath] = None vcs_ref: OptStr = None data: AnyByStrDict = field(default_factory=dict) @@ -210,7 +211,7 @@ def _render_context(self) -> Mapping: _folder_name=self.subproject.local_abspath.name, ) - def _path_matcher(self, patterns: StrSeq) -> Callable[[Path], bool]: + def _path_matcher(self, patterns: Iterable[str]) -> Callable[[Path], bool]: """Produce a function that matches against specified patterns.""" # TODO Is normalization really needed? normalized_patterns = (normalize("NFD", pattern) for pattern in patterns) @@ -347,7 +348,7 @@ def answers(self) -> AnswersMap: question.get_default() if self.defaults else unsafe_prompt( - question.get_questionary_structure(), answers=result.combined + [question.get_questionary_structure()], answers=result.combined )[question.var_name] ) except KeyboardInterrupt as err: diff --git a/copier/subproject.py b/copier/subproject.py index c4d400978..73fd22634 100644 --- a/copier/subproject.py +++ b/copier/subproject.py @@ -3,6 +3,7 @@ A *subproject* is a project that gets rendered and/or updated with Copier. """ +import sys from pathlib import Path from typing import Optional @@ -15,9 +16,10 @@ from .types import AbsolutePath, AnyByStrDict, VCSTypes from .vcs import is_in_git_repo -try: +# HACK https://github.com/python/mypy/issues/8520#issuecomment-772081075 +if sys.version_info >= (3, 8): from functools import cached_property -except ImportError: +else: from backports.cached_property import cached_property diff --git a/copier/template.py b/copier/template.py index d543a1128..3b62732a1 100644 --- a/copier/template.py +++ b/copier/template.py @@ -29,13 +29,10 @@ try: from functools import cached_property except ImportError: - from backports.cached_property import cached_property - -try: - from typing import Literal -except ImportError: - from typing_extensions import Literal + # HACK https://github.com/python/mypy/issues/1153#issuecomment-558556828 + from backports.cached_property import cached_property # type: ignore +from .types import Literal # Default list of files in the template to exclude from the rendered project DEFAULT_EXCLUDE: Tuple[str, ...] = ( diff --git a/copier/tools.py b/copier/tools.py index ea90d27bf..be415510f 100644 --- a/copier/tools.py +++ b/copier/tools.py @@ -9,13 +9,14 @@ import warnings from contextlib import suppress from pathlib import Path -from typing import Any, Callable, Optional, TextIO, Union +from types import TracebackType +from typing import Any, Callable, Optional, TextIO, Tuple, Union import colorama from packaging.version import Version from pydantic import StrictBool -from .types import ExcInfo, IntSeq +from .types import IntSeq try: from importlib.metadata import version @@ -128,7 +129,9 @@ def force_str_end(original_str: str, end: str = "\n") -> str: return original_str -def handle_remove_readonly(func: Callable, path: str, exc: ExcInfo) -> None: +def handle_remove_readonly( + func: Callable, path: str, exc: Tuple[BaseException, OSError, TracebackType] +) -> None: """Handle errors when trying to remove read-only files through `shutil.rmtree`. This handler makes sure the given file is writable, then re-execute the given removal function. diff --git a/copier/types.py b/copier/types.py index 8b18a6649..99dfd1c9c 100644 --- a/copier/types.py +++ b/copier/types.py @@ -1,7 +1,7 @@ """Complex types, annotations, validators.""" +import sys from pathlib import Path -from types import TracebackType from typing import ( TYPE_CHECKING, Any, @@ -18,9 +18,10 @@ from pydantic.validators import path_validator -try: +# HACK https://github.com/python/mypy/issues/8520#issuecomment-772081075 +if sys.version_info >= (3, 8): from typing import Literal -except ImportError: +else: from typing_extensions import Literal if TYPE_CHECKING: @@ -54,7 +55,6 @@ Filters = Dict[str, Callable] LoaderPaths = Union[str, Iterable[str]] VCSTypes = Literal["git"] -ExcInfo = Tuple[BaseException, Exception, TracebackType] class AllowArbitraryTypes: diff --git a/copier/user_data.py b/copier/user_data.py index 9c295bf21..4d2fe9a3f 100644 --- a/copier/user_data.py +++ b/copier/user_data.py @@ -1,6 +1,7 @@ """Functions used to load user data.""" import datetime import json +import sys import warnings from collections import ChainMap from dataclasses import field @@ -30,9 +31,10 @@ from .tools import cast_str_to_bool, force_str_end from .types import AllowArbitraryTypes, AnyByStrDict, OptStr, OptStrOrPath, StrOrPath -try: +# HACK https://github.com/python/mypy/issues/8520#issuecomment-772081075 +if sys.version_info >= (3, 8): from functools import cached_property -except ImportError: +else: from backports.cached_property import cached_property if TYPE_CHECKING: @@ -249,7 +251,7 @@ def get_default_rendered(self) -> Union[bool, str, Choice, None]: return json.dumps(default, indent=2 if self.get_multiline() else None) if self.get_type_name() == "yaml": return yaml.safe_dump( - default, default_flow_style=not self.get_multiline(), width=float("inf") + default, default_flow_style=not self.get_multiline(), width=2147483647 ).strip() # All other data has to be str return str(default) diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 0f2fd850e..000000000 --- a/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -warn_no_return = False -ignore_missing_imports = True diff --git a/poetry.lock b/poetry.lock index 4c11cf90a..285dad2b7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -552,21 +552,21 @@ pytkdocs = ">=0.2.0,<0.13.0" [[package]] name = "mypy" -version = "0.910" +version = "0.920" description = "Optional static typing for Python" category = "dev" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" [package.dependencies] mypy-extensions = ">=0.4.3,<0.5.0" -toml = "*" -typed-ast = {version = ">=1.4.0,<1.5.0", markers = "python_version < \"3.8\""} +tomli = ">=1.1.0,<3.0.0" +typed-ast = {version = ">=1.4.0,<2", markers = "python_version < \"3.8\""} typing-extensions = ">=3.7.4" [package.extras] dmypy = ["psutil (>=4.0)"] -python2 = ["typed-ast (>=1.4.0,<1.5.0)"] +python2 = ["typed-ast (>=1.4.0,<2)"] [[package]] name = "mypy-extensions" @@ -732,7 +732,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "pydantic" -version = "1.8.2" +version = "1.9.0a1" description = "Data validation and settings management using python 3.6 type hinting" category = "main" optional = false @@ -1001,6 +1001,22 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "types-backports" +version = "0.1.3" +description = "Typing stubs for backports" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "types-pyyaml" +version = "6.0.1" +description = "Typing stubs for PyYAML" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "typing" version = "3.7.4.3" @@ -1088,7 +1104,7 @@ docs = ["mkdocs-material", "mkdocs-mermaid2-plugin", "mkdocstrings"] [metadata] lock-version = "1.1" python-versions = ">=3.6.2,<3.11" -content-hash = "74f077726a7a0c9e26b98af5bb29bf48c37568f6ac9ce6219f427fbe98655ce5" +content-hash = "c4d7f069f9cb841fa4ef8a01afd94fc8a6f84632fb9c89710447c6bb0bff153d" [metadata.files] astunparse = [ @@ -1413,29 +1429,26 @@ mkdocstrings = [ {file = "mkdocstrings-0.16.2.tar.gz", hash = "sha256:3d8a86c283dfa21818d5b9579aa4e750eea6b5c127b43ad8b00cebbfb7f9634e"}, ] mypy = [ - {file = "mypy-0.910-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:a155d80ea6cee511a3694b108c4494a39f42de11ee4e61e72bc424c490e46457"}, - {file = "mypy-0.910-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:b94e4b785e304a04ea0828759172a15add27088520dc7e49ceade7834275bedb"}, - {file = "mypy-0.910-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:088cd9c7904b4ad80bec811053272986611b84221835e079be5bcad029e79dd9"}, - {file = "mypy-0.910-cp35-cp35m-win_amd64.whl", hash = "sha256:adaeee09bfde366d2c13fe6093a7df5df83c9a2ba98638c7d76b010694db760e"}, - {file = "mypy-0.910-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:ecd2c3fe726758037234c93df7e98deb257fd15c24c9180dacf1ef829da5f921"}, - {file = "mypy-0.910-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:d9dd839eb0dc1bbe866a288ba3c1afc33a202015d2ad83b31e875b5905a079b6"}, - {file = "mypy-0.910-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:3e382b29f8e0ccf19a2df2b29a167591245df90c0b5a2542249873b5c1d78212"}, - {file = "mypy-0.910-cp36-cp36m-win_amd64.whl", hash = "sha256:53fd2eb27a8ee2892614370896956af2ff61254c275aaee4c230ae771cadd885"}, - {file = "mypy-0.910-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b6fb13123aeef4a3abbcfd7e71773ff3ff1526a7d3dc538f3929a49b42be03f0"}, - {file = "mypy-0.910-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e4dab234478e3bd3ce83bac4193b2ecd9cf94e720ddd95ce69840273bf44f6de"}, - {file = "mypy-0.910-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:7df1ead20c81371ccd6091fa3e2878559b5c4d4caadaf1a484cf88d93ca06703"}, - {file = "mypy-0.910-cp37-cp37m-win_amd64.whl", hash = "sha256:0aadfb2d3935988ec3815952e44058a3100499f5be5b28c34ac9d79f002a4a9a"}, - {file = "mypy-0.910-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ec4e0cd079db280b6bdabdc807047ff3e199f334050db5cbb91ba3e959a67504"}, - {file = "mypy-0.910-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:119bed3832d961f3a880787bf621634ba042cb8dc850a7429f643508eeac97b9"}, - {file = "mypy-0.910-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:866c41f28cee548475f146aa4d39a51cf3b6a84246969f3759cb3e9c742fc072"}, - {file = "mypy-0.910-cp38-cp38-win_amd64.whl", hash = "sha256:ceb6e0a6e27fb364fb3853389607cf7eb3a126ad335790fa1e14ed02fba50811"}, - {file = "mypy-0.910-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1a85e280d4d217150ce8cb1a6dddffd14e753a4e0c3cf90baabb32cefa41b59e"}, - {file = "mypy-0.910-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:42c266ced41b65ed40a282c575705325fa7991af370036d3f134518336636f5b"}, - {file = "mypy-0.910-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:3c4b8ca36877fc75339253721f69603a9c7fdb5d4d5a95a1a1b899d8b86a4de2"}, - {file = "mypy-0.910-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:c0df2d30ed496a08de5daed2a9ea807d07c21ae0ab23acf541ab88c24b26ab97"}, - {file = "mypy-0.910-cp39-cp39-win_amd64.whl", hash = "sha256:c6c2602dffb74867498f86e6129fd52a2770c48b7cd3ece77ada4fa38f94eba8"}, - {file = "mypy-0.910-py3-none-any.whl", hash = "sha256:ef565033fa5a958e62796867b1df10c40263ea9ded87164d67572834e57a174d"}, - {file = "mypy-0.910.tar.gz", hash = "sha256:704098302473cb31a218f1775a873b376b30b4c18229421e9e9dc8916fd16150"}, + {file = "mypy-0.920-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:41f3575b20714171c832d8f6c7aaaa0d499c9a2d1b8adaaf837b4c9065c38540"}, + {file = "mypy-0.920-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:431be889ffc8d9681813a45575c42e341c19467cbfa6dd09bf41467631feb530"}, + {file = "mypy-0.920-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f8b2059f73878e92eff7ed11a03515d6572f4338a882dd7547b5f7dd242118e6"}, + {file = "mypy-0.920-cp310-cp310-win_amd64.whl", hash = "sha256:9cd316e9705555ca6a50670ba5fb0084d756d1d8cb1697c83820b1456b0bc5f3"}, + {file = "mypy-0.920-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e091fe58b4475b3504dc7c3022ff7f4af2f9e9ddf7182047111759ed0973bbde"}, + {file = "mypy-0.920-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98b4f91a75fed2e4c6339e9047aba95968d3a7c4b91e92ab9dc62c0c583564f4"}, + {file = "mypy-0.920-cp36-cp36m-win_amd64.whl", hash = "sha256:562a0e335222d5bbf5162b554c3afe3745b495d67c7fe6f8b0d1b5bace0c1eeb"}, + {file = "mypy-0.920-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:618e677aabd21f30670bffb39a885a967337f5b112c6fb7c79375e6dced605d6"}, + {file = "mypy-0.920-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:40cb062f1b7ff4cd6e897a89d8ddc48c6ad7f326b5277c93a8c559564cc1551c"}, + {file = "mypy-0.920-cp37-cp37m-win_amd64.whl", hash = "sha256:69b5a835b12fdbfeed84ef31152d41343d32ccb2b345256d8682324409164330"}, + {file = "mypy-0.920-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:993c2e52ea9570e6e872296c046c946377b9f5e89eeb7afea2a1524cf6e50b27"}, + {file = "mypy-0.920-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:df0fec878ccfcb2d1d2306ba31aa757848f681e7bbed443318d9bbd4b0d0fe9a"}, + {file = "mypy-0.920-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:331a81d2c9bf1be25317260a073b41f4584cd11701a7c14facef0aa5a005e843"}, + {file = "mypy-0.920-cp38-cp38-win_amd64.whl", hash = "sha256:ffb1e57ec49a30e3c0ebcfdc910ae4aceb7afb649310b7355509df6b15bd75f6"}, + {file = "mypy-0.920-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:31895b0b3060baf15bf76e789d94722c026f673b34b774bba9e8772295edccff"}, + {file = "mypy-0.920-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:140174e872d20d4768124a089b9f9fc83abd6a349b7f8cc6276bc344eb598922"}, + {file = "mypy-0.920-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:13b3c110309b53f5a62aa1b360f598124be33a42563b790a2a9efaacac99f1fc"}, + {file = "mypy-0.920-cp39-cp39-win_amd64.whl", hash = "sha256:82e6c15675264e923b60a11d6eb8f90665504352e68edfbb4a79aac7a04caddd"}, + {file = "mypy-0.920-py3-none-any.whl", hash = "sha256:71c77bd885d2ce44900731d4652d0d1c174dc66a0f11200e0c680bdedf1a6b37"}, + {file = "mypy-0.920.tar.gz", hash = "sha256:a55438627f5f546192f13255a994d6d1cf2659df48adcf966132b4379fd9c86b"}, ] mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, @@ -1498,28 +1511,34 @@ pycodestyle = [ {file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"}, ] pydantic = [ - {file = "pydantic-1.8.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:05ddfd37c1720c392f4e0d43c484217b7521558302e7069ce8d318438d297739"}, - {file = "pydantic-1.8.2-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a7c6002203fe2c5a1b5cbb141bb85060cbff88c2d78eccbc72d97eb7022c43e4"}, - {file = "pydantic-1.8.2-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:589eb6cd6361e8ac341db97602eb7f354551482368a37f4fd086c0733548308e"}, - {file = "pydantic-1.8.2-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:10e5622224245941efc193ad1d159887872776df7a8fd592ed746aa25d071840"}, - {file = "pydantic-1.8.2-cp36-cp36m-win_amd64.whl", hash = "sha256:99a9fc39470010c45c161a1dc584997f1feb13f689ecf645f59bb4ba623e586b"}, - {file = "pydantic-1.8.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a83db7205f60c6a86f2c44a61791d993dff4b73135df1973ecd9eed5ea0bda20"}, - {file = "pydantic-1.8.2-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:41b542c0b3c42dc17da70554bc6f38cbc30d7066d2c2815a94499b5684582ecb"}, - {file = "pydantic-1.8.2-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:ea5cb40a3b23b3265f6325727ddfc45141b08ed665458be8c6285e7b85bd73a1"}, - {file = "pydantic-1.8.2-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:18b5ea242dd3e62dbf89b2b0ec9ba6c7b5abaf6af85b95a97b00279f65845a23"}, - {file = "pydantic-1.8.2-cp37-cp37m-win_amd64.whl", hash = "sha256:234a6c19f1c14e25e362cb05c68afb7f183eb931dd3cd4605eafff055ebbf287"}, - {file = "pydantic-1.8.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:021ea0e4133e8c824775a0cfe098677acf6fa5a3cbf9206a376eed3fc09302cd"}, - {file = "pydantic-1.8.2-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e710876437bc07bd414ff453ac8ec63d219e7690128d925c6e82889d674bb505"}, - {file = "pydantic-1.8.2-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:ac8eed4ca3bd3aadc58a13c2aa93cd8a884bcf21cb019f8cfecaae3b6ce3746e"}, - {file = "pydantic-1.8.2-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:4a03cbbe743e9c7247ceae6f0d8898f7a64bb65800a45cbdc52d65e370570820"}, - {file = "pydantic-1.8.2-cp38-cp38-win_amd64.whl", hash = "sha256:8621559dcf5afacf0069ed194278f35c255dc1a1385c28b32dd6c110fd6531b3"}, - {file = "pydantic-1.8.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8b223557f9510cf0bfd8b01316bf6dd281cf41826607eada99662f5e4963f316"}, - {file = "pydantic-1.8.2-cp39-cp39-manylinux1_i686.whl", hash = "sha256:244ad78eeb388a43b0c927e74d3af78008e944074b7d0f4f696ddd5b2af43c62"}, - {file = "pydantic-1.8.2-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:05ef5246a7ffd2ce12a619cbb29f3307b7c4509307b1b49f456657b43529dc6f"}, - {file = "pydantic-1.8.2-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:54cd5121383f4a461ff7644c7ca20c0419d58052db70d8791eacbbe31528916b"}, - {file = "pydantic-1.8.2-cp39-cp39-win_amd64.whl", hash = "sha256:4be75bebf676a5f0f87937c6ddb061fa39cbea067240d98e298508c1bda6f3f3"}, - {file = "pydantic-1.8.2-py3-none-any.whl", hash = "sha256:fec866a0b59f372b7e776f2d7308511784dace622e0992a0b59ea3ccee0ae833"}, - {file = "pydantic-1.8.2.tar.gz", hash = "sha256:26464e57ccaafe72b7ad156fdaa4e9b9ef051f69e175dbbb463283000c05ab7b"}, + {file = "pydantic-1.9.0a1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:0f5d37caf853b21313d0ce1e552056d8c437f8629213a70a9b7022c6f4e9847e"}, + {file = "pydantic-1.9.0a1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fc86051cf543bebb3fd1453a6498c7b0527ac2efda067ac4796f8784a0c4372"}, + {file = "pydantic-1.9.0a1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a5a51dd5479d35ddb31788137a877dc3d3c42d6ae5728a40ee2f9983180bd1b7"}, + {file = "pydantic-1.9.0a1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:4d9e1a1d129039325ea37fae46aa7f7507f064e9f697957cd6edfaef7d3495e2"}, + {file = "pydantic-1.9.0a1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:6cd1a637d541f4e5efe520fd604e4be78261105c0ba1adb82f3058ca104664b6"}, + {file = "pydantic-1.9.0a1-cp36-cp36m-win_amd64.whl", hash = "sha256:ba48134642abccd96177060e45805fcf51f95d307f129aa995d5f8b245484ae5"}, + {file = "pydantic-1.9.0a1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:f6c72b4f850e469f03b256ebc0db8430b15d54269d4553057da62a2a6c87c840"}, + {file = "pydantic-1.9.0a1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1a8a1f8af567a9794ff71fe93cdcac53163cd3c186352a20fdd7eab390c8a370"}, + {file = "pydantic-1.9.0a1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:022f1b57be8dc895c71d2e5ae4f18b3d9b9cac6ffc4cadc85d457c7142d7b876"}, + {file = "pydantic-1.9.0a1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c92877634e1e0320f4d723255dd10a10e6a7cb810caee52fa61aaf0e9938a38c"}, + {file = "pydantic-1.9.0a1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:c4c0925747d730efef3dfbdd05873019fae795302234ad50c194bb53f6f41589"}, + {file = "pydantic-1.9.0a1-cp37-cp37m-win_amd64.whl", hash = "sha256:9d6c622351c8ad80d2741fef4b8bc34b133a255c5119008b22dc1141829664f5"}, + {file = "pydantic-1.9.0a1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:063fa9de9159d17e26b6849f8531532ef6192bd42a1917cbf067efd52256a1c1"}, + {file = "pydantic-1.9.0a1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ea3b1fbbfed8191c175c786e6da614cb02f7f13acc775d2c0b6b4c23bbc3bf0b"}, + {file = "pydantic-1.9.0a1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:08b621d2f267e37ef965c5651861f20c7d1289407ec51f98227a06365f7508fc"}, + {file = "pydantic-1.9.0a1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f173849d17524a59ea080854056202ef40b088d13520e46fadc156642df60afa"}, + {file = "pydantic-1.9.0a1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:be13b6db2ed2b6dc0fbd6ae6cea97c1dd033aa1bc66a77d1145c84b395c5ffcc"}, + {file = "pydantic-1.9.0a1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:cdf2deaae7ff4ff79ede8c1825d19e4d414850779533cc8777a42b80ad85a745"}, + {file = "pydantic-1.9.0a1-cp38-cp38-win_amd64.whl", hash = "sha256:59097757a73e82e204608f95b89607e7fea955feb5c2dcf1847e261176efd9f5"}, + {file = "pydantic-1.9.0a1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:e3d05f2e4061b19709f1ba8b2fb329ff028444376712b8fa5b47b6e2e28e83fd"}, + {file = "pydantic-1.9.0a1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:1c4290343c90636bd4c6271dc5ccd9ffd55c41b62d0d00e3a12eb54ab7008c11"}, + {file = "pydantic-1.9.0a1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eb880ef3ee3073f6e255de2f479903f9ecc34a0905bad3b3bb0afaaa1fb5e1d1"}, + {file = "pydantic-1.9.0a1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fbdd504ae26e2cbebbdc0837bb54f75eeecebe3d92380a2b4be7b70d685c97a3"}, + {file = "pydantic-1.9.0a1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:ef3f401c41db09340f7d8e606207c4835c7118af39f8d126d3cd2f5d0dce5fcf"}, + {file = "pydantic-1.9.0a1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:706bf53a1f3f28a865ea8b0dc21da2f001e2389c0dc93aab64b34c6e19062856"}, + {file = "pydantic-1.9.0a1-cp39-cp39-win_amd64.whl", hash = "sha256:786b0c309900c7a9e5b639195a824dd6e405d631be2e2e0f80083238b8b9f3d7"}, + {file = "pydantic-1.9.0a1-py3-none-any.whl", hash = "sha256:4bf5aed4f22e1a7d91f6084150584bf9d3d8192c88c03451e59cdc46fd12b6be"}, + {file = "pydantic-1.9.0a1.tar.gz", hash = "sha256:c51156e35b35dcaeb964cad89e0914d9468f2612bd2455898ac11b038aced03d"}, ] pyflakes = [ {file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"}, @@ -1672,6 +1691,14 @@ typed-ast = [ {file = "typed_ast-1.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:9c6d1a54552b5330bc657b7ef0eae25d00ba7ffe85d9ea8ae6540d2197a3788c"}, {file = "typed_ast-1.4.3.tar.gz", hash = "sha256:fb1bbeac803adea29cedd70781399c99138358c26d05fcbd23c13016b7f5ec65"}, ] +types-backports = [ + {file = "types-backports-0.1.3.tar.gz", hash = "sha256:f4b7206c073df88d6200891e3d27506185fd60cda66fb289737b2fa92c0010cf"}, + {file = "types_backports-0.1.3-py2.py3-none-any.whl", hash = "sha256:dafcd61848081503e738a7768872d1dd6c018401b4d2a1cfb608ea87ec9864b9"}, +] +types-pyyaml = [ + {file = "types-PyYAML-6.0.1.tar.gz", hash = "sha256:2e27b0118ca4248a646101c5c318dc02e4ca2866d6bc42e84045dbb851555a76"}, + {file = "types_PyYAML-6.0.1-py3-none-any.whl", hash = "sha256:d5b318269652e809b5c30a5fe666c50159ab80bfd41cd6bafe655bf20b29fcba"}, +] typing = [ {file = "typing-3.7.4.3-py2-none-any.whl", hash = "sha256:283d868f5071ab9ad873e5e52268d611e851c870a2ba354193026f2dfb29d8b5"}, {file = "typing-3.7.4.3.tar.gz", hash = "sha256:1187fb9c82fd670d10aa07bbb6cfcfe4bdda42d6fab8d5134f04e8c4d0b71cc9"}, diff --git a/pyproject.toml b/pyproject.toml index b8de57c97..2fafc0647 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ mkdocstrings = { version = "^0.16.2", optional = true } packaging = "^21.0" # packaging is needed when installing from PyPI pathspec = "^0.9.0" plumbum = "^1.6.9" -pydantic = "^1.7.2" +pydantic = "^1.9.0a1" # HACK https://github.com/samuelcolvin/pydantic/pull/3175 Pygments = "^2.7.1" PyYAML = "^5.3.1" pyyaml-include = "^1.2" @@ -62,13 +62,15 @@ flake8 = "^4.0.1" flake8-bugbear = "^21.11.29" flake8-comprehensions = "^3.7.0" flake8-debugger = "^4.0.0" -mypy = "^0.910" +mypy = "^0.920" pexpect = "^4.8.0" poethepoet = "^0.11.0" pre-commit = "^2.16.0" pytest = "^6.1.1" pytest-cov = "^3.0.0" pytest-xdist = "^2.5.0" +types-PyYAML = "^6.0.1" +types-backports = "^0.1.3" [tool.poe.tasks.clean] script = "devtasks:clean" @@ -117,6 +119,11 @@ line_length = 88 multi_line_output = 3 # black interop use_parentheses = true +[tool.mypy] +ignore_missing_imports = true +plugins = ["pydantic.mypy"] +warn_no_return = false + [build-system] requires = ["poetry_core>=1.0.0", "poetry-dynamic-versioning"] build-backend = "poetry.core.masonry.api" diff --git a/tests/test_templated_prompt.py b/tests/test_templated_prompt.py index 903b2868d..9e5c7e8cf 100644 --- a/tests/test_templated_prompt.py +++ b/tests/test_templated_prompt.py @@ -18,7 +18,6 @@ build_file_tree, ) -envops = {} main_default = "copier" main_question = { "main": {"default": main_default},