Skip to content

Commit 4498572

Browse files
Merge pull request #503 from laughingman7743/migrate_from_poetry_to_pdm
Migrate package manager from poetry to pdm
2 parents 8b05194 + b04eef4 commit 4498572

File tree

11 files changed

+1751
-2080
lines changed

11 files changed

+1751
-2080
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,17 @@ jobs:
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
22-
- name: Install poetry
23-
run: pipx install poetry
2422
- name: Set up Python
25-
uses: actions/setup-python@v4
23+
uses: pdm-project/setup-pdm@v3
2624
with:
2725
python-version: ${{ env.PYTHON_VERSION }}
28-
cache: 'poetry'
26+
cache: true
2927
- name: Install dependencies
30-
run: poetry install --no-interaction --no-root
28+
run: pdm install -v --dev
3129

3230
- name: Build
3331
run: |
34-
poetry build -vvv
32+
pdm build -v
3533
- name: Publish release distributions to PyPI
3634
uses: pypa/gh-action-pypi-publish@release/v1
3735
- name: Release

.github/workflows/test.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@ jobs:
2727
steps:
2828
- name: Checkout
2929
uses: actions/checkout@v4
30-
- name: Install poetry
31-
run: pipx install poetry
3230
- name: Set up Python
33-
uses: actions/setup-python@v4
31+
uses: pdm-project/setup-pdm@v3
3432
with:
3533
python-version: ${{ matrix.python-version }}
36-
cache: 'poetry'
34+
cache: true
3735
- name: Install dependencies
38-
run: poetry install --no-interaction --no-root
36+
run: pdm install -v --dev
3937

