Skip to content

Commit e00eaa3

Browse files
committed
Extract development notes to DEVELOPMENT.md
1 parent efb6680 commit e00eaa3

File tree

2 files changed

+94
-91
lines changed

2 files changed

+94
-91
lines changed

.github/DEVELOPMENT.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Development
2+
3+
## Getting started with development
4+
5+
Start by forking the repository and then modify the code in your fork.
6+
7+
We recommend that you use Python3's `venv` for development:
8+
9+
```
10+
python3 -m venv .venv
11+
. .venv/bin/activate
12+
pip install -e '.[tests]'
13+
```
14+
15+
With `-e` passed to `pip install` above pip can reference the code you are
16+
modifying in the *virtual env*. That way, you do not need to run `pip install`
17+
again to make your changes applied to the *virtual env*.
18+
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
31+
32+
`trino-python-client` uses [pytest](https://pytest.org/) for its tests. To run
33+
only unit tests, type:
34+
35+
```
36+
pytest tests/unit
37+
```
38+
39+
Then you can pass options like `--pdb` or anything supported by `pytest --help`.
40+
41+
To run integration tests:
42+
43+
```
44+
pytest tests/integration
45+
```
46+
47+
They pull a Docker image and then run a container with a Trino server:
48+
- the image is named `trinodb/trino:${TRINO_VERSION}`
49+
- the container is named `trino-python-client-tests-{uuid4()[:7]}`
50+
51+
To run the tests with different versions of Python in managed *virtual envs*,
52+
use `tox` (see the configuration in `tox.ini`):
53+
54+
```
55+
tox
56+
```
57+
58+
## Releasing
59+
60+
- [Set up your development environment](#Getting-Started-With-Development).
61+
- Check the local workspace is up to date and has no uncommitted changes
62+
```bash
63+
git fetch -a && git status
64+
```
65+
- Change version in `trino/__init__.py` to a new version, e.g. `0.123.0`.
66+
- Commit
67+
```bash
68+
git commit -a -m "Bump version to 0.123.0"
69+
```
70+
- Create an annotated tag
71+
```bash
72+
git tag -m "" 0.123.0
73+
```
74+
- Create release package and upload it to PyPI
75+
```bash
76+
. .venv/bin/activate && \
77+
pip install twine wheel setuptools && \
78+
rm -rf dist/ && \
79+
./setup.py sdist bdist_wheel && \
80+
twine upload dist/* && \
81+
open https://pypi.org/project/trino/ && \
82+
echo "Released!"
83+
```
84+
- Push the branch and the tag
85+
```bash
86+
git push upstream master 0.123.0
87+
```
88+
- Send release announcement on the *#python-client* channel on [Trino Slack](https://trino.io/slack.html).

README.md

Lines changed: 6 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ It supports Python>=3.7 and pypy.
77
[![Trino Slack](https://img.shields.io/static/v1?logo=slack&logoColor=959DA5&label=Slack&labelColor=333a41&message=join%20conversation&color=3AC358)](https://trino.io/slack.html)
88
[![Trino: The Definitive Guide book download](https://img.shields.io/badge/Trino%3A%20The%20Definitive%20Guide-download-brightgreen)](https://www.starburst.io/info/oreilly-trino-guide/)
99

10+
## Development
11+
12+
See [DEVELOPMENT](.github/DEVELOPMENT.md) for information about code style,
13+
development process, and guidelines.
14+
1015
## Usage
1116

1217
### The Python Database API (DBAPI)
@@ -412,101 +417,11 @@ assert rows[0][0] == params
412417
assert cur.description[0][1] == "timestamp with time zone"
413418
```
414419

415-
# Development
416-
417-
## Getting started with development
418-
419-
Start by forking the repository and then modify the code in your fork.
420-
421-
We recommend that you use Python3's `venv` for development:
422-
423-
```
424-
$ python3 -m venv .venv
425-
$ . .venv/bin/activate
426-
$ pip install -e '.[tests]'
427-
```
428-
429-
With `-e` passed to `pip install` above pip can reference the code you are
430-
modifying in the *virtual env*. That way, you do not need to run `pip install`
431-
again to make your changes applied to the *virtual env*.
432-
433-
When the code is ready, submit a Pull Request.
434-
435-
### Code style
436-
437-
- For Python code, adhere to PEP 8.
438-
- Prefer code that is readable over one that is "clever".
439-
- When writing a Git commit message, follow these [guidelines](https://chris.beams.io/posts/git-commit/).
440-
441-
See also Trino's [guidelines](https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md).
442-
Most of them also apply to code in trino-python-client.
443-
444-
### Running tests
445-
446-
`trino-python-client` uses [pytest](https://pytest.org/) for its tests. To run
447-
only unit tests, type:
448-
449-
```
450-
$ pytest tests/unit
451-
```
452-
453-
Then you can pass options like `--pdb` or anything supported by `pytest --help`.
454-
455-
To run integration tests:
456-
457-
```
458-
$ pytest tests/integration
459-
```
460-
461-
They pull a Docker image and then run a container with a Trino server:
462-
- the image is named `trinodb/trino:${TRINO_VERSION}`
463-
- the container is named `trino-python-client-tests-{uuid4()[:7]}`
464-
465-
To run the tests with different versions of Python in managed *virtual envs*,
466-
use `tox` (see the configuration in `tox.ini`):
467-
468-
```
469-
$ tox
470-
```
471-
472-
## Releasing
473-
474-
- [Set up your development environment](#Getting-Started-With-Development).
475-
- Check the local workspace is up to date and has no uncommitted changes
476-
```bash
477-
git fetch -a && git status
478-
```
479-
- Change version in `trino/__init__.py` to a new version, e.g. `0.123.0`.
480-
- Commit
481-
```bash
482-
git commit -a -m "Bump version to 0.123.0"
483-
```
484-
- Create an annotated tag
485-
```bash
486-
git tag -m "" 0.123.0
487-
```
488-
- Create release package and upload it to PyPI
489-
```bash
490-
. .venv/bin/activate && \
491-
pip install twine wheel setuptools && \
492-
rm -rf dist/ && \
493-
./setup.py sdist bdist_wheel && \
494-
twine upload dist/* && \
495-
open https://pypi.org/project/trino/ && \
496-
echo "Released!"
497-
```
498-
- Push the branch and the tag
499-
```bash
500-
git push upstream master 0.123.0
501-
```
502-
- Send release announcement on the *#python-client* channel on [Trino Slack][trino-slack].
503-
504420
# Need help?
505421

506422
Feel free to create an issue as it makes your request visible to other users and contributors.
507423

508424
If an interactive discussion would be better or if you just want to hangout and chat about
509425
the Trino Python client, you can join us on the *#python-client* channel on
510-
[Trino Slack][trino-slack].
426+
[Trino Slack](https://trino.io/slack.html).
511427

512-
[trino-slack]: https://trino.io/slack.html

0 commit comments

Comments
 (0)