Skip to content

Commit

Permalink
Make version # PEP 440 compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
liamtoney committed Jan 30, 2024
1 parent 9374c63 commit c99a9c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
1 change: 0 additions & 1 deletion .environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dependencies:
- ffmpeg
- obspy
- pip
- setuptools<58.4.0 # https://github.com/pypa/setuptools/issues/2497
- tqdm
# Lines above should be IDENTICAL to environment.yml
- black
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dependencies:
- ffmpeg
- obspy
- pip
- setuptools<58.4.0 # https://github.com/pypa/setuptools/issues/2497
- tqdm
- pip:
- --editable .
27 changes: 15 additions & 12 deletions sonify/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import subprocess
from pathlib import Path

__version__ = subprocess.run(
[
'git',
'-C',
Path(__file__).resolve().parent,
'rev-parse',
'--short=7',
'HEAD',
],
capture_output=True,
text=True,
).stdout.strip()
__version__ = (
'0+g' # Makes the version number PEP 440 compliant
+ subprocess.run(
[
'git',
'-C',
Path(__file__).resolve().parent,
'rev-parse',
'--short=7', # First 7 characters of the commit hash
'HEAD',
],
capture_output=True,
text=True,
).stdout.strip()
)

del subprocess
del Path
Expand Down

0 comments on commit c99a9c6

Please sign in to comment.