Skip to content
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

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

Open
arrowtype opened this issue Feb 6, 2025 · 9 comments

Comments

@arrowtype
Copy link
Contributor

arrowtype commented Feb 6, 2025

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:

"com.google.fonts/check/glyphsets/shape_languages": "googlefonts/glyphsets/shape_language",

@check(
id="googlefonts/glyphsets/shape_languages",

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

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

"googlefonts/glyphsets/shape_languages",

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!

felipesanches added a commit to felipesanches/fontbakery that referenced this issue Feb 7, 2025
on the legacy_checkids.py file.

(issue fonttools#4987)
@felipesanches
Copy link
Collaborator

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
Copy link
Collaborator

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

@felipesanches
Copy link
Collaborator

  • 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
Copy link
Collaborator

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).

@frankrolf
Copy link

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.

@arrowtype
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@n7s
Copy link

n7s commented Feb 19, 2025

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

@simoncozens
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants