Skip to content

Contributing to pyfredapi

Thank you for your interest in contributing to pyfredapi! There are many ways you can help:

  • Reporting a bug
  • Submitting a fix
  • Adding/Proposing new features

Report bugs

Report a bug by opening a new issue.

How to contribute to pyfredapi

Before contributing to pyfredapi it a good idea to create an issue to discuss the changes you would like to make. This will help ensure that your changes are accepted and merged into the project.

When you're ready contribute changes to pyfredapi, you will need to setup the project on your machine. The following steps will help you get started:

  1. Set your FRED API key as an environment variable. The pyfredapi tests require a FRED API key to run. You can set the API key as an environment variable by adding the following line to your ~/.zshrc, ~/.bashrc file:
export FRED_API_KEY="your_api_key"
  1. Fork the pyfredapi repo
  2. Clone your fork of the repo to your local machine
  3. Create a branch from main. Give your branch a descriptive name, e.g. add-foo-feature

Once you have completed the above steps, you need to setup your development environment. The pyfredapi project uses hatch to build and publish the pyfredapi package, so it a good idea to use hatch to setup your development environment.

  1. Follow the hatch install instructions.
  2. This step is a personal preference. Update the hatch config.toml to setup a python virtual environment in the project's directory. Follow the hatch config docs

  3. Create a virtual environment for the project and activate the environment

hatch env create
hatch shell
  1. Install the pyfredapi development dependencies
pip install '.[dev]'
  1. Setup pre-commit
pre-commit install
  1. Run the tests. Before making any changes it is a good to test that your environment is setup correctly. From the root of the project directory, run:

With pytest:

pytest tests/

With tox:

tox
  1. Make your changes. After making your changes:

    • Add or update tests
    • Add or update documentation
  2. Ensure the test and lint suites pass with tox. From the root of the project directory, run:

tox
  1. Ensure the documentation builds correctly. The documentation is built with sphinx. From the root of the project directory, run:

bash make html -C docs/

Then open the html docs with:

bash open docs/_build/html/index.html

  1. Submit a pull request (PR)