You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+93-5
Original file line number
Diff line number
Diff line change
@@ -424,12 +424,12 @@ exits the *with* context and the queries succeed, otherwise
424
424
425
425
## Improved Python types
426
426
427
-
If you enable the flag `experimental_python_types`, the client will convert the results of the query to the
427
+
If you enable the flag `experimental_python_types`, the client will convert the results of the query to the
428
428
corresponding Python types. For example, if the query returns a `DECIMAL` column, the result will be a `Decimal`object.
429
429
430
-
Limitations of the Python types are described in the
431
-
[Python types documentation](https://docs.python.org/3/library/datatypes.html). These limitations will generate an
432
-
exception `trino.exceptions.DataError`if the query returns a value that cannot be converted to the corresponding Python
430
+
Limitations of the Python types are described in the
431
+
[Python types documentation](https://docs.python.org/3/library/datatypes.html). These limitations will generate an
432
+
exception `trino.exceptions.DataError`if the query returns a value that cannot be converted to the corresponding Python
433
433
type.
434
434
435
435
```python
@@ -457,7 +457,95 @@ assert cur.description[0][1] == "timestamp with time zone"
457
457
458
458
Feel free to create an issue as it makes your request visible to other users and contributors.
459
459
460
+
## Getting Started With Development
461
+
462
+
Start by forking the repository and then modify the code in your fork.
463
+
464
+
Clone the repository and go inside the code directory.
465
+
466
+
Python dependencies are managed using [Poetry](https://python-poetry.org/) which helps to ensure the project is managed in a deterministic way. Poetry [creates a virtual environment](https://python-poetry.org/docs/managing-environments/) to aid with the process. Poetry should be installed via:
- Prefer code that is readable over one that is"clever".
478
+
- When writing a Git commit message, follow these [guidelines](https://chris.beams.io/posts/git-commit/).
479
+
480
+
### Running Tests
481
+
482
+
`trino-python-client` uses [tox](https://tox.wiki/en/latest/)—a tool for standardizing testing in Python—which leverages the [pytest](https://pytest.org/) testing framework. To run
483
+
only unit tests, type:
484
+
485
+
```
486
+
$ poetry run tox -e <environment>-- tests/unit
487
+
```
488
+
489
+
Similarly to run only integration tests, type:
490
+
491
+
```
492
+
$ poetry run tox -e <environment>-- tests/integration
493
+
```
494
+
495
+
where `<environment>` denotes the Python environment (see the configuration in`tox.ini`).
496
+
497
+
Then you can pass options like `--pdb`or anything supported by `pytest --help`.
498
+
499
+
They pull a Docker image and then run a container with a Trino server:
500
+
- the image is named `trinodb/trino:${TRINO_VERSION}`
501
+
- the container is named `trino-python-client-tests-{uuid4()[:7]}`
502
+
503
+
### pre-commit
504
+
505
+
`trino-python-client` leverages [pre-commit](https://pre-commit.com/) to help identify simple issues before submission to code review. Checks include the validity of the `pyproject.toml`file, type checks via [Mypy](https://github.com/python/mypy), etc. To enable `pre-commit` run:
506
+
507
+
```
508
+
poetry run pre-commit install
509
+
```
510
+
511
+
which will run on every commit. You can also run it anytime using:
512
+
513
+
```
514
+
poetry run tox -e pre-commit
515
+
```
516
+
517
+
### Releasing
518
+
519
+
- [Set up your development environment](#Getting-Started-With-Development).
520
+
- Check the local workspace is up to date and has no uncommitted changes
521
+
```bash
522
+
git fetch -a && git status
523
+
```
524
+
- Change version in`trino/pyproject.toml` to a new version, e.g. `0.123.0`.
525
+
- Commit
526
+
```bash
527
+
git commit -a -m "Bump version to 0.123.0"
528
+
```
529
+
- Create an annotated tag
530
+
```bash
531
+
git tag -m ""0.123.0
532
+
```
533
+
- Create release package and upload it to PyPI
534
+
```bash
535
+
poetry publish --build &&
536
+
open https://pypi.org/project/trino/&&
537
+
echo "Released!"
538
+
```
539
+
- Push the branch and the tag
540
+
```bash
541
+
git push upstream master 0.123.0
542
+
```
543
+
- Send release announcement.
544
+
545
+
## Need Help?
546
+
547
+
Feel free to create an issue as it make your request visible to other users and contributors.
548
+
460
549
If an interactive discussion would be better orif you just want to hangout and chat about
461
550
the Trino Python client, you can join us on the *#python-client* channel on
0 commit comments