Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
fb4c5ab
feat: new CLI with `cdxt index` and `cdxt repackage`
malteos Oct 8, 2026
45dbc85
docs: document the new CLI and add a migration guide
malteos Oct 8, 2026
316e96e
fix: CI on Windows and in the minimal job, test the untested paths
malteos Oct 9, 2026
1293f6f
feat: Common Crawl's recommended AWS settings as defaults for S3 requ…
malteos Oct 10, 2026
ab5e323
feat: use the AWS defaults for Athena and DuckDB too
malteos Oct 10, 2026
45051fa
fix: abort the output file when writing fails, stop the pipeline cleanly
malteos Oct 12, 2026
72975f8
fix: cdxt repackage exits with status 1 when captures could not be fe…
malteos Oct 12, 2026
a1833af
fix: validate range responses before writing them to the WARC
malteos Oct 12, 2026
2156bff
fix: read full s3:// and hf:// filenames with the reader of their scheme
malteos Oct 12, 2026
df43f6b
fix: SQL results without a url column work unless --url-fgrep is used
malteos Oct 12, 2026
fc5bfc7
fix: CSV, TSV and Parquet output keep fields that only later captures…
malteos Oct 12, 2026
05a90e4
fix: SQL --domain matches a subdomain selector and its subdomains
malteos Oct 12, 2026
4c122f2
fix: overlapping CDX API selectors return each capture once
malteos Oct 12, 2026
4a6c2ce
fix: --limit applies before the URL filters for CDX files, --count is…
malteos Oct 12, 2026
a418826
fix: HTTP range reads of parallel readers run concurrently
malteos Oct 12, 2026
39ec559
fix: explicit AWS settings win over the defaults: AWS_REGION and retr…
malteos Oct 12, 2026
81b7598
fix: SQL --to includes the fractions of its last second
malteos Oct 12, 2026
8488edd
fix: WARC files staged for hf:// (and other non-S3 remote) output nam…
malteos Oct 12, 2026
6a592e7
refactor: SQL query building and execution move to indexes, repackage…
malteos Oct 12, 2026
3a27999
test: replace repetitive writer tests with behaviour tests, cover the…
malteos Oct 12, 2026
de4313a
test: skip the S3 client test without aioboto3 (minimal install)
malteos Oct 12, 2026
89178ff
test: requires_aioboto3 decorator instead of importorskip, like requi…
malteos Oct 12, 2026
92ebc03
test: no remote requests by default: mock data.commoncrawl.org, S3 (m…
malteos Oct 12, 2026
0e7059e
chore: CDXT_ prefix for all of cdx_toolkit's environment variables
malteos Oct 12, 2026
5bfdbbb
fix: file names of local paths on Windows (warcinfo WARC-Filename, on…
malteos Oct 12, 2026
3c9cbac
test: spawn the worker processes of the mocked S3 test (a forkserver …
malteos Oct 12, 2026
de2b3de
ci: AWS login only in the slow CI, which runs the live tests
malteos Oct 12, 2026
8c3cd9d
fix(repackage): a WARC file that cannot be closed is removed (final f…
malteos Oct 12, 2026
b8496ef
fix(repackage): reject a prefix whose WARC series exists already (no …
malteos Oct 12, 2026
6c47ca8
fix(index): exact --hostname for CDX files (www.), case-insensitive -…
malteos Oct 12, 2026
388a528
fix(repackage): worker processes keep the order of their shard (--no-…
malteos Oct 12, 2026
f7db9b0
fix(cli): --processes and --parallel-readers must be positive (0 read…
malteos Oct 12, 2026
b637924
fix(repackage): S3 range reads retry the whole transfer (also reading…
malteos Oct 12, 2026
8ab38bb
fix(repackage): cancelled HTTP range reads do not wait for their thre…
malteos Oct 12, 2026
84822d4
refactor(repackage): one writer life cycle (start_file aborts, close …
malteos Oct 12, 2026
a268587
refactor(index): DuckDB loads httpfs/aws and AWS credentials only for…
malteos Oct 12, 2026
26727d7
test: check AWS access when a live test runs, not when the tests are …
malteos Oct 12, 2026
ef6d7da
docs: changelog: cdxt repackage does not overwrite an existing series
malteos Oct 12, 2026
20a1fd4
fix(repackage): --wb also rejects existing WARC files of the prefix (…
malteos Oct 12, 2026
6962d20
refactor(index): move the backends to cdx_toolkit.indexes.backends (o…
malteos Oct 13, 2026
8380740
refactor(index): every backend turns the query into a plan (plan(), s…
malteos Oct 13, 2026
ca39e47
refactor(index): AthenaLocation and AthenaClient
malteos Oct 13, 2026
11fcacf
refactor(repackage): readers/ and writers/ packages, jobs.py, urls.py…
malteos Oct 13, 2026
ac15294
refactor(repackage): RangeReader per storage (HTTP, S3, HF); RangeJob…
malteos Oct 13, 2026
0b66613
refactor(repackage): OutputFile base class; WarcFileSeries owns numbe…
malteos Oct 13, 2026
ebb2631
refactor(repackage): WARCFilter is only the pipeline; ThroughputTrack…
malteos Oct 13, 2026
57b6dc3
refactor(myrequests): HostRateLimiter for the minimum interval betwee…
malteos Oct 13, 2026
0825739
fix(myrequests): a DNS error is only fatal for hosts not seen before
malteos Oct 13, 2026
4c2d61e
refactor(repackage): WARCFilter in pipeline.py → Repackager in repack…
malteos Oct 13, 2026
33f4f7a
refactor(indexes): open_index(); records(), count() and explain() val…
malteos Oct 13, 2026
9976318
refactor(repackage): --wb replays through the Repackager and WarcFile…
malteos Oct 13, 2026
e7c9677
feat(repackage): repackage() function; cdxt repackage calls it
malteos Oct 13, 2026
03ed061
deprecate CDXToolkitWARCWriter; document the Python API of index and …
malteos Oct 13, 2026
f21cad6
fix(repackage): --wb checks the captures: url, timestamp and status a…
malteos Oct 13, 2026
0b9bbf7
fix(repackage): a writer stopped by a failing source logs that it sto…
malteos Oct 13, 2026
471d818
fix(indexes): an --filter the Internet Archive does not support is a …
malteos Oct 14, 2026
857aa6d
docs(readme): fix default limits, --count for CDX files and stale not…
malteos Oct 15, 2026
c087091
refactor(cli): --index-backend cdx-api|cdx-files|duckdb|athena replac…
malteos Oct 15, 2026
116df2b
test: name the open_index() backend tests after open_index
malteos Oct 15, 2026
f2bc3c7
docs: settings.md with the AWS settings and the rate limits and retri…
malteos Oct 15, 2026
8d69363
reorganized settings.md
malteos Oct 15, 2026
35ea715
removed notes file (moved to cdxt benchmark repo)
malteos Oct 15, 2026
f6b3d0c
test: CDXT_LIVE_TESTS=http,s3,athena,hf selects the services to test …
malteos Oct 15, 2026
4f004d0
perf(indexes): SQL host selectors use url_host_name_reversed, which f…
malteos Oct 15, 2026
9b6fad6
test: the Athena access check no longer simulates the IAM policy of a…
malteos Oct 15, 2026
e253aa7
ci: CI-slow also runs the HTTP requests live (CDXT_LIVE_TESTS=http,s3…
malteos Oct 15, 2026
2cbe210
test: the tests that can run live are marked live and live_<service> …
malteos Oct 15, 2026
329478d
docs: usage guides for HTTP, AWS (Athena, S3) and Hugging Face, linke…
malteos Oct 15, 2026
30067d9
fix(index): refuse an output that overwrites an input; one output per…
malteos Oct 15, 2026
ad15f4a
fix(indexes): URL prefixes keep a trailing / or ? as a boundary; host…
malteos Oct 15, 2026
be68d86
fix(cdx-api): --hostname selects exactly the host
malteos Oct 15, 2026
7fae406
fix(repackage): a blocked source no longer delays the writer's error …
malteos Oct 15, 2026
38974bb
fix(repackage): a failing process stops the other processes at once
malteos Oct 15, 2026
42db6fc
fix: the worker processes of cdxt index (one output per CDX file) use…
malteos Oct 15, 2026
8283da1
fix(myrequests): every attempt, also a retry, takes its turn in the p…
malteos Oct 15, 2026
cc2902b
fix(hf): require huggingface_hub>=1.7.2 for Storage Buckets, with a c…
malteos Oct 15, 2026
e61b1a2
fix(indexes): --cc-mirror and --cc-sort are rejected for other indexe…
malteos Oct 15, 2026
aecab0a
fix(indexes): --from, --to and --closest are validated as dates by ev…
malteos Oct 15, 2026
ac9ce04
docs: quote the extras in install commands (zsh treats cdx_toolkit[s3…
malteos Oct 15, 2026
4716df1
docs: examples/homepages.sql, the --sql query of the examples
malteos Oct 15, 2026
e7ebbcc
refactor(repackage): one formatter of the WARC file names; current do…
malteos Oct 15, 2026
35683a2
fix(myrequests): retry when the CDX index server answers with a conne…
malteos Oct 15, 2026
55c7add
fix(repackage): Ctrl-C on Python < 3.11 and exit with a blocked stdin…
malteos Oct 15, 2026
f3377dd
fix(cli): exit without finalization only for the source thread of thi…
malteos Oct 15, 2026
b51aaf4
test: the rate limiter test checks the reserved turns, not measured s…
malteos Oct 15, 2026
9e96e67
test: the stdin subprocess tests do not pipe stderr without reading it
malteos Oct 15, 2026
c9c68ba
fix(cli): remove the exit without finalization for a blocked source t…
malteos Oct 15, 2026
e2ff0d7
Keep the 0.9.39 cdxt command lines working (deprecated) (#80)
malteos Oct 16, 2026
721fd4c
docs: get_writer() will be removed in a future version
malteos Oct 16, 2026
b27e7c3
docs: --crawl with SQL indexes, Parquet output, TEST prefix of the ol…
malteos Oct 16, 2026
92c76e6
docs: repository URLs of commoncrawl/cdx_toolkit; CHANGELOG entry of …
malteos Oct 16, 2026
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: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# test fixtures are compared byte for byte (e.g. WARC payload digests): no line-ending conversion
tests/data/** -text
19 changes: 18 additions & 1 deletion .github/workflows/ci-slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ name: CI-slow

on: workflow_dispatch

# live tests (CDXT_LIVE_TESTS=http,s3,athena,hf): the HTTP requests to the CDX APIs and data.commoncrawl.org, S3,
# Athena and DuckDB against AWS, and the Hugging Face Storage Buckets (HF_TOKEN: writes to
# hf://buckets/commoncrawl/commoncrawl-ci-temp). The permissions are needed to get AWS credentials via GitHub's OIDC
# token endpoint
permissions:
id-token: write
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# 'queue: max' ensures old runs finish in order instead of being canceled
Expand Down Expand Up @@ -42,8 +50,17 @@ jobs:
pip install setuptools

- name: Install cdx_toolkit
run: pip install .[test]
run: pip install ".[all]"

- name: Configure AWS credentials from OIDC
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::837454214164:role/GitHubActions-Role
aws-region: us-east-1

- name: Run tests
env:
CDXT_LIVE_TESTS: 'http,s3,athena,hf'
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
make test_coverage
28 changes: 6 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ on:
branches:
- main

# These permissions are needed to interact with AWS S3 via GitHub's OIDC Token endpoint
# the tests make no remote requests (they are mocked); the live tests run in ci-slow.yaml
permissions:
id-token: write
contents: read
pull-requests: read

Expand Down Expand Up @@ -39,7 +38,7 @@ jobs:
- python-version: '3.14'
os: ubuntu-latest
env:
LOGLEVEL=DEBUG
CDXT_LOGLEVEL=DEBUG
EXTRA: true
- python-version: '3.14'
os: macos-latest
Expand Down Expand Up @@ -68,21 +67,8 @@ jobs:
pip install setuptools

- name: Install cdx_toolkit
run: pip install .[all]
run: pip install ".[all]"

- name: Configure AWS credentials from OIDC (disabled for forks)
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::837454214164:role/GitHubActions-Role
aws-region: us-east-1

- name: Disable S3 unit tests for Python 3.8 (botocore requires Python 3.9+)
if: ${{ startsWith(matrix.python-version, '3.8') }}
uses: actions/github-script@v9
with:
script: |
core.exportVariable('CDXT_DISABLE_S3_TESTS', '1')
- name: Set environment variables for faster unit tests (requests are mocked)
uses: actions/github-script@v9
with:
Expand All @@ -93,8 +79,7 @@ jobs:
core.exportVariable('CDXT_CC_INDEX_MIN_RETRY_INTERVAL', '0.01')
core.exportVariable('CDXT_CC_DATA_MIN_RETRY_INTERVAL', '0.01')
core.exportVariable('CDXT_IA_MIN_RETRY_INTERVAL', '0.01')
core.exportVariable('DISABLE_ATHENA_TESTS', '1')
core.exportVariable('LOGLEVEL', 'DEBUG')
core.exportVariable('CDXT_LOGLEVEL', 'DEBUG')

- name: Lint code
run: |
Expand Down Expand Up @@ -140,7 +125,7 @@ jobs:
pip install setuptools

- name: Install cdx_toolkit (minimal)
run: pip install .[test]
run: pip install ".[test]"

- name: Set environment variables for faster unit tests (requests are mocked)
uses: actions/github-script@v9
Expand All @@ -152,8 +137,7 @@ jobs:
core.exportVariable('CDXT_CC_INDEX_MIN_RETRY_INTERVAL', '0.01')
core.exportVariable('CDXT_CC_DATA_MIN_RETRY_INTERVAL', '0.01')
core.exportVariable('CDXT_IA_MIN_RETRY_INTERVAL', '0.01')
core.exportVariable('DISABLE_ATHENA_TESTS', '1')
core.exportVariable('LOGLEVEL', 'DEBUG')
core.exportVariable('CDXT_LOGLEVEL', 'DEBUG')

- name: test minimal
run: |
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ matrix:
arch: s390x # unreliable in travis
include:
- python: 3.5
env: LOGLEVEL=DEBUG # same time as normal
env: CDXT_LOGLEVEL=DEBUG # same time as normal
- python: 3.8
arch: arm64 # 50% extra runtime
- python: 3.8
Expand Down
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
- unreleased
+ new command line interface: `cdxt index` and `cdxt repackage` (see README)
+ the command lines of 0.9.39 (`cdxt --cc iter URL`, `size`, `warc`) are deprecated (to be removed in a future version): they run
with the new code and print a suggested new command line; `iter` output, `--get` and `size --details` are kept;
`warc` writes `TEST-001.warc.gz` (was `TEST-000000.extracted.warc.gz`) with the records copied byte-for-byte
(no `WARC-Source-URI`/`WARC-Source-Range` headers), no file without captures, and exits with status 1 if
captures could not be fetched; `iter --all-fields --csv` is a usage error (was a traceback)
+ `cdxt index`: `--hostname`, `--domain`, repeatable `--url`, `-o/--output` (local or remote),
JSONL/CDXJ/CSV/TSV output, all fields by default, `--count` replaces `size`
+ `cdxt repackage`: reads captures from a file or stdin, human-readable `--size`, `--is-part-of`, `--description`
+ `--cc-sort` is now passed on to the CDX fetcher
+ the log level variable is `CDXT_LOGLEVEL` (`LOGLEVEL` still works), like cdx_toolkit's other environment variables
+ `cdxt index` queries Common Crawl's columnar URL index with DuckDB (`cc-url-index-s3`, `cc-url-index-hf`, `*.parquet`)
or AWS Athena (`athena://...`): `--hostname`/`--domain`/`--crawl`/`--limit` or your own `--sql`, cost confirmation (`--yes`), `--dry-run`;
`--index-backend cdx-api|cdx-files|duckdb|athena` overrides the backend detected from INDEX
+ `cdxt repackage` copies WARC records byte-for-byte with the async WARC fetcher (from the feat/warc-range-sources branch):
reads from https://, s3:// and hf:// (Hugging Face Storage Buckets), writes to local, s3:// or hf://,
`--processes`, `--parallel-readers`, `--add-metadata-record`, glob input; output files are now named `<prefix>-001.warc.gz`
(`--wb` wayback replays too, which now work with `--parallel-readers` and `--add-metadata-record`); with
`--processes`, the processes share one file counter
and write the final file names directly, so each `warcinfo` record names its own file
+ `hf://` WARC reads resolve each WARC file once and read its records from the signed CDN URL
(one HF Resolvers rate-limit request per WARC file instead of per record)
+ `cdxt index` reads CDX files (local or remote, globs): `--url`/`--hostname`/`--domain`/`--url-file` matched as SURT
prefixes (`--url-file-type domain` for host lists), one output per CDX file for an `-o` path without extension
(a new or empty directory), `--processes`; `cdxt index` refuses an output that would overwrite its input
+ SQL indexes: `--url` patterns (matched against `url_surtkey`), `--from`/`--to` (fetch time), `--language` (primary content language, three-letter ISO 639-3 codes)
+ SQL indexes: `--hostname`, `--domain` and `--url` select by `url_host_name_reversed`, which follows the sort order
of the index, so DuckDB (and Athena) skip the row groups of other hosts by their min/max statistics; `--domain` no
longer reads `url_surtkey` (one Parquet file: 3 s instead of 87 s over S3)
+ `--output-format cdx` / `--input-format cdx` as another name for `cdxj`; clear error for globs over http(s)
+ Parquet output for `cdxt index` and Parquet input for `cdxt repackage` (`cdx_toolkit[parquet]`)
+ `cdxt repackage`: default `--prefix REPACKAGE` (was `TEST`), no WARC file is written without captures,
a full URL in `warc_filename`/`filename` is used as it is (the `warc_url` column is gone); stops (exit status 2)
if WARC files with the same prefix exist already, instead of overwriting them (also with `--wb`, which
numbered its files after the existing ones before)
+ fixed `--to` with a day (e.g. `--to 20240410`), which was padded to the end of the month, and February in leap years
+ `cdxt index ia --filter` with a filter the Internet Archive does not support (`=`, `~`, `!=`, `!~`) is a usage error
(exit status 2) before any request, instead of a traceback while the captures are read
+ fixed DNS errors of hosts that worked before: they are retried again (like connection errors) instead of failing at once
+ removed the deprecated `cdx_iter` and `cdx_size` scripts
+ S3 requests use Common Crawl's recommended AWS settings (us-east-1, adaptive retries, 100000 attempts, virtual
addressing, no payload signing, 2 concurrent requests) unless configured by the user; `CDXT_AWS_DEFAULTS=0` turns them off;
also for Athena and, as far as DuckDB has equivalents, for DuckDB (fixes DuckDB's `http_timeout`, which is in seconds)
+ `cdxt repackage --wb` checks the captures before replaying them: `url` (http/https), `timestamp` and `status`
are needed, and Common Crawl captures are refused (as `cdxt --cc warc` refused `--wb`)
+ Python API of the new commands: `cdx_toolkit.indexes.open_index()` with `IndexQuery` (`records()`, `count()`, `explain()`)
and `cdx_toolkit.repackage.repackage()`; `cdxt index` and `cdxt repackage` run the same code
+ deprecated `cdx_toolkit.warc.get_writer()` and `CDXToolkitWARCWriter` (FutureWarning): use `repackage()`
+ new extras: `athena`, `duckdb`, `hf` (`huggingface_hub>=1.7.2`, the first version whose `HfFileSystem` handles
Storage Buckets), `parquet`; `fsspec` and `aiofiles` are now required

- 0.9.39
+ `CDXToolkitWARCWriter` (`cdx_toolkit.warc.get_writer()`) supports the context manager protocol (`with ... as writer:`),
so the WARC file is closed, and an S3 upload committed, also on errors; `close()` still works (#70)
+ WARC files can be written to S3 (and other fsspec file systems); `cdx_toolkit[s3]` extra (#67)
+ settings are read from `CDXT_*` environment variables (`settings.py`), common CLI code moved to `utils.py`,
the CLI and the example close the WARC writer (#67)
+ weekly GitHub Action that checks Common Crawl's CDX index server (#60)
+ PyPI releases with a manually dispatched trusted-publisher workflow (#69)

- 0.9.38
+ deprecated support for py3.7 and py.3.8
+ added support for py3.13 and py3.14
Expand Down
37 changes: 32 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,46 @@ make test
make unit
```

By default, all remote requests are mocked. To change this behaviour and actually call remote APIs (if you run this from a whitelisted IP address), the following environment variable can be set:
By default, all remote requests are mocked: the CDX API and HTTP downloads are served from recorded data in `tests/data`, S3 is a local [moto](https://github.com/getmoto/moto) server (installed with `.[all]`; without it, the S3 tests are skipped), and the Hugging Face reads are faked. The mocked requests still wait for the per-host rate limits ([docs/settings.md](docs/settings.md)); the CI shortens them:

```bash
export DISABLE_MOCK_RESPONSES=1
export CDXT_DEFAULT_MIN_RETRY_INTERVAL=0.01 CDXT_CC_INDEX_MIN_RETRY_INTERVAL=0.01 \
CDXT_CC_DATA_MIN_RETRY_INTERVAL=0.01 CDXT_IA_MIN_RETRY_INTERVAL=0.01
```

To test services live instead, set `CDXT_LIVE_TESTS` to a comma-separated list of them, or `all` (unset the short intervals above, the live servers rate-limit):

| Service | Live tests |
|---|---|
| `http` | the CDX API (index.commoncrawl.org, web.archive.org) and HTTP downloads (data.commoncrawl.org); needs an allowed IP address |
| `s3` | the S3 tests against AWS, and DuckDB queries of Common Crawl's index on S3; needs AWS credentials |
| `athena` | the Athena queries; needs AWS credentials with Athena access |
| `hf` | `cdxt index cc-url-index-hf`, and `cdxt repackage` reading from `hf://buckets/commoncrawl/commoncrawl` and writing to `hf://buckets/commoncrawl/commoncrawl-ci-temp` (`CDXT_TEST_HF_BUCKET`); writing needs a Hugging Face token (`HF_TOKEN` or `hf auth login`) |

```bash
CDXT_LIVE_TESTS=s3,athena,hf make test
```

The tests that can run live are marked `live` and `live_<service>`, so `-m` selects only them:

```bash
CDXT_LIVE_TESTS=all pytest -m live tests # all live tests
CDXT_LIVE_TESTS=s3 pytest -m live_s3 tests # only the S3 tests
```

The marker only selects the tests; without the service in `CDXT_LIVE_TESTS`, they are skipped (`s3`, `athena`, `hf`) or run with mocked responses (`http`, and `s3` against moto).

The CI workflow of pull requests runs the mocked tests only; the `CI-slow` workflow (started manually) runs all live tests (`http,s3,athena,hf`) with AWS credentials and `HF_TOKEN`.

The WARC records that the `cdxt repackage` tests download (from `data.commoncrawl.org` or `s3://commoncrawl`) are recorded in `tests/data/repackage/warc_records.jsonl`, and DuckDB queries a small local index built from the same captures (the `local_url_index` fixture in `tests/conftest.py`).

If the remote APIs change, new mock data can be semi-automatically collected by setting another environment variable, running corresponding unit tests, and overwriting existing mock data in `tests/data/mock_responses`:

```bash
# set environment variable (DISABLE_MOCK_RESPONSES should not be set)
export SAVE_MOCK_RESPONSES=./tmp/mock_responses
# set environment variable (CDXT_LIVE_TESTS should not have http)
export CDXT_SAVE_MOCK_RESPONSES=./tmp/mock_responses

# run the test for what mock data should be saved to $SAVE_MOCK_RESPONSES/<test_file>/<test_func>.jsonl
# run the test for what mock data should be saved to $CDXT_SAVE_MOCK_RESPONSES/<test_file>/<test_func>.jsonl
pytest tests/test_cli.py::test_basics
```

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: init test clean_coverage test_coverage lint distclean distcheck dist install
.PHONY: init test example clean_coverage test_coverage lint distclean distcheck dist install

init36:
# packages are deprecating support, so this uses exact versions
Expand All @@ -12,6 +12,9 @@ unit:

test:
PYTHONPATH=. py.test --doctest-modules cdx_toolkit tests -v -v

# runs against the live Common Crawl index (not part of `test`: connections from CI runners time out)
example:
PYTHONPATH=. examples/iter-and-warc.py

clean_coverage:
Expand All @@ -20,7 +23,7 @@ clean_coverage:
test_coverage: clean_coverage
# PYTHONPATH=. coverage run -a --source=cdx_toolkit,examples examples/iter-and-warc.py
# -rA to see all output, pass or fail
# LOGLEVEL=DEBUG
# CDXT_LOGLEVEL=DEBUG
# -vvvv -s
PYTHONPATH=. py.test -rA -s --doctest-modules --cov-report=xml --cov-append --cov cdx_toolkit tests -v -v
coverage report
Expand Down
Loading
Loading