Skip to content

Commit f97d3da

Browse files
committed
[CI] Migrate to pyproject.toml and poetry for deterministic builds
1 parent 25fac12 commit f97d3da

File tree

7 files changed

+51
-82
lines changed

7 files changed

+51
-82
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17-
checks:
18-
runs-on: ubuntu-latest
19-
steps:
20-
- name: "Checkout the source code"
21-
uses: actions/checkout@v2
22-
23-
- name: "Install Python"
24-
uses: actions/setup-python@v2
25-
2617
build:
2718
runs-on: ubuntu-latest
2819
strategy:
@@ -43,6 +34,7 @@ jobs:
4334
# Test with older Trino versions for backward compatibility
4435
- { python: "3.10", trino: "351" } # first Trino version
4536
env:
37+
TOX_PARALLEL_NO_SPINNER: 1
4638
TRINO_VERSION: "${{ matrix.trino }}"
4739
steps:
4840
- uses: actions/checkout@v2
@@ -53,7 +45,8 @@ jobs:
5345
run: |
5446
sudo apt-get update
5547
sudo apt-get install libkrb5-dev
56-
sudo curl -sSL https://install.python-poetry.org | python3 - --preview
57-
- name: Run tests
48+
sudo curl -sSL https://install.python-poetry.org | python3
49+
poetry install
50+
- name: Run tox
5851
run: |
5952
poetry run tox --parallel

.pre-commit-config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,3 @@ repos:
1313
additional_dependencies:
1414
- "types-pytz"
1515
- "types-requests"
16-
17-
- repo: "https://github.com/python-poetry/poetry"
18-
rev: "1.2.0b3"
19-
hooks:
20-
- id: poetry-check
21-
- id: poetry-lock

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ the [`JWT` authentication type](https://trino.io/docs/current/security/jwt.html)
177177
from sqlalchemy import create_engine
178178

179179
engine = create_engine("trino://<username>@<host>:<port>/<catalog>/<schema>?access_token=<jwt_token>")
180-
180+
181181
# or
182182
from trino.auth import JWTAuthentication
183183
engine = create_engine(
@@ -419,10 +419,10 @@ Start by forking the repository and then modify the code in your fork.
419419

420420
Clone the repository and go inside the code directory.
421421

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:
422+
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:
423423

424424
```
425-
$ curl -sSL https://install.python-poetry.org | python3 - --preview
425+
$ curl -sSL https://install.python-poetry.org | python3
426426
```
427427

428428
When the code is ready, submit a Pull Request.
@@ -477,7 +477,7 @@ poetry run tox -e pre-commit
477477
```bash
478478
git fetch -a && git status
479479
```
480-
- Change version in `trino/__init__.py` to a new version, e.g. `0.123.0`.
480+
- Change version in `trino/pyproject.toml` to a new version, e.g. `0.123.0`.
481481
- Commit
482482
```bash
483483
git commit -a -m "Bump version to 0.123.0"
@@ -488,7 +488,7 @@ poetry run tox -e pre-commit
488488
```
489489
- Create release package and upload it to PyPI
490490
```bash
491-
poetry publish &&
491+
poetry publish --build &&
492492
open https://pypi.org/project/trino/ &&
493493
echo "Released!"
494494
```

poetry.lock

Lines changed: 23 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
21
[build-system]
3-
requires = ["poetry-core>=1.1.0b3"]
2+
requires = ["poetry-core>=1.0.0"]
43
build-backend = "poetry.core.masonry.api"
54

65
[tool.poetry]
@@ -45,23 +44,28 @@ requests = "*"
4544
requests_kerberos = { version = "*", optional = true }
4645
sqlalchemy = { version = "~1.4", optional = true }
4746

48-
[tool.poetry.extras]
49-
external-authentication-token-cache = ["keyring"]
50-
kerberos = ["requests_kerberos"]
51-
sqlalchemy = ["sqlalchemy"]
52-
53-
[tool.poetry.group.dev]
54-
optional = true
55-
56-
[tool.poetry.group.dev.dependencies]
47+
[tool.poetry.dev-dependencies]
48+
# In Poetry 1.2 these should be defined via:
49+
#
50+
# [tool.poetry.group.dev]
51+
# optional = true
52+
#
53+
# [tool.poetry.group.dev.dependencies]
5754
pre-commit = "*"
5855
tox = "*"
5956
tox-gh-actions = "*"
6057

61-
[tool.poetry.group.test.dependencies]
58+
# In Poetry 1.2 these should be defined via:
59+
#
60+
# [tool.poetry.group.test.dependencies]
6261
click = "*"
6362
httpretty = "<1.1"
6463
pytest = "*"
6564

65+
[tool.poetry.extras]
66+
external-authentication-token-cache = ["keyring"]
67+
kerberos = ["requests_kerberos"]
68+
sqlalchemy = ["sqlalchemy"]
69+
6670
[tool.poetry.plugins."sqlalchemy.dialects"]
6771
trino = "trino.sqlalchemy.dialect:TrinoDialect"

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ python =
44
3.8: py38
55
3.9: py39
66
3.10: py310
7-
pypy-3.7: py37
8-
pypy-3.8: py38
7+
pypy-3.7: pypy37
8+
pypy-3.8: pypy38
99

1010
[testenv]
1111
allowlist_externals =
@@ -17,7 +17,7 @@ parallel_show_output = true
1717

1818
[testenv:pre-commit]
1919
commands =
20-
poetry install --only=dev
20+
poetry install
2121
poetry run pre-commit run --all-files --show-diff-on-failure
2222

2323
[tox]

trino/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@
1818
from . import logging
1919

2020
__all__ = ['auth', 'dbapi', 'client', 'constants', 'exceptions', 'logging']
21-

0 commit comments

Comments
 (0)