Skip to content

Commit

Permalink
Adds project url options to cookiecutter
Browse files Browse the repository at this point in the history
  • Loading branch information
CyclingNinja committed Nov 15, 2024
1 parent 68fed7e commit 2e93f4b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
14 changes: 13 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"author_name": "",
"author_email": "",
"project_url": "",
"download_url": "",
"sourcecode_url": "",
"documentation_url": "",
"changelog_url": "",
"issue_tracker_url": "",
"license": [
"BSD 3-Clause",
"GNU GPL v3+",
Expand All @@ -30,5 +35,12 @@
"docs/_templates",
"docs/_static",
".github/workflows/sub_package_update.yml"
]
],
"__prompts__" : {
"project_url": "Primary website for the project, leave blank for Sunpy Homepage[]",
"sourcecode_url": "Pypi address for the project, optional",
"documentation_url": "Documentation url, optional",
"changelog_url": "Url to the changelog, optional",
"issue_tracker_url": "Url to the issue tracker, optional"
}
}
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ deps =
cookiecutter
pytest-cookies
pytest-venv
tox[testing]
tox[test]

commands =
!bake_cookies: pytest tests/ {posargs}
Expand Down
27 changes: 22 additions & 5 deletions {{ cookiecutter.package_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@ dependencies = [
]
dynamic = ["version"]

[project.urls]
{%- if cookiecutter.project_url %}
Homepage = "{{ cookiecutter.project_url }}"
{% else %}
Homepage = "https://sunpy.org"
{%- endif %}
{% if cookiecutter.download_url %}
Download = "{{ cookiecutter.download_url }}"
{% endif -%}
{% if cookiecutter.sourcecode_url %}
"Source Code" = "{{ cookiecutter.sourcecode_url }}"
{% endif -%}
{%- if cookiecutter.documentation_url %}
Documentation = "{{ documentation_url }}"
{% endif -%}
{%- if cookiecutter.changelog_url %}
Changelog = "{{ changelog_url }}"
{% endif -%}
{%- if cookiecutter.issue_tracker_url %}
"Issue Tracker" = "{{ cookiecutter.issue_tracker_url }}"
{% endif %}

{% if cookiecutter.include_example_code == 'y' -%}
[project.scripts]
open_astronomy_package_template_example = "{{ cookiecutter.module_name }}.example_mod:main"
Expand All @@ -46,11 +68,6 @@ docs = [
"packaging",
]

{%- if cookiecutter.project_url %}
[project.urls]
repository = "{{ cookiecutter.project_url }}"
{%- endif %}

[tool.setuptools]
zip-safe = false
include-package-data = true
Expand Down

0 comments on commit 2e93f4b

Please sign in to comment.