Skip to content

Circular Imports and Typing#155

Merged
2e0byo merged 3 commits into
EbbLabs:masterfrom
PretzelVector:pv
Jul 12, 2023
Merged

Circular Imports and Typing#155
2e0byo merged 3 commits into
EbbLabs:masterfrom
PretzelVector:pv

Conversation

@PretzelVector
Copy link
Copy Markdown

Definitely a seagull PR.

I was unable to utilize this library due to #148 so I tried using HEAD, but had problems with circular imports.

Along the way, also added types I was interested in for what I was doing.

Works For Me™️

Comment thread README.rst

Unofficial Python API for TIDAL music streaming service.

Requires Python 3.7 or higher.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might change very soon.. We should remember to update it to the latest supported version.

@2e0byo
Copy link
Copy Markdown
Collaborator

2e0byo commented Jul 11, 2023

How did you trigger circular imports? Would like to reproduce.

@PretzelVector
Copy link
Copy Markdown
Author

PretzelVector commented Jul 11, 2023

How did you trigger circular imports? Would like to reproduce.

$ git clone https://github.com/tamland/python-tidal.git
$ cd .\python-tidal\
$ git describe
v0.7.0-63-g53e7081
$ poetry install --no-root
$ poetry run python
Python 3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tidalapi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\tmp\python-tidal\tidalapi\__init__.py", line 4, in <module>
    from .media import Track, Video  # noqa: F401
  File "C:\tmp\python-tidal\tidalapi\media.py", line 34, in <module>
    class Media:
  File "C:\tmp\python-tidal\tidalapi\media.py", line 63, in Media
    self, session: tidalapi.session.Session, media_id: Optional[str] = None
AttributeError: partially initialized module 'tidalapi' has no attribute 'session' (most likely due to a circular import)
>>>

Edit: Initial version missed entering the venv

@2e0byo
Copy link
Copy Markdown
Collaborator

2e0byo commented Jul 12, 2023

Oh rats that should never have happened, I really need to get the tests running again.

I'd prefer to avoid some of these long x.y.z but lots of refactoring will land soon anyhow. Thanks for the improvements; merging.

@2e0byo 2e0byo merged commit 01d7688 into EbbLabs:master Jul 12, 2023
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 this pull request may close these issues.

3 participants