Skip to content
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

Added a CLI #38

Merged
merged 10 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[run]
source = epispot
source =
epispot
bin

[report]
show_missing = True
9 changes: 7 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ jobs:
python -m pip install --upgrade pip
pip install flake8
pip install -U pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -r bin/requirements.txt
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test code for errors
- name: Test package source code for errors
run: |
python tests/CI/test_sir.py
python tests/CI/test_seir.py
Expand All @@ -39,3 +40,7 @@ jobs:
python tests/CI/test_fit.py
python tests/CI/test_recurrent.py
python tests/CI/test_critical.py
- name: Test CLI for errors
run: |
python setup.py develop
epispot about
1 change: 1 addition & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- name: Generate Coverage Report
continue-on-error: true
run: |
python -m coverage report
python -m coverage xml
- name: Upload to codecov
run: |
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Nightly Changelog
@v2.1.1.2
___

- v2.1.1.2
- Added *very* basic epispot CLI functionality
- See `bin/requirements.txt` for CLI requirements
- Fire up a terminal and enter
```shell
$ epispot about
```
- Added this changelog for nightly package
35 changes: 16 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,38 @@
A tool for creating and testing epidemiological models faster than ever for the mathematical modeling of infectious
diseases. An idea from https://github.com/henrifroese/infectious_disease_modelling.

**This is a nightly build of epispot. Releases may contain unstable code and issues are to be expected.\
Additionally, code within this branch may be deprecated at any time.\
See the official stable build and all its features [here](https://pypi.org/project/epispot/)**

To ensure that you are using the latest version, run the following command regularly*:\
`pip install epispot-nightly --upgrade` \
*updates are published after every commit (~1/day)
> **This is a nightly build of epispot. Releases may contain unstable code and issues are to be expected.\
> Additionally, code within this branch may be deprecated at any time.\
> See the official stable build and all its features [here](https://pypi.org/project/epispot/)**

<br>

## Installation

Epispot nightly can _only_ be installed on pip at this time.
Install with:
```
```shell
pip install epispot-nightly
```
As a shorthand, use `import epispot as epi`.
Both nightly and stable packages cannot be used at the same time in the same file.
To ensure that you are using the latest version, run the following command regularly*:\
```shell
pip install epispot-nightly --upgrade
```

*updates are published after every commit (~1/day)\
See [CHANGELOG.md](https://www.github.com/epispot/epispot/tree/nightly/CHANGELOG.md)
for detailed update information

## Getting Started

Make sure you are already familiar with epispot. You can view the new functions and changes by using the built in python `help()` command.
Make sure you are already familiar with [epispot](https://www.pypi.org/project/epispot).
If not, checkout the [tests/ directory](https://www.github.com/epispot/epispot/tree/nightly/tests)
for hands-on examples.
You can view the new functions and changes by using the built-in Python `help()` command.
Epispot docs are located [here](https://epispot.github.io/epispot).

## Latest Release Notes

- 3/13/21 2.0.1.23 Add documentation, triggering workflow. See commit description for deeper info.
- 2/26/21 2.0.1.22 Automations
- Automated code coverage reports
- Working on automating release notes
- 2/12/21 2.0.1.17 Actions Test
- 2/12/21 2.0.1.16: Stability Improvements
- Allows for faster bug and issue tracking

## Stay one step ahead
### And preview the latest features
Documentation can easily be accessed from function, class, and file docstrings.
Expand Down
45 changes: 45 additions & 0 deletions bin/epispot
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python

"""Shell Initialization"""
import pathlib
import epispot

__color__ = False

try:
import fire
except:
print("Please install Fire to use epispot's CLI")
print('>>> pip install fire')

try:
__color__ = True
import termcolor
except:
print('Color output will be suppressed. To use colors run')
print('>>> pip install termcolor')


class Shell(object):
"""The base shell for epispot containing linking commands for Fire"""

def __init__(self, color=False):
"""Initialize the epispot shell"""

self.color = color
self.path = pathlib.Path(__file__).parent.absolute()
self.version = 'shell-v0.1.0-alpha epispot-{0}'.format(epispot.__version__)

def about(self):
"""Basic information about the epispot CLI"""

print('Epispot was invoked via the epispot CLI')
print('Path: {0}'.format(self.path))
print('Version: {0}'.format(self.version))
print('Color output enabled (True/False): {0}'.format(self.color))


if __name__ == '__main__':
fire.Fire(Shell(
color=__color__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using a library like termcolor for terminal string styling? You can use the python built-in ANSI escape codes which are much more customizable, such as italics or underlined

))
3 changes: 3 additions & 0 deletions bin/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
epispot
fire
termcolor
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
matplotlib
numpy
sphinx
numpy
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
long_description_content_type="text/markdown",
url="https://www.github.com/epispot/epispot/tree/nightly",
packages=setuptools.find_packages(),
scripts=['bin/epispot'],
Quantalabs marked this conversation as resolved.
Show resolved Hide resolved
classifiers=[
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
Expand Down