diff --git a/CHANGELOG.md b/CHANGELOG.md index 170865c5c..aec5dfb47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Lowered the minimum version of `python-dateutil` to 2.8.0 for improved compatibility (#298 & #299). Thanks @bowenwr! - The `from_dict` method on generated models is now a `@classmethod` instead of `@staticmethod` (#215 & #292). Thanks @forest-benchling! +- Renamed all templates to end in `.jinja`, and all python-templates to end in `.py.jinja` to fix confusion with the latest version of mypy. Note **this will break existing custom templates until you update your template file names**. ### Fixes diff --git a/end_to_end_tests/test_custom_templates/endpoint_module.pyi b/end_to_end_tests/test_custom_templates/endpoint_module.py.jinja similarity index 93% rename from end_to_end_tests/test_custom_templates/endpoint_module.pyi rename to end_to_end_tests/test_custom_templates/endpoint_module.py.jinja index 2964791eb..876fe3ea2 100644 --- a/end_to_end_tests/test_custom_templates/endpoint_module.pyi +++ b/end_to_end_tests/test_custom_templates/endpoint_module.py.jinja @@ -10,7 +10,7 @@ Client = httpx.Client {{ relative }} {% endfor %} -{% from "endpoint_macros.pyi" import header_params, query_params, json_body, return_type, arguments, client, kwargs, parse_response %} +{% from "endpoint_macros.py.jinja" import header_params, query_params, json_body, return_type, arguments, client, kwargs, parse_response %} {% set return_string = return_type(endpoint) %} {% set parsed_responses = (endpoint.responses | length > 0) and return_string != "None" %} diff --git a/mypy.ini b/mypy.ini index af89f61b0..a85aa5f4d 100644 --- a/mypy.ini +++ b/mypy.ini @@ -12,3 +12,4 @@ ignore_missing_imports = True [mypy-typer] ignore_missing_imports = True + diff --git a/openapi_python_client/__init__.py b/openapi_python_client/__init__.py index 489488364..74de04520 100644 --- a/openapi_python_client/__init__.py +++ b/openapi_python_client/__init__.py @@ -136,14 +136,14 @@ def _create_package(self) -> None: # Package __init__.py package_init = self.package_dir / "__init__.py" - package_init_template = self.env.get_template("package_init.pyi") + package_init_template = self.env.get_template("package_init.py.jinja") package_init.write_text(package_init_template.render(description=self.package_description)) if self.meta != MetaType.NONE: pytyped = self.package_dir / "py.typed" pytyped.write_text("# Marker file for PEP 561") - types_template = self.env.get_template("types.py") + types_template = self.env.get_template("types.py.jinja") types_path = self.package_dir / "types.py" types_path.write_text(types_template.render()) @@ -157,7 +157,7 @@ def _build_metadata(self) -> None: # README.md readme = self.project_dir / "README.md" - readme_template = self.env.get_template("README.md") + readme_template = self.env.get_template("README.md.jinja") readme.write_text( readme_template.render( project_name=self.project_name, description=self.package_description, package_name=self.package_name @@ -166,11 +166,11 @@ def _build_metadata(self) -> None: # .gitignore git_ignore_path = self.project_dir / ".gitignore" - git_ignore_template = self.env.get_template(".gitignore") + git_ignore_template = self.env.get_template(".gitignore.jinja") git_ignore_path.write_text(git_ignore_template.render()) def _build_pyproject_toml(self, *, use_poetry: bool) -> None: - template = "pyproject.toml" if use_poetry else "pyproject_no_poetry.toml" + template = "pyproject.toml.jinja" if use_poetry else "pyproject_no_poetry.toml.jinja" pyproject_template = self.env.get_template(template) pyproject_path = self.project_dir / "pyproject.toml" pyproject_path.write_text( @@ -183,7 +183,7 @@ def _build_pyproject_toml(self, *, use_poetry: bool) -> None: ) def _build_setup_py(self) -> None: - template = self.env.get_template("setup.py") + template = self.env.get_template("setup.py.jinja") path = self.project_dir / "setup.py" path.write_text( template.render( @@ -201,15 +201,15 @@ def _build_models(self) -> None: models_init = models_dir / "__init__.py" imports = [] - model_template = self.env.get_template("model.pyi") + model_template = self.env.get_template("model.py.jinja") for model in self.openapi.models.values(): module_path = models_dir / f"{model.reference.module_name}.py" module_path.write_text(model_template.render(model=model)) imports.append(import_string_from_reference(model.reference)) # Generate enums - str_enum_template = self.env.get_template("str_enum.pyi") - int_enum_template = self.env.get_template("int_enum.pyi") + str_enum_template = self.env.get_template("str_enum.py.jinja") + int_enum_template = self.env.get_template("int_enum.py.jinja") for enum in self.openapi.enums.values(): module_path = models_dir / f"{enum.reference.module_name}.py" if enum.value_type is int: @@ -218,13 +218,13 @@ def _build_models(self) -> None: module_path.write_text(str_enum_template.render(enum=enum)) imports.append(import_string_from_reference(enum.reference)) - models_init_template = self.env.get_template("models_init.pyi") + models_init_template = self.env.get_template("models_init.py.jinja") models_init.write_text(models_init_template.render(imports=imports)) def _build_api(self) -> None: # Generate Client client_path = self.package_dir / "client.py" - client_template = self.env.get_template("client.pyi") + client_template = self.env.get_template("client.py.jinja") client_path.write_text(client_template.render()) # Generate endpoints @@ -233,7 +233,7 @@ def _build_api(self) -> None: api_init = api_dir / "__init__.py" api_init.write_text('""" Contains methods for accessing the API """') - endpoint_template = self.env.get_template("endpoint_module.pyi") + endpoint_template = self.env.get_template("endpoint_module.py.jinja") for tag, collection in self.openapi.endpoint_collections_by_tag.items(): tag = utils.snake_case(tag) tag_dir = api_dir / tag diff --git a/openapi_python_client/parser/properties/__init__.py b/openapi_python_client/parser/properties/__init__.py index 427276692..2ea75a569 100644 --- a/openapi_python_client/parser/properties/__init__.py +++ b/openapi_python_client/parser/properties/__init__.py @@ -19,7 +19,7 @@ class NoneProperty(Property): """ A property that is always None (used for empty schemas) """ _type_string: ClassVar[str] = "None" - template: ClassVar[Optional[str]] = "none_property.pyi" + template: ClassVar[Optional[str]] = "none_property.py.jinja" @attr.s(auto_attribs=True, frozen=True) @@ -38,7 +38,7 @@ class DateTimeProperty(Property): """ _type_string: ClassVar[str] = "datetime.datetime" - template: ClassVar[str] = "datetime_property.pyi" + template: ClassVar[str] = "datetime_property.py.jinja" def get_imports(self, *, prefix: str) -> Set[str]: """ @@ -58,7 +58,7 @@ class DateProperty(Property): """ A property of type datetime.date """ _type_string: ClassVar[str] = "datetime.date" - template: ClassVar[str] = "date_property.pyi" + template: ClassVar[str] = "date_property.py.jinja" def get_imports(self, *, prefix: str) -> Set[str]: """ @@ -78,7 +78,7 @@ class FileProperty(Property): """ A property used for uploading files """ _type_string: ClassVar[str] = "File" - template: ClassVar[str] = "file_property.pyi" + template: ClassVar[str] = "file_property.py.jinja" def get_imports(self, *, prefix: str) -> Set[str]: """ @@ -122,7 +122,7 @@ class ListProperty(Property, Generic[InnerProp]): """ A property representing a list (array) of other properties """ inner_property: InnerProp - template: ClassVar[str] = "list_property.pyi" + template: ClassVar[str] = "list_property.py.jinja" def get_type_string(self, no_optional: bool = False) -> str: """ Get a string representation of type that should be used when declaring this property """ @@ -158,7 +158,7 @@ class UnionProperty(Property): """ A property representing a Union (anyOf) of other properties """ inner_properties: List[Property] - template: ClassVar[str] = "union_property.pyi" + template: ClassVar[str] = "union_property.py.jinja" has_properties_without_templates: bool = attr.ib(init=False) def __attrs_post_init__(self) -> None: diff --git a/openapi_python_client/parser/properties/enum_property.py b/openapi_python_client/parser/properties/enum_property.py index 1217f23ee..7549ba1a8 100644 --- a/openapi_python_client/parser/properties/enum_property.py +++ b/openapi_python_client/parser/properties/enum_property.py @@ -20,7 +20,7 @@ class EnumProperty(Property): value_type: Type[ValueType] default: Optional[Any] = attr.ib() - template: ClassVar[str] = "enum_property.pyi" + template: ClassVar[str] = "enum_property.py.jinja" def get_type_string(self, no_optional: bool = False) -> str: """ Get a string representation of type that should be used when declaring this property """ diff --git a/openapi_python_client/parser/properties/model_property.py b/openapi_python_client/parser/properties/model_property.py index 084017a41..d5b15e866 100644 --- a/openapi_python_client/parser/properties/model_property.py +++ b/openapi_python_client/parser/properties/model_property.py @@ -18,7 +18,7 @@ class ModelProperty(Property): relative_imports: Set[str] additional_properties: Union[bool, Property] - template: ClassVar[str] = "model_property.pyi" + template: ClassVar[str] = "model_property.py.jinja" def get_type_string(self, no_optional: bool = False) -> str: """ Get a string representation of type that should be used when declaring this property """ diff --git a/openapi_python_client/templates/.gitignore b/openapi_python_client/templates/.gitignore.jinja similarity index 100% rename from openapi_python_client/templates/.gitignore rename to openapi_python_client/templates/.gitignore.jinja diff --git a/openapi_python_client/templates/README.md b/openapi_python_client/templates/README.md.jinja similarity index 100% rename from openapi_python_client/templates/README.md rename to openapi_python_client/templates/README.md.jinja diff --git a/openapi_python_client/templates/client.pyi b/openapi_python_client/templates/client.py.jinja similarity index 100% rename from openapi_python_client/templates/client.pyi rename to openapi_python_client/templates/client.py.jinja diff --git a/openapi_python_client/templates/endpoint_macros.pyi b/openapi_python_client/templates/endpoint_macros.py.jinja similarity index 100% rename from openapi_python_client/templates/endpoint_macros.pyi rename to openapi_python_client/templates/endpoint_macros.py.jinja diff --git a/openapi_python_client/templates/endpoint_module.pyi b/openapi_python_client/templates/endpoint_module.py.jinja similarity index 96% rename from openapi_python_client/templates/endpoint_module.pyi rename to openapi_python_client/templates/endpoint_module.py.jinja index 29dfadc46..cd08ad2c2 100644 --- a/openapi_python_client/templates/endpoint_module.pyi +++ b/openapi_python_client/templates/endpoint_module.py.jinja @@ -10,7 +10,7 @@ from ...types import Response {{ relative }} {% endfor %} -{% from "endpoint_macros.pyi" import header_params, query_params, json_body, return_type, arguments, client, kwargs, parse_response %} +{% from "endpoint_macros.py.jinja" import header_params, query_params, json_body, return_type, arguments, client, kwargs, parse_response %} {% set return_string = return_type(endpoint) %} {% set parsed_responses = (endpoint.responses | length > 0) and return_string != "None" %} diff --git a/openapi_python_client/templates/int_enum.pyi b/openapi_python_client/templates/int_enum.py.jinja similarity index 100% rename from openapi_python_client/templates/int_enum.pyi rename to openapi_python_client/templates/int_enum.py.jinja diff --git a/openapi_python_client/templates/model.pyi b/openapi_python_client/templates/model.py.jinja similarity index 100% rename from openapi_python_client/templates/model.pyi rename to openapi_python_client/templates/model.py.jinja diff --git a/openapi_python_client/templates/models_init.pyi b/openapi_python_client/templates/models_init.py.jinja similarity index 100% rename from openapi_python_client/templates/models_init.pyi rename to openapi_python_client/templates/models_init.py.jinja diff --git a/openapi_python_client/templates/package_init.pyi b/openapi_python_client/templates/package_init.py.jinja similarity index 100% rename from openapi_python_client/templates/package_init.pyi rename to openapi_python_client/templates/package_init.py.jinja diff --git a/openapi_python_client/templates/property_templates/date_property.pyi b/openapi_python_client/templates/property_templates/date_property.py.jinja similarity index 100% rename from openapi_python_client/templates/property_templates/date_property.pyi rename to openapi_python_client/templates/property_templates/date_property.py.jinja diff --git a/openapi_python_client/templates/property_templates/datetime_property.pyi b/openapi_python_client/templates/property_templates/datetime_property.py.jinja similarity index 100% rename from openapi_python_client/templates/property_templates/datetime_property.pyi rename to openapi_python_client/templates/property_templates/datetime_property.py.jinja diff --git a/openapi_python_client/templates/property_templates/dict_property.pyi b/openapi_python_client/templates/property_templates/dict_property.pyi deleted file mode 100644 index 36a6b4292..000000000 --- a/openapi_python_client/templates/property_templates/dict_property.pyi +++ /dev/null @@ -1,18 +0,0 @@ -{% macro construct(property, source, initial_value="None") %} -{% if property.required %} -{{ property.python_name }} = {{ source }} -{% else %} -{{ property.python_name }} = {{ initial_value }} -_{{ property.python_name }} = {{ source }} -if _{{ property.python_name }} is not None: - {{ property.python_name }} = _{{ property.python_name }} -{% endif %} -{% endmacro %} - -{% macro transform(property, source, destination, declare_type=True) %} -{% if property.nullable %} -{{ destination }} = {{ source }} if {{ source }} else None -{% else %} -{{ destination }} = {{ source }} -{% endif %} -{% endmacro %} diff --git a/openapi_python_client/templates/property_templates/enum_property.pyi b/openapi_python_client/templates/property_templates/enum_property.py.jinja similarity index 100% rename from openapi_python_client/templates/property_templates/enum_property.pyi rename to openapi_python_client/templates/property_templates/enum_property.py.jinja diff --git a/openapi_python_client/templates/property_templates/file_property.pyi b/openapi_python_client/templates/property_templates/file_property.py.jinja similarity index 100% rename from openapi_python_client/templates/property_templates/file_property.pyi rename to openapi_python_client/templates/property_templates/file_property.py.jinja diff --git a/openapi_python_client/templates/property_templates/list_property.pyi b/openapi_python_client/templates/property_templates/list_property.py.jinja similarity index 100% rename from openapi_python_client/templates/property_templates/list_property.pyi rename to openapi_python_client/templates/property_templates/list_property.py.jinja diff --git a/openapi_python_client/templates/property_templates/model_property.pyi b/openapi_python_client/templates/property_templates/model_property.py.jinja similarity index 100% rename from openapi_python_client/templates/property_templates/model_property.pyi rename to openapi_python_client/templates/property_templates/model_property.py.jinja diff --git a/openapi_python_client/templates/property_templates/none_property.pyi b/openapi_python_client/templates/property_templates/none_property.py.jinja similarity index 100% rename from openapi_python_client/templates/property_templates/none_property.pyi rename to openapi_python_client/templates/property_templates/none_property.py.jinja diff --git a/openapi_python_client/templates/property_templates/union_property.pyi b/openapi_python_client/templates/property_templates/union_property.py.jinja similarity index 100% rename from openapi_python_client/templates/property_templates/union_property.pyi rename to openapi_python_client/templates/property_templates/union_property.py.jinja diff --git a/openapi_python_client/templates/pyproject.toml b/openapi_python_client/templates/pyproject.toml.jinja similarity index 100% rename from openapi_python_client/templates/pyproject.toml rename to openapi_python_client/templates/pyproject.toml.jinja diff --git a/openapi_python_client/templates/pyproject_no_poetry.toml b/openapi_python_client/templates/pyproject_no_poetry.toml.jinja similarity index 100% rename from openapi_python_client/templates/pyproject_no_poetry.toml rename to openapi_python_client/templates/pyproject_no_poetry.toml.jinja diff --git a/openapi_python_client/templates/setup.py b/openapi_python_client/templates/setup.py.jinja similarity index 100% rename from openapi_python_client/templates/setup.py rename to openapi_python_client/templates/setup.py.jinja diff --git a/openapi_python_client/templates/str_enum.pyi b/openapi_python_client/templates/str_enum.py.jinja similarity index 100% rename from openapi_python_client/templates/str_enum.pyi rename to openapi_python_client/templates/str_enum.py.jinja diff --git a/openapi_python_client/templates/types.py b/openapi_python_client/templates/types.py.jinja similarity index 100% rename from openapi_python_client/templates/types.py rename to openapi_python_client/templates/types.py.jinja diff --git a/poetry.lock b/poetry.lock index 742ded252..a5fd2a62a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -287,7 +287,7 @@ python-versions = ">=3.5" [[package]] name = "mypy" -version = "0.790" +version = "0.800" description = "Optional static typing for Python" category = "dev" optional = false @@ -687,6 +687,7 @@ autoflake = [ {file = "autoflake-1.4.tar.gz", hash = "sha256:61a353012cff6ab94ca062823d1fb2f692c4acda51c76ff83a8d77915fba51ea"}, ] black = [ + {file = "black-20.8b1-py3-none-any.whl", hash = "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b"}, {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, ] certifi = [ @@ -865,20 +866,28 @@ mslex = [ {file = "mslex-0.3.0.tar.gz", hash = "sha256:4a1ac3f25025cad78ad2fe499dd16d42759f7a3801645399cce5c404415daa97"}, ] mypy = [ - {file = "mypy-0.790-cp35-cp35m-macosx_10_6_x86_64.whl", hash = "sha256:bd03b3cf666bff8d710d633d1c56ab7facbdc204d567715cb3b9f85c6e94f669"}, - {file = "mypy-0.790-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:2170492030f6faa537647d29945786d297e4862765f0b4ac5930ff62e300d802"}, - {file = "mypy-0.790-cp35-cp35m-win_amd64.whl", hash = "sha256:e86bdace26c5fe9cf8cb735e7cedfe7850ad92b327ac5d797c656717d2ca66de"}, - {file = "mypy-0.790-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e97e9c13d67fbe524be17e4d8025d51a7dca38f90de2e462243ab8ed8a9178d1"}, - {file = "mypy-0.790-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0d34d6b122597d48a36d6c59e35341f410d4abfa771d96d04ae2c468dd201abc"}, - {file = "mypy-0.790-cp36-cp36m-win_amd64.whl", hash = "sha256:72060bf64f290fb629bd4a67c707a66fd88ca26e413a91384b18db3876e57ed7"}, - {file = "mypy-0.790-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:eea260feb1830a627fb526d22fbb426b750d9f5a47b624e8d5e7e004359b219c"}, - {file = "mypy-0.790-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c614194e01c85bb2e551c421397e49afb2872c88b5830e3554f0519f9fb1c178"}, - {file = "mypy-0.790-cp37-cp37m-win_amd64.whl", hash = "sha256:0a0d102247c16ce93c97066443d11e2d36e6cc2a32d8ccc1f705268970479324"}, - {file = "mypy-0.790-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cf4e7bf7f1214826cf7333627cb2547c0db7e3078723227820d0a2490f117a01"}, - {file = "mypy-0.790-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:af4e9ff1834e565f1baa74ccf7ae2564ae38c8df2a85b057af1dbbc958eb6666"}, - {file = "mypy-0.790-cp38-cp38-win_amd64.whl", hash = "sha256:da56dedcd7cd502ccd3c5dddc656cb36113dd793ad466e894574125945653cea"}, - {file = "mypy-0.790-py3-none-any.whl", hash = "sha256:2842d4fbd1b12ab422346376aad03ff5d0805b706102e475e962370f874a5122"}, - {file = "mypy-0.790.tar.gz", hash = "sha256:2b21ba45ad9ef2e2eb88ce4aeadd0112d0f5026418324176fd494a6824b74975"}, + {file = "mypy-0.800-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:e1c84c65ff6d69fb42958ece5b1255394714e0aac4df5ffe151bc4fe19c7600a"}, + {file = "mypy-0.800-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:947126195bfe4709c360e89b40114c6746ae248f04d379dca6f6ab677aa07641"}, + {file = "mypy-0.800-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:b95068a3ce3b50332c40e31a955653be245666a4bc7819d3c8898aa9fb9ea496"}, + {file = "mypy-0.800-cp35-cp35m-win_amd64.whl", hash = "sha256:ca7ad5aed210841f1e77f5f2f7d725b62c78fa77519312042c719ed2ab937876"}, + {file = "mypy-0.800-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e32b7b282c4ed4e378bba8b8dfa08e1cfa6f6574067ef22f86bee5b1039de0c9"}, + {file = "mypy-0.800-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:e497a544391f733eca922fdcb326d19e894789cd4ff61d48b4b195776476c5cf"}, + {file = "mypy-0.800-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:5615785d3e2f4f03ab7697983d82c4b98af5c321614f51b8f1034eb9ebe48363"}, + {file = "mypy-0.800-cp36-cp36m-win_amd64.whl", hash = "sha256:2b216eacca0ec0ee124af9429bfd858d5619a0725ee5f88057e6e076f9eb1a7b"}, + {file = "mypy-0.800-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e3b8432f8df19e3c11235c4563a7250666dc9aa7cdda58d21b4177b20256ca9f"}, + {file = "mypy-0.800-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d16c54b0dffb861dc6318a8730952265876d90c5101085a4bc56913e8521ba19"}, + {file = "mypy-0.800-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:0d2fc8beb99cd88f2d7e20d69131353053fbecea17904ee6f0348759302c52fa"}, + {file = "mypy-0.800-cp37-cp37m-win_amd64.whl", hash = "sha256:aa9d4901f3ee1a986a3a79fe079ffbf7f999478c281376f48faa31daaa814e86"}, + {file = "mypy-0.800-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:319ee5c248a7c3f94477f92a729b7ab06bf8a6d04447ef3aa8c9ba2aa47c6dcf"}, + {file = "mypy-0.800-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:74f5aa50d0866bc6fb8e213441c41e466c86678c800700b87b012ed11c0a13e0"}, + {file = "mypy-0.800-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:a301da58d566aca05f8f449403c710c50a9860782148332322decf73a603280b"}, + {file = "mypy-0.800-cp38-cp38-win_amd64.whl", hash = "sha256:b9150db14a48a8fa114189bfe49baccdff89da8c6639c2717750c7ae62316738"}, + {file = "mypy-0.800-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f5fdf935a46aa20aa937f2478480ebf4be9186e98e49cc3843af9a5795a49a25"}, + {file = "mypy-0.800-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:6f8425fecd2ba6007e526209bb985ce7f49ed0d2ac1cc1a44f243380a06a84fb"}, + {file = "mypy-0.800-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:5ff616787122774f510caeb7b980542a7cc2222be3f00837a304ea85cd56e488"}, + {file = "mypy-0.800-cp39-cp39-win_amd64.whl", hash = "sha256:90b6f46dc2181d74f80617deca611925d7e63007cf416397358aa42efb593e07"}, + {file = "mypy-0.800-py3-none-any.whl", hash = "sha256:3e0c159a7853e3521e3f582adb1f3eac66d0b0639d434278e2867af3a8c62653"}, + {file = "mypy-0.800.tar.gz", hash = "sha256:e0202e37756ed09daf4b0ba64ad2c245d357659e014c3f51d8cd0681ba66940a"}, ] mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, @@ -1012,12 +1021,6 @@ regex = [ {file = "regex-2020.9.27-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:8d69cef61fa50c8133382e61fd97439de1ae623fe943578e477e76a9d9471637"}, {file = "regex-2020.9.27-cp38-cp38-win32.whl", hash = "sha256:f2388013e68e750eaa16ccbea62d4130180c26abb1d8e5d584b9baf69672b30f"}, {file = "regex-2020.9.27-cp38-cp38-win_amd64.whl", hash = "sha256:4318d56bccfe7d43e5addb272406ade7a2274da4b70eb15922a071c58ab0108c"}, - {file = "regex-2020.9.27-cp39-cp39-manylinux1_i686.whl", hash = "sha256:84cada8effefe9a9f53f9b0d2ba9b7b6f5edf8d2155f9fdbe34616e06ececf81"}, - {file = "regex-2020.9.27-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:816064fc915796ea1f26966163f6845de5af78923dfcecf6551e095f00983650"}, - {file = "regex-2020.9.27-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:5d892a4f1c999834eaa3c32bc9e8b976c5825116cde553928c4c8e7e48ebda67"}, - {file = "regex-2020.9.27-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:c9443124c67b1515e4fe0bb0aa18df640965e1030f468a2a5dc2589b26d130ad"}, - {file = "regex-2020.9.27-cp39-cp39-win32.whl", hash = "sha256:49f23ebd5ac073765ecbcf046edc10d63dcab2f4ae2bce160982cb30df0c0302"}, - {file = "regex-2020.9.27-cp39-cp39-win_amd64.whl", hash = "sha256:3d20024a70b97b4f9546696cbf2fd30bae5f42229fbddf8661261b1eaff0deb7"}, {file = "regex-2020.9.27.tar.gz", hash = "sha256:a6f32aea4260dfe0e55dc9733ea162ea38f0ea86aa7d0f77b15beac5bf7b369d"}, ] requests = [ @@ -1063,28 +1066,19 @@ typed-ast = [ {file = "typed_ast-1.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75"}, {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652"}, {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"}, - {file = "typed_ast-1.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:fcf135e17cc74dbfbc05894ebca928ffeb23d9790b3167a674921db19082401f"}, {file = "typed_ast-1.4.1-cp36-cp36m-win32.whl", hash = "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1"}, {file = "typed_ast-1.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa"}, {file = "typed_ast-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614"}, {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41"}, {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b"}, - {file = "typed_ast-1.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:f208eb7aff048f6bea9586e61af041ddf7f9ade7caed625742af423f6bae3298"}, {file = "typed_ast-1.4.1-cp37-cp37m-win32.whl", hash = "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe"}, {file = "typed_ast-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355"}, {file = "typed_ast-1.4.1-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6"}, {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907"}, {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d"}, - {file = "typed_ast-1.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:7e4c9d7658aaa1fc80018593abdf8598bf91325af6af5cce4ce7c73bc45ea53d"}, {file = "typed_ast-1.4.1-cp38-cp38-win32.whl", hash = "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c"}, {file = "typed_ast-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4"}, {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34"}, - {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:92c325624e304ebf0e025d1224b77dd4e6393f18aab8d829b5b7e04afe9b7a2c"}, - {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:d648b8e3bf2fe648745c8ffcee3db3ff903d0817a01a12dd6a6ea7a8f4889072"}, - {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:fac11badff8313e23717f3dada86a15389d0708275bddf766cca67a84ead3e91"}, - {file = "typed_ast-1.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:0d8110d78a5736e16e26213114a38ca35cb15b6515d535413b090bd50951556d"}, - {file = "typed_ast-1.4.1-cp39-cp39-win32.whl", hash = "sha256:b52ccf7cfe4ce2a1064b18594381bccf4179c2ecf7f513134ec2f993dd4ab395"}, - {file = "typed_ast-1.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:3742b32cf1c6ef124d57f95be609c473d7ec4c14d0090e5a5e05a15269fb4d0c"}, {file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"}, ] typer = [ diff --git a/tests/test___init__.py b/tests/test___init__.py index aa7ecf529..d45108181 100644 --- a/tests/test___init__.py +++ b/tests/test___init__.py @@ -379,14 +379,14 @@ def test__build_metadata_poetry(self, mocker): git_ignore_template = mocker.MagicMock(autospec=jinja2.Template) project.env = mocker.MagicMock(autospec=jinja2.Environment) templates = { - "README.md": readme_template, - ".gitignore": git_ignore_template, + "README.md.jinja": readme_template, + ".gitignore.jinja": git_ignore_template, } project.env.get_template.side_effect = lambda x: templates[x] project._build_metadata() - project.env.get_template.assert_has_calls([mocker.call("README.md"), mocker.call(".gitignore")]) + project.env.get_template.assert_has_calls([mocker.call("README.md.jinja"), mocker.call(".gitignore.jinja")]) readme_template.render.assert_called_once_with( description=project.package_description, project_name=project.project_name, @@ -416,14 +416,14 @@ def test__build_metadata_setup(self, mocker): git_ignore_template = mocker.MagicMock(autospec=jinja2.Template) project.env = mocker.MagicMock(autospec=jinja2.Environment) templates = { - "README.md": readme_template, - ".gitignore": git_ignore_template, + "README.md.jinja": readme_template, + ".gitignore.jinja": git_ignore_template, } project.env.get_template.side_effect = lambda x: templates[x] project._build_metadata() - project.env.get_template.assert_has_calls([mocker.call("README.md"), mocker.call(".gitignore")]) + project.env.get_template.assert_has_calls([mocker.call("README.md.jinja"), mocker.call(".gitignore.jinja")]) readme_template.render.assert_called_once_with( description=project.package_description, project_name=project.project_name, @@ -459,7 +459,7 @@ def test__build_pyproject_toml(self, mocker, use_poetry): pyproject_template = mocker.MagicMock(autospec=jinja2.Template) project.env = mocker.MagicMock(autospec=jinja2.Environment) - template_path = "pyproject.toml" if use_poetry else "pyproject_no_poetry.toml" + template_path = "pyproject.toml.jinja" if use_poetry else "pyproject_no_poetry.toml.jinja" templates = { template_path: pyproject_template, } @@ -491,13 +491,13 @@ def test__build_setup_py(self, mocker): setup_template = mocker.MagicMock(autospec=jinja2.Template) project.env = mocker.MagicMock(autospec=jinja2.Environment) templates = { - "setup.py": setup_template, + "setup.py.jinja": setup_template, } project.env.get_template.side_effect = lambda x: templates[x] project._build_setup_py() - project.env.get_template.assert_called_once_with("setup.py") + project.env.get_template.assert_called_once_with("setup.py.jinja") setup_template.render.assert_called_once_with( project_name=project.project_name, diff --git a/tests/test_templates/test_endpoint_module.py b/tests/test_templates/test_endpoint_module.py index 082ca84b3..868c51c58 100644 --- a/tests/test_templates/test_endpoint_module.py +++ b/tests/test_templates/test_endpoint_module.py @@ -6,7 +6,7 @@ @pytest.fixture(scope="session") def template(env) -> Template: - return env.get_template("endpoint_module.pyi") + return env.get_template("endpoint_module.py.jinja") def test_async_module(template, mocker): diff --git a/tests/test_templates/test_property_templates/test_date_property/date_property_template.py b/tests/test_templates/test_property_templates/test_date_property/date_property_template.py index 9393b28ed..3709963fe 100644 --- a/tests/test_templates/test_property_templates/test_date_property/date_property_template.py +++ b/tests/test_templates/test_property_templates/test_date_property/date_property_template.py @@ -2,7 +2,7 @@ from typing import cast, Union from dateutil.parser import isoparse -{% from "property_templates/date_property.pyi" import transform, construct %} +{% from "property_templates/date_property.py.jinja" import transform, construct %} some_source = date(2020, 10, 12) {{ transform(property, "some_source", "some_destination") }} {{ construct(property, "some_destination") }}