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

ImportError: cannot import name 'Checker' from 'shaperglot' #126

Open
arrowtype opened this issue Feb 6, 2025 · 1 comment
Open

ImportError: cannot import name 'Checker' from 'shaperglot' #126

arrowtype opened this issue Feb 6, 2025 · 1 comment

Comments

@arrowtype
Copy link

arrowtype commented Feb 6, 2025

I’ve installed Shaperglot in a virtual environment, but I’m having import errors.

In part, this is leading to a Font Bakery issue: fonttools/fontbakery#4987

However, trying to chase this down a bit, I’m finding that I’m having the same issues in a much more basic use case.

Shaperglot is installed at working at a basic level. For example, the following works as I would expect (for the most part... I am slightly confused at what exactly the last line of the message means, but it is clearly working overall, and my lack of understanding may be on me):

▶ shaperglot describe en_Latn
To test for English support, shaperglot will:
 * ensure that the following glyphs are in the font: '̀', '́', '̂', '̃', '̈', '̧', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
   'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y' and 'z'
 * ensure that, when shaping the text 'E j J h k I F L e n r p G O P q B S f K d u y v D g T V i C b o z M Y W t m c A Z H a X Q w l R s x N U', no marks are left unattached

However, it doesn’t seem to work at all, as soon as I try to import something in Python.

Python 3.12.2 (main, Mar 14 2024, 16:50:37) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from shaperglot import Checker
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Checker' from 'shaperglot' (/Users/stephennixon/venv/lib/python3.12/site-packages/shaperglot/__init__.py)
>>> 

Versions:

  • Python 3.12.2 (the issue also occurred in 3.11.3)
  • Shaperglot 0.6.4 (also tested 0.6.3 and 0.6.2)
  • macOS 14.4, if relevant

Am I missing something? Thank you for any insights! This seems like an awesome tool, so I’m eager to start using it.

@simoncozens
Copy link
Collaborator

There are currently two versions of Shaperglot knocking around with slightly different interfaces. Shaperglot 0.6 is fully Python, and Shaperglot 1.0 (pre-release) is in Rust with Python bindings. I've tried to keep the interface as similar as possible, but there's a small change from from shaperglot.checker import Checker (0.6) to from shaperglot import Checker (1.0pre) - and similar for other modules. Fontbakery has recently started using the pre-release, which is why code you see there uses the new interface. If you're doing something new in shaperglot I suggest you install the 1.0 pre-release in your virtual environment with pip3 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

2 participants