diff --git a/.github/workflows/test-redistribute.yml b/.github/workflows/test-redistribute.yml index a68344175a..cf3ac46f9c 100644 --- a/.github/workflows/test-redistribute.yml +++ b/.github/workflows/test-redistribute.yml @@ -12,11 +12,6 @@ on: jobs: test-redistribute: runs-on: ubuntu-latest - strategy: - matrix: - package: - - sqlmodel - - sqlmodel-slim steps: - name: Dump GitHub context env: @@ -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: | @@ -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*/ diff --git a/pdm_build.py b/pdm_build.py index 33a6b267e4..67e71cbb05 100644 --- a/pdm_build.py +++ b/pdm_build.py @@ -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 @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 69c9bd6a60..f3a516e470 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/sqlmodel-slim/README.md b/sqlmodel-slim/README.md new file mode 100644 index 0000000000..bc4b07b5e8 --- /dev/null +++ b/sqlmodel-slim/README.md @@ -0,0 +1,52 @@ +
++ SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness. +
+ + +--- + +**Documentation**: https://sqlmodel.tiangolo.com + +**Source Code**: https://github.com/fastapi/sqlmodel + +--- + +SQLModel is a library for interacting with SQL databases 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 Pydantic and SQLAlchemy. + +## `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.