Skip to content

Commit 71c9a05

Browse files
authored
chore: Update project stucture (#19)
* Update project structure
1 parent 4ba2c32 commit 71c9a05

File tree

7 files changed

+55
-67
lines changed

7 files changed

+55
-67
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,17 @@ jobs:
2424
uses: actions/setup-python@v6.2.0
2525
with:
2626
python-version: ${{ matrix.python-version }}
27-
- name: Install and configure Poetry
28-
uses: snok/install-poetry@v1
27+
- name: Set up UV
28+
uses: astral-sh/setup-uv@v7
29+
- name: Cache pip
30+
uses: actions/cache@v5
2931
with:
30-
virtualenvs-create: true
31-
virtualenvs-in-project: true
32-
- name: Load cached venv
33-
id: cached-poetry-dependencies
34-
uses: actions/cache@v5.0.3
35-
with:
36-
path: .venv
37-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
38-
- name: Install dependencies
39-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
40-
run: poetry install --no-interaction --no-root
41-
- name: Install library
42-
run: poetry install --no-interaction
43-
- name: Run tests
32+
path: ~/.cache/pip
33+
key: ${{ runner.os }}-pip-cache-${{ matrix.python-version }}-${{ hashFiles('**/uv.lock') }}
34+
- name: Install UV and sync dependencies
4435
run: |
45-
source .venv/bin/activate
46-
pytest
36+
python -m pip install --upgrade pip
37+
pip install uv==0.10.7
38+
uv sync --group dev
39+
- name: Run tests
40+
run: uv run pytest -q

.github/workflows/publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ jobs:
1212
deploy:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
16-
- name: Build and publish to pypi
17-
uses: JRubics/poetry-publish@v2.0
18-
with:
19-
pypi_token: ${{ secrets.PYPI_TOKEN }}
20-
poetry_install_options: "--without dev"
15+
- uses: actions/checkout@v6
16+
- name: Set up UV
17+
uses: astral-sh/setup-uv@v7
18+
- name: Build package
19+
run: uv build
20+
- name: Publish to PyPI
21+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
__pycache__/
1010
.pytest_cache
1111
.coverage
12+
dist/
1213

13-
# Poetry
14+
# Lock files
1415
poetry.lock
16+
uv.lock
1517

1618
# Temporary
1719
tests/tmp

.pre-commit-config.yaml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
3+
rev: v6.0.0
44
hooks:
55
# Identify invalid files
66
- id: check-ast
@@ -28,26 +28,14 @@ repos:
2828
- id: end-of-file-fixer
2929

3030
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
rev: v0.9.4
31+
rev: v0.15.4
3232
hooks:
3333
- id: ruff
3434
args: [ --fix ]
3535
- id: ruff-format
3636

37-
- repo: https://github.com/pre-commit/mirrors-mypy
38-
rev: v1.14.1
39-
hooks:
40-
- id: mypy
41-
args:
42-
- --strict
43-
- --ignore-missing-imports
44-
- --install-types
45-
- --allow-subclassing-any
46-
- --allow-untyped-decorators
47-
exclude: ^tests/
48-
4937
- repo: https://github.com/igorshubovych/markdownlint-cli
50-
rev: v0.44.0
38+
rev: v0.47.0
5139
hooks:
5240
- id: markdownlint
5341
args:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
<!-- markdownlint-disable MD013 -->
44

5-
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
5+
[![prek](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/j178/prek/master/docs/assets/badge-v0.json)](https://github.com/j178/prek)
66
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
7-
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
7+
[![uv](https://img.shields.io/badge/powered%20by-uv-blue)](https://github.com/astral-sh/uv)
88
[![image](https://img.shields.io/pypi/v/pydantic-glue.svg)](https://pypi.python.org/pypi/pydantic-glue)
99
[![image](https://img.shields.io/pypi/l/pydantic-glue.svg)](https://github.com/svdimchenko/pydantic-glue/blob/main/LICENSE)
1010
[![image](https://img.shields.io/pypi/pyversions/pydantic-glue.svg)](https://pypi.python.org/pypi/pydantic-glue)

pyproject.toml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
1-
[tool.poetry]
1+
[project]
22
name = "pydantic-glue"
33
keywords = ["pydantic", "glue", "athena", "types", "convert"]
4-
version = "0.7.0"
4+
version = "0.7.1"
55
description = "Convert pydantic model to aws glue schema for terraform"
6-
authors = ["Serhii Dimchenko <svdimchenko@gmail.com>"]
76
readme = "README.md"
87
license = "MIT"
9-
repository = "https://github.com/svdimchenko/pydantic-glue"
8+
license-files = ["LICENSE"]
9+
authors = [ { name = "Serhii Dimchenko", email = "svdimchenko@gmail.com" } ]
10+
requires-python = ">=3.10,<4.0"
11+
dependencies = [
12+
"jsonref >=1.1.0,<2.0.0",
13+
"pydantic >=2.7.1,<3.0.0",
14+
]
1015

11-
[tool.poetry.urls]
16+
[project.urls]
1217
"Bug Tracker" = "https://github.com/svdimchenko/pydantic-glue/issues"
1318
"Releases" = "https://github.com/svdimchenko/pydantic-glue/releases"
19+
Repository = "https://github.com/svdimchenko/pydantic-glue"
1420

15-
[tool.poetry.scripts]
21+
[project.scripts]
1622
pydantic-glue = "pydantic_glue.cli:cli"
1723

18-
[tool.poetry.dependencies]
19-
python = "^3.10"
20-
jsonref = "^1.1.0"
21-
pydantic = "^2.7.1"
22-
23-
[tool.poetry.group.dev.dependencies]
24-
pytest = "^8.2.0"
25-
cli-test-helpers = "^4.1.0"
26-
mypy = "^1.10.0"
27-
ruff = ">=0.9.4,<0.16.0"
28-
pytest-cov = ">=6,<8"
24+
[dependency-groups]
25+
dev = [
26+
"pytest >=8.2.0,<9.0.0",
27+
"cli-test-helpers >=4.1.0,<5.0.0",
28+
"mypy >=1.10.0,<2.0.0",
29+
"ruff >=0.9.4,<0.16.0",
30+
"pytest-cov >=6,<8",
31+
]
2932

3033
[tool.ruff]
3134
line-length = 120
3235
indent-width = 4
33-
target-version = "py39"
36+
target-version = "py310"
3437

3538
[tool.ruff.lint]
3639
select = ["ALL"]
@@ -91,5 +94,5 @@ ignore_missing_imports = true
9194
strict = true
9295

9396
[build-system]
94-
requires = ["poetry-core"]
95-
build-backend = "poetry.core.masonry.api"
97+
requires = ["hatchling"]
98+
build-backend = "hatchling.build"

tests/unit/test_convert.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import datetime
44
import json
55
from decimal import Decimal
6-
from typing import Annotated, Optional, Union
6+
from typing import Annotated, Union
77

88
import pytest
99
from pydantic import BaseModel, Field, field_serializer
@@ -214,19 +214,19 @@ class A(BaseModel):
214214
"glue_type": "timestamp",
215215
},
216216
)
217-
optional_unixtime: Optional[int] = Field(
217+
optional_unixtime: int | None = Field(
218218
...,
219219
json_schema_extra={
220220
"glue_type": "timestamp",
221221
},
222222
)
223-
clobber_union_unixtime: Optional[Union[int, str]] = Field(
223+
clobber_union_unixtime: Union[int, str] | None = Field(
224224
...,
225225
json_schema_extra={
226226
"glue_type": "timestamp",
227227
},
228228
)
229-
correct_union_unixtime: Optional[Union[int, str]] = Field(
229+
correct_union_unixtime: Union[int, str] | None = Field(
230230
...,
231231
json_schema_extra={
232232
"glue_type": "union<timestamp,string>",
@@ -282,7 +282,7 @@ class A(BaseModel):
282282

283283
def test_single_optional_column():
284284
class A(BaseModel):
285-
name: Optional[str] = None
285+
name: str | None = None
286286

287287
expected = [("name", "string")]
288288
actual = json.dumps(A.model_json_schema())

0 commit comments

Comments
 (0)