Skip to content

Commit

Permalink
Generate version from git tags (#98)
Browse files Browse the repository at this point in the history
* Generate version from git tags

* use no-local-version

* Update .gitignore

* export generated version

* fetch tags

* Use fetch-depth instead
  • Loading branch information
carlosgjs authored May 4, 2023
1 parent 1184c96 commit fa56c8a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Set up Python
uses: actions/[email protected]
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,6 @@ cython_debug/

# Cache location for inventory (used by FDSNChannelCatalog)
noisepy_cache/

# Version file generated at build time
src/noisepy/seis/_version.py
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -49,7 +49,13 @@ dependencies = [
Homepage = "https://github.com/mdenolle/NoisePy"

[tool.hatch.version]
path = "src/noisepy/seis/__init__.py"
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/noisepy/seis/_version.py"

[tool.hatch.version.raw-options]
local_scheme = "no-local-version"

[tool.hatch.build.targets.sdist]
include = [
Expand Down
2 changes: 1 addition & 1 deletion src/noisepy/seis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# no-qa F401
import logging

from ._version import __version__ # noqa: F401
from .S0A_download_ASDF_MPI import download # noqa: F401
from .S1_fft_cc_MPI import cross_correlate # noqa: F401
from .S2_stacking import stack # noqa: F401

__version__ = "0.5.13"
"""
NoisePy is a Python package designed for fast and easy computation of ambient noise cross-correlation functions.
It provides additional functionality for noise monitoring and surface wave dispersion analysis.
Expand Down

0 comments on commit fa56c8a

Please sign in to comment.