Skip to content

Commit 8d43b5e

Browse files
authored
Merge pull request #40 from cmu-delphi/rzatserkovnyi/docs
[WIP] Port R docs vignettes to epidatpy
2 parents 896be6a + b092dad commit 8d43b5e

17 files changed

+828
-504
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ __pycache__
88
dist/
99
build/
1010
docs/_build
11-
env/
11+
.venv/

Makefile

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
.PHONY = venv, lint, test, clean, release
22

33
venv:
4-
python3.8 -m venv env
4+
python3.8 -m venv .venv
55

66
install: venv
7-
env/bin/python -m pip install --upgrade pip
8-
env/bin/pip install -e ".[dev]"
7+
.venv/bin/python -m pip install --upgrade pip
8+
.venv/bin/pip install -e ".[dev]"
99

1010
lint_ruff:
11-
env/bin/ruff check epidatpy tests
11+
.venv/bin/ruff check epidatpy tests
1212

1313
lint_mypy:
14-
env/bin/mypy epidatpy tests
14+
.venv/bin/mypy epidatpy tests
1515

1616
lint_pylint:
17-
env/bin/pylint epidatpy tests
17+
.venv/bin/pylint epidatpy tests
1818

1919
lint: lint_ruff lint_mypy lint_pylint
2020

2121
format:
22-
env/bin/ruff format epidatpy tests
22+
.venv/bin/ruff format epidatpy tests
2323

2424
test:
25-
env/bin/pytest .
25+
.venv/bin/pytest .
2626

27-
docs:
28-
env/bin/sphinx-build -b html docs docs/_build
29-
env/bin/python -m webbrowser -t "docs/_build/index.html"
27+
doc:
28+
@pandoc --version >/dev/null 2>&1 || (echo "ERROR: pandoc is required (install via your platform's package manager)"; exit 1)
29+
.venv/bin/sphinx-build -b html docs docs/_build
30+
.venv/bin/python -m webbrowser -t "docs/_build/index.html"
3031

31-
clean_docs:
32+
clean_doc:
3233
rm -rf docs/_build
3334

3435
clean_build:
@@ -41,10 +42,10 @@ clean_python:
4142
find . -name '*.pyo' -exec rm -f {} +
4243
find . -name '__pycache__' -exec rm -fr {} +
4344

44-
clean: clean_docs clean_build clean_python
45+
clean: clean_doc clean_build clean_python
4546

4647
release: clean lint test
47-
env/bin/python -m build --sdist --wheel
48+
.venv/bin/python -m build --sdist --wheel
4849

4950
upload: release
50-
env/bin/twine upload dist/*
51+
.venv/bin/twine upload dist/*

README.md

+33-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![License: MIT][mit-image]][mit-url] [![Github Actions][github-actions-image]][github-actions-url] [![PyPi][pypi-image]][pypi-url] [![Read the Docs][docs-image]][docs-url]
44

5-
A Python client for the [Delphi Epidata API](https://cmu-delphi.github.io/delphi-epidata/). Still in development.
5+
The Python client for the [Delphi Epidata API](https://cmu-delphi.github.io/delphi-epidata/).
66

77
## Install
88

@@ -18,7 +18,23 @@ pip install epidatpy
1818

1919
## Usage
2020

21-
TODO
21+
```py
22+
from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange
23+
24+
# All calls using the `epidata` object will now be cached for 7 days
25+
epidata = EpiDataContext(use_cache=True, cache_max_age_days=7)
26+
27+
# Obtain a DataFrame of the most up-to-date version of the smoothed covid-like illness (CLI)
28+
# signal from the COVID-19 Trends and Impact survey for the US
29+
epidata.pub_covidcast(
30+
data_source="jhu-csse",
31+
signals="confirmed_cumulative_num",
32+
geo_type="nation",
33+
time_type="day",
34+
geo_values="us",
35+
time_values=EpiRange(20210405, 20210410),
36+
).df()
37+
```
2238

2339
## Development
2440

@@ -35,6 +51,21 @@ make release # upload the current version to pypi
3551
make clean # clean build and docs artifacts
3652
```
3753

54+
Building the documentation additionally requires the Pandoc package. These
55+
commands can be used to install the package on common platforms (see the
56+
[official documentation](https://pandoc.org/installing.html) for more options):
57+
58+
```sh
59+
# Linux (Debian/Ubuntu)
60+
sudo apt-get install pandoc
61+
62+
# OS X / Linux (with Homebrew)
63+
brew install pandoc
64+
65+
# Windows (with Chocolatey)
66+
choco install pandoc
67+
```
68+
3869
### Release Process
3970

4071
The release consists of multiple steps which can be all done via the GitHub website:

docs/conf.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@
3131
# Add any Sphinx extension module names here, as strings. They can be
3232
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3333
# ones.
34-
extensions = [
35-
"sphinx.ext.autodoc",
36-
"sphinx_autodoc_typehints",
37-
# 'matplotlib.sphinxext.plot_directive'
38-
]
34+
extensions = ["sphinx.ext.autodoc", "sphinx_autodoc_typehints", "nbsphinx"]
3935

4036
# Add any paths that contain templates here, relative to this directory.
4137
templates_path = ["_templates"]
@@ -84,3 +80,8 @@
8480

8581
# https://pypi.org/project/sphinx-autodoc-typehints/
8682
always_document_param_types = True
83+
84+
# https://nbsphinx.readthedocs.io/
85+
nbsphinx_prompt_width = 0
86+
nbsphinx_input_prompt = "%.0s"
87+
nbsphinx_output_prompt = "%.0s"

docs/covidcast_examples.rst

-60
This file was deleted.

docs/epidatpy.rst

+4-15
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@ epidatpy Reference
44
.. toctree::
55
:maxdepth: 4
66

7-
Submodules
8-
----------
9-
10-
Module contents
11-
---------------
12-
13-
.. automodule:: epidatpy
14-
:members:
15-
:undoc-members:
16-
:show-inheritance:
17-
187
epidatpy.request module
198
-----------------------
209

@@ -23,11 +12,11 @@ epidatpy.request module
2312
:undoc-members:
2413
:show-inheritance:
2514

26-
epidatpy.async\_request module
27-
------------------------------
15+
epidatpy._endpoints module
16+
-----------------------
2817

29-
.. automodule:: epidatpy.async_request
18+
.. automodule:: epidatpy._endpoints
3019
:members:
3120
:undoc-members:
3221
:show-inheritance:
33-
22+
:exclude-members: get_wildcard_equivalent_dates

0 commit comments

Comments
 (0)