From 831ed762a0178f0237a013227481c094ef8828cb Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Mon, 4 Nov 2024 13:26:09 -0500 Subject: [PATCH] [ttx_diff] Use pip-compile and requirements.in This is a more consistent way of ensuring we have pinned our python dependencies. --- fontc_crater/README.md | 18 +- resources/scripts/constraints.txt | 97 --------- resources/scripts/requirements.in | 12 ++ resources/scripts/requirements.txt | 334 +++++++++++++++++++++++++++-- 4 files changed, 343 insertions(+), 118 deletions(-) delete mode 100644 resources/scripts/constraints.txt create mode 100644 resources/scripts/requirements.in diff --git a/fontc_crater/README.md b/fontc_crater/README.md index f1f74571..c7d9e07a 100644 --- a/fontc_crater/README.md +++ b/fontc_crater/README.md @@ -22,14 +22,15 @@ script in the [`fontc_crater` repo][crater-repo] and results are posted to To run in CI mode locally to play with the html output: When run in CI, we want to ensure that we have complete control over the set of -python pacakges we are comparing against; to ensure this we use `constraints.txt` -in the root `resources/scripts` directory. To update the set of python packages -in use, you need to update this file: +python pacakges we are comparing against; to ensure this we use `pip-compile` +(part of [`pip-tools`]) to generate a pinned `requirements.txt` from a +`requirements.in` file in the root `resources/scripts` directory. To update the +set of python packages in use, you need to update this file: -- `rm -rf` your existing venv -- create a new venv and activate it -- `pip install -r resources/scripts/requirements.txt` -- `pip freeze > resources/scripts/constraints.txt` +- make sure you have pip-tools installed (`python -m pip install pip-tools`) +- delete `resources/scripts/requirements.txt` +- run `pip-compile resources/scripts/requirements.in` +- commit the new `requirements.txt` file. ```shell # clone git@github.com:googlefonts/fontc_crater.git somewhere, we'll assume at ../fontc_crater @@ -45,5 +46,4 @@ $ cargo run --release -p=fontc_crater -- ci ../fontc_crater/gf-repos-2024-09-23. [rust-lang/crater]: https://github.com/rust-lang/crater [crater-repo]: https://github.com/googlefonts/fontc_crater [crater-results]: https://googlefonts.github.io/fontc_crater/ - - +[`pip-tools`]: https://github.com/jazzband/pip-tools diff --git a/resources/scripts/constraints.txt b/resources/scripts/constraints.txt deleted file mode 100644 index b7db6597..00000000 --- a/resources/scripts/constraints.txt +++ /dev/null @@ -1,97 +0,0 @@ -absl-py==2.1.0 -afdko==4.0.1 -appdirs==1.4.4 -attrs==24.2.0 -axisregistry==0.4.11 -babelfont==3.0.5 -beautifulsoup4==4.12.3 -booleanOperations==0.9.0 -Brotli==1.1.0 -bump2version==1.0.1 -bumpfontversion==0.4.1 -cattrs==24.1.2 -cdifflib==1.2.6 -certifi==2024.8.30 -cffi==1.17.1 -cffsubr==0.3.0 -charset-normalizer==3.4.0 -compreffor==0.5.6 -cryptography==43.0.3 -defcon==0.10.3 -Deprecated==1.2.14 -font-v==2.1.0 -fontFeatures==1.8.0 -fontmake==3.10.0 -fontMath==0.9.4 -fontParts==0.12.2 -fontPens==0.2.4 -fonttools==4.54.1 -fs==2.4.16 -gflanguages==0.7.0 -gfsubsets==2024.9.25 -gftools @ git+https://github.com/googlefonts/gftools.git@31d7c7871796abdcaca25e98535abbcfe188b950 -gitdb==4.0.11 -GitPython==3.1.43 -glyphsets==1.0.0 -glyphsLib==6.9.2 -idna==3.10 -importlib_resources==6.4.5 -Jinja2==3.1.4 -lxml==5.3.0 -markdown-it-py==3.0.0 -MarkupSafe==3.0.2 -mdurl==0.1.2 -MutatorMath==3.0.1 -nanoemoji==0.15.1 -networkx==3.4.2 -ninja==1.11.1.1 -openstep_plist==0.4.0 -opentype-sanitizer==9.1.0 -orjson==3.10.10 -packaging==24.1 -picosvg==0.22.1 -pillow==11.0.0 -pngquant-cli==3.0.3 -protobuf==3.20.3 -pyclipper==1.3.0.post6 -pycparser==2.22 -pygit2==1.14.1 -PyGithub==2.4.0 -Pygments==2.18.0 -PyJWT==2.9.0 -PyNaCl==1.5.0 -pyparsing==3.2.0 -python-dateutil==2.9.0.post0 -PyYAML==6.0.2 -regex==2024.9.11 -requests==2.32.3 -resvg-cli==0.44.0 -rich==13.9.3 -ruamel.yaml==0.18.6 -ruamel.yaml.clib==0.2.12 -setuptools==75.3.0 -six==1.16.0 -skia-pathops==0.8.0.post2 -smmap==5.0.1 -soupsieve==2.6 -statmake==0.6.0 -strictyaml==1.7.3 -tabulate==0.9.0 -toml==0.10.2 -tqdm==4.66.6 -ttfautohint-py==0.5.1 -typing_extensions==4.12.2 -ufo2ft==3.3.1 -ufoLib2==0.16.1 -ufomerge==1.8.2 -ufonormalizer==0.6.2 -ufoProcessor==1.13.1 -uharfbuzz==0.41.1 -unicodedata2==15.1.0 -Unidecode==1.3.8 -urllib3==2.2.3 -vfbLib==0.7.1 -vharfbuzz==0.3.1 -vttLib==0.12.0 -wrapt==1.16.0 -zopfli==0.2.3.post1 diff --git a/resources/scripts/requirements.in b/resources/scripts/requirements.in new file mode 100644 index 00000000..5e7f674f --- /dev/null +++ b/resources/scripts/requirements.in @@ -0,0 +1,12 @@ +absl-py +# keep fontmake version pinned to ensure output from ttx_diff.py is stable; +# the 'repacker' option enables faster GSUB/GPOS serialization via uharfbuzz +fontmake[repacker]==3.10.0 +# technically fonttools is in turn a dependency of fontmake but a few of +# our scripts import it directly, so we list it among the top-level requirements. +fonttools +lxml +cdifflib +glyphsLib +# our custom branch of gftools +git+https://github.com/googlefonts/gftools.git@fontc-flag-sketch diff --git a/resources/scripts/requirements.txt b/resources/scripts/requirements.txt index 5e7f674f..970b4c25 100644 --- a/resources/scripts/requirements.txt +++ b/resources/scripts/requirements.txt @@ -1,12 +1,322 @@ -absl-py -# keep fontmake version pinned to ensure output from ttx_diff.py is stable; -# the 'repacker' option enables faster GSUB/GPOS serialization via uharfbuzz -fontmake[repacker]==3.10.0 -# technically fonttools is in turn a dependency of fontmake but a few of -# our scripts import it directly, so we list it among the top-level requirements. -fonttools -lxml -cdifflib -glyphsLib -# our custom branch of gftools -git+https://github.com/googlefonts/gftools.git@fontc-flag-sketch +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# pip-compile resources/scripts/requirements.in +# +absl-py==2.1.0 + # via + # -r resources/scripts/requirements.in + # gftools + # nanoemoji + # picosvg +afdko==4.0.1 + # via gftools +appdirs==1.4.4 + # via fs +attrs==24.2.0 + # via + # cattrs + # statmake + # ufolib2 +axisregistry==0.4.11 + # via gftools +babelfont==3.0.5 + # via gftools +beautifulsoup4==4.12.3 + # via gftools +booleanoperations==0.9.0 + # via + # afdko + # fontparts + # ufo2ft +brotli==1.1.0 + # via + # fonttools + # gftools +bump2version==1.0.1 + # via bumpfontversion +bumpfontversion==0.4.1 + # via gftools +cattrs==24.1.2 + # via + # statmake + # ufolib2 +cdifflib==1.2.6 + # via -r resources/scripts/requirements.in +certifi==2024.8.30 + # via requests +cffi==1.17.1 + # via + # cryptography + # pygit2 + # pynacl +cffsubr==0.3.0 + # via ufo2ft +charset-normalizer==3.4.0 + # via requests +compreffor==0.5.6 + # via ufo2ft +cryptography==43.0.3 + # via pyjwt +defcon[lxml,pens]==0.10.3 + # via + # afdko + # fontparts + # glyphsets + # mutatormath + # ufoprocessor +deprecated==1.2.14 + # via pygithub +font-v==2.1.0 + # via gftools +fontfeatures==1.8.0 + # via + # babelfont + # gftools +fontmake[json,repacker]==3.10.0 + # via + # -r resources/scripts/requirements.in + # gftools +fontmath==0.9.4 + # via + # afdko + # fontmake + # fontparts + # mutatormath + # ufo2ft + # ufoprocessor +fontparts==0.12.2 + # via ufoprocessor +fontpens==0.2.4 + # via defcon +fonttools[lxml,repacker,ufo,unicode,woff]==4.54.1 + # via + # -r resources/scripts/requirements.in + # afdko + # axisregistry + # babelfont + # booleanoperations + # bumpfontversion + # cffsubr + # compreffor + # defcon + # font-v + # fontfeatures + # fontmake + # fontmath + # fontparts + # fontpens + # gftools + # glyphsets + # glyphslib + # mutatormath + # nanoemoji + # statmake + # ufo2ft + # ufolib2 + # ufomerge + # ufoprocessor + # vfblib + # vharfbuzz + # vttlib +fs==2.4.16 + # via + # fontfeatures + # fonttools +gflanguages==0.7.0 + # via + # gftools + # glyphsets +gfsubsets==2024.9.25 + # via gftools +gftools @ git+https://github.com/googlefonts/gftools.git@fontc-flag-sketch + # via -r resources/scripts/requirements.in +gitdb==4.0.11 + # via gitpython +gitpython==3.1.43 + # via font-v +glyphsets==1.0.0 + # via gftools +glyphslib==6.9.2 + # via + # -r resources/scripts/requirements.in + # babelfont + # bumpfontversion + # fontmake + # gftools + # glyphsets +idna==3.10 + # via requests +importlib-resources==6.4.5 + # via + # gflanguages + # gfsubsets +jinja2==3.1.4 + # via gftools +lxml==5.3.0 + # via + # -r resources/scripts/requirements.in + # afdko + # fontfeatures + # fonttools + # nanoemoji + # picosvg +markdown-it-py==3.0.0 + # via rich +markupsafe==3.0.2 + # via jinja2 +mdurl==0.1.2 + # via markdown-it-py +mutatormath==3.0.1 + # via ufoprocessor +nanoemoji==0.15.1 + # via gftools +networkx==3.4.2 + # via gftools +ninja==1.11.1.1 + # via + # gftools + # nanoemoji +openstep-plist==0.4.0 + # via + # babelfont + # bumpfontversion + # glyphslib +opentype-sanitizer==9.1.0 + # via gftools +orjson==3.10.10 + # via + # babelfont + # ufolib2 +packaging==24.1 + # via gftools +picosvg==0.22.1 + # via nanoemoji +pillow==11.0.0 + # via + # gftools + # nanoemoji +pngquant-cli==3.0.3 + # via nanoemoji +protobuf==3.20.3 + # via + # axisregistry + # gflanguages + # gftools +pyclipper==1.3.0.post6 + # via booleanoperations +pycparser==2.22 + # via cffi +pygit2==1.14.1 + # via gftools +pygithub==2.4.0 + # via gftools +pygments==2.18.0 + # via rich +pyjwt[crypto]==2.9.0 + # via pygithub +pynacl==1.5.0 + # via pygithub +pyparsing==3.2.0 + # via vttlib +python-dateutil==2.9.0.post0 + # via strictyaml +pyyaml==6.0.2 + # via + # gftools + # glyphsets +regex==2024.9.11 + # via nanoemoji +requests==2.32.3 + # via + # gftools + # glyphsets + # pygithub +resvg-cli==0.44.0 + # via nanoemoji +rich==13.9.3 + # via gftools +ruamel-yaml==0.18.6 + # via gftools +ruamel-yaml-clib==0.2.12 + # via ruamel-yaml +six==1.16.0 + # via + # fs + # python-dateutil +skia-pathops==0.8.0.post2 + # via + # gftools + # picosvg +smmap==5.0.1 + # via gitdb +soupsieve==2.6 + # via beautifulsoup4 +statmake==0.6.0 + # via gftools +strictyaml==1.7.3 + # via gftools +tabulate==0.9.0 + # via gftools +toml==0.10.2 + # via nanoemoji +tqdm==4.66.6 + # via afdko +ttfautohint-py==0.5.1 + # via gftools +typing-extensions==4.12.2 + # via + # pygithub + # vfblib +ufo2ft[cffsubr,compreffor]==3.3.1 + # via + # fontmake + # nanoemoji +ufolib2[json]==0.16.1 + # via + # babelfont + # bumpfontversion + # fontmake + # glyphslib + # nanoemoji + # ufomerge + # vfblib + # vttlib +ufomerge==1.8.2 + # via gftools +ufonormalizer==0.6.2 + # via + # afdko + # vfblib +ufoprocessor==1.13.1 + # via afdko +uharfbuzz==0.41.1 + # via + # fonttools + # vharfbuzz +unicodedata2==15.1.0 + # via + # fonttools + # glyphsets +unidecode==1.3.8 + # via gftools +urllib3==2.2.3 + # via + # pygithub + # requests +vfblib==0.7.1 + # via babelfont +vharfbuzz==0.3.1 + # via gftools +vttlib==0.12.0 + # via gftools +wrapt==1.16.0 + # via deprecated +zopfli==0.2.3.post1 + # via + # fonttools + # nanoemoji + +# The following packages are considered to be unsafe in a requirements file: +# setuptools