-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Documentation on reducing package size and custom CFLAGS #2517
Documentation on reducing package size and custom CFLAGS #2517
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2517 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 25 25
Lines 5109 5109
Branches 1050 1050
=========================================
Hits 5109 5109 Continue to review full report at Codecov.
|
@PrettyWood I was wondering, should I request a review for this somewhere? And if so, where can I do this? |
I let Samuel merge PRs. Nothing to do on your side ;) |
Hopefully I can make time to work on pydantic next week. |
Great, I'll leave it here then. No rush from my side. |
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.
otherwise LGTM.
os.environ['CFLAGS'] = '-O3' | ||
# Set CFLAG to all optimizations (-O3) | ||
# Any additional CFLAGS will be appended. Only the last optimization flag will have effect | ||
os.environ['CFLAGS'] = '-O3 ' + os.environ.get('CFLAGS', '') |
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.
👍
please update. |
@samuelcolvin Thank you for the review. I updated this PR according to the suggestions, rebased the changes on the latest master, and pushed the changes here. This should be ready to merge. please review. |
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.
Please update and rebase/merge to have new deps to fix CI.
Otherwise looks good thanks!
@PrettyWood I:
Please review |
https://smokeshow.helpmanual.io/4944455v3p5m500e732e/install/ I think you need to remove the colon at the end of |
Squashed commit Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
resolved please review |
Change Summary
setup.py
to allow for custom CFLAGS when compiling.Setup.py CFLAGS
pydantic's
setup.py
overwrites all custom CFLAGS that a user might pass in when rebuilding pydantic.This change appends custom CFLAGS to the current CFLAGS used when building. There should not be any change in the current default behaviour.
By appending custom CFLAGS to the end it is possible to overwrite the default optimization flags currently used in pydantic. From the gcc docs:
Performance impact of setting different CFLAGS
pip install
(from PyPI)pip install --no-binary
(from PyPI)pip install --no-binary
(from PyPI) with cythonpip install --no-binary
with cython CFLAG "-O3" (This branch)pip install --no-binary
with cython CFLAG "-Os" (This branch)Related issue number
Issue #2276 will be resolved by documenting how to reduce pydantic installation size. Additionally, users can pass in custom CFLAGs to trade-off speed vs size.
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)