Documentation on reducing package size and custom CFLAGS#2517
Documentation on reducing package size and custom CFLAGS#2517PrettyWood merged 1 commit intopydantic:masterfrom peterroelants:allow_custom_compile_flags
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. |
| 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', '') |
|
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. |
|
@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.pyto allow for custom CFLAGS when compiling.Setup.py CFLAGS
pydantic's
setup.pyoverwrites 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-binarywith cython CFLAG "-O3" (This branch)pip install --no-binarywith 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>.mdfile added describing change(see changes/README.md for details)