Skip to content

Commit 14b56b8

Browse files
authored
Stand-alone guide to contributing (#574)
* Stand-alone guide to contributing * Update changelog * Include the best Slack channel name to use to reach out
1 parent 9d93773 commit 14b56b8

File tree

3 files changed

+93
-2
lines changed

3 files changed

+93
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Quality of life
44
- Documentation about listagg macro ([#544](https://github.com/dbt-labs/dbt-utils/issues/544), [#560](https://github.com/dbt-labs/dbt-utils/pull/560))
55
- Fix links to macro section in table of contents ([#555](https://github.com/dbt-labs/dbt-utils/pull/555))
6+
- Contributing guide ([#574](https://github.com/dbt-labs/dbt-utils/pull/574))
67

78
## Under the hood
89
- Fail integration tests appropriately ([#540](https://github.com/dbt-labs/dbt-utils/issues/540), [#545](https://github.com/dbt-labs/dbt-utils/pull/545))

CONTRIBUTING.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Contributing to `dbt-utils`
2+
3+
`dbt-utils` is open source software. It is what it is today because community members have opened issues, provided feedback, and [contributed to the knowledge loop](https://www.getdbt.com/dbt-labs/values/). 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.
4+
5+
1. [About this document](#about-this-document)
6+
2. [Getting the code](#getting-the-code)
7+
3. [Setting up an environment](#setting-up-an-environment)
8+
4. [Testing dbt-utils](#testing)
9+
5. [Adding CHANGELOG Entry](#adding-changelog-entry)
10+
6. [Submitting a Pull Request](#submitting-a-pull-request)
11+
12+
## About this document
13+
14+
There are many ways to contribute to the ongoing development of `dbt-utils`, such as by participating in discussions and issues. We encourage you to first read our higher-level document: ["Expectations for Open Source Contributors"](https://docs.getdbt.com/docs/contributing/oss-expectations).
15+
16+
The rest of this document serves as a more granular guide for contributing code changes to `dbt-utils` (this repository). It is not intended as a guide for using `dbt-utils`, 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.
17+
18+
### Notes
19+
20+
- **CLA:** Please note that anyone contributing code to `dbt-utils` must sign the [Contributor License Agreement](https://docs.getdbt.com/docs/contributor-license-agreements). If you are unable to sign the CLA, the `dbt-utils` 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.
21+
- **Branches:** All pull requests from community contributors should target the `main` branch (default). If the change is needed as a patch for a version of `dbt-utils` that has already been released (or is already a release candidate), a maintainer will backport the changes in your PR to the relevant branch.
22+
23+
## Getting the code
24+
25+
### Installing git
26+
27+
You will need `git` in order to download and modify the `dbt-utils` source code. On macOS, the best way to download git is to just install [Xcode](https://developer.apple.com/support/xcode/).
28+
29+
### External contributors
30+
31+
If you are not a member of the `dbt-labs` GitHub organization, you can contribute to `dbt-utils` by forking the `dbt-utils` repository. For a detailed overview on forking, check out the [GitHub docs on forking](https://help.github.com/en/articles/fork-a-repo). In short, you will need to:
32+
33+
1. Fork the `dbt-utils` repository
34+
2. Clone your fork locally
35+
3. Check out a new branch for your proposed changes
36+
4. Push changes to your fork
37+
5. Open a pull request against `dbt-labs/dbt-utils` from your forked repository
38+
39+
### dbt Labs contributors
40+
41+
If you are a member of the `dbt-labs` GitHub organization, you will have push access to the `dbt-utils` repo. Rather than forking `dbt-utils` to make your changes, just clone the repository, check out a new branch, and push directly to that branch.
42+
43+
## Setting up an environment
44+
45+
There are some tools that will be helpful to you in developing locally. While this is the list relevant for `dbt-utils` development, many of these tools are used commonly across open-source python projects.
46+
47+
### Tools
48+
49+
These are the tools used in `dbt-utils` development and testing:
50+
- [`make`](https://users.cs.duke.edu/~ola/courses/programming/Makefiles/Makefiles.html) to run multiple setup or test steps in combination. Don't worry too much, nobody _really_ understands how `make` works, and our Makefile aims to be super simple.
51+
- [CircleCI](https://circleci.com/) for automating tests and checks, once a PR is pushed to the `dbt-utils` repository
52+
53+
A deep understanding of these tools in not required to effectively contribute to `dbt-utils`, but we recommend checking out the attached documentation if you're interested in learning more about each one.
54+
55+
#### Virtual environments
56+
57+
We strongly recommend using virtual environments when developing code in `dbt-utils`. We recommend creating this virtualenv
58+
in the root of the `dbt-utils` repository. To create a new virtualenv, run:
59+
```sh
60+
python3 -m venv env
61+
source env/bin/activate
62+
```
63+
64+
This will create and activate a new Python virtual environment.
65+
66+
## Testing
67+
68+
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:
69+
- Your code changes do not unexpectedly break other established functionality
70+
- Your code changes can handle all known edge cases
71+
- The functionality you're adding will _keep_ working in the future
72+
73+
See here for details for running existing integration tests and adding new ones:
74+
- [integration_tests/README.md](integration_tests/README.md)
75+
76+
## Adding CHANGELOG Entry
77+
78+
Unlike `dbt-core`, we edit the `CHANGELOG.md` directly.
79+
80+
You don't need to worry about which `dbt-utils` 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-utils`. 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-utils`.
81+
82+
## Submitting a Pull Request
83+
84+
A `dbt-utils` 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.
85+
86+
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-utils` repository trigger integration tests against Postgres [TODO]. dbt Labs also provides CI environments in which to test changes to other adapters, triggered by PRs in those adapters' repositories, as well as periodic maintenance checks of each adapter in concert with the latest `dbt-utils` code changes.
87+
88+
Once all tests are passing and your PR has been approved, a `dbt-utils` maintainer will merge your changes into the active development branch. And that's it! Happy developing :tada:

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1219,9 +1219,11 @@ A useful workaround is to change the above post-hook to:
12191219
12201220
----
12211221
1222-
### Contributing
1222+
### Reporting bugs and contributing code
12231223
1224-
We welcome contributions to this repo! To contribute a new feature or a fix, please open a Pull Request with 1) your changes, 2) updated documentation for the `README.md` file, and 3) a working integration test. See [this page](integration_tests/README.md) for more information.
1224+
- Want to report a bug or request a feature? Let us know in the `#package-ecosystem` channel on [Slack](http://community.getdbt.com/), or open [an issue](https://github.com/dbt-labs/dbt-utils/issues/new)
1225+
- Want to help us build dbt-utils? Check out the [Contributing Guide](https://github.com/dbt-utils/dbt-core/blob/HEAD/CONTRIBUTING.md)
1226+
- **TL;DR** Open a Pull Request with 1) your changes, 2) updated documentation for the `README.md` file, and 3) a working integration test.
12251227

12261228
----
12271229

0 commit comments

Comments
 (0)