We welcome contributions to dbt-watsonx-presto! If you'd like to help, follow the steps below to get started.
You can contribute to dbt-watsonx-presto by forking the repository. For a detailed overview on forking, check out the GitHub docs on forking. In short, you will need to:
- Fork the
dbt-watsonx-prestorepository - Clone your fork locally.
- Create a new branch for your proposed changes.
- Push changes to your fork.
- Open a pull request against the
IBM/dbt-watsonx-prestorepository from your fork
There are some tools that will be helpful to you in developing locally. While this list is relevant for dbt-watsonx-presto, many of these tools are used commonly across open-source Python projects.
These are the tools used in dbt-watsonx-presto development and testing:
pytestfor defining, discovering, and running tests.toxto manage virtual environments across Python versions.flake8for code linting.blackfor code formatting.isortfor sorting imports.flaky: To rerun flaky tests to improve test reliability.
Though understanding all of these tools isn't mandatory, we recommend familiarizing yourself with them to contribute more effectively.
We strongly recommend using a Python virtual environment for development. To set up a new virtual environment, run:
python3 -m venv env
source env/bin/activateThis will create and activate a new virtual environment, ensuring a clean setup for your development work.
After Setting up an environment, install the project dependencies by running:
pip install --upgrade pipNext, install dbt-watsonx-presto (and its dependencies) with:
pip install -e . -r dev_requirements.txtThe -e . option installs dbt-watsonx-presto in "editable" mode, meaning any changes you make to the code will be immediately reflected in your local environment.
Once you've installed everything, ensure that the dbt command is pointing to the local source code by running:
which dbtThis should show the path to dbt inside your virtual environment. Additionally, ensure your profile is set up to connect to your target database. If needed, create a new profile for connecting to a local Presto or watsonx.data instance
Testing is a crucial part of contributing. Once you've made code changes, you should run existing tests and add new ones to ensure the stability and reliability of the project.
To run tests, you will need access to a Presto or watsonx.data instance. Once that's set up, you can proceed with running tests locally.
You can use pytest to run tests. The following commands help you test locally:
- Run all unit tests:
# run all unit tests in a file
python3 -m pytest tests/unit/- Run a specific test:
# run a specific unit test
python3 -m pytest tests/unit/test_adapter.py::TestPrestoAdapter::test_acquire_connectionThese commands allow you to run tests directly from the command line.
Whenever you introduce new features or fix bugs, ensure that you add test cases to verify your changes. This includes writing appropriate unit tests for functionality and integration tests where needed. Well-tested code is critical for maintaining long-term project stability.
We use changie to generate CHANGELOG entries. Note: Do not edit the CHANGELOG.md directly. Your modifications will be lost.
Follow the steps to install changie for your system.
Once changie is installed and your PR is created, simply run changie new and changie will walk you through the process of creating a changelog entry. Commit the file that's created and your changelog entry is complete!
You don't need to worry about which dbt-watsonx-presto version your change will go into. Just create the changelog entry with changie, and open your PR against the main branch.
Once your changes are complete and tested, it's time to open a pull request:
- Push your changes to your fork.
- Open a pull request from your fork to the IBM/dbt-watsonx-presto repository.
- A maintainer will review your PR and may request additional changes or tests.
- Once your PR is approved and all tests pass, it will be merged into the main branch.
That's it! Happy coding! 🎉