Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 1.77 KB

File metadata and controls

69 lines (45 loc) · 1.77 KB

Contributing to cdx_toolkit

We welcome contributions to cdx_toolkit! Whether you're adding new features, improving documentation, or fixing bugs, your help is greatly appreciated.

Local installation

Clone the repository, setup a virtual environment, and run the following command:

make install

For S3-related features or tests, install optional dependencies:

pip install -e ".[s3]"

To install everything (dev/test/S3), use:

pip install -e ".[all]"

Tests

To test code changes, please run our test suite before submitting pull requests:

# all tests (same as CI)
make test

# simple unit tests without integration tests
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:

export DISABLE_MOCK_RESPONSES=1

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:

# set environment variable (DISABLE_MOCK_RESPONSES should not be set)
export 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
pytest tests/test_cli.py::test_basics

Code format & linting

Please following the definitions from .editorconfig and .flake8.

To test the linting, run this command:

make lint

To automatically run the linting on every commit, you can use the pre-commit hooks (automatically installed via make install).

You can also run the hooks manually on all files:

pre-commit run --all-files