Skip to content

Commit b1d1f41

Browse files
committed
Inline relevant information from Trino's DEVELOPMENT.md
Most of the information on Trino's DEVELOPMENT.md doesn't apply to Python and leads to confusion.
1 parent bb7baed commit b1d1f41

File tree

1 file changed

+60
-14
lines changed

1 file changed

+60
-14
lines changed

.github/DEVELOPMENT.md

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Development
22

3-
## Getting started with development
3+
Developers should read [the development section of the website](https://trino.io/development),
4+
which covers things like development philosophy and contribution process.
5+
6+
* [Getting started](#getting-started)
7+
* [Running tests](#running-tests)
8+
* [Commits and pull requests](#commits-and-pull-requests)
9+
* [Code style](#code-style)
10+
* [Releasing](#releasing)
11+
12+
## Getting started
413

514
Start by forking the repository and then modify the code in your fork.
615

@@ -16,18 +25,7 @@ With `-e` passed to `pip install` above pip can reference the code you are
1625
modifying in the *virtual env*. That way, you do not need to run `pip install`
1726
again to make your changes applied to the *virtual env*.
1827

19-
When the code is ready, submit a Pull Request.
20-
21-
### Code style
22-
23-
- For Python code, adhere to PEP 8.
24-
- Prefer code that is readable over one that is "clever".
25-
- When writing a Git commit message, follow these [guidelines](https://chris.beams.io/posts/git-commit/).
26-
27-
See also Trino's [guidelines](https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md).
28-
Most of them also apply to code in trino-python-client.
29-
30-
### Running tests
28+
## Running tests
3129

3230
`trino-python-client` uses [pytest](https://pytest.org/) for its tests. To run
3331
only unit tests, type:
@@ -55,9 +53,57 @@ use `tox` (see the configuration in `tox.ini`):
5553
tox
5654
```
5755

56+
When the code is ready, submit a Pull Request.
57+
58+
## Commits and pull requests
59+
60+
See [Commits and pull requests](https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md#commits-and-pull-requests) section from Trino.
61+
62+
## Code style
63+
64+
To run linting and formatting checks before opening a PR: `pip install pre-commit && pre-commit run --all-files`
65+
66+
In addition to that you should also adhere to the following:
67+
68+
### Readability
69+
70+
Prefer code that is readable over one that is "clever". The purpose of code
71+
style rules is to maintain code readability and developer efficiency when
72+
working with the code. All the code style rules explained below are good
73+
guidelines to follow but there may be exceptional situations where we
74+
purposefully depart from them. When readability and code style rule are at
75+
odds, the readability is more important.
76+
77+
### Consistency
78+
79+
Keep code consistent with surrounding code where possible.
80+
81+
### Avoid mocks where possible
82+
83+
Do not use mocking libraries. These libraries encourage testing specific call
84+
sequences, interactions, and other internal behavior, which we believe leads to
85+
fragile tests. They also make it possible to mock complex interfaces or
86+
classes, which hides the fact that these classes are not (easily) testable. We
87+
prefer to write mocks by hand, which forces code to be written in a certain
88+
testable style.
89+
90+
We also acknowledge that there is existing code which uses mocks but that
91+
should not be taken as a reason increase reliance on mocks.
92+
93+
### Maintain production quality for test code
94+
95+
Maintain the same quality for production and test code.
96+
97+
### Avoid abbreviations
98+
99+
Please avoid abbreviations, slang or inside jokes as this makes harder for
100+
non-native english speaker to understand the code. Very well known
101+
abbreviations like `max` or `min` and ones already very commonly used across
102+
the code base like `ttl` are allowed and encouraged.
103+
58104
## Releasing
59105

60-
- [Set up your development environment](#Getting-Started-With-Development).
106+
- [Set up your development environment](#getting-started).
61107
- Check the local workspace is up to date and has no uncommitted changes
62108
```bash
63109
git fetch -a && git status

0 commit comments

Comments
 (0)