Merge branch 'sqlalchemy_polymorphic_support' of https://github.com/PaleNeutron/sqlmodel into sqlalchemy_polymorphic_support
This commit is contained in:
commit
88670a5bbb
3
.github/workflows/build-docs.yml
vendored
3
.github/workflows/build-docs.yml
vendored
@ -41,6 +41,7 @@ jobs:
|
||||
- mkdocs.no-insiders.yml
|
||||
- .github/workflows/build-docs.yml
|
||||
- .github/workflows/deploy-docs.yml
|
||||
- data/**
|
||||
|
||||
build-docs:
|
||||
needs:
|
||||
@ -58,7 +59,7 @@ jobs:
|
||||
with:
|
||||
python-version: "3.11"
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
uses: astral-sh/setup-uv@v4
|
||||
with:
|
||||
version: "0.4.15"
|
||||
enable-cache: true
|
||||
|
2
.github/workflows/deploy-docs.yml
vendored
2
.github/workflows/deploy-docs.yml
vendored
@ -29,7 +29,7 @@ jobs:
|
||||
with:
|
||||
python-version: "3.11"
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
uses: astral-sh/setup-uv@v4
|
||||
with:
|
||||
version: "0.4.15"
|
||||
enable-cache: true
|
||||
|
2
.github/workflows/latest-changes.yml
vendored
2
.github/workflows/latest-changes.yml
vendored
@ -30,7 +30,7 @@ jobs:
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
|
||||
with:
|
||||
limit-access-to-actor: true
|
||||
- uses: tiangolo/latest-changes@0.3.1
|
||||
- uses: tiangolo/latest-changes@0.3.2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
latest_changes_file: docs/release-notes.md
|
||||
|
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@ -34,4 +34,4 @@ jobs:
|
||||
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
|
||||
run: python -m build
|
||||
- name: Publish
|
||||
uses: pypa/gh-action-pypi-publish@v1.9.0
|
||||
uses: pypa/gh-action-pypi-publish@v1.12.3
|
||||
|
2
.github/workflows/smokeshow.yml
vendored
2
.github/workflows/smokeshow.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
||||
with:
|
||||
python-version: '3.9'
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
uses: astral-sh/setup-uv@v4
|
||||
with:
|
||||
version: "0.4.15"
|
||||
enable-cache: true
|
||||
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -44,7 +44,7 @@ jobs:
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
uses: astral-sh/setup-uv@v4
|
||||
with:
|
||||
version: "0.4.15"
|
||||
enable-cache: true
|
||||
@ -92,7 +92,7 @@ jobs:
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Setup uv
|
||||
uses: astral-sh/setup-uv@v3
|
||||
uses: astral-sh/setup-uv@v4
|
||||
with:
|
||||
version: "0.4.15"
|
||||
enable-cache: true
|
||||
|
@ -1,4 +1,3 @@
|
||||
members:
|
||||
- login: tiangolo
|
||||
- login: estebanx64
|
||||
- login: alejsdev
|
||||
|
@ -17,6 +17,12 @@
|
||||
|
||||
### Internal
|
||||
|
||||
* ⬆ Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.12.3. PR [#1240](https://github.com/fastapi/sqlmodel/pull/1240) by [@dependabot[bot]](https://github.com/apps/dependabot).
|
||||
* ⬆ Bump astral-sh/setup-uv from 3 to 4. PR [#1225](https://github.com/fastapi/sqlmodel/pull/1225) by [@dependabot[bot]](https://github.com/apps/dependabot).
|
||||
* ⬆ Bump tiangolo/latest-changes from 0.3.1 to 0.3.2. PR [#1207](https://github.com/fastapi/sqlmodel/pull/1207) by [@dependabot[bot]](https://github.com/apps/dependabot).
|
||||
* 🔨 Update docs previews script. PR [#1236](https://github.com/fastapi/sqlmodel/pull/1236) by [@tiangolo](https://github.com/tiangolo).
|
||||
* 🔧 Update build-docs filter paths. PR [#1235](https://github.com/fastapi/sqlmodel/pull/1235) by [@tiangolo](https://github.com/tiangolo).
|
||||
* 🔧 Update team members. PR [#1234](https://github.com/fastapi/sqlmodel/pull/1234) by [@tiangolo](https://github.com/tiangolo).
|
||||
* ⬆️ Upgrade markdown-include-variants to version 0.0.3. PR [#1152](https://github.com/fastapi/sqlmodel/pull/1152) by [@tiangolo](https://github.com/tiangolo).
|
||||
* 👷 Update issue manager workflow. PR [#1137](https://github.com/fastapi/sqlmodel/pull/1137) by [@alejsdev](https://github.com/alejsdev).
|
||||
* 👷 Fix smokeshow, checkout files on CI. PR [#1136](https://github.com/fastapi/sqlmodel/pull/1136) by [@tiangolo](https://github.com/tiangolo).
|
||||
|
@ -2,9 +2,11 @@ import logging
|
||||
import re
|
||||
|
||||
from github import Github
|
||||
from pydantic import SecretStr
|
||||
from pydantic import BaseModel, SecretStr
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
site_domain = "sqlmodel.tiangolo.com"
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
github_repository: str
|
||||
@ -15,7 +17,12 @@ class Settings(BaseSettings):
|
||||
is_done: bool = False
|
||||
|
||||
|
||||
def main():
|
||||
class LinkData(BaseModel):
|
||||
previous_link: str
|
||||
preview_link: str
|
||||
|
||||
|
||||
def main() -> None:
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
settings = Settings()
|
||||
|
||||
@ -60,24 +67,31 @@ def main():
|
||||
docs_files = [f for f in files if f.filename.startswith("docs/")]
|
||||
|
||||
deploy_url = settings.deploy_url.rstrip("/")
|
||||
links: list[str] = []
|
||||
links: list[LinkData] = []
|
||||
for f in docs_files:
|
||||
match = re.match(r"docs/(.*)", f.filename)
|
||||
assert match
|
||||
if not match:
|
||||
continue
|
||||
path = match.group(1)
|
||||
if path.endswith("index.md"):
|
||||
path = path.replace("index.md", "")
|
||||
use_path = path.replace("index.md", "")
|
||||
else:
|
||||
path = path.replace(".md", "/")
|
||||
link = f"{deploy_url}/{path}"
|
||||
use_path = path.replace(".md", "/")
|
||||
link = LinkData(
|
||||
previous_link=f"https://{site_domain}/{use_path}",
|
||||
preview_link=f"{deploy_url}/{use_path}",
|
||||
)
|
||||
links.append(link)
|
||||
links.sort()
|
||||
links.sort(key=lambda x: x.preview_link)
|
||||
|
||||
message = f"📝 Docs preview for commit {settings.commit_sha} at: {deploy_url}"
|
||||
|
||||
if links:
|
||||
message += "\n\n### Modified Pages\n\n"
|
||||
message += "\n".join([f"* {link}" for link in links])
|
||||
for link in links:
|
||||
message += f"* {link.preview_link}"
|
||||
message += f" - ([before]({link.previous_link}))"
|
||||
message += "\n"
|
||||
|
||||
print(message)
|
||||
use_pr.as_issue().create_comment(message)
|
||||
|
@ -70,7 +70,7 @@ def set_polymorphic_default_value(
|
||||
self_instance: _TSQLModel,
|
||||
values: Dict[str, Any],
|
||||
) -> bool:
|
||||
"""By defalut, when init a model, pydantic will set the polymorphic_on
|
||||
"""By default, when init a model, pydantic will set the polymorphic_on
|
||||
value to field default value. But when inherit a model, the polymorphic_on
|
||||
should be set to polymorphic_identity value by default."""
|
||||
cls = type(self_instance)
|
||||
|
Loading…
x
Reference in New Issue
Block a user