-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve contribution process #239
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e00eaa3
Extract development notes to DEVELOPMENT.md
hashhar f5f65ba
Inline relevant information from Trino's DEVELOPMENT.md
hashhar f80d3d9
Add CONTRIBUTING.md
hashhar 7ad91bf
Clarify that docs-only changes don't need release notes
hashhar 1b12fd6
Do not run CI for changes to markdown files
hashhar 4513be6
empty for ci
hashhar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Contributing to Trino Python Client | ||
|
||
## Contributor License Agreement ("CLA") | ||
|
||
In order to accept your pull request, we need you to [submit a CLA](https://github.com/trinodb/cla). | ||
|
||
## License | ||
|
||
By contributing to Trino Python Client, you agree that your contributions will be licensed under the [Apache License Version 2.0 (APLv2)](../LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# Development | ||
|
||
Developers should read [the development section of the website](https://trino.io/development), | ||
which covers things like development philosophy and contribution process. | ||
|
||
* [Getting started](#getting-started) | ||
* [Running tests](#running-tests) | ||
* [Commits and pull requests](#commits-and-pull-requests) | ||
* [Code style](#code-style) | ||
* [Releasing](#releasing) | ||
|
||
## Getting started | ||
|
||
Start by forking the repository and then modify the code in your fork. | ||
|
||
We recommend that you use Python3's `venv` for development: | ||
|
||
``` | ||
python3 -m venv .venv | ||
. .venv/bin/activate | ||
pip install -e '.[tests]' | ||
``` | ||
|
||
With `-e` passed to `pip install` above pip can reference the code you are | ||
modifying in the *virtual env*. That way, you do not need to run `pip install` | ||
again to make your changes applied to the *virtual env*. | ||
|
||
## Running tests | ||
|
||
`trino-python-client` uses [pytest](https://pytest.org/) for its tests. To run | ||
only unit tests, type: | ||
|
||
``` | ||
pytest tests/unit | ||
``` | ||
|
||
Then you can pass options like `--pdb` or anything supported by `pytest --help`. | ||
|
||
To run integration tests: | ||
|
||
``` | ||
pytest tests/integration | ||
``` | ||
|
||
They pull a Docker image and then run a container with a Trino server: | ||
- the image is named `trinodb/trino:${TRINO_VERSION}` | ||
- the container is named `trino-python-client-tests-{uuid4()[:7]}` | ||
|
||
To run the tests with different versions of Python in managed *virtual envs*, | ||
use `tox` (see the configuration in `tox.ini`): | ||
|
||
``` | ||
tox | ||
``` | ||
|
||
When the code is ready, submit a Pull Request. | ||
|
||
## Commits and pull requests | ||
|
||
See [Commits and pull requests](https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md#commits-and-pull-requests) section from Trino. | ||
|
||
## Code style | ||
|
||
To run linting and formatting checks before opening a PR: `pip install pre-commit && pre-commit run --all-files` | ||
|
||
In addition to that you should also adhere to the following: | ||
|
||
### Readability | ||
|
||
Prefer code that is readable over one that is "clever". The purpose of code | ||
style rules is to maintain code readability and developer efficiency when | ||
working with the code. All the code style rules explained below are good | ||
guidelines to follow but there may be exceptional situations where we | ||
purposefully depart from them. When readability and code style rule are at | ||
odds, the readability is more important. | ||
|
||
### Consistency | ||
|
||
Keep code consistent with surrounding code where possible. | ||
|
||
### Avoid mocks where possible | ||
|
||
Do not use mocking libraries. These libraries encourage testing specific call | ||
sequences, interactions, and other internal behavior, which we believe leads to | ||
fragile tests. They also make it possible to mock complex interfaces or | ||
classes, which hides the fact that these classes are not (easily) testable. We | ||
prefer to write mocks by hand, which forces code to be written in a certain | ||
testable style. | ||
|
||
We also acknowledge that there is existing code which uses mocks but that | ||
should not be taken as a reason increase reliance on mocks. | ||
|
||
### Maintain production quality for test code | ||
|
||
Maintain the same quality for production and test code. | ||
|
||
### Avoid abbreviations | ||
|
||
Please avoid abbreviations, slang or inside jokes as this makes harder for | ||
non-native english speaker to understand the code. Very well known | ||
abbreviations like `max` or `min` and ones already very commonly used across | ||
the code base like `ttl` are allowed and encouraged. | ||
|
||
## Releasing | ||
|
||
- [Set up your development environment](#getting-started). | ||
- Check the local workspace is up to date and has no uncommitted changes | ||
```bash | ||
git fetch -a && git status | ||
``` | ||
- Change version in `trino/__init__.py` to a new version, e.g. `0.123.0`. | ||
- Commit | ||
```bash | ||
git commit -a -m "Bump version to 0.123.0" | ||
``` | ||
- Create an annotated tag | ||
```bash | ||
git tag -m "" 0.123.0 | ||
``` | ||
- Create release package and upload it to PyPI | ||
```bash | ||
. .venv/bin/activate && \ | ||
pip install twine wheel setuptools && \ | ||
rm -rf dist/ && \ | ||
./setup.py sdist bdist_wheel && \ | ||
twine upload dist/* && \ | ||
open https://pypi.org/project/trino/ && \ | ||
echo "Released!" | ||
``` | ||
- Push the branch and the tag | ||
```bash | ||
git push upstream master 0.123.0 | ||
``` | ||
- Send release announcement on the *#python-client* channel on [Trino Slack](https://trino.io/slack.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps indicating somewhere that creating an issue before actually starting working on something make sense to avoid unnecessary work which won't be accepted by maintainers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the first things linked from this DEVELOPMENT.md page - https://trino.io/development/process.html