adobe-fonts / source-code-pro

Monospaced font family for user interface and coding environments
https://adobe-fonts.github.io/source-code-pro/
SIL Open Font License 1.1
19.85k stars 1.62k forks source link

Added `fs` dependency #253

Closed arifer612 closed 3 years ago

arifer612 commented 3 years ago

fs package also required to build fonts from source.

frankrolf commented 3 years ago

I’m curious about this. Where is it needed? Which system are you on?

arifer612 commented 3 years ago

I was setting up a new ZorinOS distro and building the fonts from source. On my first attempt at building it with ./build.sh, I hit a ModuleNotFoundError. I could not find an exact dependence of fs in any of the source code but after digging into fonttools, I think that this is the reason why the error was raised: https://github.com/fonttools/fonttools/blob/186032cb10d399d6f1e0de540770e035f38db0e7/requirements.txt#L9

It seems that it did not get installed as a dependency when I installed fonttools through pip3 install fonttools.

cjchapman commented 3 years ago

fs gets installed as a dependency of afdko. I confirmed that in a virtual environment just now.

cjchapman commented 3 years ago
(test_env) cchapman-macOS:tmp cchapman$ pip freeze
(test_env) cchapman-macOS:tmp cchapman$ pip install afdko
Collecting afdko
  Using cached afdko-3.5.1-py3-none-macosx_10_13_x86_64.whl (2.4 MB)
Collecting fontMath>=0.6.0
  Using cached fontMath-0.6.0-py2.py3-none-any.whl (31 kB)
Collecting fontTools[lxml,ufo,unicode,woff]>=4.14.0
  Using cached fonttools-4.16.1-py3-none-any.whl (818 kB)
Collecting ufoProcessor>=1.9.0
  Using cached ufoProcessor-1.9.0-py2.py3-none-any.whl (22 kB)
Collecting booleanOperations>=0.9.0
  Using cached booleanOperations-0.9.0-py3-none-any.whl (18 kB)
Collecting tqdm>=4.48.2
  Using cached tqdm-4.51.0-py2.py3-none-any.whl (70 kB)
Collecting defcon[lxml,pens]>=0.7.2
  Using cached defcon-0.7.2-py3-none-any.whl (228 kB)
Collecting ufonormalizer>=0.4.2
  Using cached ufonormalizer-0.4.2-py2.py3-none-any.whl (16 kB)
Collecting lxml>=4.5.2
  Using cached lxml-4.6.1-cp38-cp38-macosx_10_9_x86_64.whl (4.6 MB)
Collecting mutatorMath>=3.0.1
  Using cached MutatorMath-3.0.1-py2.py3-none-any.whl (31 kB)
Collecting psautohint>=2.1.0
  Using cached psautohint-2.1.2-cp38-cp38-macosx_10_9_x86_64.whl (221 kB)
Collecting fs<3,>=2.2.0; extra == "ufo"
  Using cached fs-2.4.11-py2.py3-none-any.whl (127 kB)
Collecting unicodedata2>=13.0.0; (python_version < "3.9" and platform_python_implementation != "PyPy") and extra == "unicode"
  Using cached unicodedata2-13.0.0.post2-cp38-cp38-macosx_10_9_x86_64.whl (417 kB)
Collecting brotli>=1.0.1; platform_python_implementation != "PyPy" and extra == "woff"
  Using cached Brotli-1.0.9-cp38-cp38-macosx_10_9_x86_64.whl (421 kB)
Collecting zopfli>=0.1.4; extra == "woff"
  Using cached zopfli-0.1.7-cp38-cp38-macosx_10_9_x86_64.whl (38 kB)
Collecting fontParts>=0.8.2
  Using cached fontParts-0.9.6-py3-none-any.whl (161 kB)
Collecting pyclipper>=1.1.0.post1
  Using cached pyclipper-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl (136 kB)
Collecting fontPens>=0.1.0; extra == "pens"
  Using cached fontPens-0.2.4-py2.py3-none-any.whl (19 kB)
Collecting pytz
  Using cached pytz-2020.4-py2.py3-none-any.whl (509 kB)
Collecting six~=1.10
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: setuptools in ./test_env/lib/python3.8/site-packages (from fs<3,>=2.2.0; extra == "ufo"->fontTools[lxml,ufo,unicode,woff]>=4.14.0->afdko) (47.1.0)
Collecting appdirs~=1.4.3
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Installing collected packages: lxml, pytz, six, appdirs, fs, unicodedata2, brotli, zopfli, fontTools, fontMath, fontPens, defcon, mutatorMath, pyclipper, booleanOperations, fontParts, ufoProcessor, tqdm, ufonormalizer, psautohint, afdko
Successfully installed afdko-3.5.1 appdirs-1.4.4 booleanOperations-0.9.0 brotli-1.0.9 defcon-0.7.2 fontMath-0.6.0 fontParts-0.9.6 fontPens-0.2.4 fontTools-4.16.1 fs-2.4.11 lxml-4.6.1 mutatorMath-3.0.1 psautohint-2.1.2 pyclipper-1.2.0 pytz-2020.4 six-1.15.0 tqdm-4.51.0 ufoProcessor-1.9.0 ufonormalizer-0.4.2 unicodedata2-13.0.0.post2 zopfli-0.1.7
WARNING: You are using pip version 20.1.1; however, version 20.2.4 is available.
You should consider upgrading via the '/Users/cchapman/tmp/test_env/bin/python3 -m pip install --upgrade pip' command.
(test_env) cchapman-macOS:tmp cchapman$ pip freeze
afdko==3.5.1
appdirs==1.4.4
booleanOperations==0.9.0
Brotli==1.0.9
defcon==0.7.2
fontMath==0.6.0
fontParts==0.9.6
fontPens==0.2.4
fonttools==4.16.1
fs==2.4.11
lxml==4.6.1
MutatorMath==3.0.1
psautohint==2.1.2
pyclipper==1.2.0
pytz==2020.4
six==1.15.0
tqdm==4.51.0
ufonormalizer==0.4.2
ufoProcessor==1.9.0
unicodedata2==13.0.0.post2
zopfli==0.1.7
(test_env) cchapman-macOS:tmp cchapman$ 
cjchapman commented 3 years ago

