diff --git a/.github/ISSUE_TEMPLATE/blank_template.md b/.github/ISSUE_TEMPLATE/blank_template.md new file mode 100644 index 000000000..90a074dd8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/blank_template.md @@ -0,0 +1,8 @@ +--- +name: Other +about: For all other issues to reach the community... +title: '' +labels: '' +assignees: '' + +--- diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..0f78764f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,54 @@ +--- +name: Bug report +about: Create a report to help us reproduce and correct the bug +title: '' +labels: 'Bug: triage' +assignees: '' + +--- + + + +#### Describe the bug + + +#### Steps/Code to Reproduce + + +```python +Sample code to reproduce the problem +``` + +#### Expected Results + + +#### Actual Results + + +#### Screenshots + + +#### Versions + + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..3ba13e0ce --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/doc_improvement.md b/.github/ISSUE_TEMPLATE/doc_improvement.md new file mode 100644 index 000000000..34b21d8c7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/doc_improvement.md @@ -0,0 +1,20 @@ +--- +name: Documentation improvement +about: Create a report to help us improve the documentation. Alternatively you can just open a pull request with the suggested change. +title: '' +labels: Documentation +assignees: '' + +--- + +#### Describe the issue linked to the documentation + + + +#### Suggest a potential alternative/fix + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..452d6e358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,22 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: feature-request +assignees: '' + +--- + +#### Is your feature request related to a problem? Please describe. + + +#### Describe the solution you'd like + + +#### Describe alternatives you've considered, if relevant + + +#### Additional context + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..4eb3d97e0 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Description + + + + +## Tests + +- [ ] no new tests required +- [ ] new tests added +- [ ] existing tests adjusted + +## Documentation + +- [ ] no documentation changes needed +- [ ] documentation added or edited +- [ ] example notebook added or updated diff --git a/pyrit/__init__.py b/pyrit/__init__.py index b14b47650..eba3948b4 100644 --- a/pyrit/__init__.py +++ b/pyrit/__init__.py @@ -1,2 +1,9 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. + +from .show_versions import show_versions # noqa: F401 + + +__name__ = "pyrit" +# Remove dev suffix when releasing and keep in sync with pyproject.toml +__version__ = "0.1.0.dev0" diff --git a/pyrit/show_versions.py b/pyrit/show_versions.py new file mode 100644 index 000000000..38a29b1c6 --- /dev/null +++ b/pyrit/show_versions.py @@ -0,0 +1,83 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. + +"""Utility methods to print system info for debugging. + +Adapted from :py:func:`pandas.show_versions` and :py:func:`sklearn.show_versions`. +""" # noqa: RST304 + +import platform +import sys + + +def _get_sys_info(): + """System information. + + Returns + ------- + sys_info : dict + system and Python version information + """ + python = sys.version.replace("\n", " ") + + blob = [ + ("python", python), + ("executable", sys.executable), + ("machine", platform.platform()), + ] + + return dict(blob) + + +def _get_deps_info(): + """Overview of the installed version of main dependencies. + + This function does not import the modules to collect the version numbers + but instead relies on standard Python package metadata. + + Returns + ------- + deps_info: dict + version information on relevant Python libraries + """ + deps = sorted( + [ + "pip", + "setuptools", + "numpy", + "scipy", + "Cython", + "scikit-learn", + "openai", + "torch", + "tensorflow", + "transformers", + ] + ) + + from pyrit import __version__ + + deps_info = {"pyrit": __version__} + + from importlib.metadata import PackageNotFoundError, version + + for modname in deps: + try: + deps_info[modname] = version(modname) + except PackageNotFoundError: + deps_info[modname] = None + return deps_info + + +def show_versions(): + """Print useful debugging information.""" + sys_info = _get_sys_info() + deps_info = _get_deps_info() + + print("\nSystem:") + for k, stat in sys_info.items(): + print("{k:>10}: {stat}".format(k=k, stat=stat)) + + print("\nPython dependencies:") + for k, stat in deps_info.items(): + print("{k:>13}: {stat}".format(k=k, stat=stat))