-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add ISSUE_TEMPLATE for github and xr.show_versions() #1485
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7ec3298
add ISSUE_TEMPLATE for github and xr.show_versions()
baca462
fix Nio import
5843350
print version info on appveyor
6f5836f
use mod.__version__ for numpy/scipy
11ee6eb
add CONTRIBUTING.md
56c456b
Merge branch 'master' of github.com:pydata/xarray into feature/print_…
2f59713
whats new
a95f3b0
Merge branch 'master' of github.com:pydata/xarray into feature/print_…
a05ffce
fix whatsnew
4749876
Merge branch 'master' of github.com:pydata/xarray into feature/print_…
d6e9f56
update flake8 prompt to only run on python sources
bdd66bf
update travis to run flak8
9614848
fix flake8
425059e
flake8 fix
97ee679
Merge branch 'master' into feature/print_versions
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 hidden or 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,18 @@ | ||
#### Code Sample, a copy-pastable example if possible | ||
|
||
```python | ||
# Your code here | ||
|
||
``` | ||
#### Problem description | ||
|
||
[this should explain **why** the current behavior is a problem and why the expected output is a better solution.] | ||
|
||
#### Expected Output | ||
|
||
#### Output of ``xr.show_versions()`` | ||
|
||
<details> | ||
# Paste the output here xr.show_versions() here | ||
|
||
</details> |
This file contains hidden or 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 hidden or 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 hidden or 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
Empty file.
This file contains hidden or 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,151 @@ | ||
'''utility functions for printing version information | ||
|
||
|
||
see pandas/pandas/util/_print_versions.py''' | ||
import os | ||
import platform | ||
import sys | ||
import struct | ||
import subprocess | ||
import codecs | ||
import locale | ||
import importlib | ||
|
||
|
||
def get_sys_info(): | ||
"Returns system information as a dict" | ||
|
||
blob = [] | ||
|
||
# get full commit hash | ||
commit = None | ||
if os.path.isdir(".git") and os.path.isdir("xarray"): | ||
try: | ||
pipe = subprocess.Popen('git log --format="%H" -n 1'.split(" "), | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE) | ||
so, serr = pipe.communicate() | ||
except: | ||
pass | ||
else: | ||
if pipe.returncode == 0: | ||
commit = so | ||
try: | ||
commit = so.decode('utf-8') | ||
except ValueError: | ||
pass | ||
commit = commit.strip().strip('"') | ||
|
||
blob.append(('commit', commit)) | ||
|
||
try: | ||
(sysname, nodename, release, | ||
version, machine, processor) = platform.uname() | ||
blob.extend([ | ||
("python", "%d.%d.%d.%s.%s" % sys.version_info[:]), | ||
("python-bits", struct.calcsize("P") * 8), | ||
("OS", "%s" % (sysname)), | ||
("OS-release", "%s" % (release)), | ||
# ("Version", "%s" % (version)), | ||
("machine", "%s" % (machine)), | ||
("processor", "%s" % (processor)), | ||
("byteorder", "%s" % sys.byteorder), | ||
("LC_ALL", "%s" % os.environ.get('LC_ALL', "None")), | ||
("LANG", "%s" % os.environ.get('LANG', "None")), | ||
("LOCALE", "%s.%s" % locale.getlocale()), | ||
|
||
]) | ||
except: | ||
pass | ||
|
||
return blob | ||
|
||
|
||
def show_versions(as_json=False): | ||
sys_info = get_sys_info() | ||
|
||
deps = [ | ||
# (MODULE_NAME, f(mod) -> mod version) | ||
("xarray", lambda mod: mod.__version__), | ||
("pandas", lambda mod: mod.__version__), | ||
("numpy", lambda mod: mod.version.version), | ||
("scipy", lambda mod: mod.version.version), | ||
# xarray optionals | ||
("netCDF4", lambda mod: mod.__version__), | ||
# ("pydap", lambda mod: mod.version.version), | ||
("h5netcdf", lambda mod: mod.__version__), | ||
("Nio", lambda mod: mod.__version__), | ||
("bottleneck", lambda mod: mod.__version__), | ||
("cyordereddict", lambda mod: mod.__version__), | ||
("dask", lambda mod: mod.__version__), | ||
("matplotlib", lambda mod: mod.__version__), | ||
("cartopy", lambda mod: mod.__version__), | ||
("seaborn", lambda mod: mod.__version__), | ||
# xarray setup/test | ||
("setuptools", lambda mod: mod.__version__), | ||
("pip", lambda mod: mod.__version__), | ||
("conda", lambda mod: mod.__version__), | ||
("pytest", lambda mod: mod.__version__), | ||
# Misc. | ||
("IPython", lambda mod: mod.__version__), | ||
("sphinx", lambda mod: mod.__version__), | ||
] | ||
|
||
deps_blob = list() | ||
for (modname, ver_f) in deps: | ||
try: | ||
if modname in sys.modules: | ||
mod = sys.modules[modname] | ||
else: | ||
mod = importlib.import_module(modname) | ||
ver = ver_f(mod) | ||
deps_blob.append((modname, ver)) | ||
except: | ||
deps_blob.append((modname, None)) | ||
|
||
if (as_json): | ||
try: | ||
import json | ||
except: | ||
import simplejson as json | ||
|
||
j = dict(system=dict(sys_info), dependencies=dict(deps_blob)) | ||
|
||
if as_json is True: | ||
print(j) | ||
else: | ||
with codecs.open(as_json, "wb", encoding='utf8') as f: | ||
json.dump(j, f, indent=2) | ||
|
||
else: | ||
|
||
print("\nINSTALLED VERSIONS") | ||
print("------------------") | ||
|
||
for k, stat in sys_info: | ||
print("%s: %s" % (k, stat)) | ||
|
||
print("") | ||
for k, stat in deps_blob: | ||
print("%s: %s" % (k, stat)) | ||
|
||
|
||
def main(): | ||
from optparse import OptionParser | ||
parser = OptionParser() | ||
parser.add_option("-j", "--json", metavar="FILE", nargs=1, | ||
help="Save output as JSON into file, pass in " | ||
"'-' to output to stdout") | ||
|
||
(options, args) = parser.parse_args() | ||
|
||
if options.json == "-": | ||
options.json = True | ||
|
||
show_versions(as_json=options.json) | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
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.
Can we just use
mod.__version__
for numpy and scipy? That's the more standard way to access this information.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.
yes, that works. Done.