Since fonttools is also installed as a dependency of afdko (see above), I think it would be better to change that line from:

pip3 install afdko fonttools

to:

pip3 install afdko
arifer612 commented 3 years ago

I managed to reproduce what @cjchapman did and agree with what he suggests. It turns out that doing

pip3 install afdko fonttools

actually ends up installing fewer dependencies than expected.

The output of the above command is as follows:

[I] ➜ pip3 install afdko fonttools                                                                                        
Collecting afdko
  Using cached afdko-3.5.1-py3-none-manylinux2010_x86_64.whl (2.6 MB)
Collecting fonttools
  Using cached fonttools-4.16.1-py3-none-any.whl (818 kB)
Collecting booleanOperations>=0.9.0
  Using cached booleanOperations-0.9.0-py3-none-any.whl (18 kB)
Collecting lxml>=4.5.2
  Using cached lxml-4.6.1-cp36-cp36m-manylinux1_x86_64.whl (5.5 MB)
Collecting mutatorMath>=3.0.1
  Using cached MutatorMath-3.0.1-py2.py3-none-any.whl (31 kB)
Collecting fontMath>=0.6.0
  Using cached fontMath-0.6.0-py2.py3-none-any.whl (31 kB)
Collecting psautohint>=2.1.0
  Using cached psautohint-2.1.2-cp36-cp36m-manylinux1_x86_64.whl (590 kB)
Collecting ufoProcessor>=1.9.0
  Using cached ufoProcessor-1.9.0-py2.py3-none-any.whl (22 kB)
Collecting defcon[lxml,pens]>=0.7.2
  Using cached defcon-0.7.2-py3-none-any.whl (228 kB)
Collecting ufonormalizer>=0.4.2
  Using cached ufonormalizer-0.4.2-py2.py3-none-any.whl (16 kB)
Collecting tqdm>=4.48.2
  Using cached tqdm-4.51.0-py2.py3-none-any.whl (70 kB)
Collecting pyclipper>=1.1.0.post1
  Using cached pyclipper-1.2.0-cp36-cp36m-manylinux1_x86_64.whl (126 kB)
Collecting fontParts>=0.8.2
  Using cached fontParts-0.9.6-py3-none-any.whl (161 kB)
Collecting fontPens>=0.1.0; extra == "pens"
  Using cached fontPens-0.2.4-py2.py3-none-any.whl (19 kB)
Installing collected packages: pyclipper, fonttools, booleanOperations, lxml, fontMath, fontPens, defcon, mutatorMath, psautohint, fontParts, ufoProcessor, ufonormalizer, tqdm, afdko
Successfully installed afdko-3.5.1 booleanOperations-0.9.0 defcon-0.7.2 fontMath-0.6.0 fontParts-0.9.6 fontPens-0.2.4 fonttools-4.16.1 lxml-4.6.1 mutatorMath-3.0.1 psautohint-2.1.2 pyclipper-1.2.0 tqdm-4.51.0 ufoProcessor-1.9.0 ufonormalizer-0.4.2

where you can see that fs is clearly not being installed.

Moreover, doing pip freeze afterwards, I get the following:

afdko==3.5.1
booleanOperations==0.9.0
defcon==0.7.2
fontMath==0.6.0
fontParts==0.9.6
fontPens==0.2.4
fonttools==4.16.1
lxml==4.6.1
MutatorMath==3.0.1
pkg-resources==0.0.0
psautohint==2.1.2
pyclipper==1.2.0
tqdm==4.51.0
ufonormalizer==0.4.2
ufoProcessor==1.9.0

which is fewer packages installed compared to what @cjchapman got. I got the same results on 2 different Linux machines, using both venv and virtualenv to create the virtual environments to test.

Installing afdko alone sounds like a better solution than adding fs as an additional dependency to install.

josh-hadley commented 3 years ago

The reason for the difference between pip install afdko fonttools versus pip install afdko is that afdko's requirement is not simply fonttools, but fonttools[lxml,ufo,unicode,woff]. The ufo extra for fonttools is what triggers fs to get installed: https://github.com/fonttools/fonttools/blob/67d01e837c0289b95f3d5f49ed73f026d4f078a7/setup.py#L72-L76

The current (and soon-to-be-legacy) resolver in pip has some problems, and apparently this hits one of them (doesn't fully resolve packages from CLI pip install <package>. Using pip v20.2 or later with the new resolver: pip install afdko fonttools --use-feature=2020-resolver ...it does correctly follow afdko's extras for fonttools, and fs gets installed.

This is kind of moot for this issue because the approved change of just pip install afdko fixes everything, but I wanted to understand what was going on and document it. So there you have it.

arifer612 commented 3 years ago

@josh-hadley Thank you for your clarification and explanation of the resolver issue!