Skip to content

Commit ac0366b

Browse files
committed
update for clarity
1 parent 17cc59b commit ac0366b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

release.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
import re
22
import os
33

4+
# Constants to package __init__.py to update version of package
45
file_location = "./kepconfig/__init__.py"
56
version_re_string = "([0-9]+)\.([0-9]+)\.([0-9]+(?:[ab][0-9])?)"
67
version_search = re.compile(r'__version__ = "'+ version_re_string + '"')
78
version_check = re.compile(version_re_string)
89

10+
# Updates the version of package via __init__.py file
911
def bump_version():
1012
with open(file_location) as f:
1113
s = f.read()
1214
m = version_search.search(s)
1315
v1, v2, v3 = m.groups()
1416
oldv = "{0}.{1}.{2}".format(v1, v2, v3)
17+
18+
# Need to provide version explicitly before building and releasing
1519
ans = input("Current version of kepconfig is: {} \nUpdate new version to? (ctrl-c to exit): ".format(oldv))
1620
if ans:
1721
m = version_check.search(ans)
@@ -30,28 +34,40 @@ def bump_version():
3034

3135

3236
def release():
37+
# Update/confirm version of package
3338
v = bump_version()
39+
40+
# Commit changes to git
3441
ans = input("Version updated, commit changes?(y/n)")
3542
if ans.lower() in ("y", "yes"):
3643
os.system("git add " + file_location)
3744
os.system('git commit -m \"{} Release\"'.format(v))
3845
os.system("git tag {0}".format(v))
39-
ans = input("Change committed, push to server? (Y/n)")
46+
47+
# This will push the committed changes and tag to Github for release
48+
ans = input("Change committed, push to Github server? (Y/n)")
4049
if ans.lower() in ("y", "yes"):
4150
os.system("git push --tags")
4251
# os.system("git push --follow-tags")
52+
53+
# Build Distribution packages for external distribution
4354
ans = input("Build dist packages?(Y/n)")
4455
if ans.lower() in ("y", "yes"):
4556
# os.system("rm -rf dist/*") #Linux
4657
os.system("RMDIR /S /Q dist") #Windows
4758
os.system("python -m build")
48-
ans = input("Upload to pip?(Y/n)")
59+
60+
# Upload to pypi. Initially test with pypi test environment at test.pypi.org. Final release to pypi production
61+
# You'll be asked for credentials to authentice updating
62+
ans = input("Upload to pypi?(Y/n)")
4963
if ans.lower() in ("y", "yes"):
5064
ans = input("Push to production?(Y=production pypi/n=test pypi)")
5165
if ans.lower() in ("y", "yes"):
66+
5267
#Production PyPi Server
5368
os.system("python -m twine upload dist/*")
5469
else:
70+
5571
# Test PyPi Server
5672
os.system("python -m twine upload --repository testpypi dist/*")
5773

0 commit comments

Comments
 (0)