-
Notifications
You must be signed in to change notification settings - Fork 1k
Configurable rules for exclusions in bundling of python_modules #10927
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?
Conversation
🦋 Changeset detectedLatest commit: fbade0e The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
63ae386
to
466f746
Compare
466f746
to
fbade0e
Compare
from js import Response, console | ||
def on_fetch(request): | ||
console.log(f"hello {mul(2,3)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you mix console.log()
and print()
? Is there a reason not to choose one and stick with it?
try: | ||
import excluded_module | ||
print("excluded_module found") | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except: | |
except ImportError: |
writeWranglerConfig({ | ||
main: "src/index.py", | ||
compatibility_flags: ["python_workers"], | ||
python_modules_excludes: ["**/*.pyc"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we will eventually want to exclude these by default. But that can be left to followup work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very reasonable to me. Thanks @dom96!
Implements a new
python_modules_excludes
wrangler config field. The user can specify a list of globs in that field to exclude them from being vendored. By default every file inpython_modules
is included but for certain packages they contain so much stuff that sometimes it's good to be able to filter it out, especially since our bundle sizes are limited.Test Plan