Skip to content

Commit

Permalink
Merge branch 'master' into feat/autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo authored Dec 4, 2024
2 parents da62b3b + b88c327 commit 365e374
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- mkdocs.no-insiders.yml
- .github/workflows/build-docs.yml
- .github/workflows/deploy-docs.yml
- data/**
build-docs:
needs:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
rev: v0.8.1
hooks:
- id: ruff
args:
Expand Down
1 change: 1 addition & 0 deletions data/members.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
members:
- login: tiangolo
- login: svlandeg
- login: patrick91
16 changes: 16 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

## Latest Changes

### Features

* 🗑️ Deprecate `shell_complete` and continue to use `autocompletion` for CLI parameters. PR [#974](https://github.com/fastapi/typer/pull/974) by [@svlandeg](https://github.com/svlandeg).

### Docs

* ✏️ Fix a few small typos in the documentation. PR [#1077](https://github.com/fastapi/typer/pull/1077) by [@svlandeg](https://github.com/svlandeg).

### Internal

* 🔧 Update build-docs filter patterns. PR [#1080](https://github.com/fastapi/typer/pull/1080) by [@tiangolo](https://github.com/tiangolo).
* 🔨 Update deploy docs preview script. PR [#1079](https://github.com/fastapi/typer/pull/1079) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update members. PR [#1078](https://github.com/fastapi/typer/pull/1078) by [@tiangolo](https://github.com/tiangolo).
*[pre-commit.ci] pre-commit autoupdate. PR [#1071](https://github.com/fastapi/typer/pull/1071) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Update httpx requirement from <0.28.0,>=0.27.0 to >=0.27.0,<0.29.0. PR [#1065](https://github.com/fastapi/typer/pull/1065) by [@dependabot[bot]](https://github.com/apps/dependabot).

## 0.15.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion requirements-github-actions.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PyGithub>=2.3.0,<3.0.0
pydantic>=2.5.3,<3.0.0
pydantic-settings>=2.1.0,<3.0.0
httpx>=0.27.0,<0.28.0
httpx>=0.27.0,<0.29.0
smokeshow
32 changes: 23 additions & 9 deletions scripts/deploy_docs_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import re

from github import Github
from pydantic import SecretStr
from pydantic import BaseModel, SecretStr
from pydantic_settings import BaseSettings

site_domain = "typer.tiangolo.com"


class Settings(BaseSettings):
github_repository: str
Expand All @@ -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()

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions typer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def __init__(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down Expand Up @@ -414,6 +415,7 @@ def __init__(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down
3 changes: 3 additions & 0 deletions typer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def __init__(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down Expand Up @@ -283,6 +284,7 @@ def __init__(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down Expand Up @@ -411,6 +413,7 @@ def __init__(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down
6 changes: 6 additions & 0 deletions typer/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def Option(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down Expand Up @@ -85,6 +86,7 @@ def Option(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down Expand Up @@ -148,6 +150,7 @@ def Option(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down Expand Up @@ -269,6 +272,7 @@ def Argument(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down Expand Up @@ -325,6 +329,7 @@ def Argument(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down Expand Up @@ -379,6 +384,7 @@ def Argument(
is_eager: bool = False,
envvar: Optional[Union[str, List[str]]] = None,
# Note that shell_complete is not fully supported and will be removed in future versions
# TODO: Remove shell_complete in a future version (after 0.16.0)
shell_complete: Optional[
Callable[
[click.Context, click.Parameter, str],
Expand Down

0 comments on commit 365e374

Please sign in to comment.