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

Move library code out of inner directory #15

Closed
kattni opened this issue Jun 7, 2022 · 4 comments · Fixed by #16
Closed

Move library code out of inner directory #15

kattni opened this issue Jun 7, 2022 · 4 comments · Fixed by #16
Assignees

Comments

@kattni
Copy link
Contributor

kattni commented Jun 7, 2022

From Dave Astels:
There's something wrong with the adafruit_itertools build/packaging. Using the source from GitHub works, but the dir/mpy in the bundle doesn't... it just imports empty.

Please see https://forums.adafruit.com/viewtopic.php?f=65&t=191711

From Kattni:
I tried importing islice using the GitHub source code, and it failed. I see it in the file, it exists, but it's not importing evidently. Dave originally included running dir(adafruit_itertools) from the REPL as proof that it was importing empty, but even the GitHub source code only shows ['__class__', '__name__', '__file__', '__path__']. I am unsure whether it is supposed to show more.

@kattni
Copy link
Contributor Author

kattni commented Jun 7, 2022

Turns out the import structure for IterTools is import adafruit_itertools.adafruit_itertools. Thank you to Neradoc on Discord for catching this.

>>> import adafruit_itertools.adafruit_itertools
>>> dir(adafruit_itertools.adafruit_itertools)
['__class__', '__name__', 'count', '__file__', '__version__', 'chain', 'compress', '__repo__', 'accumulate', 'chain_from_iterable', 'combinations', 'combinations_with_replacement', 'cycle', 'dropwhile', 'filterfalse', 'groupby', 'islice', 'permutations', 'product', 'repeat', 'starmap', 'takewhile', 'tee', 'zip_longest']
>>>

@kattni kattni closed this as completed Jun 7, 2022
@caternuson
Copy link

caternuson commented Jun 7, 2022

Is this just import syntax confusion? The folder is the same name as one of the modules.

Don't import the folder:

Adafruit CircuitPython 7.3.0 on 2022-05-23; Adafruit CLUE nRF52840 Express with nRF52840
>>> import adafruit_itertools
>>> dir(adafruit_itertools)
['__class__', '__name__', '__file__', '__path__']
>>> 

import the module:

Adafruit CircuitPython 7.3.0 on 2022-05-23; Adafruit CLUE nRF52840 Express with nRF52840
>>> from adafruit_itertools import adafruit_itertools
>>> dir(adafruit_itertools)
['__class__', '__name__', 'count', '__file__', '__version__', 'chain', 'compress', '__repo__', 'accumulate', 'chain_from_iterable', 'combinations', 'combinations_with_replacement', 'cycle', 'dropwhile', 'filterfalse', 'groupby', 'islice', 'permutations', 'product', 'repeat', 'starmap', 'takewhile', 'tee', 'zip_longest']
>>>  

EDIT: oops. nvm. looks like that's already been found.

@dhalbert
Copy link
Contributor

dhalbert commented Jun 7, 2022

I believe this is basically a bug. In CPython, regular itertools functionality is not two levels down.

Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import itertools
>>> dir(itertools)
['__doc__', '__loader__', '__name__', '__package__', '__spec__', '_grouper', '_tee', '_tee_dataobject', 'accumulate', 'chain', 'combinations', 'combinations_with_replacement', 'compress', 'count', 'cycle', 'dropwhile', 'filterfalse', 'groupby', 'islice', 'pairwise', 'permutations', 'product', 'repeat', 'starmap', 'takewhile', 'tee', 'zip_longest']

@dhalbert dhalbert changed the title Release assets do not include all library functionality Move library code out of inner directory Jun 7, 2022
@dhalbert
Copy link
Contributor

dhalbert commented Jun 7, 2022

The inner directory should be removed. Reopening.

@dhalbert dhalbert reopened this Jun 7, 2022
rtyley added a commit to rtyley/lego-tardis that referenced this issue Oct 23, 2022
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

Successfully merging a pull request may close this issue.

4 participants