Skip to content

Commit

Permalink
An assortment of small fixes (#286)
Browse files Browse the repository at this point in the history
* Only CI on main and PRs

* Update system_info function

Fixes #252

* Add a little more to the readme

* Reformat license so that GH detects it

* Add a contributing guide

* Update dkist/utils/sysinfo.py

Co-authored-by: Drew Leonard <[email protected]>

---------

Co-authored-by: Drew Leonard <[email protected]>
  • Loading branch information
Cadair and SolarDrew authored Aug 7, 2023
1 parent df0724f commit 344ad8e
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 47 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
# Allow manual runs through the web UI
workflow_dispatch:
push:
# Only run CI on release branches and main
branches:
- 'main'
- '*.*'
pull_request:
schedule:
# ┌───────── minute (0 - 59)
Expand Down
58 changes: 58 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Contribute

We love contributions! `dkist` is open source, built on open source, and we'd love to have you hang out in our community.

**Imposter syndrome disclaimer**: We want your help. No, really.

There may be a little voice inside your head that is telling you that you're not ready to be an open source contributor; that your skills aren't nearly good enough to contribute.
What could you possibly offer a project like this one?

We assure you - the little voice in your head is wrong.
If you can write code at all, you can contribute code to open source.
Contributing to open source projects is a fantastic way to advance one's coding skills.
Writing perfect code isn't the measure of a good developer (that would disqualify all of us!); it's trying to create something, making mistakes, and learning from those mistakes.
That's how we all improve, and we are happy to help others learn.

Being an open source contributor doesn't just mean writing code, either.
You can help out by writing documentation, tests, or even giving feedback about the project (and yes - that includes giving feedback about the contribution process).
Some of these contributions may be the most valuable to the project as a whole, because you're coming to the project with fresh eyes, so you can see the errors and assumptions that seasoned contributors have glossed over.

Note: This disclaimer was originally written by [Adrienne Lowe](https://github.com/adriennefriend) for a [PyCon talk](https://www.youtube.com/watch?v=6Uj746j9Heo), and was adapted by dkist based on its use in the README file for the [MetPy project](https://github.com/Unidata/MetPy).


## Provide Feedback

We could always use more voices and opinions in the discussions about dkist and its development from both users and developers.
You may want to suggest a new feature or tell us about how something is not working in the manner you would expect it to.
There are a number of ways to make your voice heard and we would love to hear from you.

We strongly recommend that your first port of call would be to our lovely [matrix channel].
Here you can get in easily get in touch with developers or users for questions or support.

## Report Bugs

If you run into unexpected behavior or run into a bug we urge you to please report it.
All bugs are kept track of on our [issue tracker].
You can add a bug report there or you can report it on [matrix channel].
Ideally, we would like a short code example so we can reproduce the bug on our own machines.

## Provide Code

If you are interested in contributing fixes, code or documentation to dkist please have a read of the SunPy's [newcomers guide] as it's an excellent introduction to contributing.

dkist uses a distributed version control system called [git] and the code is hosted on [GitHub].
To get started, create an account [on github] and fork dkist then submit your changes via a pull request.
If you are unfamiliar with this style of development, Astropy provide a sample [workflow] but you can also find lots of [tutorials] online.
You can browse our [issue list] to find something that you can tackle.
Please leave a comment on the issue on [GitHub] and stop by the [matrix channel] to let people know what you are planning to work on.

[matrix channel]: https://app.element.io/#/room/#dki-solar-telescope:openastronomy.org
[issue tracker]: https://github.com/DKISTDC/dkist/issues
[issue list]: https://github.com/dkist/dkist/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22Good+First+Issue%22
[newcomers guide]: https://docs.dkist.org/en/latest/dev_guide/contents/newcomers.html
[developer guide]: https://docs.dkist.org/en/latest/dev_guide/
[git]: https://git-scm.com
[github]: https://github.com/DKISTDC/dkist/
[on github]: https://help.github.com/en/articles/signing-up-for-a-new-github-account
[workflow]: https://docs.astropy.org/en/stable/development/workflow/development_workflow.html#development-workflow
[tutorials]: https://readwrite.com/2013/09/30/understanding-github-a-journey-for-beginners-part-1#awesm
45 changes: 24 additions & 21 deletions LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
BSD 3-Clause License

Copyright (c) 2019-2022, NSO / AURA
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the names of DKIST, NSO or AURA nor the names of
the contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 changes: 28 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
DKIST User Tools
----------------
================

.. image:: https://img.shields.io/pypi/v/dkist.svg
:target: https://pypi.python.org/pypi/dkist/
:alt: PyPI for dkist package
.. image:: https://img.shields.io/pypi/pyversions/dkist
:alt: PyPI - Python Version
.. image:: https://img.shields.io/matrix/dki-solar-telescope:openastronomy.org.svg?colorB=%23FE7900&label=Chat&logo=matrix&server_fqdn=matrix.org
:target: https://app.element.io/#/room/#dki-solar-telescope:openastronomy.org
:alt: DKIST chat room on matrix
.. image:: https://github.com/DKISTDC/dkist/actions/workflows/main.yml/badge.svg?branch=main
:target: https://github.com/DKISTDC/dkist/actions/workflows/main.yml
:alt: Latest CI Status for dkist package
.. image:: https://codecov.io/github/dkistdc/dkist/branch/master/graph/badge.svg?token=A4ggaCurqz
:target: https://codecov.io/github/dkistdc/dkist
:alt: Latest codecov Status for dkist package
.. image:: https://readthedocs.com/projects/dkistdc-dkist/badge/?version=latest
:target: https://docs.dkist.nso.edu/projects/python-tools
:alt: Documentation Status
Expand All @@ -21,11 +25,30 @@ DKIST User Tools
A Python library of tools for obtaining, processing and interacting with DKIST
data.

Documentation
-------------

See the documentation at `https://docs.dkist.nso.edu/projects/python-tools<https://docs.dkist.nso.edu/projects/python-tools>`__.

Installation
------------

The recommended way to install ``dkist`` is with `miniforge <https://github.com/conda-forge/miniforge#miniforge3>`__.
To install ``dkist`` once miniforge is installed run the following command:

.. code:: bash
$ conda install dkist
For detailed installation instructions, see the `installation guide <https://docs.dkist.nso.edu/projects/python-tools/en/stable/installation.html>`__ in the ``dkist`` docs.

License
-------

This project is Copyright (c) NSO / AURA and licensed under
the terms of the BSD 3-Clause license. This package is based upon
the `Astropy package template <https://github.com/astropy/package-template>`_
which is licensed under the BSD 3-clause licence. See the licenses folder for
more information.
the terms of the BSD 3-Clause license.

Code of Conduct
---------------

When you are interacting with the `dkist` project you are asked to follow the SunPy `Code of Conduct<https://sunpy.org/coc>`__.
41 changes: 20 additions & 21 deletions dkist/utils/sysinfo.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
import platform
from importlib.metadata import version, distribution

from pkg_resources import get_distribution

from sunpy.extern.distro import linux_distribution
from sunpy.util.sysinfo import find_dependencies
import sunpy.extern.distro as distro
from sunpy.util.sysinfo import find_dependencies, get_keys_list, get_requirements

__all__ = ['system_info']


def system_info():
"""
Display information about your system for submitting bug reports.
Prints one's system info in an "attractive" fashion.
"""
base_reqs = get_distribution("dkist").requires()
base_reqs = {base_req.name.lower() for base_req in base_reqs}

missing_packages, installed_packages = find_dependencies(package="dkist")
package_name = "dkist"
requirements = get_requirements(package_name)
base_reqs = get_keys_list(requirements['required'])
missing_packages, installed_packages = find_dependencies(package=package_name)
extra_prop = {"System": platform.system(),
"Arch": f"{platform.architecture()[0]}, ({platform.processor()})",
"Python": platform.python_version(),
"SunPy": get_distribution("dkist").version}
package_name: version(package_name)}
sys_prop = {**installed_packages, **missing_packages, **extra_prop}

print("==============================")
print("DKIST Installation Information")
print("==============================")
title_str = f"{package_name} Installation Information"
print("=" * len(title_str))
print(title_str)
print("=" * len(title_str))
print()
print("General")
print("#######")
if sys_prop['System'] == "Linux":
distro = " ".join(linux_distribution())
print(f"OS: {distro} (Linux {platform.release()})")
print(f"OS: {distro.name()} ({distro.version()}, Linux {platform.release()})")
elif sys_prop['System'] == "Darwin":
print(f"OS: Mac OS {platform.mac_ver()[0]}")
elif sys_prop['System'] == "Windows":
print(f"OS: Windows {platform.release()} {platform.version()}")
else:
print("Unknown OS")
for sys_info in ['Arch', 'SunPy']:
print('{} : {}'.format(sys_info, sys_prop[sys_info]))
for sys_info in ['Arch', package_name]:
print(f'{sys_info}: {sys_prop[sys_info]}')
print(f'Installation path: {distribution(package_name)._path}')
print()
print("Required Dependices")
print("###################")
print("Required Dependencies")
print("#####################")
for req in base_reqs:
print('{}: {}'.format(req, sys_prop[req]))
print(f'{req}: {sys_prop[req]}')
11 changes: 11 additions & 0 deletions dkist/utils/tests/test_sysinfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import dkist


def test_system_info(capsys):
"""
A very minimal test for system_info to test it runs.
"""
dkist.system_info()
captured_output = capsys.readouterr().out
assert "dkist Installation Information" in captured_output
assert f"dkist: {dkist.__version__}" in captured_output

0 comments on commit 344ad8e

Please sign in to comment.