dbt-codegen
is open source software. It is what it is today because community members have opened issues, provided feedback, and contributed to the knowledge loop. Whether you are a seasoned open source contributor or a first-time committer, we welcome and encourage you to contribute code, documentation, ideas, or problem statements to this project.
Remember: all PRs (apart from cosmetic fixes like typos) should be associated with an issue.
- About this document
- Getting the code
- Setting up an environment
- Implementation guidelines
- Testing dbt-codegen
- Adding CHANGELOG Entry
- Submitting a Pull Request
There are many ways to contribute to the ongoing development of dbt-codegen
, such as by participating in discussions and issues. We encourage you to first read our higher-level document: "Expectations for Open Source Contributors".
The rest of this document serves as a more granular guide for contributing code changes to dbt-codegen
(this repository). It is not intended as a guide for using dbt-codegen
, and some pieces assume a level of familiarity with Python development (virtualenvs, pip
, etc). Specific code snippets in this guide assume you are using macOS or Linux and are comfortable with the command line.
- CLA: Please note that anyone contributing code to
dbt-codegen
must sign the Contributor License Agreement. If you are unable to sign the CLA, thedbt-codegen
maintainers will unfortunately be unable to merge any of your Pull Requests. We welcome you to participate in discussions, open issues, and comment on existing ones. - Branches: All pull requests from community contributors should target the
main
branch (default). If the change is needed as a patch for a version ofdbt-codegen
that has already been released (or is already a release candidate), a maintainer will backport the changes in your PR to the relevant branch.
You will need git
in order to download and modify the dbt-codegen
source code. On macOS, the best way to download git is to just install Xcode.
If you are not a member of the dbt-labs
GitHub organization, you can contribute to dbt-codegen
by forking the dbt-codegen
repository. For a detailed overview on forking, check out the GitHub docs on forking. In short, you will need to:
- Fork the
dbt-codegen
repository - Clone your fork locally
- Check out a new branch for your proposed changes
- Push changes to your fork
- Open a pull request against
dbt-labs/dbt-codegen
from your forked repository
If you are a member of the dbt-labs
GitHub organization, you will have push access to the dbt-codegen
repo. Rather than forking dbt-codegen
to make your changes, just clone the repository, check out a new branch, and push directly to that branch.
There are some tools that will be helpful to you in developing locally. While this is the list relevant for dbt-codegen
development, many of these tools are used commonly across open-source python projects.
These are the tools used in dbt-codegen
development and testing:
make
to run multiple setup or test steps in combination. Don't worry too much, nobody really understands howmake
works, and our Makefile aims to be super simple.- CircleCI for automating tests and checks, once a PR is pushed to the
dbt-codegen
repository
A deep understanding of these tools in not required to effectively contribute to dbt-codegen
, but we recommend checking out the attached documentation if you're interested in learning more about each one.
Once you're able to manually test that your code change is working as expected, it's important to run existing automated tests, as well as adding some new ones. These tests will ensure that:
- Your code changes do not unexpectedly break other established functionality
- Your code changes can handle all known edge cases
- The functionality you're adding will keep working in the future
See here for details for running existing integration tests and adding new ones:
Unlike dbt-core
, we edit the CHANGELOG.md
directly.
You don't need to worry about which dbt-codegen
version your change will go into. Just create the changelog entry at the top of CHANGELOG.md and open your PR against the main
branch. All merged changes will be included in the next minor version of dbt-codegen
. The maintainers may choose to "backport" specific changes in order to patch older minor versions. In that case, a maintainer will take care of that backport after merging your PR, before releasing the new version of dbt-codegen
.
A dbt-codegen
maintainer will review your PR. They may suggest code revision for style or clarity, or request that you add unit or integration test(s). These are good things! We believe that, with a little bit of help, anyone can contribute high-quality code.
Automated tests run via CircleCI. If you're a first-time contributor, all tests (including code checks and unit tests) will require a maintainer to approve. Changes in the dbt-codegen
repository trigger integration tests.
Once all tests are passing and your PR has been approved, a dbt-codegen
maintainer will merge your changes into the active development branch. And that's it! Happy developing 🎉