Skip to content

Commit 9ca41b2

Browse files
Deploy Version 0.0.4
Improved validation for many classes of widgets.
1 parent 672729e commit 9ca41b2

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

src/navigate/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.3
1+
0.0.4

src/navigate/_commit.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242

4343
def get_git_revision_hash() -> str:
44-
""" Get the git commit hash of the current repository.
44+
"""Get the git commit hash of the current repository.
4545
4646
This function will return the git commit hash of the current repository, or None if
4747
the current directory is not a git repository.
@@ -57,12 +57,19 @@ def get_git_revision_hash() -> str:
5757
os.chdir(file_directory)
5858

5959
try:
60-
is_git_repo = subprocess.check_output(
61-
["git", "rev-parse", "--is-inside-work-tree"],
62-
stderr=subprocess.DEVNULL).decode("ascii").strip()
60+
is_git_repo = (
61+
subprocess.check_output(
62+
["git", "rev-parse", "--is-inside-work-tree"], stderr=subprocess.DEVNULL
63+
)
64+
.decode("ascii")
65+
.strip()
66+
)
6367
if is_git_repo:
64-
commit_hash = subprocess.check_output(
65-
["git", "rev-parse", "HEAD"]).decode("ascii").strip()
68+
commit_hash = (
69+
subprocess.check_output(["git", "rev-parse", "HEAD"])
70+
.decode("ascii")
71+
.strip()
72+
)
6673
else:
6774
commit_hash = None
6875
except subprocess.CalledProcessError:
@@ -71,8 +78,9 @@ def get_git_revision_hash() -> str:
7178
os.chdir(working_directory)
7279
return commit_hash
7380

74-
def get_version_from_file(file_name='VERSION'):
75-
""" Retrieve the version from a file in the same directory as this file.
81+
82+
def get_version_from_file(file_name="VERSION"):
83+
"""Retrieve the version from a file in the same directory as this file.
7684
7785
The VERSION file located in src/navigate/VERSION contains the version of the
7886
package when deployed to PyPI.
@@ -91,12 +99,13 @@ def get_version_from_file(file_name='VERSION'):
9199
file_path = os.path.join(os.path.dirname(absolute_path), file_name)
92100

93101
try:
94-
with open(file_path, 'r') as file:
102+
with open(file_path, "r") as file:
95103
version = file.read().strip()
96104
return version
97105
except FileNotFoundError:
98106
return "unknown"
99107

108+
100109
__commit__ = get_git_revision_hash()
101110
if __commit__ is None:
102111
__commit__ = get_version_from_file()

0 commit comments

Comments
 (0)