disentcorp / perdict

Persistent Dictionary
Other
0 stars 0 forks source link

from perdict import Perdict does not import anything and does not raise exception #3

Open nielslauritzen0 opened 3 months ago

nielslauritzen0 commented 3 months ago

we should be able to import Perdict from perdict but instead it raises exception

Python 3.12.2 (main, Feb 25 2024, 16:35:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from perdict import Perdict
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Perdict' from 'perdict' (/home/niels/github_/perdict/perdict/__init__.py)
>>>

also import perdict does not import anything

>>> import perdict
>>> dir(perdict)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>>

note that dir() just shows standard module infrastructure and does not show Perdict

My guess is that the init.py file in the perdict folder is empty when really it should contain code that brings the definition of class Perdict into scope. See how dateroll does this properly and works correctly.

amalizzio commented 3 months ago

thanks niels! @Batu4 i would make a feature branch called feature-fixsetattr solely for this issue, then when you think it is fixed, and coverage is 100%, do a pull request into dev (which i just recreated), main will be used for stable releases controlled by @nielslauritzen0

for simplicity setattr should call setitem (or a wrapper function) that writes to dict-then-disk.