8000 Type hint issues · Issue #1050 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content

Type hint issues #1050

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

Closed
pierresouchay opened this issue May 31, 2022 · 6 comments
Closed

Type hint issues #1050

pierresouchay opened this issue May 31, 2022 · 6 comments
Labels
bug help wanted A user needs help, may be a mistake, a bug or a feature request

Comments

@pierresouchay
Copy link

Describe the bug
Recently tried to bump tableauserverclient from version 0.16.0 to 0.18.0

Versions
Details of your environment, including:

  • Tableau Server version : Tableau Online
  • Python version: 3.9
  • TSC library version: 0.18.0
  • mypy version: mypy 0.942

To Reproduce
Create this simplistic file:

#!/usr/bin/env/python

import os

import tableauserverclient as TSC


tableau_auth = TSC.TableauAuth(os.environ["USERNAME"], os.environ["PASSWORD"], site_id=os.environ["SITE_ID"])
server = TSC.Server("https://dub01.online.tableau.com")
my_group = TSC.GroupItem(os.environ["GROUP_ITEM"])

Run mypy test_script.py --ignore-missing-imports --strict

Results

mypy test_script.py --ignore-missing-imports --strict 
test_script.py:8: error: Module has no attribute "TableauAuth"
test_script.py:9: error: Module has no attribute "Server"
test_script.py:10: error: Module has no attribute "GroupItem"

=> this is simplistic and mypy complains

I suspect the typed.py file is not at the right place or the imports are not being set correctly In the init.py file

Maybe #991 not being implemented correctly

@jorwoods
Copy link
Contributor
jorwoods commented Jun 6, 2022

The types are not present in 0.18. Try again with the development branch. It should work there. 0.19 is being prepared for release and will have the typing information.

@jacalata jacalata added the help wanted A user needs help, may be a mistake, a bug or a feature request label Jun 7, 2022
@jacalata
Copy link
Contributor
jacalata commented Jun 7, 2022

Thanks jorwoods - @pierresouchay this release is now available and hopefully solves your issue!

@jacalata jacalata closed this as completed Jun 7, 2022
@pierresouchay
Copy link
Author

@jorwoods @jacalata Does not seem to work...

With the example provided above:

mypy test_script.py --ignore-missing-imports --strict
test_script.py:8: error: Module has no attribute "TableauAuth"
test_script.py:9: error: Module has no attribute "Server"
test_script.py:10: error: Module has no attribute "GroupItem"
Found 3 errors in 1 file (checked 1 source file)
(venv) % python
Python 3.9.2 (v3.9.2:1a79785e3e, Feb 19 2021, 09:06:10)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tableauserverclient as TSC
>>> TSC.__version__
'0.19.0'
>>> exit()

@jacalata jacalata reopened this Jun 7, 2022
@jacalata
Copy link
Contributor
jacalata commented Jun 7, 2022

Huh - I can definitely repro this. I'll take a look, thanks very much for following up!

@jacalata jacalata added the bug label Jun 7, 2022
@jorwoods
Copy link
Contributor
jorwoods commented Jun 8, 2022

I believe the problem is because if you are in the TYPE_CHECKING mode, there are circular references, which break when trying to inspect from the top level. These things still work during run time because they are behind the TYPE_CHECKING flag.

@jorwoods
Copy link
Contributor

Tested and confirmed this is resolved by #1394

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted A user needs help, may be a mistake, a bug or a feature request
Projects
None yet
Development

No branches or pull requests

4 participants
0