Skip to main content

pr-imports

Python package that downloads and processes Puerto Rico international trade data from the Puerto Rico Institute of Statistics (IEPR) and the U.S. Census API. Data is cleaned with Polars and stored as Parquet partitions (data/raw/<source>/<year>/<month>/) with change history, and queried with DuckDB. A PostgreSQL/TimescaleDB database (SQLModel + Alembic) holds the HTS code catalog.

Testing

Requirements

Run uv sync (or enter devenv shell). This installs pytest and pytest-cov as dev dependencies.

Layout

tests/
├── conftest.py                    # shared fixtures (incl. autouse block_network)
├── unit/
│   ├── test_smoke.py              # basic import/sanity checks
│   ├── test_fixtures.py           # checks that the shared fixtures behave
│   ├── test_partition_df.py       # tests for the partition_df logic
│   └── test_schema_contracts.py   # schema/column contract checks
└── integration/                   # empty for now (see below)

Commands

uv run pytest                                  # full suite
uv run pytest -m unit                          # unit tests only
uv run pytest tests/unit/test_smoke.py         # one file
uv run pytest tests/unit/test_partition_df.py::TestModifiedRecord::test_old_version_marked_removed_and_new_active   # one test
uv run pytest --cov --cov-report=term-missing  # with coverage

devenv shortcuts (extra arguments are forwarded to pytest):

test        # uv run pytest
test-unit   # uv run pytest -m unit
test-cov    # uv run pytest --cov --cov-report=term-missing

Coverage is opt-in (it is not in addopts) so the normal run stays fast.

Known bugs (xfail)

Known bugs are documented as tests marked xfail(strict=True): the test is expected to fail. Show them with:

uv run pytest -rx

When a bug gets fixed, its test reports XPASS(strict) and the run fails. That is the signal to remove the xfail marker so the test becomes a normal regression test.

Integration tests

There are none yet. They will require TimescaleDB and declared DB dependencies (sqlmodel, alembic, a driver), which is pending a maintainer decision.

Test isolation

Tests write only to pytest's tmp_path, and the network is blocked by the autouse fixture block_network.

Metadata

Release files for pr-imports 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pr-imports 0.5.0
File Size Uploaded Provenance Actions
pr_imports-0.5.0.tar.gz 241.1 kB Without provenance Details for pr_imports-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pr-imports 0.5.0
File Interpreter ABI Platform Actions
pr_imports-0.5.0-py3-none-any.whl Python 3 none any Details for pr_imports-0.5.0-py3-none-any.whl

Total release size: 251.3 kB

Release files / pr_imports-0.5.0.tar.gz

Download URL pr_imports-0.5.0.tar.gz
Size 241.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b557acfdf6f0eb0be41af2d3cbd7b20bdbbd383d9ef2bddebce6942cdc3d9f08
BLAKE2b-256 checksum
How to use checksums
543d2c797da2cd77d9e54b15da7a7a7c61cd6f3bd1f35fdaee1bdb23ff56e917
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pr_imports-0.5.0-py3-none-any.whl

Download URL pr_imports-0.5.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcdfffba313e2f8b8a69be83639262931bbfc10249355921628920973f9b6257
BLAKE2b-256 checksum
How to use checksums
5e66810eda61cf5da58ee02d20395033fa1e9ab8ea84989fe72fdb9865dfab82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pr-imports 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page