Skip to content

Commit 196d73a

Browse files
authored
Revert "Development to master branch merge" (#1513)
Revert "0.34 development merge" This reverts commit 6798b9e.
1 parent 6798b9e commit 196d73a

File tree

149 files changed

+1407
-3347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1407
-3347
lines changed

.github/workflows/meta-checks.yml

-14
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,6 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414

1515
steps:
16-
- name: Get pip cache dir
17-
id: pip-cache
18-
shell: bash
19-
run: |
20-
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
21-
22-
- name: cache
23-
uses: actions/cache@v4
24-
with:
25-
path: ${{ steps.pip-cache.outputs.dir }}
26-
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
27-
restore-keys: |
28-
${{ runner.os }}-${{ matrix.python-version }}-pip-
29-
3016
- uses: actions/checkout@v4
3117

3218
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}

.github/workflows/run-tests.yml

+1-15
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,11 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
16+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
1717

1818
runs-on: ${{ matrix.os }}
1919

2020
steps:
21-
- name: Get pip cache dir
22-
id: pip-cache
23-
shell: bash
24-
run: |
25-
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
26-
27-
- name: cache
28-
uses: actions/cache@v4
29-
with:
30-
path: ${{ steps.pip-cache.outputs.dir }}
31-
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
32-
restore-keys: |
33-
${{ runner.os }}-${{ matrix.python-version }}-pip-
34-
3521
- uses: actions/checkout@v4
3622

3723
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}

pyproject.toml

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,42 @@ readme = "README.md"
1414
dependencies = [
1515
'defusedxml>=0.7.1', # latest as at 7/31/23
1616
'packaging>=23.1', # latest as at 7/31/23
17-
'requests>=2.32', # latest as at 7/31/23
18-
'urllib3>=2.2.2,<3',
17+
'requests>=2.31', # latest as at 7/31/23
18+
'urllib3==2.2.2', # dependabot
1919
'typing_extensions>=4.0.1',
2020
]
21-
requires-python = ">=3.9"
21+
requires-python = ">=3.7"
2222
classifiers = [
2323
"Programming Language :: Python",
2424
"Programming Language :: Python :: 3",
25+
"Programming Language :: Python :: 3.8",
2526
"Programming Language :: Python :: 3.9",
2627
"Programming Language :: Python :: 3.10",
2728
"Programming Language :: Python :: 3.11",
28-
"Programming Language :: Python :: 3.12",
29-
"Programming Language :: Python :: 3.13"
29+
"Programming Language :: Python :: 3.12"
3030
]
3131
[project.urls]
3232
repository = "https://github.com/tableau/server-client-python"
3333

