-
Notifications
You must be signed in to change notification settings - Fork 6
Update release script (issue 177) #487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update release script (issue 177) #487
Conversation
0f72093
to
29d4826
Compare
Is there an equivalent for |
make_release.py
Outdated
with request.urlopen(url) as response, open(tar_file, 'wb') as out_file: | ||
print('File {} downloaded'.format(url)) | ||
copyfileobj(response, out_file) | ||
sha256 = call('openssl sha256 {}'.format(tar_file)).split('=')[1].strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use hashlib (https://docs.python.org/2/library/hashlib.html) ?
make_release.py
Outdated
@@ -340,23 +397,25 @@ def make_release(release_name=None, branch='master'): | |||
chdir('build') | |||
# ---------- # | |||
|
|||
do('Tagging release', call, 'git tag -a v%(name)s -m "tag release %(name)s"' % {'name': release_name}) | |||
do('Tagging release', call, 'git tag -a v{name} -m "tag release {name}"'.format(name=release_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not use "v" in tags for larray
also I realize now that the make_release.py script is based on a very old version of the script from LIAM2 (liam2/liam2@a3bc927#diff-e94194a6680f2a567bea5103af5fe9cf). The relevant parts should be updated using the relevant changes until the latest version: liam2/liam2@a3bc927...master#diff-e94194a6680f2a567bea5103af5fe9cf Of note is update_changelog, but also some generic functions and a few bits here and there which were made more robust. |
c7edf0e
to
22710d1
Compare
updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work overall!
make_release.py
Outdated
chdir(context['repository']) | ||
version = short(context['release_name']) | ||
do('Updating larrayenv metapackage to version {version}'.format(version=version), call, | ||
'make_meta_package.bat {version}'.format(version=version)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there is any use to keep the .bat file. We could move the command in here.
make_release.py
Outdated
@@ -539,6 +548,9 @@ def cleanup(context): | |||
(pull, ''), | |||
# >>> need internet from here | |||
(push, ''), | |||
# assume the tar archive for the new release exists | |||
(update_metapackage, ''), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making the conda packages themselves before the metapackage is required.
make_release.py
Outdated
meta_file = r'condarecipe\larray\meta.yaml' | ||
with open(meta_file) as f: | ||
lines = f.readlines() | ||
lines[2] = " version: {}\n".format(version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems fragile, see below.
make_release.py
Outdated
with open(meta_file) as f: | ||
lines = f.readlines() | ||
lines[2] = " version: {}\n".format(version) | ||
lines[5] = " git_tag: {}\n".format(version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too fragile to my taste. See below.
make_release.py
Outdated
with open(init_file) as f: | ||
lines = f.readlines() | ||
for i, line in enumerate(lines[:]): | ||
if '__version__' in line: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make a generic function for replacing lines in a file and use it for meta, init.py and setup.py
def replace_lines(fpath, [(substring_to_find, new_line), (sub2, newline2)]):
pass
make_release.py
Outdated
'tmp_dir': TMP_PATH, | ||
'build_dir': os.path.join(TMP_PATH, 'build'), | ||
'public_release': public_release} | ||
context_conda = {'branch': branch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have a single context and a single tmp_dir. Add the necessary keys for the feedstock part. e.g.
'feedstock_repository': CONDA_LARRAY_FEEDSTOCK_REP,
'feedstock_build': os.path.join(TMP_PATH, 'feedstock')
you will need to either inline the clone_repository function in update_conda_forge_package or split clone_repository into:
def git_clone(repository, branch, build_dir):
...
and
def clone_source_repository(context):
return git_clone(**context)
and have update_conda_forge_package call git_clone directly.
86144d5
to
5dd6c31
Compare
|
||
Released on {date}. | ||
def create_source_archive(release_name, rev): | ||
call(r'git archive --format zip --output ..\larray-{}-src.zip {}'.format(release_name, rev)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using sdist instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
5dd6c31
to
5712808
Compare
|
||
def update_changelog(release_name): | ||
fname = relname2fname(release_name) | ||
def replace_lines(fpath, changes, end="\n"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have an end argument? Is there a case where it is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not now but it might.
make_release.py
Outdated
lines = f.readlines() | ||
for i, line in enumerate(lines[:]): | ||
for substring_to_find, new_line in changes: | ||
if substring_to_find in line and '#' not in line: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the '#' not in line
is meant to avoid commented lines. In that case I would use something like line.strip().startswith('#')
to avoid skipping a "used" line with a comment at the end of the line.
make_release.py
Outdated
############################################ | ||
# UPDATE LARRAY METAPACKAGE ON CONDA-FORGE # | ||
############################################ | ||
# assume larray package on cond-forge has been updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conda-forge
next_release.py
Outdated
def add_release(release_name, branch='master'): | ||
update_changelog(release_name) | ||
context = {'branch': branch, | ||
'release_name': 'dev', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have something more descriptive here. Something like release_name+'dev'
16821f8
to
e38ed5f
Compare
make_release.py
Outdated
@@ -606,6 +621,7 @@ def announce_new_release(context): | |||
(pull, ''), | |||
# >>> need internet from here | |||
(push, ''), | |||
(push_on_pypi, 'Pushing on Pypi'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be nice to have a "push on pypi test server" step before, and potentially split the "push_on_pypi" step into "create_pypi_packages" and "push_on_pypi", so that we can check packages before they are uploaded. This could come later though.
FWIW, here is what I used for the liam2 announce: |
The comments from my review from 2 days ago still stand. |
'repository': abspath(dirname(__file__)), | ||
'build_dir': abspath(dirname(__file__)), | ||
'public_release': True} | ||
update_version(context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be hard to create a single commit for update_changelog & update_version? If you can do that in less than 10min, then that's probably worth it (cleaner history), otherwise nevermind.
1499812
to
68cb9ea
Compare
Squash and merge I guess? I prefer to not use fix 177 in the commit message since it has not been tested in real life yet and current version of |
68cb9ea
to
d81f46f
Compare
yes, squash & merge indeed :) |
… 177 for more details)
d81f46f
to
52e0094
Compare
nice work! |
I would like to proceed step by step.
I started with
update conda-forge feedstock to trigger new packages
(see #177).