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
@@ -273,7 +273,7 @@ the [`Kerberos` authentication type](https://trino.io/docs/current/security/kerb
273
273
```python
274
274
from trino.dbapi import connect
275
275
from trino.auth import KerberosAuthentication
276
-
276
+
277
277
conn = connect(
278
278
user="<username>",
279
279
auth=KerberosAuthentication(...),
@@ -382,12 +382,12 @@ exits the *with* context and the queries succeed, otherwise
382
382
383
383
# Improved Python types
384
384
385
-
If you enable the flag `experimental_python_types`, the client will convert the results of the query to the
385
+
If you enable the flag `experimental_python_types`, the client will convert the results of the query to the
386
386
corresponding Python types. For example, if the query returns a `DECIMAL` column, the result will be a `Decimal`object.
387
387
388
-
Limitations of the Python types are described in the
389
-
[Python types documentation](https://docs.python.org/3/library/datatypes.html). These limitations will generate an
390
-
exception `trino.exceptions.DataError`if the query returns a value that cannot be converted to the corresponding Python
388
+
Limitations of the Python types are described in the
389
+
[Python types documentation](https://docs.python.org/3/library/datatypes.html). These limitations will generate an
390
+
exception `trino.exceptions.DataError`if the query returns a value that cannot be converted to the corresponding Python
391
391
type.
392
392
393
393
```python
@@ -417,29 +417,14 @@ assert cur.description[0][1] == "timestamp with time zone"
417
417
418
418
Start by forking the repository and then modify the code in your fork.
419
419
420
-
Clone the repository and go inside the code directory. Then you can get the
421
-
version with`./setup.py --version`.
420
+
Clone the repository and go inside the code directory.
422
421
423
-
We recommend that you use Python3's `venv` for development:
422
+
Python dependencies are managed using [Poetry](https://python-poetry.org/) which helps to ensure the project is managed in a deterministic way. Currently this project leverages [dependency groups](https://python-poetry.org/docs/master/managing-dependencies/) which are a pre-release feature and thus Poetry should be installed via:
For development purpose, pip can reference the code you are modifying in a
432
-
*virtual env*:
433
-
434
-
```
435
-
$ pip install -e .
436
-
# To additionally install all dependencies for development run below command
437
-
$ pip install -e '.[tests]'
438
-
```
439
-
440
-
That way, you do not need to run `pip install` again to make your changes
441
-
applied to the *virtual env*.
442
-
443
428
When the code is ready, submit a Pull Request.
444
429
445
430
### Code Style
@@ -450,32 +435,41 @@ When the code is ready, submit a Pull Request.
450
435
451
436
### Running Tests
452
437
453
-
`trino-python-client` uses [pytest](https://pytest.org/) for its tests. To run
438
+
`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
454
439
only unit tests, type:
455
440
456
441
```
457
-
$pytest tests/unit
442
+
$poetry run tox -e <environment>-- tests/unit
458
443
```
459
444
460
-
Then you can pass options like `--pdb`or anything supported by `pytest --help`.
461
-
462
-
To run the tests with different versions of Python in managed *virtual envs*,
463
-
use `tox` (see the configuration in`tox.ini`):
445
+
Similarly to run only integration tests, type:
464
446
465
447
```
466
-
$ tox
448
+
$poetry run tox-e <environment>-- tests/integration
467
449
```
468
450
469
-
To run integration tests:
451
+
where `<environment>` denotes the Python environment (see the configuration in`tox.ini`).
470
452
471
-
```
472
-
$ pytest tests/integration
473
-
```
453
+
Then you can pass options like `--pdb`or anything supported by `pytest --help`.
474
454
475
455
They pull a Docker image and then run a container with a Trino server:
476
456
- the image is named `trinodb/trino:${TRINO_VERSION}`
477
457
- the container is named `trino-python-client-tests-{uuid4()[:7]}`
478
458
459
+
### pre-commit
460
+
461
+
`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:
462
+
463
+
```
464
+
poetry run pre-commit install
465
+
```
466
+
467
+
which will run on every commit. You can also run it anytime using:
468
+
469
+
```
470
+
poetry run tox -e pre-commit
471
+
```
472
+
479
473
### Releasing
480
474
481
475
- [Set up your development environment](#Getting-Started-With-Development).
@@ -494,11 +488,7 @@ They pull a Docker image and then run a container with a Trino server:
0 commit comments