Skip to content

[WIP] Port R docs vignettes to epidatpy #40

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

Merged
merged 8 commits into from
Oct 2, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ __pycache__
dist/
build/
docs/_build
env/
.venv/
31 changes: 16 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
.PHONY = venv, lint, test, clean, release

venv:
python3.8 -m venv env
python3.8 -m venv .venv

install: venv
env/bin/python -m pip install --upgrade pip
env/bin/pip install -e ".[dev]"
.venv/bin/python -m pip install --upgrade pip
.venv/bin/pip install -e ".[dev]"

lint_ruff:
env/bin/ruff check epidatpy tests
.venv/bin/ruff check epidatpy tests

lint_mypy:
env/bin/mypy epidatpy tests
.venv/bin/mypy epidatpy tests

lint_pylint:
env/bin/pylint epidatpy tests
.venv/bin/pylint epidatpy tests

lint: lint_ruff lint_mypy lint_pylint

format:
env/bin/ruff format epidatpy tests
.venv/bin/ruff format epidatpy tests

test:
env/bin/pytest .
.venv/bin/pytest .

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

clean_docs:
clean_doc:
rm -rf docs/_build

clean_build:
Expand All @@ -41,10 +42,10 @@ clean_python:
find . -name '*.pyo' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean: clean_docs clean_build clean_python
clean: clean_doc clean_build clean_python

release: clean lint test
env/bin/python -m build --sdist --wheel
.venv/bin/python -m build --sdist --wheel

upload: release
env/bin/twine upload dist/*
.venv/bin/twine upload dist/*
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![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]

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

## Install

Expand All @@ -18,7 +18,23 @@ pip install epidatpy

## Usage

TODO
```py
from epidatpy import CovidcastEpidata, EpiDataContext, EpiRange

# All calls using the `epidata` object will now be cached for 7 days
epidata = EpiDataContext(use_cache=True, cache_max_age_days=7)

# Obtain a DataFrame of the most up-to-date version of the smoothed covid-like illness (CLI)
# signal from the COVID-19 Trends and Impact survey for the US
epidata.pub_covidcast(
data_source="jhu-csse",
signals="confirmed_cumulative_num",
geo_type="nation",
time_type="day",
geo_values="us",
time_values=EpiRange(20210405, 20210410),
).df()
```

## Development

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

Building the documentation additionally requires the Pandoc package. These
commands can be used to install the package on common platforms (see the
[official documentation](https://pandoc.org/installing.html) for more options):

```sh
# Linux (Debian/Ubuntu)
sudo apt-get install pandoc

# OS X / Linux (with Homebrew)
brew install pandoc

# Windows (with Chocolatey)
choco install pandoc
```

### Release Process

The release consists of multiple steps which can be all done via the GitHub website:
Expand Down
11 changes: 6 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx_autodoc_typehints",
# 'matplotlib.sphinxext.plot_directive'
]
extensions = ["sphinx.ext.autodoc", "sphinx_autodoc_typehints", "nbsphinx"]

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

# https://pypi.org/project/sphinx-autodoc-typehints/
always_document_param_types = True

# https://nbsphinx.readthedocs.io/
nbsphinx_prompt_width = 0
nbsphinx_input_prompt = "%.0s"
nbsphinx_output_prompt = "%.0s"
60 changes: 0 additions & 60 deletions docs/covidcast_examples.rst

This file was deleted.

19 changes: 4 additions & 15 deletions docs/epidatpy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ epidatpy Reference
.. toctree::
:maxdepth: 4

Submodules
----------

Module contents
---------------

.. automodule:: epidatpy
:members:
:undoc-members:
:show-inheritance:

epidatpy.request module
-----------------------

Expand All @@ -23,11 +12,11 @@ epidatpy.request module
:undoc-members:
:show-inheritance:

epidatpy.async\_request module
------------------------------
epidatpy._endpoints module
-----------------------

.. automodule:: epidatpy.async_request
.. automodule:: epidatpy._endpoints
:members:
:undoc-members:
:show-inheritance:

:exclude-members: get_wildcard_equivalent_dates
Loading