-
Notifications
You must be signed in to change notification settings - Fork 710
refactor(bindings/python): Update Stubs and dependencies for split #7181
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
base: main
Are you sure you want to change the base?
Changes from all commits
7292b08
4611cd6
1f28ad1
b4d7773
c7203c2
cf1903c
0e65f88
38f1397
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,39 +38,42 @@ setup: | |
| [group('maintenance')] | ||
| clean: | ||
| @echo "{{ BOLD }}--- Cleaning Rust build artifacts (Cargo) ---{{ NORMAL }}" | ||
| @cargo clean | ||
| @echo "{{ BOLD }}--- Removing .venv/, build/, dist/ directories, and other caches ---{{ NORMAL }}" | ||
| @rm -rf .venv/ build/ dist/ .pytest_cache/ .mypy_cache/ .hypothesis/ .ruff_cache/ | ||
| @echo "{{ BOLD }}--- Removing Python bytecode and compiled extensions ---{{ NORMAL }}" | ||
| @find . -type f -name '*.py[co]' -delete \ | ||
| -o -type d -name __pycache__ -exec rm -rf {} + \ | ||
| -o -type f -name '_opendal*.so' -delete | ||
| @cargo clean --quiet | ||
| @echo "{{ BOLD }}--- Removing build directories, other caches, python bytecode and compiled extensions ---{{ NORMAL }}" | ||
| @find . \ | ||
| \( -type d \( -name __pycache__ -o -name .venv -o -name .build -o -name dist -o -name .pytest_cache -o -name .mypy_cache -o -name .hypothesis -o -name .ruff_cache \) -prune -exec rm -rf {} + \) \ | ||
|
Comment on lines
+42
to
+44
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same logic as before, just done in 1 command now |
||
| -o \ | ||
| \( -type f \( -name '*.py[co]' -o -name '_*.so' \) -delete \) | ||
|
|
||
| # ============================================================================== | ||
| # Dev & Build | ||
| # ============================================================================== | ||
|
|
||
| # Generate Python type stubs | ||
| [group('build')] | ||
| [group('dev')] | ||
| stub-gen: setup | ||
| @echo "{{ BOLD }}--- Generating Python type stubs ---{{ NORMAL }}" | ||
| @cargo run --quiet --manifest-path=../../dev/Cargo.toml -- generate -l python | ||
| @echo "{{ BOLD }}--- Generating stubs for (opendal) ---{{ NORMAL }}" | ||
| @cargo run --quiet --bin stub_gen | ||
| @echo "{{ BOLD }}--- Formatting and fixing generated stubs ---{{ NORMAL }}" | ||
| @just _post-gen-cleanup | ||
|
|
||
| # Internal: Post-generation cleanup (fix linting and formatting) | ||
| [private] | ||
| _post-gen-cleanup: | ||
| -@bash -c 'shopt -s globstar; uv run ruff check **/*.pyi --fix --unsafe-fixes --silent || true' | ||
| @just fmt | ||
|
|
||
| # Compile and produce a release wheel with optimizations | ||
| [group('release')] | ||
| build-release *args: stub-gen | ||
| @echo "{{ BOLD }}--- Building release wheel ---{{ NORMAL }}" | ||
| @echo "{{ BOLD }}--- Building release wheel (opendal) ---{{ NORMAL }}" | ||
| @uv run maturin build -m ./Cargo.toml --profile release --strip --release --out dist {{ args }} | ||
| @uv run mkdocs build | ||
|
|
||
| # Build and install the release wheel in the current venv | ||
| [group('release')] | ||
| install-release *args: stub-gen | ||
| @echo "{{ BOLD }}--- Installing release wheel ---{{ NORMAL }}" | ||
| @echo "{{ BOLD }}--- Installing release wheel (opendal) ---{{ NORMAL }}" | ||
| @uv run maturin develop -m ./Cargo.toml --profile release --strip --release {{ args }} | ||
|
|
||
| # Build and install the release wheel in the current venv | ||
|
|
@@ -84,20 +87,20 @@ bench: install-release | |
| # Build only a source distribution (sdist) without compiling | ||
| [group('release')] | ||
| sdist *args: stub-gen | ||
| @echo "{{ BOLD }}--- Building source distribution without compiling ---{{ NORMAL }}" | ||
| @echo "{{ BOLD }}--- Building source distribution without compiling (opendal) ---{{ NORMAL }}" | ||
| @uv run maturin sdist -m ./Cargo.toml --out dist {{ args }} | ||
|
|
||
| # Compile and produce a development wheel | ||
| [group('dev')] | ||
| build-dev *args: stub-gen | ||
| @echo "{{ BOLD }}--- Building development wheel ---{{ NORMAL }}" | ||
| @echo "{{ BOLD }}--- Building development wheel (opendal) ---{{ NORMAL }}" | ||
| @uv run maturin build -m ./Cargo.toml --out dist {{ args }} | ||
| @uv run mkdocs build | ||
|
|
||
| # Build and install the development wheel in the current venv | ||
| [group('dev')] | ||
| install-dev *args: stub-gen | ||
| @echo "{{ BOLD }}--- Installing development wheel ---{{ NORMAL }}" | ||
| @echo "{{ BOLD }}--- Installing development wheel (opendal) ---{{ NORMAL }}" | ||
| @uv run maturin develop -m ./Cargo.toml {{ args }} | ||
|
|
||
| # Run tests | ||
|
|
@@ -113,11 +116,12 @@ test *args: install-dev | |
| # Run all lint checks for Rust and Python | ||
| [group('lint')] | ||
| lint: setup | ||
| @echo "{{ BOLD }}--- Running Rust linter (Clippy) ---{{ NORMAL }}" | ||
| @echo "{{ BOLD }}--- Running Rust linter ---{{ NORMAL }}" | ||
| ## remove `-A clippy::incompatible_msrv` until https://github.com/rust-lang/rust-clippy/issues/15792 is fixed and released | ||
| @cargo clippy -- -D warnings -D clippy::dbg_macro -A clippy::incompatible_msrv | ||
| @echo "{{ BOLD }}--- Running Python linter (Ruff) ---{{ NORMAL }}" | ||
| @echo "{{ BOLD }}--- Running Python linter ---{{ NORMAL }}" | ||
| @uv run ruff check | ||
| @uv run ty check ./python | ||
|
|
||
| # Format all code (Rust, Python, etc.) | ||
| [group('lint')] | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,34 +15,18 @@ | |
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # ruff: noqa: D104 | ||
| from __future__ import annotations | ||
| # ruff: noqa: D104, F405, F403 | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| if TYPE_CHECKING: | ||
| __version__: str | ||
| from opendal import capability, exceptions, file, layers, services, types | ||
| else: | ||
| from opendal._opendal import ( | ||
| __version__, # noqa: F401 | ||
| capability, | ||
| exceptions, | ||
| file, | ||
| layers, | ||
| services, | ||
| types, | ||
| ) | ||
|
|
||
| from opendal.operator import AsyncOperator, Operator # pyright:ignore | ||
| from opendal._opendal import * # ty: ignore | ||
| from opendal.operator import AsyncOperator, Operator | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @frostming as you made some recent changes, can you check this out, if this works ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it reverts my change and the typecheckers can't find types, because In fact I don't understand why you moved *.pyi into its own package. it looks less clean
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is done by a recent update of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| __all__ = [ | ||
| "capability", | ||
| "exceptions", | ||
| "file", | ||
| "layers", | ||
| "services", | ||
| "types", | ||
| "AsyncOperator", | ||
| "Operator", | ||
| "__version__", | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # This file is automatically generated by pyo3_stub_gen | ||
| # ruff: noqa: E501, F401, F403, F405 | ||
|
|
||
| from opendal import capability, exceptions, file, layers, operator, types | ||
|
|
||
| __all__ = [ | ||
| "capability", | ||
| "exceptions", | ||
| "file", | ||
| "layers", | ||
| "operator", | ||
| "types", | ||
| ] |

Uh oh!
There was an error while loading. Please reload this page.