File tree Expand file tree Collapse file tree 3 files changed +12
-36
lines changed
Expand file tree Collapse file tree 3 files changed +12
-36
lines changed Original file line number Diff line number Diff line change 11[project ]
22name = " spras"
3- dynamic = [ " version " ] # update spras_version in setup.py!
3+ version = " 0.6.0 "
44description = " Signaling Pathway Reconstruction Analysis Streamliner"
55authors = [
66 { name = " Anthony Gitter" , email = " gitter@biostat.wisc.edu" },
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1717import hashlib
1818import importlib .metadata
1919import itertools as it
20- import subprocess
21- import tomllib
2220import warnings
2321from pathlib import Path
2422from typing import Any
3634def spras_revision () -> str :
3735 """
3836 Gets the current revision of SPRAS.
39-
40- Note that the SPRAS package version is dynamically dependent on setup.py.
41- """
42- return importlib .metadata .version ('spras' )
4337
38+ Note that this is not dependent on the SPRAS version nor the git commit, but rather solely on the PyPA RECORD file,
39+ (https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file), which contains
40+ hashes of all files associated with the package distribution [other than itself], and is also included in the package distribution.
41+ """
42+ try :
43+ record_path = str (importlib .metadata .distribution ('spras' ).locate_file (f"spras-{ importlib .metadata .version ('spras' )} .dist-info/RECORD" ))
44+ with open (record_path , 'rb' , buffering = 0 ) as f :
45+ # Truncated to the magic value 8, the length of the short git revision.
46+ return hashlib .file_digest (f , 'sha256' ).hexdigest ()[:8 ]
47+ except importlib .metadata .PackageNotFoundError as err :
48+ raise RuntimeError ('spras is not an installed pip-module: did you forget to install SPRAS as a module?' ) from err
4449def attach_spras_revision (label : str ) -> str :
4550 return f"{ label } _{ spras_revision ()} "
4651
You can’t perform that action at this time.
0 commit comments