Skip to content

Commit

Permalink
added poetry optional install and updated markdownlint error
Browse files Browse the repository at this point in the history
  • Loading branch information
EuanMason committed May 21, 2024
1 parent 5ef1277 commit 0bd7d92
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"docstrings_style": ["google", "numpy", "pep257"],
"use_mypy": "y",
"install_precommit_hooks": "y",
"install_poetry": "y",
"_copy_without_render": ["docs/changelog.md", "docs/contributing.md", "docs/index.md", ".github/workflows/*.yml"]
}
27 changes: 26 additions & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,26 @@ def init_git():


def install_pre_commit_hooks():
execute(sys.executable, "-m", "pip", "install", "pre-commit==3.6.2")
execute(sys.executable, "-m", "pip", "install", "pre-commit", "--user")
execute(sys.executable, "-m", "pre_commit", "install")


def install_poetry():
execute(sys.executable, "-m", "pip", "install", "poetry", "--user")
execute(
sys.executable,
"-m",
"poetry",
"install",
"-E",
"doc",
"-E",
"dev",
"-E",
"test",
)


if __name__ == "__main__":

if "no" in "{{ cookiecutter.command_line_interface|lower }}":
Expand All @@ -74,3 +90,12 @@ def install_pre_commit_hooks():
print(
"Failed to install pre-commit hooks. Please run `pre-commit install` by your self. For more on pre-commit, please refer to https://pre-commit.com"
)

if "{{ cookiecutter.install_poetry }}" == "y":
try:
install_pre_commit_hooks()
except Exception as e:
print(str(e))
print(
"Failed to install pre-commit hooks. Please run `pre-commit install` by your self. For more on pre-commit, please refer to https://pre-commit.com"
)
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
{% if is_open_source %}

* Documentation: <https://{{ cookiecutter.github_username }}.github.io/{{ cookiecutter.project_slug }}>
* GitHub: <<https://github.com/{{> cookiecutter.github_username }}/{{ cookiecutter.project_slug }}>
* PyPI: <<https://pypi.org/project/{{> cookiecutter.project_slug }}/>
* GitHub: <https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}> {{< mdl-disable "<!-- markdownlint-disable MD034 -->" >}}
* PyPI: <https://pypi.org/project/{{ cookiecutter.project_slug }}/> {{< mdl-disable "<!-- markdownlint-disable MD034 -->" >}}
* Free software: {{ cookiecutter.open_source_license }}
{% endif %}

Expand Down

0 comments on commit 0bd7d92

Please sign in to comment.