Skip to content
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
10 changes: 5 additions & 5 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
python_version: ["3.10", "3.11"]
python_version: ["3.10", "3.11", "3.12", "3.13"]

concurrency:
group: ci-tests-${{ matrix.python_version }}-${{ github.ref }}
Expand All @@ -24,13 +24,12 @@ jobs:

- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
mamba-version: "*"
miniforge-version: latest
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: pysus
use-mamba: true
miniforge-variant: Mambaforge
auto-update-conda: true
conda-solver: libmamba

- name: Run jupyterlab with PySUS
run: |
Expand All @@ -39,6 +38,7 @@ jobs:

- name: Linting & Tests
run: |
export CI=1
poetry install
pre-commit run --all-files
make test-pysus
7 changes: 3 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ jobs:

- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
mamba-version: "*"
miniforge-version: latest
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: pysus
use-mamba: true
miniforge-variant: Mambaforge
auto-update-conda: true
conda-solver: libmamba

- uses: actions/setup-node@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test-jupyter-pysus: ## run pytest for notebooks inside jupyter container

.PHONY: test-pysus
test-pysus: ## run tests quickly with the default Python
poetry run pytest -vv pysus/tests/
poetry run pytest -vv pysus/tests/ --retries 3 --retry-delay 15

# RELEASE
# =======
Expand Down
20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,26 +138,6 @@ datetime.date(2016, 4, 1)

```

**Reading `.dbc` file:**

```python
>>> from pysus.utilities.readdbc import read_dbc

>>> df = read_dbc(filename, encoding='iso-8859-1')
>>> df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1239 entries, 0 to 1238
Data columns (total 58 columns):
AP_MVM 1239 non-null object
AP_CONDIC 1239 non-null object
AP_GESTAO 1239 non-null object
AP_CODUNI 1239 non-null object
AP_AUTORIZ 1239 non-null object
AP_CMP 1239 non-null object
AP_PRIPAL 1239 non-null object
AP_VL_AP 1239 non-null float64
...
```
Downloading and reading SINASC data:

```python
Expand Down
7 changes: 2 additions & 5 deletions conda/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ channels:
- defaults
dependencies:
- docker-compose
- python >=3.10,<3.12
- numpy>=1.26.2
- cffi
- gcc
- python>=3.10,<3.14
- jupyter
- make
- poetry>=1.3.2
- poetry
- pip
1 change: 1 addition & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
privileged: true
environment:
- DISPLAY=:0
- CI=${CI:-0}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
entrypoint: ["/entrypoint.sh"]
Expand Down
571 changes: 427 additions & 144 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ license = "GPL"
packages = [{include='pysus'}]

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
python = ">=3.10,<3.14"
python-dateutil = "2.8.2"
cffi = "1.15.1"
dbfread = "2.0.7"
fastparquet = ">=2023.10.1"
numpy = "1.26.2"
fastparquet = ">=2023.10.1,<=2024.11.0"
numpy = ">1,<3"
pyarrow = ">=11.0.0"
pycparser = "2.21"
pyreaddbc = ">=1.1.0"
Expand All @@ -39,6 +38,7 @@ isort = "^5.10.1"
pre-commit = "^2.20.0"
pytest-timeout = "^2.1.0"
nbsphinx = "^0.9.3"
pytest-retry = "1.7.0"

[tool.poetry.group.docs.dependencies]
sphinx = "^5.1.1"
Expand Down
2 changes: 0 additions & 2 deletions pysus/online_data/vaccine.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ def elasticsearch_fetch(uri, auth, json_body={}):
print(resp)
total += len(resp["hits"]["hits"])
print(f"Downloaded {total} records\r", end="")
# print(resp)
# print(uri)
yield [h["_source"] for h in resp["hits"]["hits"]]
if "_scroll_id" in resp:
scroll_id = resp["_scroll_id"]
Expand Down
6 changes: 3 additions & 3 deletions pysus/tests/test_data/test_vaccine.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest

import pandas as pd
Expand All @@ -6,10 +7,9 @@


class VaccineTestCase(unittest.TestCase):
pytest.mark.timeout(5)

@pytest.mark.timeout(15)
@unittest.skipIf(os.getenv("CI"), "Forbidden on CI")
def test_Download(self):
"""Careful! this download can take a long time"""
df = download_covid("BA", only_header=True)
self.assertIsInstance(df, pd.DataFrame)
self.assertEqual(df.shape, (10000, 42))
Expand Down
6 changes: 2 additions & 4 deletions pysus/tests/test_ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ def _test_database(testcase: unittest.TestCase, database: Database):
set(["description", "long_name", "source"]) == set(database.metadata)
)

downloaded_file = (
database.download(database.files[0])
if database.files[0].extension != ".zip"
else database.download(database.files[-1])
downloaded_file = database.download(
[f for f in database.files if ".zip" not in f.basename][0]
)
testcase.assertTrue(isinstance(downloaded_file, ParquetSet))
testcase.assertTrue(Path(downloaded_file.path).exists())
Expand Down
2 changes: 1 addition & 1 deletion pysus/tests/test_ibge.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_get_population(self):
self.assertEqual(len(l1), 5570)
l2 = IBGE.get_population(year=2012, source="projpop")
self.assertEqual(type(l2), pd.DataFrame)
self.assertEqual(len(l2), 182)
self.assertEqual(len(l2), 4914)


if __name__ == "__main__":
Expand Down
Loading