Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@ jobs:
matrix:
python-version: [3.9, "3.10", 3.11, 3.12, 3.13]
steps:
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install and configure Poetry
run: |
pip install -U pip poetry
poetry config virtualenvs.create false
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Run CI
run: make ci
run: uv run make ci
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

## 0.6

### 0.6.2 (Unreleased)
### 0.6.2

- feat: migrate from poetry to uv
- fix: `** (power)` does not get translated to POWER in MSSQL (#34)

### 0.6.1
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ py_warn = PYTHONDEVMODE=1
pytest_opts = -n auto --cov=$(src_dir) --cov-append --cov-branch --tb=native -q

up:
@poetry update
@uv lock --upgrade

deps:
poetry install --all-groups
uv sync --active --inexact --all-groups --all-extras

typehints:
codeqc:
mypy $(checkfiles)
bandit -c pyproject.toml -r $(checkfiles)
twine check dist/*
Expand All @@ -18,7 +18,7 @@ check: build _check
_check:
ruff format --check $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false)
ruff check $(checkfiles)
$(MAKE) typehints
$(MAKE) codeqc

test: deps _test
_test:
Expand All @@ -31,11 +31,11 @@ _style:
ruff format $(checkfiles)
ruff check --fix $(checkfiles)

lint: build _style
$(MAKE) typehints
lint: build _style codeqc

build: deps
poetry build --clean
rm -fR dist/
uv build

publish: build
twine upload dist/*
1,290 changes: 0 additions & 1,290 deletions poetry.lock

This file was deleted.

2 changes: 2 additions & 0 deletions pypika_tortoise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@

NULL = NullValue()
SYSTEM_TIME = SystemTimeValue()

__version__ = "0.6.2"
37 changes: 23 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[project]
name = "pypika-tortoise"
version = "0.6.1"
dynamic = ["version"]
description = "Forked from pypika and streamline just for tortoise-orm"
authors = [{name="long2ice", email="long2ice@gmail.com"}]
license = {text="Apache-2.0"}
readme = "README.md"
keywords = ["postgresql", "Tortoise-ORM", "mysql", "sqlite", "sql"]
include = ["CHANGELOG.md", "LICENSE", "README.md"]
requires-python = ">=3.9"

[project.urls]
Expand All @@ -18,22 +17,32 @@ documentation = "https://github.com/tortoise/pypika-tortoise"
packages = [
{ include = "pypika_tortoise" }
]
version = "0.0.0"

[tool.poetry.group.dev.dependencies]
ruff = "*"
mypy = "*"
bandit = "*"
twine = "*"
typing-extensions = {version = "*", python = "<3.11"}
[tool.pdm]
version = {source="file", path="pypika_tortoise/__init__.py"}

[tool.poetry.group.test.dependencies]
pytest = "*"
pytest-cov = "*"
pytest-xdist = "*"
[dependency-groups]
dev = [
"ruff",
"mypy",
"bandit",
"twine",
"typing-extensions; python_version < '3.11'",
]
test=[
"pytest",
"pytest-cov",
"pytest-xdist",
]

[build-system]
requires = ["poetry-core>=2.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[tool.pdm.build]
excludes = ["./**/.git", "./**/.*_cache"]
include = ["CHANGELOG.md", "LICENSE", "README.md"]

[tool.mypy]
pretty = true
Expand Down
16 changes: 14 additions & 2 deletions tests/test_poetry_add.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import shlex
import shutil
import subprocess # nosec
import sys
from pathlib import Path
Expand All @@ -24,11 +26,21 @@ def __exit__(self, *excinfo) -> None:
os.chdir(self._old_cwd.pop())


def _run_shell(cmd: str, **kw) -> subprocess.CompletedProcess[str]:
return subprocess.run(shlex.split(cmd), **kw) # nosec


def test_added_by_poetry_v2(tmp_path: Path):
lib = Path(__file__).parent.resolve().parent
py = "{}.{}".format(*sys.version_info)
poetry = "poetry"
if shutil.which(poetry) is None:
poetry = "uvx " + poetry
with chdir(tmp_path):
package = "foo"
subprocess.run(["poetry", "new", package]) # nosec
_run_shell(f"{poetry} new {package} --python=^{py}") # nosec
with chdir(package):
r = subprocess.run(["poetry", "add", lib]) # nosec
_run_shell(f"{poetry} config --local virtualenvs.in-project true") # nosec
_run_shell(f"{poetry} env use {py}") # nosec
r = _run_shell(f"{poetry} add {lib}") # nosec
assert r.returncode == 0
971 changes: 971 additions & 0 deletions uv.lock

Large diffs are not rendered by default.