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

Slim packages by using cache #260

Closed
kennydude opened this issue Oct 5, 2018 · 6 comments
Closed

Slim packages by using cache #260

kennydude opened this issue Oct 5, 2018 · 6 comments

Comments

@kennydude
Copy link

Would it be possible to slim packages by only keeping the Python bytecode?

Mapbox have seemingly been able to come up with some commands to move the pyc files into place so they are used instead of the py files (we can't really edit the source python files once it's on lambda anyway) -- https://blog.mapbox.com/aws-lambda-python-magic-e0f6a407ffc6 see "Magic trick"

@dschep
Copy link
Collaborator

dschep commented Oct 7, 2018

Intereseting idea. But as they meniont, its a very small differenc compared to the .py files. It might make it a bit faster too tho. Currently, since it doesn't require a trick (moving files around) the slim option deletes the pyc files instead.

It'd be interesting to do the otherway around as mapbox is doing, but that'll be a bit more complicated.

But also.. I didn't realize this. this is good to know:

LD_LIBRARY_PATH is set to /var/task/lib

@Suor
Copy link

Suor commented Oct 20, 2018

Deleting pyc files makes cold start slower. I would leave them as is.

@dschep
Copy link
Collaborator

dschep commented Oct 22, 2018

I don't remember the exact portability of pyc files. Namely, can a python3.6 pyc file from windows or mac os be used with python3.6 in linux?

@kennydude
Copy link
Author

Linked from the original post this post suggests:

The contents of the ‘spam.pyc’ file are platform independent, so a Python module directory can be shared by machines of different architectures.

@bweigel
Copy link
Contributor

bweigel commented Nov 9, 2018

Maybe #276 could solve this. You could exclude .py files and override the deletion of the .pyc files.

@pgrzesik
Copy link
Collaborator

Hey 👋 I'm closing this ticket as it looks like it's heavily outdated, we can of course reopen it if needed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants