-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create guidelines for an issue and getting help (#528)
* Add a GitHub issue template and a convenience function to display the status and version of important dependencies. (You can see a very similar setup when you go to https://github.com/pandas-dev/pandas/issues/new.) * Add a link to a guide on how to ask a good question. * Add function to get version information
- Loading branch information
1 parent
b88a251
commit 7640a6c
Showing
6 changed files
with
177 additions
and
8 deletions.
There are no files selected for viewing
File renamed without changes.
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,28 @@ | ||
#### Problem description | ||
|
||
Please explain: | ||
* **what** you tried to achieve, | ||
* **how** you went about it (referring to the code sample), and | ||
* **why** the current behaviour is a problem and what output | ||
you expected instead. | ||
|
||
#### Code Sample | ||
|
||
Create a [minimal, complete, verifiable example | ||
](https://stackoverflow.com/help/mcve). | ||
|
||
```python | ||
# Paste your code here. | ||
|
||
``` | ||
|
||
#### Actual Output | ||
|
||
#### Expected Output | ||
|
||
#### Output of `cobra.show_versions()` | ||
|
||
<details> | ||
# Paste the output of `import cobra;cobra.show_versions()` here. | ||
|
||
</details> |
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
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,79 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Adapated from: | ||
# https://github.com/pandas-dev/pandas/blob/master/pandas/util/_print_versions.py | ||
# which is published under a BSD license. | ||
|
||
from __future__ import absolute_import, print_function | ||
|
||
from builtins import dict | ||
|
||
import platform | ||
|
||
import pip | ||
|
||
__all__ = ("show_versions",) | ||
|
||
SYS_ORDER = [ | ||
"OS", | ||
"OS-release", | ||
"Python" | ||
] | ||
PKG_ORDER = [ | ||
"pip", | ||
"setuptools", | ||
"cobra", | ||
"future", | ||
"swiglpk", | ||
"optlang", | ||
"ruamel.yaml", | ||
"pandas", | ||
"numpy", | ||
"tabulate", | ||
"python-libsbml", | ||
"lxml", | ||
"scipy", | ||
"matplotlib", | ||
"palettable", | ||
"pymatbridge" | ||
] | ||
|
||
|
||
def get_sys_info(): | ||
"""Returns system information as a dict.""" | ||
blob = dict() | ||
blob["OS"] = platform.system() | ||
blob["OS-release"] = platform.release() | ||
blob["Python"] = platform.python_version() | ||
return blob | ||
|
||
|
||
def get_pkg_info(): | ||
"""Returns Python package information as a dict.""" | ||
# TODO: Basically copying the requirements from setup.py is brittle, | ||
# should come up with a better way in future, for example, | ||
# using requirements files that can be read in. | ||
dependencies = frozenset(PKG_ORDER) | ||
blob = dict() | ||
for dist in pip.get_installed_distributions(): | ||
if dist.project_name in dependencies: | ||
blob[dist.project_name] = dist.version | ||
return blob | ||
|
||
|
||
def show_versions(): | ||
"""Print the formatted information to standard out.""" | ||
info = get_sys_info() | ||
info.update(get_pkg_info()) | ||
format_str = "{:<%d} {:>%d}" % (max(map(len, info)), | ||
max(map(len, info.values()))) | ||
print("\nSystem Information") | ||
print("==================") | ||
for name in SYS_ORDER: | ||
print(format_str.format(name, info[name])) | ||
|
||
print("\nPackage Versions") | ||
print("================") | ||
for name in PKG_ORDER: | ||
if name in info: | ||
print(format_str.format(name, info[name])) |