3434
[project.optional-dependencies]
35-
test = ["black==24.8", "build", "mypy==1.4", "pytest>=7.0", "pytest-cov", "pytest-subtests",
35+
test = ["black==23.7", "build", "mypy==1.4", "pytest>=7.0", "pytest-cov", "pytest-subtests",
3636
"requests-mock>=1.0,<2.0"]
3737

3838
[tool.black]
3939
line-length = 120
40-
target-version = ['py39', 'py310', 'py311', 'py312', 'py313']
40+
target-version = ['py37', 'py38', 'py39', 'py310', 'py311', 'py312']
4141

4242
[tool.mypy]
4343
check_untyped_defs = false
4444
disable_error_code = [
4545
'misc',
46+
# tableauserverclient\server\endpoint\datasources_endpoint.py:48: error: Cannot assign multiple types to name "FilePath" without an explicit "Type[...]" annotation [misc]
4647
'annotation-unchecked' # can be removed when check_untyped_defs = true
4748
]
48-
files = ["tableauserverclient", "test", "samples"]
49+
files = ["tableauserverclient", "test"]
4950
show_error_codes = true
5051
ignore_missing_imports = true # defusedxml library has no types
5152
no_implicit_reexport = true
52-
implicit_optional = true
5353

5454
[tool.pytest.ini_options]
5555
testpaths = ["test"]

samples/add_default_permission.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ def main():
6363
for permission in new_default_permissions:
6464
grantee = permission.grantee
6565
capabilities = permission.capabilities
66-
print(f"\nCapabilities for {grantee.tag_name} {grantee.id}:")
66+
print("\nCapabilities for {0} {1}:".format(grantee.tag_name, grantee.id))
6767

6868
for capability in capabilities:
69-
print(f"\t{capability} - {capabilities[capability]}")
69+
print("\t{0} - {1}".format(capability, capabilities[capability]))
7070

7171
# Uncomment lines below to DELETE the new capability and the new project
7272
# rules_to_delete = TSC.PermissionsRule(

samples/create_group.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import os
1212

1313
from datetime import time
14+
from typing import List
1415

1516
import tableauserverclient as TSC
1617
from tableauserverclient import ServerResponseError
@@ -62,23 +63,23 @@ def main():
6263

6364
if args.file:
6465
filepath = os.path.abspath(args.file)
65-
print(f"Add users to site from file {filepath}:")
66-
added: list[TSC.UserItem]
67-
failed: list[TSC.UserItem, TSC.ServerResponseError]
66+
print("Add users to site from file {}:".format(filepath))
67+
added: List[TSC.UserItem]
68+
failed: List[TSC.UserItem, TSC.ServerResponseError]
6869
added, failed = server.users.create_from_file(filepath)
6970
for user, error in failed:
7071
print(user, error.code)
7172
if error.code == "409017":
7273
user = server.users.filter(name=user.name)[0]
7374
added.append(user)
74-
print(f"Adding users to group:{added}")
75+
print("Adding users to group:{}".format(added))
7576
for user in added:
76-
print(f"Adding user {user}")
77+
print("Adding user {}".format(user))
7778
try:
7879
server.groups.add_user(group, user.id)
7980
except ServerResponseError as serverError:
8081
if serverError.code == "409011":
81-
print(f"user {user.name} is already a member of group {group.name}")
82+
print("user {} is already a member of group {}".format(user.name, group.name))
8283
else:
8384
raise rError
8485

samples/create_project.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def main():
8484
server.projects.populate_datasource_default_permissions(changed_project),
8585
server.projects.populate_permissions(changed_project)
8686
# Projects have default permissions set for the object types they contain
87-
print(f"Permissions from project {changed_project.id}:")
87+
print("Permissions from project {}:".format(changed_project.id))
8888
print(changed_project.permissions)
8989
print(
9090
changed_project.default_workbook_permissions,

samples/create_schedules.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def main():
5555
)
5656
try:
5757
hourly_schedule = server.schedules.create(hourly_schedule)
58-
print(f"Hourly schedule created (ID: {hourly_schedule.id}).")
58+
print("Hourly schedule created (ID: {}).".format(hourly_schedule.id))
5959
except Exception as e:
6060
print(e)
6161

@@ -71,7 +71,7 @@ def main():
7171
)
7272
try:
7373
daily_schedule = server.schedules.create(daily_schedule)
74-
print(f"Daily schedule created (ID: {daily_schedule.id}).")
74+
print("Daily schedule created (ID: {}).".format(daily_schedule.id))
7575
except Exception as e:
7676
print(e)
7777

@@ -89,7 +89,7 @@ def main():
8989
)
9090
try:
9191
weekly_schedule = server.schedules.create(weekly_schedule)
92-
print(f"Weekly schedule created (ID: {weekly_schedule.id}).")
92+
print("Weekly schedule created (ID: {}).".format(weekly_schedule.id))
9393
except Exception as e:
9494
print(e)
9595
options = TSC.RequestOptions()
@@ -112,7 +112,7 @@ def main():
112112
)
113113
try:
114114
monthly_schedule = server.schedules.create(monthly_schedule)
115-
print(f"Monthly schedule created (ID: {monthly_schedule.id}).")
115+
print("Monthly schedule created (ID: {}).".format(monthly_schedule.id))
116116
except Exception as e:
117117
print(e)
118118

samples/explore_datasource.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,16 @@ def main():
5151
if args.publish:
5252
if default_project is not None:
5353
new_datasource = TSC.DatasourceItem(default_project.id)
54-
new_datasource.description = "Published with a description"
5554
new_datasource = server.datasources.publish(
5655
new_datasource, args.publish, TSC.Server.PublishMode.Overwrite
5756
)
58-
print(f"Datasource published. ID: {new_datasource.id}")
57+
print("Datasource published. ID: {}".format(new_datasource.id))
5958
else:
6059
print("Publish failed. Could not find the default project.")
6160

6261
# Gets all datasource items
6362
all_datasources, pagination_item = server.datasources.get()
64-
print(f"\nThere are {pagination_item.total_available} datasources on site: ")
63+
print("\nThere are {} datasources on site: ".format(pagination_item.total_available))
6564
print([datasource.name for datasource in all_datasources])
6665

6766
if all_datasources:
@@ -70,19 +69,20 @@ def main():
7069