4038
- name: Configure AWS credentials
4139
uses: aws-actions/configure-aws-credentials@v4

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
.project
88
.pydevproject
99
.settings
10+
.pdm-build
1011
/*.egg-info/
1112
/dist/
1213
/build/
@@ -16,6 +17,7 @@ cover/
1617
.cache/
1718
.tox
1819
.python-version
20+
.pdm-python
1921
.pytest_cache
2022
.mypy_cache
2123
.tmp

Makefile

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
.PHONY: fmt
22
fmt:
3-
poetry run isort .
4-
poetry run black .
3+
pdm run ruff check --select I --fix .
4+
pdm run ruff format .
55

66
.PHONY: chk
77
chk:
8-
# https://github.com/PyCQA/flake8/issues/234
9-
poetry run flake8 --max-line-length 100 --exclude .poetry,.tox,.tmp .
10-
poetry run isort -c .
11-
poetry run black --check --diff .
12-
poetry run mypy .
8+
pdm run ruff check .
9+
pdm run ruff format --check .
10+
pdm run mypy .
11+
1312

1413
.PHONY: test
1514
test: chk
16-
poetry run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/pyathena/
15+
pdm run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/pyathena/
1716

1817
.PHONY: test-sqla
1918
test-sqla:
20-
poetry run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/
19+
pdm run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/
2120

2221
.PHONY: tox
2322
tox:
24-
poetry run tox
23+
pdm run tox

README.rst

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
.. image:: https://static.pepy.tech/badge/pyathena/month
1414
:target: https://pepy.tech/project/pyathena
1515

16-
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
17-
:target: https://github.com/psf/black
18-
19-
.. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336
20-
:target: https://pycqa.github.io/isort/
16+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
17+
:target: https://github.com/astral-sh/ruff
18+
:alt: Ruff
2119

2220
PyAthena
2321
========
@@ -2311,19 +2309,19 @@ Run test
23112309

23122310
.. code:: bash
23132311
2314-
$ pip install poetry
2315-
$ poetry install -v
2316-
$ poetry run pytest
2312+
$ pip install pdm
2313+
$ pdm install -v
2314+
$ pdm run pytest
23172315
23182316
Run test multiple Python versions
23192317
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23202318

23212319
.. code:: bash
23222320
2323-
$ pip install poetry
2324-
$ poetry install -v
2321+
$ pip install pdm
2322+
$ pdm install -v
23252323
$ pyenv local 3.11.1 3.10.1 3.9.1 3.8.2
2326-
$ poetry run tox
2324+
$ pdm run tox
23272325
23282326
GitHub Actions
23292327
~~~~~~~~~~~~~~
@@ -2358,7 +2356,7 @@ The example of the CloudFormation execution command is the following:
23582356
Code formatting
23592357
---------------
23602358

2361-
The code formatting uses `black`_ and `isort`_.
2359+
The code formatting uses `ruff`_.
23622360

23632361
Appy format
23642362
~~~~~~~~~~~
@@ -2374,8 +2372,7 @@ Check format
23742372
23752373
$ make chk
23762374
2377-
.. _`black`: https://github.com/psf/black
2378-
.. _`isort`: https://github.com/timothycrosley/isort
2375+
.. _`ruff`: https://github.com/astral-sh/ruff
23792376

23802377
License
23812378
-------

pdm.lock

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

poetry.lock

Lines changed: 0 additions & 1943 deletions
This file was deleted.

pyathena/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
if TYPE_CHECKING:
1010
from pyathena.connection import Connection
1111

12-
__version__: str = "3.1.0"
12+
__version__ = "3.1.0"
1313
user_agent_extra: str = f"PyAthena/{__version__}"
1414

1515
# Globals https://www.python.org/dev/peps/pep-0249/#globals

pyathena/error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Error(Exception):
1616
pass
1717

1818

19-
class Warning(Exception):
19+
class Warning(Exception): # noqa: N818
2020
pass
2121

2222

pyathena/sqlalchemy/base.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -432,91 +432,91 @@ def limit_clause(self, select: "GenerativeSelect", **kw):
432432

433433

434434
class AthenaTypeCompiler(GenericTypeCompiler):
435-
def visit_FLOAT(self, type_: Type[Any], **kw) -> str:
435+
def visit_FLOAT(self, type_: Type[Any], **kw) -> str: # noqa: N802
436436
return self.visit_REAL(type_, **kw)
437437

438-
def visit_REAL(self, type_: Type[Any], **kw) -> str:
438+
def visit_REAL(self, type_: Type[Any], **kw) -> str: # noqa: N802
439439
return "DOUBLE"
440440

441-
def visit_NUMERIC(self, type_: Type[Any], **kw) -> str:
441+
def visit_NUMERIC(self, type_: Type[Any], **kw) -> str: # noqa: N802
442442
return self.visit_DECIMAL(type_, **kw)
443443

444-
def visit_DECIMAL(self, type_: Type[Any], **kw) -> str:
444+
def visit_DECIMAL(self, type_: Type[Any], **kw) -> str: # noqa: N802
445445
if type_.precision is None:
446446
return "DECIMAL"
447447
elif type_.scale is None:
448448
return f"DECIMAL({type_.precision})"
449449
else:
450450
return f"DECIMAL({type_.precision}, {type_.scale})"
451451

452-
def visit_INTEGER(self, type_: Type[Any], **kw) -> str:
452+
def visit_INTEGER(self, type_: Type[Any], **kw) -> str: # noqa: N802
453453
return "INTEGER"
454454

455-
def visit_SMALLINT(self, type_: Type[Any], **kw) -> str:
455+
def visit_SMALLINT(self, type_: Type[Any], **kw) -> str: # noqa: N802
456456
return "SMALLINT"
457457

458-
def visit_BIGINT(self, type_: Type[Any], **kw) -> str:
458+
def visit_BIGINT(self, type_: Type[Any], **kw) -> str: # noqa: N802
459459
return "BIGINT"
460460

461-
def visit_TIMESTAMP(self, type_: Type[Any], **kw) -> str:
461+
def visit_TIMESTAMP(self, type_: Type[Any], **kw) -> str: # noqa: N802
462462
return "TIMESTAMP"
463463

464-
def visit_DATETIME(self, type_: Type[Any], **kw) -> str:
464+
def visit_DATETIME(self, type_: Type[Any], **kw) -> str: # noqa: N802
465465
return self.visit_TIMESTAMP(type_, **kw)
466466

467-
def visit_DATE(self, type_: Type[Any], **kw) -> str:
467+
def visit_DATE(self, type_: Type[Any], **kw) -> str: # noqa: N802
468468
return "DATE"
469469

470-
def visit_TIME(self, type_: Type[Any], **kw) -> str:
470+
def visit_TIME(self, type_: Type[Any], **kw) -> str: # noqa: N802
471471
raise exc.CompileError(f"Data type `{type_}` is not supported")
472472

473-
def visit_CLOB(self, type_: Type[Any], **kw) -> str:
473+
def visit_CLOB(self, type_: Type[Any], **kw) -> str: # noqa: N802
474474
return self.visit_BINARY(type_, **kw)
475475

476-
def visit_NCLOB(self, type_: Type[Any], **kw) -> str:
476+
def visit_NCLOB(self, type_: Type[Any], **kw) -> str: # noqa: N802
477477
return self.visit_BINARY(type_, **kw)
478478

479-
def visit_CHAR(self, type_: Type[Any], **kw) -> str:
479+
def visit_CHAR(self, type_: Type[Any], **kw) -> str: # noqa: N802
480480
if type_.length:
481481
return cast(str, self._render_string_type(type_, "CHAR"))
482482
return "STRING"
483483

484-
def visit_NCHAR(self, type_: Type[Any], **kw) -> str:
484+
def visit_NCHAR(self, type_: Type[Any], **kw) -> str: # noqa: N802
485485
return self.visit_CHAR(type_, **kw)
486486

487-
def visit_VARCHAR(self, type_: Type[Any], **kw) -> str:
487+
def visit_VARCHAR(self, type_: Type[Any], **kw) -> str: # noqa: N802
488488
if type_.length:
489489
return cast(str, self._render_string_type(type_, "VARCHAR"))
490490
return "STRING"
491491

492-
def visit_NVARCHAR(self, type_: Type[Any], **kw) -> str:
492+
def visit_NVARCHAR(self, type_: Type[Any], **kw) -> str: # noqa: N802
493493
return self.visit_VARCHAR(type_, **kw)
494494

495-
def visit_TEXT(self, type_: Type[Any], **kw) -> str:
495+
def visit_TEXT(self, type_: Type[Any], **kw) -> str: # noqa: N802
496496
return "STRING"
497497

498-
def visit_BLOB(self, type_: Type[Any], **kw) -> str:
498+
def visit_BLOB(self, type_: Type[Any], **kw) -> str: # noqa: N802
499499
return self.visit_BINARY(type_, **kw)
500500

501-
def visit_BINARY(self, type_: Type[Any], **kw) -> str:
501+
def visit_BINARY(self, type_: Type[Any], **kw) -> str: # noqa: N802
502502
return "BINARY"
503503

504-
def visit_VARBINARY(self, type_: Type[Any], **kw) -> str:
504+
def visit_VARBINARY(self, type_: Type[Any], **kw) -> str: # noqa: N802
505505
return self.visit_BINARY(type_, **kw)
506506

507-
def visit_BOOLEAN(self, type_: Type[Any], **kw) -> str:
507+
def visit_BOOLEAN(self, type_: Type[Any], **kw) -> str: # noqa: N802
508508
return "BOOLEAN"
509509

510-
def visit_string(self, type_, **kw):
510+
def visit_string(self, type_, **kw): # noqa: N802
511511
return "STRING"
512512

513-
def visit_unicode(self, type_, **kw):
513+
def visit_unicode(self, type_, **kw): # noqa: N802
514514
return "STRING"
515515

516-
def visit_unicode_text(self, type_, **kw):
516+
def visit_unicode_text(self, type_, **kw): # noqa: N802
517517
return "STRING"
518518

519-
def visit_null(self, type_, **kw):
519+
def visit_null(self, type_, **kw): # noqa: N802
520520
return "NULL"
521521

522522

0 commit comments

Comments
 (0)