Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷 Add setup for uv and use uv for dependency installation #198

Merged
merged 7 commits into from
Mar 21, 2024
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
3 changes: 2 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# These are supported funding model platforms
github: [yezz123]
github: yezz123
polar: yezz123
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ updates:
directory: "/"
schedule:
interval: "weekly"
groups:
python-packages:
patterns:
- "*"
commit-message:
prefix: ⬆
39 changes: 29 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: pip install -e .[lint]
- uses: pre-commit/action@v3.0.1
- name: setup uv
uses: yezz123/setup-uv@v4
with:
extra_args: --all-files --verbose
uv-version: "0.1.22"
uv-venv: ".venv"
- name: Install Dependencies
run: uv pip install -e .[lint]
- name: Run Pre-commit
run: bash scripts/format.sh
- name: check Static Analysis
run: bash scripts/lint.sh

Expand All @@ -50,17 +54,21 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: setup uv
uses: yezz123/setup-uv@v4
with:
uv-version: "0.1.22"
uv-venv: ".venv"

- name: Install SQLAlchemy version 1.4.42
run: |
python -m pip install --upgrade pip
pip install SQLAlchemy==1.4.42
uv pip install SQLAlchemy==1.4.42

- name: Install Dependencies
run: pip install -e .[sqlite,test]
run: uv pip install -e .[sqlite,test]

- name: Freeze Dependencies
run: pip freeze
run: uv pip freeze

- name: Test with pytest
run: bash scripts/test.sh
Expand Down Expand Up @@ -107,8 +115,13 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: setup uv
uses: yezz123/setup-uv@v4
with:
uv-version: "0.1.22"
uv-venv: ".venv"
- name: Install Dependencies
run: pip install -e .[postgresql,test]
run: uv pip install -e .[postgresql,test]
- name: Integration Tests, Postgres
run: bash scripts/integration.sh
env:
Expand All @@ -131,8 +144,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: setup uv
uses: yezz123/setup-uv@v4
with:
uv-version: "0.1.22"
uv-venv: ".venv"

- name: Install Dependencies
run: pip install -e .[sqlite,test]
run: uv pip install -e .[sqlite,test]

- name: Integration Tests, SQLite
run: bash scripts/integration.sh
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.9
rev: v0.3.3
hooks:
- id: ruff
args:
Expand Down
1 change: 0 additions & 1 deletion ormdantic/generator/_crud.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Handle table interactions for a model."""


from typing import Any, Generic

from pypika import Order
Expand Down
1 change: 1 addition & 0 deletions ormdantic/generator/_field.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for building queries from field data."""

from typing import Any

from pypika import Field, Order
Expand Down
1 change: 1 addition & 0 deletions ormdantic/generator/_table.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module providing PydanticSQLTableGenerator."""

import uuid
from datetime import date, datetime
from types import UnionType
Expand Down
1 change: 1 addition & 0 deletions ormdantic/handler/helper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions used throughout the project."""

import json
from typing import Any, Type
from uuid import UUID
Expand Down
1 change: 1 addition & 0 deletions ormdantic/orm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module providing a way to create ORM models and schemas"""

from types import UnionType
from typing import Callable, ForwardRef, Type, get_args, get_origin

Expand Down
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ path = "ormdantic/__init__.py"
profile = "black"
known_third_party = ["pydantic", "sqlalchemy", "typing_extensions"]

[tool.ruff]
[tool.ruff.lint]
mccabe = { max-complexity = 14 }
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
Expand All @@ -106,13 +107,13 @@ ignore = [
"C901", # too complex
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]

[tool.ruff.isort]
known-third-party = ["pydantic", "sqlalchemy", "typing_extensions"]
[tool.ruff.lint.isort]
known-third-party = ["pydantic", "typing_extensions", "sqlalchemy"]

[tool.ruff.pyupgrade]
[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true

[tool.coverage.run]
Expand Down
3 changes: 1 addition & 2 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set -x
echo "ENV=${ENV}"

export PYTHONPATH=.

pytest --cov=ormdantic --cov-report=term-missing --cov-fail-under=80
pytest --cov=ormdantic --cov-report=xml