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
9 changes: 0 additions & 9 deletions .github/workflows/test-redistribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ on:
jobs:
test-redistribute:
runs-on: ubuntu-latest
strategy:
matrix:
package:
- sqlmodel
- sqlmodel-slim
steps:
- name: Dump GitHub context
env:
Expand All @@ -30,8 +25,6 @@ jobs:
- 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: |
Expand All @@ -41,8 +34,6 @@ jobs:
run: |
cd dist/sqlmodel*/
pip install --group tests --editable .
env:
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
- name: Run source distribution tests
run: |
cd dist/sqlmodel*/
Expand Down
31 changes: 16 additions & 15 deletions pdm_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@

from pdm.backend.hooks import Context

TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE", "sqlmodel")
TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE", "typer")


def pdm_build_initialize(context: Context) -> None:
metadata = context.config.metadata
# Get main version
version = metadata["version"]
# Get custom config for the current package, from the env var
config: dict[str, Any] = context.config.data["tool"]["tiangolo"][
all_configs_config: dict[str, Any] = context.config.data["tool"]["tiangolo"][
"_internal-slim-build"
]["packages"][TIANGOLO_BUILD_PACKAGE]
]["packages"]

if TIANGOLO_BUILD_PACKAGE not in all_configs_config:
return

config = all_configs_config[TIANGOLO_BUILD_PACKAGE]
project_config: dict[str, Any] = config["project"]
# Get main optional dependencies, extras
optional_dependencies: dict[str, list[str]] = metadata.get(
"optional-dependencies", {}
)
# Get custom optional dependencies name to always include in this (non-slim) package
include_optional_dependencies: list[str] = config.get(
"include-optional-dependencies", []
)
# Override main [project] configs with custom configs for this package
for key, value in project_config.items():
metadata[key] = value
Expand All @@ -33,7 +32,9 @@ def pdm_build_initialize(context: Context) -> None:
context.config.build_config[key] = value
# Get main dependencies
dependencies: list[str] = metadata.get("dependencies", [])
# Add optional dependencies to the default dependencies for this (non-slim) package
for include_optional in include_optional_dependencies:
optional_dependencies_group = optional_dependencies.get(include_optional, [])
dependencies.extend(optional_dependencies_group)
# Sync versions in dependencies
new_dependencies = []
for dep in dependencies:
new_dep = f"{dep}>={version}"
new_dependencies.append(new_dep)
metadata["dependencies"] = new_dependencies
30 changes: 22 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,29 @@ source-includes = [

[tool.tiangolo._internal-slim-build.packages.sqlmodel-slim.project]
name = "sqlmodel-slim"

[tool.tiangolo._internal-slim-build.packages.sqlmodel]
# include-optional-dependencies = ["standard"]

[tool.tiangolo._internal-slim-build.packages.sqlmodel.project]
readme = "sqlmodel-slim/README.md"
dependencies = [
"sqlmodel",
]
optional-dependencies = {}

# [tool.tiangolo._internal-slim-build.packages.sqlmodel.project.scripts]
# sqlmodel = "sqlmodel.cli:main"
scripts = {}

[tool.tiangolo._internal-slim-build.packages.sqlmodel-slim.tool.pdm.build]
# excludes needs to explicitly exclude the top level python packages,
# otherwise PDM includes them by default
# A "*" glob pattern can't be used here because in PDM internals, the patterns are put
# in a set (unordered, order varies) and each excluded file is assigned one of the
# glob patterns that matches, as the set is unordered, the matched pattern could be "*"
# independent of the order here. And then the internal code would give it a lower score
# than the one for a default included file.
# By not using "*" and explicitly excluding the top level packages, they get a higher
# score than the default inclusion
excludes = ["sqlmodel", "tests", "pdm_build.py"]
# source-includes needs to explicitly define some value because PDM will check the
# truthy value of the list, and if empty, will include some defaults, including "tests",
# an empty string doesn't match anything, but makes the list truthy, so that PDM
# doesn't override it during the build.
source-includes = [""]

[tool.coverage.run]
parallel = true
Expand Down
52 changes: 52 additions & 0 deletions sqlmodel-slim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<p align="center">
<a href="https://sqlmodel.tiangolo.com"><img src="https://sqlmodel.tiangolo.com/img/logo-margin/logo-margin-vector.svg#only-light" alt="SQLModel"></a>

</p>
<p align="center">
<em>SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.</em>
</p>
<p align="center">
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3ATest+event%3Apush+branch%3Amain" target="_blank">
<img src="https://github.com/fastapi/sqlmodel/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
</a>
<a href="https://github.com/fastapi/sqlmodel/actions?query=workflow%3APublish" target="_blank">
<img src="https://github.com/fastapi/sqlmodel/actions/workflows/publish.yml/badge.svg" alt="Publish">
</a>
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/sqlmodel" target="_blank">
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/sqlmodel.svg" alt="Coverage">
<a href="https://pypi.org/project/sqlmodel" target="_blank">
<img src="https://img.shields.io/pypi/v/sqlmodel?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
</p>

---

**Documentation**: <a href="https://sqlmodel.tiangolo.com" target="_blank">https://sqlmodel.tiangolo.com</a>

**Source Code**: <a href="https://github.com/fastapi/sqlmodel" target="_blank">https://github.com/fastapi/sqlmodel</a>

---

SQLModel is a library for interacting with <abbr title='Also called "Relational databases"'>SQL databases</abbr> from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust.

**SQLModel** is based on Python type annotations, and powered by <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> and <a href="https://sqlalchemy.org/" class="external-link" target="_blank">SQLAlchemy</a>.

## `sqlmodel-slim`

⚠️ Do not install this package. ⚠️

This package, `sqlmodel-slim`, does nothing other than depend on `sqlmodel`.

You **should not** install this package.

Install instead:

```bash
pip install sqlmodel
```

This package is deprecated and will stop receiving any updates and published versions.

## License

This project is licensed under the terms of the MIT license.