fontbakery icon indicating copy to clipboard operation
fontbakery copied to clipboard

cannot import name 'Checker' from 'shaperglot' [googlefonts.glyphsets.shape_languages]

Open arrowtype opened this issue 10 months ago • 9 comments

Observed behaviour

I’m trying to run the adobe fonts profile.

It mostly seems to work well, but the command line output starts with the following error:

/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py:103: UserWarning: Failed to load fontbakery.checks.vendorspecific.googlefonts.glyphsets.shape_languages: cannot import name 'Checker' from 'shaperglot' (/Users/stephennixon/venv/lib/python3.12/site-packages/shaperglot/__init__.py)

Expected behaviour

Based on the current adobefonts profile, I wouldn’t expect the googlefonts.glyphsets.shape_languages check to run at all, so I wouldn’t expect the warning.

Still, I wanted to test the check in general, but even that isn’t working for me:

▶ fontbakery check-googlefonts <Family_path>/fonts/otf/*.*tf                                                                           
/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py:103: UserWarning: Failed to load fontbakery.checks.vendorspecific.googlefonts.glyphsets.shape_languages: cannot import name 'Checker' from 'shaperglot' (/Users/stephennixon/venv/lib/python3.12/site-packages/shaperglot/__init__.py)
  warnings.warn("Failed to load %s: %s" % (import_path, e))
Traceback (most recent call last):
  File "/Users/stephennixon/venv/bin/fontbakery", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/cli.py", line 434, in main
    profile = profile_factory(get_module(args.profile))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py", line 151, in profile_factory
    add_checks_to_nascent_profile(
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py", line 116, in add_checks_to_nascent_profile
    raise ValueError(f"Check '{check}' not found")
ValueError: Check 'googlefonts/glyphsets/shape_languages' not found

I also tried:

  • Running only this check: fontbakery check-googlefonts -c googlefonts.glyphsets.shape_languages <Familyname>/fonts/otf/*.*tf
  • Running a custom profile with only that check

Both things also failed.

Am I doing something wrong?

Possible related issue/typo?

It does seem like there may be a typo in the legacy check IDs, where the new ID is missing an "s" at the end:

https://github.com/fonttools/fontbakery/blob/ffe83a2824631ddbabdbf69c47b8128647de30d1/Lib/fontbakery/legacy_checkids.py#L70

https://github.com/fonttools/fontbakery/blob/ffe83a2824631ddbabdbf69c47b8128647de30d1/Lib/fontbakery/checks/vendorspecific/googlefonts/glyphsets/shape_languages.py#L9-L10

...but I can’t tell if that is having any impact, here.

It does seem to be correctly referenced in the google fonts profile:

https://github.com/fonttools/fontbakery/blob/ffe83a2824631ddbabdbf69c47b8128647de30d1/Lib/fontbakery/profiles/googlefonts.py#L63

Resources and steps needed to reproduce

(Provide the font file that causes the issue, and the exact steps to reproduce it. Also mention the FontBakery version you're using, and some details about your system, e.g. OS, Python version, etc.) I’ve tried making a clean venv and updating versions of various software, but I’m still running into this.

Versions:

  • fontbakery 0.13.2
  • shaperglot 0.6.4
  • glyphsets 1.1.0
  • Python 3.12.2

Any insights appreciated here. I’ll try to update if I realize what’s missing.

Thanks!

arrowtype avatar Feb 06 '25 23:02 arrowtype

Indeed there is a typo. But I am not sure that's related to the issue you're reporting.

I agree that this check should not run on Adobe Fonts profile, and it is not listed there. So maybe there's something else on your setup referencing that check.

felipesanches avatar Feb 07 '25 02:02 felipesanches

Please try to run fontbakery from git which now includes a fix for that typo and let me know if your problem persists.

felipesanches avatar Feb 07 '25 03:02 felipesanches

  • Running only this check: fontbakery check-googlefonts -c googlefonts.glyphsets.shape_languages <Familyname>/fonts/otf/*.*tf

You shouldn't use dots in the check-id. Use forward-slashes instead.

felipesanches avatar Feb 07 '25 03:02 felipesanches

Also, please inspect your setup looking for any fontbakery config file or custom invocation that may be referencing that shape_languages check (either using its old ID or the current one).

felipesanches avatar Feb 07 '25 03:02 felipesanches

Running into a related issue (also check-adobefonts profile). Even when I reproduce the fix you did in 68a7e99, I see

site-packages/fontbakery/fonts_profile.py:103: UserWarning: Failed to load fontbakery.checks.vendorspecific.googlefonts.glyphsets.shape_languages: No module named 'glyphsets'
  warnings.warn("Failed to load %s: %s" % (import_path, e))

Fortunately, this doesn’t seem to affect further progress.

frankrolf avatar Feb 07 '25 07:02 frankrolf

Hey @felipesanches, thanks so much for taking a look!

I deactivated completely removed the old vent, then updated pip and did a fresh install of the latest dev version of Font Bakery:

(venv) 
▶ pip install git+https://github.com/fonttools/fontbakery.git@main
Collecting git+https://github.com/fonttools/fontbakery.git@main
...
Successfully built fontbakery
Installing collected packages: fontbakery
  Attempting uninstall: fontbakery
    Found existing installation: fontbakery 0.13.2
    Uninstalling fontbakery-0.13.2:
      Successfully uninstalled fontbakery-0.13.2
Successfully installed fontbakery-0.13.3.dev1+g68a7e99f

But I seem to be having the same problem:

(venv) 
▶ fontbakery check-googlefonts -c googlefonts/glyphsets/shape_language Familyname/fonts/otf/*.*tf 
/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py:103: UserWarning: Failed to load fontbakery.checks.vendorspecific.googlefonts.glyphsets.shape_languages: cannot import name 'Checker' from 'shaperglot' (/Users/stephennixon/venv/lib/python3.12/site-packages/shaperglot/__init__.py)
  warnings.warn("Failed to load %s: %s" % (import_path, e))
Traceback (most recent call last):
  File "/Users/stephennixon/venv/bin/fontbakery", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/cli.py", line 434, in main
    profile = profile_factory(get_module(args.profile))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py", line 151, in profile_factory
    add_checks_to_nascent_profile(
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py", line 116, in add_checks_to_nascent_profile
    raise ValueError(f"Check '{check}' not found")
ValueError: Check 'googlefonts/glyphsets/shape_languages' not found

I also tried a couple of variations on the check name, with similar results:

(venv) 
▶ fontbakery check-googlefonts -c googlefonts/glyphsets/shape_language Familyname/fonts/otf/*.*tf 
/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py:103: UserWarning: Failed to load fontbakery.checks.vendorspecific.googlefonts.glyphsets.shape_languages: cannot import name 'Checker' from 'shaperglot' (/Users/stephennixon/venv/lib/python3.12/site-packages/shaperglot/__init__.py)
  warnings.warn("Failed to load %s: %s" % (import_path, e))
Traceback (most recent call last):
  File "/Users/stephennixon/venv/bin/fontbakery", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/cli.py", line 434, in main
    profile = profile_factory(get_module(args.profile))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py", line 151, in profile_factory
    add_checks_to_nascent_profile(
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py", line 116, in add_checks_to_nascent_profile
    raise ValueError(f"Check '{check}' not found")
ValueError: Check 'googlefonts/glyphsets/shape_languages' not found
(venv) 
▶ fontbakery check-googlefonts -c com.google.fonts/check/glyphsets/shape_languages Familyname/fonts/otf/*.*tf
/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py:103: UserWarning: Failed to load fontbakery.checks.vendorspecific.googlefonts.glyphsets.shape_languages: cannot import name 'Checker' from 'shaperglot' (/Users/stephennixon/venv/lib/python3.12/site-packages/shaperglot/__init__.py)
  warnings.warn("Failed to load %s: %s" % (import_path, e))
Traceback (most recent call last):
  File "/Users/stephennixon/venv/bin/fontbakery", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/cli.py", line 434, in main
    profile = profile_factory(get_module(args.profile))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py", line 151, in profile_factory
    add_checks_to_nascent_profile(
  File "/Users/stephennixon/venv/lib/python3.12/site-packages/fontbakery/fonts_profile.py", line 116, in add_checks_to_nascent_profile
    raise ValueError(f"Check '{check}' not found")
ValueError: Check 'googlefonts/glyphsets/shape_languages' not found

arrowtype avatar Feb 11 '25 16:02 arrowtype

Also, please inspect your setup looking for any fontbakery config file or custom invocation that may be referencing that shape_languages check (either using its old ID or the current one).

Where might such configuration exist? Outside of fontbakery config files or custom profiles (neither of which I’m calling here) I don’t know where to look.

arrowtype avatar Feb 11 '25 16:02 arrowtype

I'd look at the imports in checks/vendorspecific/googlefonts/shape_languages.py

n7s avatar Feb 19 '25 03:02 n7s

The problem here is that you have the latest released version of shaperglot installed, and Fontbakery is relying on the new API of the 1.0 prerelease. It's pretty helpful for me to know that Fontbakery works with the new API, and I should just hurry up and release 1.0, but relying on an prerelease version which is harder for users to install is unfortunate.

The fix here is pip install -U --pre shaperglot.

simoncozens avatar Feb 20 '25 10:02 simoncozens

With the release of shaperglot stable version 1.0.0 (currently at 1.0.2) I confirm that this issue is no longer present.

n7s avatar Jun 16 '25 19:06 n7s

I'm running check-universal and get this error on 1.1.0

weiweihuanghuang avatar Oct 08 '25 10:10 weiweihuanghuang