-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix for #921: unifies versioning between JS and Python libraries #923
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f872dce
Remove old python versioning scheme, use lerna and package.json to sy…
sc1f be40f4d
remove version_python.js, replace with python version script
sc1f fb004fd
remove dependency on _version from outside of module, exec() instead
sc1f bff7410
use major and minor versions only for PerspectiveWidget
sc1f File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,2 @@ | ||
################################################################################ | ||
# | ||
# Copyright (c) 2019, the Perspective Authors. | ||
# | ||
# This file is part of the Perspective library, distributed under the terms of | ||
# the Apache License 2.0. The full license can be found in the LICENSE file. | ||
# | ||
|
||
from collections import namedtuple | ||
|
||
VersionInfo = namedtuple('VersionInfo', [ | ||
'major', | ||
'minor', | ||
'micro', | ||
'releaselevel', | ||
'serial' | ||
]) | ||
|
||
# DO NOT EDIT THIS DIRECTLY! It is managed by bumpversion | ||
version_info = VersionInfo(0, 4, 2, 'final', 0) | ||
|
||
_specifier_ = {'alpha': 'alpha', 'beta': 'beta', 'rc': 'rc', 'final': ''} | ||
|
||
__version__ = '{}.{}.{}{}'.format( | ||
version_info.major, | ||
version_info.minor, | ||
version_info.micro, | ||
('' | ||
if version_info.releaselevel == 'final' | ||
else _specifier_[version_info.releaselevel] + "." + str(version_info.serial))) | ||
__version__ = "0.4.3" | ||
major_minor_version = "0.4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
################################################################################ | ||
# | ||
# Copyright (c) 2019, the Perspective Authors. | ||
# | ||
# This file is part of the Perspective library, distributed under the terms of | ||
# the Apache License 2.0. The full license can be found in the LICENSE file. | ||
# | ||
|
||
import os | ||
import json | ||
import logging | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
|
||
|
||
def truncate_patch_version(version): | ||
"""Return just the major and minor versions from `version`.""" | ||
split_version = version.split(".") | ||
return "{}.{}".format(split_version[0], split_version[1]) | ||
|
||
|
||
def write_version(): | ||
"""Retrieves the version string from `package.json` managed by Lerna, | ||
and writes it into `_version.py`. This script is run as part of Lerna's | ||
"version" task, which ensures that changes are made `after` the version | ||
has been updated, but `before` the changes made as part of `lerna version` | ||
are committed.""" | ||
logging.info("Updating Python `__version__` from `package.json`") | ||
|
||
here = os.path.abspath(os.path.dirname(__file__)) | ||
package_json_path = os.path.join(here, "..", "package.json") | ||
version = None | ||
|
||
with open(os.path.realpath(package_json_path), "r") as f: | ||
version = json.load(f)["version"] | ||
|
||
logging.info("Updating `perspective-python` to version `{}`".format(version)) | ||
|
||
version_py_path = os.path.join(here, "..", "perspective", "core", "_version.py") | ||
|
||
# PerspectiveWidget uses the major and minor versions for semver only. | ||
truncated = truncate_patch_version(version) | ||
|
||
with open(os.path.realpath(version_py_path), "w") as f: | ||
f.write('__version__ = "{}"\n'.format(version)) | ||
f.write('major_minor_version = "{}"\n'.format(truncated)) | ||
|
||
logging.info("`perspective-python` updated to version `{}`".format(version)) | ||
logging.info("`PerspectiveWidget` now requires `perspective-jupyterlab` version `~{}`".format(truncated)) | ||
|
||
|
||
if __name__ == "__main__": | ||
write_version() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
prob don't need js anymore here either due to #912