Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sras/fix type gen script #33

Merged
merged 11 commits into from
Nov 26, 2023
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
1 change: 1 addition & 0 deletions polugins_type_gen/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ polugins = ">=0.2"
optional = true

[tool.poetry.group.dev.dependencies]
polugins = ">=0.2" # We use it for the scripts/generate_polars_stubs.py
pytest = "^7.3.1"
mypy = "^1.3.0"
ruff = "^0.1.5"
Expand Down
5 changes: 3 additions & 2 deletions polugins_type_gen/src/polugins_type_gen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@

from polugins.main import _get_namespaces


def has_version(version: str) -> bool:
files = importlib_resources.files("polugins_type_gen")
return (files / "_stubs" / version).is_dir()



def create_stubs(version: str):
output_dir = Path("typings")
if not has_version(version):
msg = (f"Type stubs for version {version} does not exist."
msg = (
f"Type stubs for version {version} does not exist."
" This is usually because the version has been yanked."
" Feel free to create an issue if you want to generate types for this version"
)
Expand Down
Loading