feat(cli): Add --skip-native-installation option to by pass installing packages in native venv - #251
ryanking13 wants to merge 1 commit into
Conversation
| However, when you are testing your local package that does not include | ||
| any native extensions, you can use the `--allow-local` flag to allow installing | ||
| it from source distribution. | ||
|
|
||
| ``` | ||
| uv run pywrangler sync --allow-local | ||
| ``` |
There was a problem hiding this comment.
The documented --allow-local option does not exist; the CLI exposes --allow-build.
| However, when you are testing your local package that does not include | |
| any native extensions, you can use the `--allow-local` flag to allow installing | |
| it from source distribution. | |
| ``` | |
| uv run pywrangler sync --allow-local | |
| ``` | |
| However, when you are testing a local package that does not include any native | |
| extensions, you can use the `--allow-build` flag to allow installing it from a | |
| source distribution. | |
| ```bash | |
| uv run pywrangler sync --allow-build |
| 1. It takes more time to install packages. | ||
| 2. It may fail if the package is built only for the WASM environment / Worker runtime. | ||
|
|
||
| In such cases, you can pass the `--skip-native` flag to skip the native installation, and only install the package for the Worker runtime. |
There was a problem hiding this comment.
The prose names a flag that Click does not register, so this direct instruction fails.
| In such cases, you can pass the `--skip-native` flag to skip the native installation, and only install the package for the Worker runtime. | |
| In such cases, you can pass the `--skip-native-installation` flag to skip the native installation, and only install the package for the Worker runtime. |
|
I'm Bonk, and I've done a quick review of your PR. Adds an option to skip native virtual-environment package installation during sync.
|
dom96
left a comment
There was a problem hiding this comment.
Seems fine, though I wonder if having these two separate modes is the best way to solve this. The problem to me seems that your project would only have 1 or 2 such packages, so disabling native installation for the full project would affect your other packages too. Could we get pywrangler to intelligently know that a package cannot be installed natively and so skip the installation for only that package?
I think that is possible. But actually, it turned out that pyscopg does not need this patch (I was building the wrong package), so let me mark this as draft until we find out the actual use case of this flag. |
This adds a new
--skip-native-installationflag topywrangler sync.When this flag is enabled, pywrangler will install packages only to the Pyodide venv, not in native venv. This is useful in two scenarios.
When there is no pre-compiled wheel for the native environment. (e.g.
psycopg-c)In CI, when users don't need auto completion, type hints etc.