7170
# Populate connections
7271
server.datasources.populate_connections(sample_datasource)
73-
print(f"\nConnections for {sample_datasource.name}: ")
74-
print([f"{connection.id}({connection.datasource_name})" for connection in sample_datasource.connections])
75-
76-
# Demonstrate that description is editable
77-
sample_datasource.description = "Description updated by TSC"
78-
server.datasources.update(sample_datasource)
72+
print("\nConnections for {}: ".format(sample_datasource.name))
73+
print(
74+
[
75+
"{0}({1})".format(connection.id, connection.datasource_name)
76+
for connection in sample_datasource.connections
77+
]
78+
)
7979

8080
# Add some tags to the datasource
8181
original_tag_set = set(sample_datasource.tags)
8282
sample_datasource.tags.update("a", "b", "c", "d")
8383
server.datasources.update(sample_datasource)
84-
print(f"\nOld tag set: {original_tag_set}")
85-
print(f"New tag set: {sample_datasource.tags}")
84+
print("\nOld tag set: {}".format(original_tag_set))
85+
print("New tag set: {}".format(sample_datasource.tags))
8686

8787
# Delete all tags that were added by setting tags to original
8888
sample_datasource.tags = original_tag_set

samples/explore_favorites.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import argparse
44
import logging
55
import tableauserverclient as TSC
6-
from tableauserverclient.models import Resource
6+
from tableauserverclient import Resource
77

88

99
def main():
@@ -39,15 +39,15 @@ def main():
3939
# get all favorites on site for the logged on user
4040
user: TSC.UserItem = TSC.UserItem()
4141
user.id = server.user_id
42-
print(f"Favorites for user: {user.id}")
42+
print("Favorites for user: {}".format(user.id))
4343
server.favorites.get(user)
4444
print(user.favorites)
4545

4646
# get list of workbooks
4747
all_workbook_items, pagination_item = server.workbooks.get()
4848
if all_workbook_items is not None and len(all_workbook_items) > 0:
49-
my_workbook = all_workbook_items[0]
50-
server.favorites.add_favorite(user, Resource.Workbook, all_workbook_items[0])
49+
my_workbook: TSC.WorkbookItem = all_workbook_items[0]
50+
server.favorites.add_favorite(server, user, Resource.Workbook.name(), all_workbook_items[0])
5151
print(
5252
"Workbook added to favorites. Workbook Name: {}, Workbook ID: {}".format(
5353
my_workbook.name, my_workbook.id
@@ -57,7 +57,7 @@ def main():
5757
if views is not None and len(views) > 0:
5858
my_view = views[0]
5959
server.favorites.add_favorite_view(user, my_view)
60-
print(f"View added to favorites. View Name: {my_view.name}, View ID: {my_view.id}")
60+
print("View added to favorites. View Name: {}, View ID: {}".format(my_view.name, my_view.id))
6161

6262
all_datasource_items, pagination_item = server.datasources.get()
6363
if all_datasource_items:
@@ -70,10 +70,12 @@ def main():
7070
)
7171

7272
server.favorites.delete_favorite_workbook(user, my_workbook)
73-
print(f"Workbook deleted from favorites. Workbook Name: {my_workbook.name}, Workbook ID: {my_workbook.id}")
73+
print(
74+
"Workbook deleted from favorites. Workbook Name: {}, Workbook ID: {}".format(my_workbook.name, my_workbook.id)
75+
)
7476

7577
server.favorites.delete_favorite_view(user, my_view)
76-
print(f"View deleted from favorites. View Name: {my_view.name}, View ID: {my_view.id}")
78+
print("View deleted from favorites. View Name: {}, View ID: {}".format(my_view.name, my_view.id))
7779

7880
server.favorites.delete_favorite_datasource(user, my_datasource)
7981
print(

samples/explore_site.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def main():
4949

5050
if args.delete:
5151
print("You can only delete the site you are currently in")
52-
print(f"Delete site `{current_site.name}`?")
52+
print("Delete site `{}`?".format(current_site.name))
5353
# server.sites.delete(server.site_id)
5454

5555
elif args.create:

samples/explore_webhooks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ def main():
5252
new_webhook.event = "datasource-created"
5353
print(new_webhook)
5454
new_webhook = server.webhooks.create(new_webhook)
55-
print(f"Webhook created. ID: {new_webhook.id}")
55+
print("Webhook created. ID: {}".format(new_webhook.id))
5656

5757
# Gets all webhook items
5858
all_webhooks, pagination_item = server.webhooks.get()
59-
print(f"\nThere are {pagination_item.total_available} webhooks on site: ")
59+
print("\nThere are {} webhooks on site: ".format(pagination_item.total_available))
6060
print([webhook.name for webhook in all_webhooks])
6161

6262
if all_webhooks:

0 commit comments

Comments
 (0)