Skip to content

Commit 3de3b81

Browse files
authored
Merge pull request #275 from JedGrabman/dev-covidcast-efficiency
Batch requests when requesting multiple days of data
2 parents 0f124c2 + 2eab488 commit 3de3b81

File tree

15 files changed

+297
-108
lines changed

15 files changed

+297
-108
lines changed

.github/workflows/python_ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ jobs:
2626
python-version: ${{ matrix.python-version }}
2727
- name: Install dependencies
2828
run: |
29-
python -m pip install --upgrade pip
30-
pip install -r requirements_ci.txt
29+
make install-ci
3130
- name: Lint with pylint and mypy
3231
run: |
3332
make lint

Python-packages/covidcast-py/DEVELOP.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,21 @@ These are general recommendations for developing. They do not have to be strictl
1616
but are encouraged.
1717

1818
__Environment__
19-
- A virtual environment is recommended, which can be started with the following commands:
20-
21-
```sh
22-
python3 -m venv env
23-
source env/bin/activate
24-
```
25-
this will create an `env/` folder containing files required in the environment, which
26-
is gitignored. The environment can be deactived by running `deactivate`, and reactived by
27-
rerunning `source env/bin/activate`. To create a new environment, you can delete the
28-
`env/` folder and rerun the above commands if you do not require the old one anymore,
29-
or rerun the above command with a new environment name in place of `env`.
19+
- A virtual environment is recommended to install and develop this package. Run `make install` to generate a
20+
virtual environment and install the package in editable mode (code changes will automatically propagate). Note that
21+
editable mode may not reveal errors when packaging files, so if the CI (which does not use editable mode) is failing
22+
for reasons related to accessing data files, try debugging by installing without editable mode (`make install-ci`)
23+
- If you want to enter the virtual environment in your shell, you can run source env/bin/activate. Run deactivate
24+
to leave the virtual environment.
25+
- To remove the virtual environment, you can run `make clean` or remove the `env/` folder.
3026

3127
__Style__
32-
- Run `make lint` from `Python-packages/covidcast-py/` to run the lint commands.
28+
- Once your environment is set up, run `make lint` from `Python-packages/covidcast-py/` to run the lint commands.
3329
- `mypy`, `pylint`, and `pydocstyle` are used for linting, with associated configurations for
3430
`pylint` in `.pylintrc` and for `mypy` in `mypy.ini`.
3531

3632
__Testing__
37-
- Run `make test` from `Python-packages/covidcast-py/` to run the test commands.
33+
- Once your environment is set up, run `make test` from `Python-packages/covidcast-py/` to run the test commands.
3834
- `pytest` is the framework used in this package.
3935
- Each function should have corresponding unit tests.
4036
- Tests should be deterministic.
Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
1-
.PHONY = lint, test, install-requirements, build-and-install
1+
.PHONY = venv, install-ci, install, build, lint, test, clean
22

3-
install-requirements:
4-
pip install -r requirements_dev.txt
5-
pip install -r requirements_ci.txt
63

7-
build-and-install: install-requirements
4+
venv:
5+
python3 -m venv env
6+
7+
install-ci: venv
8+
. env/bin/activate; \
9+
python -m pip install --upgrade pip; \
10+
pip install -r requirements_dev.txt; \
11+
pip install .
12+
13+
install: venv
14+
. env/bin/activate; \
15+
python -m pip install --upgrade pip; \
16+
pip install -r requirements_dev.txt; \
17+
pip install -e .
18+
19+
build:
820
python3 setup.py clean
921
python3 setup.py sdist bdist_wheel
10-
pip3 install -e .
1122

1223
lint:
13-
pylint covidcast/ --rcfile .pylintrc
14-
mypy covidcast --config-file mypy.ini
24+
. env/bin/activate; \
25+
pylint covidcast/ --rcfile .pylintrc; \
26+
mypy covidcast --config-file mypy.ini; \
1527
pydocstyle covidcast/
1628

1729
test:
30+
. env/bin/activate; \
1831
pytest tests/ -W ignore::UserWarning
32+
33+
clean:
34+
rm -rf env

Python-packages/covidcast-py/requirements_ci.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
wheel
1+
mypy
2+
pylint
3+
pytest
4+
pydocstyle
25
sphinx
3-
sphinx-autodoc-typehints
6+
sphinx-autodoc-typehints
7+
wheel

Python-packages/covidcast-py/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
"imageio",
3232
"tqdm"
3333
],
34-
package_data={"covidcast": ["shapefiles/*", "geo_mappings/*"]}
34+
package_data={"covidcast": ["shapefiles/*/*", "geo_mappings/*"]}
3535
)

Python-packages/covidcast-py/tests/__init__.py

Whitespace-only changes.

Python-packages/covidcast-py/tests/covidcast/__init__.py

Whitespace-only changes.

Python-packages/covidcast-py/tests/covidcast/test_covidcast.py renamed to Python-packages/covidcast-py/tests/test_covidcast.py

File renamed without changes.

Python-packages/covidcast-py/tests/covidcast/test_geography.py renamed to Python-packages/covidcast-py/tests/test_geography.py

File renamed without changes.

0 commit comments

Comments
 (0)