Skip to content

Commit

Permalink
Make mypy optional + add py.typed
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-cpp committed Jul 27, 2023
1 parent 03377b0 commit 47f9ce6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/scicookie/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
USE_CONTAINERS = {{ cookiecutter.use_containers in ['Docker', 'Podman'] }}
USE_CLI = {{ cookiecutter.command_line_interface != "No command-line interface" }}
USE_CONDA = {{ cookiecutter.use_conda == "yes" }}
USE_MYPY = {{ cookiecutter.use_mypy == "yes" }}
{% if cookiecutter.code_of_conduct == "contributor-covenant" -%}
COC_PATH = PROJECT_DIRECTORY / 'coc' / 'CONTRIBUTOR_COVENANT.md'
{%- elif cookiecutter.code_of_conduct == "citizen-code-of-conduct" -%}
Expand Down Expand Up @@ -96,6 +97,7 @@ def move_selected_doc_dir():

shutil.rmtree(DOCS_SPEC_DIR)


def clean_up_docs():
remove_dirs(UNUSED_DOCS_DIRS)
move_selected_doc_dir()
Expand Down Expand Up @@ -194,6 +196,7 @@ def clean_up_build_system():
)
remove_dir("build-system")


def http2ssh(url):
url = url.replace("https://", "git@")
return url.replace("/", ":", 1)
Expand Down Expand Up @@ -241,13 +244,18 @@ def prepare_git():
print("=" * 80)


def clean_up_mypy():
if not USE_MYPY: remove_package_file("py.typed")


def post_gen():
validation()

# keep this one first, because it changes the package folder
clean_up_project_layout()

clean_up_cli()
clean_up_mypy()
clean_up_code_of_conduct()
clean_up_conda()
clean_up_containers()
Expand Down
1 change: 1 addition & 0 deletions src/scicookie/profiles/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ use_tools:
- ruff
- isort
- mccabe
- mypy
- pre-commit
- pydocstyle
- pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
from importlib import metadata as importlib_metadata


def get_version() -> str:
def get_version():
"""Return the program version."""
try:
return importlib_metadata.version(__name__)
except importlib_metadata.PackageNotFoundError: # pragma: no cover
return {{ QUOTE }}{{ cookiecutter.project_version }}{{ QUOTE }} # semantic-release


version: str = get_version()
version = get_version()

__author__ = {{ QUOTE }}{{ cookiecutter.author_full_name }}{{ QUOTE }}
__email__ = {{ QUOTE }}{{ cookiecutter.author_email }}{{ QUOTE }}
__version__: str = version
__version__ = version
Empty file.

0 comments on commit 47f9ce6

Please sign in to comment.