LogoLogo
  • Home
  • PaperQA
  • Aviary
  • LDP (Language Decision Processes)
  • Platform API
  • PaperQA2
  • Contributing to PaperQA
  • docs
    • tutorials
      • PaperQA2 for Clinical Trials
      • Measuring PaperQA2 with LFRQA
      • settings_tutorial
      • Where to get papers
  • tests
    • stub_data
      • Gravity hill
Powered by GitBook
On this page
  • Setting up the development environment
  • Installing the package for development
  • Running tests and other tooling
  • Using pytest-recording and VCR cassettes
Export as PDF

Contributing to PaperQA

PreviousPaperQA2Nextdocs

Last updated 3 months ago

Thank you for your interest in contributing to PaperQA! Here are some guidelines to help you get started.

Setting up the development environment

We use for our local development.

  1. Install uv by following the instructions on the .

  2. Run the following command to install all dependencies and set up the development environment:

    uv sync

Installing the package for development

If you prefer to use pip for installing the package in development mode, you can do so by running:

pip install -e ".[dev]"

Where the dev extra includes development dependencies such as pytest.

Running tests and other tooling

Use the following commands:

  • Run tests (requires an OpenAI key in your environment)

    pytest
    # or for multiprocessing based parallelism
    pytest -n auto
  • Run pre-commit for formatting and type checking

    pre-commit run --all-files
  • Run mypy, refurb, or pylint directly:

    mypy paperqa
    # or
    refurb paperqa
    # or
    pylint paperqa

Using pytest-recording and VCR cassettes

To record a new VCR cassette:

uv run pytest --record-mode=once tests/desired_test_module.py

Please ensure cassettes are less than 1 MB to keep tests loading quickly.

Happy coding!

See our GitHub Actions for further reference.

We use the plugin to create VCR cassettes to cache HTTP requests, making our unit tests more deterministic.

And the new cassette(s) should appear in .

Our configuration for pytest-recording can be found in . This includes header removals (e.g. OpenAI authorization key) from responses to ensure sensitive information is excluded from the cassettes.

uv
uv website
tests.yml
pytest-recording
tests/cassettes
tests/conftest.py