From c4dd94c34e2ce73735c02a64cb08123c8ad59e02 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Fri, 5 Aug 2022 15:04:28 -0700 Subject: [PATCH 1/4] Rename package to epidatpy --- .github/workflows/release_helper.yml | 2 +- README.md | 18 ++++++------ docs/conf.py | 29 ++++++++++--------- docs/getting_started.rst | 4 +-- docs/signals_covid.rst | 8 ++--- {delphi_epidata => epidatpy}/__init__.py | 0 {delphi_epidata => epidatpy}/_constants.py | 2 +- {delphi_epidata => epidatpy}/_covidcast.py | 0 {delphi_epidata => epidatpy}/_endpoints.py | 0 {delphi_epidata => epidatpy}/_model.py | 0 {delphi_epidata => epidatpy}/_parse.py | 0 {delphi_epidata => epidatpy}/async_request.py | 0 {delphi_epidata => epidatpy}/request.py | 0 pyproject.toml | 2 +- setup.cfg | 2 +- setup.py | 12 ++++---- smoke_covid_test.py | 2 +- smoke_test.py | 2 +- smoke_test_async.py | 2 +- tasks.py | 2 +- tests/test_constants.py | 2 +- tests/test_model.py | 2 +- 22 files changed, 46 insertions(+), 45 deletions(-) rename {delphi_epidata => epidatpy}/__init__.py (100%) rename {delphi_epidata => epidatpy}/_constants.py (61%) rename {delphi_epidata => epidatpy}/_covidcast.py (100%) rename {delphi_epidata => epidatpy}/_endpoints.py (100%) rename {delphi_epidata => epidatpy}/_model.py (100%) rename {delphi_epidata => epidatpy}/_parse.py (100%) rename {delphi_epidata => epidatpy}/async_request.py (100%) rename {delphi_epidata => epidatpy}/request.py (100%) diff --git a/.github/workflows/release_helper.yml b/.github/workflows/release_helper.yml index ecbce1e..873a87a 100644 --- a/.github/workflows/release_helper.yml +++ b/.github/workflows/release_helper.yml @@ -68,7 +68,7 @@ jobs: inv dist - uses: actions/upload-artifact@v2 with: - name: delphi_epidata + name: epidatpy - name: Upload Release Asset uses: AButler/upload-release-assets@v2.0 with: diff --git a/README.md b/README.md index 50b064a..0e8e2f5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Delphi Epidata Python Client +# Delphi Epidata Python Client `epidatpy` [![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] @@ -7,13 +7,13 @@ Install from PyPi: ```sh -pip install delphi-epidata +pip install epidatpy ``` latest version ```sh -pip install -e "git+https://github.com/cmu-delphi/delphi-epidata-py.git#egg=delphi_epidata" +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" ``` ## Usage @@ -48,19 +48,19 @@ inv release # upload the current version to pypi The release consists of multiple steps which can be all done via the GitHub website: -1. Go to [create_release GitHub Action](https://github.com/cmu-delphi/delphi-epidata-py/actions/workflows/create_release.yml) and click the `Run workflow` button. Enter the next version number or one of the magic keywords (patch, minor, major) and hit the green `Run workflow` button. -1. The action will prepare a new release and will end up with a new [Pull Request](https://github.com/cmu-delphi/delphi-epidata-py/pulls) +1. Go to [create_release GitHub Action](https://github.com/cmu-delphi/epidatpy/actions/workflows/create_release.yml) and click the `Run workflow` button. Enter the next version number or one of the magic keywords (patch, minor, major) and hit the green `Run workflow` button. +1. The action will prepare a new release and will end up with a new [Pull Request](https://github.com/cmu-delphi/epidatpy/pulls) 1. Let the code owner review the PR and its changes and let the CI check whether everything builds successfully 1. Once approved and merged, another GitHub action job starts which automatically will 1. create a git tag - 1. create another [Pull Request](https://github.com/cmu-delphi/delphi-epidata-py/pulls) to merge the changes back to the `dev` branch - 1. create a [GitHub release](https://github.com/cmu-delphi/delphi-epidata-py/releases) with automatically derived release notes + 1. create another [Pull Request](https://github.com/cmu-delphi/epidatpy/pulls) to merge the changes back to the `dev` branch + 1. create a [GitHub release](https://github.com/cmu-delphi/epidatpy/releases) with automatically derived release notes 1. Done [mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg [mit-url]: https://opensource.org/licenses/MIT -[github-actions-image]: https://github.com/cmu-delphi/delphi-epidata-py/workflows/ci/badge.svg -[github-actions-url]: https://github.com/cmu-delphi/delphi-epidata-py/actions +[github-actions-image]: https://github.com/cmu-delphi/epidatpy/workflows/ci/badge.svg +[github-actions-url]: https://github.com/cmu-delphi/epidatpy/actions [pypi-image]: https://img.shields.io/pypi/v/delphi-epidata [pypi-url]: https://pypi.python.org/pypi/delphi-epidata/ [docs-image]: https://readthedocs.org/projects/delphi-epidata/badge/?version=latest diff --git a/docs/conf.py b/docs/conf.py index 593597c..8d506e1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,17 +12,18 @@ # import os import sys -sys.path.insert(0, os.path.abspath('..')) -sys.path.insert(0, os.path.abspath('../delphi_epidata')) + +sys.path.insert(0, os.path.abspath("..")) +sys.path.insert(0, os.path.abspath("../epidatpy")) # -- Project information ----------------------------------------------------- -project = 'Delphi Epidata API client' -copyright = '2021, Delphi research group' # pylint: disable=redefined-builtin -author = 'Delphi research group' +project = "Delphi Epidata API client" +copyright = "2021, Delphi research group" # pylint: disable=redefined-builtin +author = "Delphi research group" # The full version, including alpha/beta/rc tags -release = '1.0.0' +release = "1.0.0" # -- General configuration --------------------------------------------------- @@ -31,29 +32,29 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx_autodoc_typehints', + "sphinx.ext.autodoc", + "sphinx_autodoc_typehints", # 'matplotlib.sphinxext.plot_directive' ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] add_module_names = False -autoclass_content = 'class' -autodoc_typehints = 'description' +autoclass_content = "class" +autodoc_typehints = "description" # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = "alabaster" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -63,7 +64,7 @@ html_theme_options = { "extra_nav_links": { "Delphi group": "https://delphi.cmu.edu/", - "Delphi Epidata API": "https://cmu-delphi.github.io/delphi-epidata" + "Delphi Epidata API": "https://cmu-delphi.github.io/delphi-epidata", } } diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 41acba0..bc66233 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -16,7 +16,7 @@ Basic examples To obtain all available sources of epidemiological data, we can use the following command: ->>> from delphi_epidata.request import CovidcastEpidata, EpiRange +>>> from epidatpy.request import CovidcastEpidata, EpiRange >>> epidata = CovidcastEpidata() >>> print(list(epidata.source_names)) ['chng-cli', 'chng-covid', 'covid-act-now', 'doctor-visits', 'fb-survey', 'google-symptoms', 'hhs', 'hospital-admissions', 'indicator-combination-cases-deaths', 'jhu-csse', 'quidel-covid-ag', 'safegraph-weekly', 'usa-facts', 'ght', 'google-survey', 'indicator-combination-nmf', 'quidel-flu', 'safegraph-daily', 'nchs-mortality'] @@ -26,7 +26,7 @@ To obtain smoothed estimates of COVID-like illness from our symptom survey, distributed through Facebook (`fb-survey`), for every county in the United States between 2020-05-01 and 2020-05-07: ->>> from delphi_epidata.request import EpiRange +>>> from epidatpy.request import EpiRange >>> apicall = epidata[("fb-survey", "smoothed_cli")].call( ... 'county', "*", EpiRange(20200501, 20200507), ... ) diff --git a/docs/signals_covid.rst b/docs/signals_covid.rst index 78878bc..87fef9a 100644 --- a/docs/signals_covid.rst +++ b/docs/signals_covid.rst @@ -24,7 +24,7 @@ Metadata Many data sources and signals are available, so one can also obtain a data frame of all signals and their associated metadata: ->>> from delphi_epidata.request import CovidcastEpidata +>>> from epidatpy.request import CovidcastEpidata >>> covid_ds = CovidcastEpidata() >>> df_source = covid_ds.source_df >>> df_signal = covid_ds.signal_df @@ -34,12 +34,12 @@ which has the property ``source_df`` and ``signal_df``, two data frames containi the information of all available sources and signals. More details of the two data frames are listed below. -.. autoclass:: delphi_epidata.request.CovidcastDataSources() +.. autoclass:: epidatpy.request.CovidcastDataSources() :members: More metadata statistics can also be obtained as follows: ->>> from delphi_epidata.request import Epidata +>>> from epidatpy.request import Epidata >>> df = Epidata.covidcast_meta().df() -.. autofunction:: delphi_epidata.request.Epidata.covidcast_meta() \ No newline at end of file +.. autofunction:: epidatpy.request.Epidata.covidcast_meta() \ No newline at end of file diff --git a/delphi_epidata/__init__.py b/epidatpy/__init__.py similarity index 100% rename from delphi_epidata/__init__.py rename to epidatpy/__init__.py diff --git a/delphi_epidata/_constants.py b/epidatpy/_constants.py similarity index 61% rename from delphi_epidata/_constants.py rename to epidatpy/_constants.py index f72a93a..cf1b857 100644 --- a/delphi_epidata/_constants.py +++ b/epidatpy/_constants.py @@ -4,6 +4,6 @@ __version__: Final = "1.0.0" -HTTP_HEADERS: Final = {"User-Agent": f"delphi_epidata/{__version__}"} +HTTP_HEADERS: Final = {"User-Agent": f"epidatpy/{__version__}"} BASE_URL: Final = "https://delphi.cmu.edu/epidata/" diff --git a/delphi_epidata/_covidcast.py b/epidatpy/_covidcast.py similarity index 100% rename from delphi_epidata/_covidcast.py rename to epidatpy/_covidcast.py diff --git a/delphi_epidata/_endpoints.py b/epidatpy/_endpoints.py similarity index 100% rename from delphi_epidata/_endpoints.py rename to epidatpy/_endpoints.py diff --git a/delphi_epidata/_model.py b/epidatpy/_model.py similarity index 100% rename from delphi_epidata/_model.py rename to epidatpy/_model.py diff --git a/delphi_epidata/_parse.py b/epidatpy/_parse.py similarity index 100% rename from delphi_epidata/_parse.py rename to epidatpy/_parse.py diff --git a/delphi_epidata/async_request.py b/epidatpy/async_request.py similarity index 100% rename from delphi_epidata/async_request.py rename to epidatpy/async_request.py diff --git a/delphi_epidata/request.py b/epidatpy/request.py similarity index 100% rename from delphi_epidata/request.py rename to epidatpy/request.py diff --git a/pyproject.toml b/pyproject.toml index 495e3fc..5cc4f12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,4 +2,4 @@ [tool.black] line-length = 120 target-version = ['py38'] -include = 'delphi_epidata' +include = 'epidatpy' diff --git a/setup.cfg b/setup.cfg index 3398f84..6e7cb2c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ current_version = 1.0.0 commit = False tag = False -[bumpversion:file:delphi_epidata/_version.py] +[bumpversion:file:epidatpy/_version.py] [bumpversion:file:docs/conf.py] [bdist_wheel] diff --git a/setup.py b/setup.py index 7bc9672..97e0211 100644 --- a/setup.py +++ b/setup.py @@ -3,14 +3,14 @@ setuptools.setup( - name="delphi_epidata", + name="epidatpy", version="1.0.0", author="Alex Reinhart", author_email="areinhar@stat.cmu.edu", description="A programmatic interface to Delphi's Epidata API.", - long_description=pathlib.Path('README.md').read_text(), + long_description=pathlib.Path("README.md").read_text(), long_description_content_type="text/markdown", - url="https://github.com/cmu-delphi/delphi-epidata-py", + url="https://github.com/cmu-delphi/epidatpy", packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", @@ -20,7 +20,7 @@ "Natural Language :: English", "Topic :: Scientific/Engineering :: Bio-Informatics", ], - python_requires='>=3.6', - install_requires=[f.strip() for f in pathlib.Path('requirements.txt').read_text().split('\n') if f], - # package_data={'delphi_epidata': []} + python_requires=">=3.6", + install_requires=[f.strip() for f in pathlib.Path("requirements.txt").read_text().split("\n") if f], + # package_data={'epidatpy': []} ) diff --git a/smoke_covid_test.py b/smoke_covid_test.py index 4fe5230..88e216d 100644 --- a/smoke_covid_test.py +++ b/smoke_covid_test.py @@ -1,4 +1,4 @@ -from delphi_epidata.request import CovidcastEpidata, EpiRange +from epidatpy.request import CovidcastEpidata, EpiRange epidata = CovidcastEpidata() print(list(epidata.source_names)) diff --git a/smoke_test.py b/smoke_test.py index 0e15310..081f7b0 100644 --- a/smoke_test.py +++ b/smoke_test.py @@ -1,5 +1,5 @@ from datetime import date -from delphi_epidata.request import Epidata, EpiRange +from epidatpy.request import Epidata, EpiRange apicall = Epidata.covidcast("fb-survey", "smoothed_cli", "day", "nation", EpiRange(20210405, 20210410), "us") diff --git a/smoke_test_async.py b/smoke_test_async.py index 7bafb6b..b26e09c 100644 --- a/smoke_test_async.py +++ b/smoke_test_async.py @@ -1,5 +1,5 @@ from asyncio import get_event_loop -from delphi_epidata.async_request import Epidata +from epidatpy.async_request import Epidata async def main() -> None: diff --git a/tasks.py b/tasks.py index 4753459..4cde5ba 100644 --- a/tasks.py +++ b/tasks.py @@ -17,7 +17,7 @@ ROOT_DIR = Path(__file__).parent SETUP_FILE = ROOT_DIR.joinpath("setup.py") TEST_DIR = ROOT_DIR.joinpath("tests") -SOURCE_DIR = ROOT_DIR.joinpath("delphi_epidata") +SOURCE_DIR = ROOT_DIR.joinpath("epidatpy") TOX_DIR = ROOT_DIR.joinpath(".tox") COVERAGE_FILE = ROOT_DIR.joinpath(".coverage") COVERAGE_DIR = ROOT_DIR.joinpath("htmlcov") diff --git a/tests/test_constants.py b/tests/test_constants.py index 4fe1aae..51fc325 100644 --- a/tests/test_constants.py +++ b/tests/test_constants.py @@ -1,4 +1,4 @@ -from delphi_epidata import __version__ +from epidatpy import __version__ def test_version() -> None: diff --git a/tests/test_model.py b/tests/test_model.py index 6835e5c..a8412cd 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -1,4 +1,4 @@ -from delphi_epidata._model import EpiRange, format_item, format_list +from epidatpy._model import EpiRange, format_item, format_list def test_epirange() -> None: From d234abf5d2abca793763e31c560abce104a731b2 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Fri, 5 Aug 2022 17:17:33 -0700 Subject: [PATCH 2/4] Add instructions to install the pre-rename package to README --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e8e2f5..2891e48 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,13 @@ pip install epidatpy latest version ```sh -pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git" +``` + +old name version + +```sh +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git@delphi_epidata-before-rename" ``` ## Usage From 23d2c6ef5369f4f38496993334c7f3f7d73f5b36 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Tue, 9 Aug 2022 16:50:31 -0700 Subject: [PATCH 3/4] Update README and a few docs * install command updated with #egg param * fixed package references in index.rst --- README.md | 12 ++++++------ docs/index.rst | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2891e48..9f45ddb 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ pip install epidatpy latest version ```sh -pip install -e "git+https://github.com/cmu-delphi/epidatpy.git" +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git#egg=epidatpy" ``` old name version ```sh -pip install -e "git+https://github.com/cmu-delphi/epidatpy.git@delphi_epidata-before-rename" +pip install -e "git+https://github.com/cmu-delphi/epidatpy.git@delphi_epidata-before-rename#egg=delphi_epidata" ``` ## Usage @@ -67,7 +67,7 @@ The release consists of multiple steps which can be all done via the GitHub webs [mit-url]: https://opensource.org/licenses/MIT [github-actions-image]: https://github.com/cmu-delphi/epidatpy/workflows/ci/badge.svg [github-actions-url]: https://github.com/cmu-delphi/epidatpy/actions -[pypi-image]: https://img.shields.io/pypi/v/delphi-epidata -[pypi-url]: https://pypi.python.org/pypi/delphi-epidata/ -[docs-image]: https://readthedocs.org/projects/delphi-epidata/badge/?version=latest -[docs-url]: https://delphi-epidata.readthedocs.io/en/latest/?badge=latest +[pypi-image]: https://img.shields.io/pypi/v/epidatpy +[pypi-url]: https://pypi.python.org/pypi/epidatpy/ +[docs-image]: https://readthedocs.org/projects/epidatpy/badge/?version=latest +[docs-url]: https://epidatpy.readthedocs.io/en/latest/?badge=latest diff --git a/docs/index.rst b/docs/index.rst index cc56da1..4bf1119 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -7,7 +7,7 @@ the `Delphi group `_ at `Carnegie Mellon University `_. The package source code and bug tracker can be found `on GitHub -`_. +`_. .. note :: **You should consider subscribing** to the `API mailing list @@ -29,12 +29,12 @@ Installation ------------ This package is available on PyPI as `covidcast -`_, and can be installed using ``pip`` or +`_, and can be installed using ``pip`` or your favorite Python package manager: .. code-block:: sh - pip install delphi-epidata + pip install epidatpy The package requires `pandas `_ and `requests `_; these should be installed From 811434f1e9b4da36c467ad4e8ed64bbc0a81d70d Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Wed, 10 Aug 2022 10:57:30 -0700 Subject: [PATCH 4/4] Fix broken API link in index.rst --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 4bf1119..6fc903c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2,7 +2,7 @@ Delphi Epi Data =============== This package provides Python access to the `Delphi Epidata API -`_ published by +`_ published by the `Delphi group `_ at `Carnegie Mellon University `_.