Skip to content

chore: Export intended public imports#76

Merged
ErikBjare merged 1 commit intoActivityWatch:masterfrom
Jeremiah-England:export-import
Sep 4, 2023
Merged

chore: Export intended public imports#76
ErikBjare merged 1 commit intoActivityWatch:masterfrom
Jeremiah-England:export-import

Conversation

@Jeremiah-England
Copy link
Copy Markdown
Contributor

It looks like MyPy and Pyright currently require imports like these to be re-exported in order to be used. Doing this raises a lint error for me due to Pyright:

import aw_client

aw_client.ActivityWatchClient()  # "ActivityWatchClient" is not exported from module "aw_client"

Ref: https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface
Ref: microsoft/pyright#3409
Ref: python/mypy#8754 (comment)


I assume the noqa was to handle the ActivityWatchClient symbol not being used. My linter doesn't complain about it being unused anymore because it special cases for the __all__ elements even though they are strings. I'm guessing you're linter is the same way but it not you'll probably want to remove that edit.

It looks like MyPy and Pyright currently require imports like these to
be re-exported in order to be used. Doing this raises a lint error for
me due to Pyright:

```python
import aw_client

aw_client.ActivityWatchClient()  # "ActivityWatchClient" is not exported from module "aw_client"
```

Ref: https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface
Ref: microsoft/pyright#3409
Ref: python/mypy#8754 (comment)
@ErikBjare
Copy link
Copy Markdown
Member

Ah, you're right about this.

I've learned the same as well since, but not revisited here.

Thanks!

@ErikBjare ErikBjare merged commit 2517cb1 into ActivityWatch:master Sep 4, 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.

2 participants