aroberge / ideas

Easy creation of custom import hooks to experiment on alternatives to Python's syntax; see https://aroberge.github.io/ideas/docs/html/
Other
76 stars 5 forks source link

Work on newer version. #22

Open aroberge opened 2 years ago

aroberge commented 2 years ago

Goals for new version:

tomkcook commented 1 year ago

Is this why simple examples fail on Python 3.10? This for instance:

import ideas

def my_transform(source, **_kwargs):
    return source

def add_hook(**_kwargs):
    hook = ideas.import_hook.create_hook(transform_source=my_transform)
    return hook
my_var = "test value"
$ python3 -m ideas test -a transforms
Module <module 'transforms' from '/home/tkcook/git/idea/transforms.py'> does not contain a function named add_hook
tomkcook commented 1 year ago

Relevant versions:

$ venv/bin/pip freeze
ideas==0.1.3
token-utils==0.1.8
$ python3 --version
Python 3.10.6
tomkcook commented 1 year ago

No, never mind, that's because an AttributeError in your add_hook function has the same effect as a missing add_hook function.

aroberge commented 1 year ago

Try to upload the newest version (0.1.4) - just uploaded to pypi. Also, instead of importing ideas and trying to call ideas.import_hook..., do

from ideas import import_hook