Skip to content

Commit

Permalink
feat: dynamic versioning for hatch (#156)
Browse files Browse the repository at this point in the history
This PR switches hatch to use dynamic versioning, similar to flit and pdm in this repository. There are also some minor fixes which I found while using the repo -

- redundant noqa
- typo in workflow file
  • Loading branch information
Saransh-cpp authored Jul 31, 2023
1 parent b122550 commit bea6ad2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ jobs:
- name: Install dependencies
run: poetry install

- name: Run Smoke Test (mkdocs)
- name: Run Smoke Test (${{ matrix.smoke_file }})
run: bash ./tests/smoke/${{ matrix.smoke_file }}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ classifiers = [
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
version = "{{ cookiecutter.project_version }}"
dynamic = ["version"]
requires-python = ">=3.8.1"
dependencies = [
{# keep this line here #}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
{%- else %}
{%- set QUOTE = "'" -%}
{%- endif %}
{% if cookiecutter.build_system == "hatch" -%}
__version__ = {{ QUOTE }}{{ cookiecutter.project_version }}{{ QUOTE }}
{%- else %}
from importlib import metadata as importlib_metadata


Expand All @@ -22,6 +25,7 @@ def get_version():

version = get_version()

__author__ = {{ QUOTE }}{{ cookiecutter.author_full_name }}{{ QUOTE }}
__email__ = {{ QUOTE }}{{ cookiecutter.author_email }}{{ QUOTE }}
__version__ = version
{%- endif %}
__author__ = {{ QUOTE }}{{ cookiecutter.project_version }}{{ QUOTE }}
__email__ = {{ QUOTE }}{{ cookiecutter.author_email }}{{ QUOTE }}

0 comments on commit bea6ad2

Please sign in to comment.