🔧 Migrate from Poetry to PDM for the internal build config (#912)
This commit is contained in:
parent
f67867f974
commit
0b4989d0b2
20
.github/workflows/build-docs.yml
vendored
20
.github/workflows/build-docs.yml
vendored
@ -27,6 +27,7 @@ jobs:
|
|||||||
- README.md
|
- README.md
|
||||||
- docs/**
|
- docs/**
|
||||||
- docs_src/**
|
- docs_src/**
|
||||||
|
- requirements-docs.txt
|
||||||
- pyproject.toml
|
- pyproject.toml
|
||||||
- mkdocs.yml
|
- mkdocs.yml
|
||||||
- mkdocs.insiders.yml
|
- mkdocs.insiders.yml
|
||||||
@ -52,21 +53,16 @@ jobs:
|
|||||||
id: cache
|
id: cache
|
||||||
with:
|
with:
|
||||||
path: ${{ env.pythonLocation }}
|
path: ${{ env.pythonLocation }}
|
||||||
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v01
|
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt') }}-v01
|
||||||
- name: Install Poetry
|
- name: Install docs extras
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: pip install -r requirements-docs.txt
|
||||||
python -m pip install --upgrade pip
|
|
||||||
python -m pip install "poetry"
|
|
||||||
python -m poetry self add poetry-version-plugin
|
|
||||||
- name: Configure poetry
|
|
||||||
run: python -m poetry config virtualenvs.create false
|
|
||||||
- name: Install Dependencies
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
run: python -m poetry install
|
|
||||||
- name: Install Material for MkDocs Insiders
|
- name: Install Material for MkDocs Insiders
|
||||||
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true'
|
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true'
|
||||||
run: python -m poetry run pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git
|
run: |
|
||||||
|
pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git
|
||||||
|
pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/griffe-typing-deprecated.git
|
||||||
|
pip install git+https://${{ secrets.SQLMODEL_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/mkdocstrings-python.git
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: mkdocs-cards-${{ github.ref }}
|
key: mkdocs-cards-${{ github.ref }}
|
||||||
|
42
.github/workflows/publish.yml
vendored
42
.github/workflows/publish.yml
vendored
@ -14,37 +14,23 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
package:
|
||||||
|
- sqlmodel
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.7"
|
python-version: "3.11"
|
||||||
# Allow debugging with tmate
|
- name: Install build dependencies
|
||||||
- name: Setup tmate session
|
run: pip install build
|
||||||
uses: mxschmitt/action-tmate@v3
|
- name: Build distribution
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
|
|
||||||
with:
|
|
||||||
limit-access-to-actor: true
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
id: cache
|
|
||||||
with:
|
|
||||||
path: ${{ env.pythonLocation }}
|
|
||||||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-v2
|
|
||||||
- name: Install poetry
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
python -m pip install "poetry"
|
|
||||||
python -m poetry self add poetry-version-plugin
|
|
||||||
- name: Configure poetry
|
|
||||||
run: python -m poetry config virtualenvs.create false
|
|
||||||
- name: Install Dependencies
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
run: python -m poetry install
|
|
||||||
- name: Publish
|
|
||||||
env:
|
env:
|
||||||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
|
||||||
run: |
|
run: python -m build
|
||||||
python -m poetry config pypi-token.pypi $PYPI_TOKEN
|
- name: Publish
|
||||||
bash scripts/publish.sh
|
uses: pypa/gh-action-pypi-publish@v1.8.11
|
||||||
|
50
.github/workflows/test-redistribute.yml
vendored
Normal file
50
.github/workflows/test-redistribute.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
name: Test Redistribute
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-redistribute:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
package:
|
||||||
|
- sqlmodel
|
||||||
|
steps:
|
||||||
|
- name: Dump GitHub context
|
||||||
|
env:
|
||||||
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||||
|
run: echo "$GITHUB_CONTEXT"
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.10"
|
||||||
|
- name: Install build dependencies
|
||||||
|
run: pip install build
|
||||||
|
- name: Build source distribution
|
||||||
|
env:
|
||||||
|
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
|
||||||
|
run: python -m build --sdist
|
||||||
|
- name: Decompress source distribution
|
||||||
|
run: |
|
||||||
|
cd dist
|
||||||
|
tar xvf sqlmodel*.tar.gz
|
||||||
|
- name: Install test dependencies
|
||||||
|
run: |
|
||||||
|
cd dist/sqlmodel*/
|
||||||
|
pip install -r requirements-tests.txt
|
||||||
|
- name: Run source distribution tests
|
||||||
|
run: |
|
||||||
|
cd dist/sqlmodel*/
|
||||||
|
bash scripts/test.sh
|
||||||
|
- name: Build wheel distribution
|
||||||
|
run: |
|
||||||
|
cd dist
|
||||||
|
pip wheel --no-deps sqlmodel*.tar.gz
|
16
.github/workflows/test.yml
vendored
16
.github/workflows/test.yml
vendored
@ -51,18 +51,10 @@ jobs:
|
|||||||
id: cache
|
id: cache
|
||||||
with:
|
with:
|
||||||
path: ${{ env.pythonLocation }}
|
path: ${{ env.pythonLocation }}
|
||||||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root-v2
|
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt') }}
|
||||||
- name: Install poetry
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
python -m pip install "poetry"
|
|
||||||
python -m poetry self add poetry-version-plugin
|
|
||||||
- name: Configure poetry
|
|
||||||
run: python -m poetry config virtualenvs.create false
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: python -m poetry install
|
run: pip install -r requirements-tests.txt
|
||||||
- name: Install Pydantic v1
|
- name: Install Pydantic v1
|
||||||
if: matrix.pydantic-version == 'pydantic-v1'
|
if: matrix.pydantic-version == 'pydantic-v1'
|
||||||
run: pip install --upgrade "pydantic>=1.10.0,<2.0.0"
|
run: pip install --upgrade "pydantic>=1.10.0,<2.0.0"
|
||||||
@ -72,10 +64,10 @@ jobs:
|
|||||||
- name: Lint
|
- name: Lint
|
||||||
# Do not run on Python 3.7 as mypy behaves differently
|
# Do not run on Python 3.7 as mypy behaves differently
|
||||||
if: matrix.python-version != '3.7' && matrix.pydantic-version == 'pydantic-v2'
|
if: matrix.python-version != '3.7' && matrix.pydantic-version == 'pydantic-v2'
|
||||||
run: python -m poetry run bash scripts/lint.sh
|
run: bash scripts/lint.sh
|
||||||
- run: mkdir coverage
|
- run: mkdir coverage
|
||||||
- name: Test
|
- name: Test
|
||||||
run: python -m poetry run bash scripts/test.sh
|
run: bash scripts/test.sh
|
||||||
env:
|
env:
|
||||||
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
|
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
|
||||||
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
|
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
[tool.poetry]
|
[build-system]
|
||||||
|
requires = ["pdm-backend"]
|
||||||
|
build-backend = "pdm.backend"
|
||||||
|
|
||||||
|
[project]
|
||||||
name = "sqlmodel"
|
name = "sqlmodel"
|
||||||
version = "0"
|
dynamic = ["version"]
|
||||||
description = "SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness."
|
description = "SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness."
|
||||||
authors = ["Sebastián Ramírez <tiangolo@gmail.com>"]
|
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
homepage = "https://github.com/tiangolo/sqlmodel"
|
requires-python = ">=3.7"
|
||||||
documentation = "https://sqlmodel.tiangolo.com"
|
authors = [
|
||||||
repository = "https://github.com/tiangolo/sqlmodel"
|
{ name = "Sebastián Ramírez", email = "tiangolo@gmail.com" },
|
||||||
license = "MIT"
|
]
|
||||||
exclude = ["sqlmodel/sql/expression.py.jinja2"]
|
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
"Framework :: AsyncIO",
|
"Framework :: AsyncIO",
|
||||||
@ -31,36 +34,28 @@ classifiers = [
|
|||||||
"Typing :: Typed",
|
"Typing :: Typed",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
dependencies = [
|
||||||
python = "^3.7"
|
"SQLAlchemy >=2.0.0,<2.1.0",
|
||||||
SQLAlchemy = ">=2.0.0,<2.1.0"
|
"pydantic >=1.10.13,<3.0.0",
|
||||||
pydantic = ">=1.10.13,<3.0.0"
|
]
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[project.urls]
|
||||||
pytest = "^7.0.1"
|
Homepage = "https://github.com/tiangolo/sqlmodel"
|
||||||
mypy = "1.4.1"
|
Documentation = "https://sqlmodel.tiangolo.com"
|
||||||
# Needed by the code generator using templates
|
Repository = "https://github.com/tiangolo/sqlmodel"
|
||||||
black = ">=22.10,<24.0"
|
|
||||||
mkdocs-material = "9.2.7"
|
|
||||||
pillow = "^9.3.0"
|
|
||||||
cairosvg = "^2.5.2"
|
|
||||||
mdx-include = "^1.4.1"
|
|
||||||
coverage = {extras = ["toml"], version = ">=6.2,<8.0"}
|
|
||||||
fastapi = "^0.103.2"
|
|
||||||
ruff = "0.2.0"
|
|
||||||
# For FastAPI tests
|
|
||||||
httpx = "0.24.1"
|
|
||||||
# TODO: upgrade when deprecating Python 3.7
|
|
||||||
dirty-equals = "^0.6.0"
|
|
||||||
typer-cli = "^0.0.13"
|
|
||||||
mkdocs-markdownextradata-plugin = ">=0.1.7,<0.3.0"
|
|
||||||
|
|
||||||
[build-system]
|
[tool.pdm]
|
||||||
requires = ["poetry-core"]
|
version = { source = "file", path = "sqlmodel/__init__.py" }
|
||||||
build-backend = "poetry.core.masonry.api"
|
distribution = true
|
||||||
|
|
||||||
[tool.poetry-version-plugin]
|
[tool.pdm.build]
|
||||||
source = "init"
|
source-includes = [
|
||||||
|
"tests/",
|
||||||
|
"docs_src/",
|
||||||
|
"requirements*.txt",
|
||||||
|
"scripts/",
|
||||||
|
"sqlmodel/sql/expression.py.jinja2",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
parallel = true
|
parallel = true
|
||||||
|
2
requirements-docs-tests.txt
Normal file
2
requirements-docs-tests.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# For mkdocstrings and code generator using templates
|
||||||
|
black >=22.10,<24.0
|
18
requirements-docs.txt
Normal file
18
requirements-docs.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
-e .
|
||||||
|
-r requirements-docs-tests.txt
|
||||||
|
mkdocs-material==9.4.7
|
||||||
|
mdx-include >=1.4.1,<2.0.0
|
||||||
|
mkdocs-markdownextradata-plugin >=0.1.7,<0.3.0
|
||||||
|
mkdocs-redirects>=1.2.1,<1.3.0
|
||||||
|
pyyaml >=5.3.1,<7.0.0
|
||||||
|
# For Material for MkDocs, Chinese search
|
||||||
|
jieba==0.42.1
|
||||||
|
# For image processing by Material for MkDocs
|
||||||
|
pillow==10.1.0
|
||||||
|
# For image processing by Material for MkDocs
|
||||||
|
cairosvg==2.7.0
|
||||||
|
mkdocstrings[python]==0.23.0
|
||||||
|
griffe-typingdoc==0.2.2
|
||||||
|
# For griffe, it formats with black
|
||||||
|
black==23.3.0
|
||||||
|
typer == 0.12.3
|
12
requirements-tests.txt
Normal file
12
requirements-tests.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-e .
|
||||||
|
-r requirements-docs-tests.txt
|
||||||
|
pytest >=7.0.1,<8.0.0
|
||||||
|
coverage[toml] >=6.2,<8.0
|
||||||
|
mypy ==1.4.1
|
||||||
|
ruff ==0.2.0
|
||||||
|
# For FastAPI tests
|
||||||
|
fastapi >=0.103.2
|
||||||
|
httpx ==0.24.1
|
||||||
|
# TODO: upgrade when deprecating Python 3.7
|
||||||
|
dirty-equals ==0.6.0
|
||||||
|
jinja2 ==3.1.3
|
6
requirements.txt
Normal file
6
requirements.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
-e .
|
||||||
|
|
||||||
|
-r requirements-tests.txt
|
||||||
|
-r requirements-docs.txt
|
||||||
|
|
||||||
|
pre-commit >=2.17.0,<4.0.0
|
@ -1,4 +1,4 @@
|
|||||||
__version__ = "0.0.16"
|
__version__ = "0.0.17.dev2"
|
||||||
|
|
||||||
# Re-export from SQLAlchemy
|
# Re-export from SQLAlchemy
|
||||||
from sqlalchemy.engine import create_engine as create_engine
|
from sqlalchemy.engine import create_engine as create_engine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user