8000 pin black and mypy versions, update many dependencies (#1265) · mtwalkup/server-client-python@4caf0a5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4caf0a5

Browse files
authored
pin black and mypy versions, update many dependencies (tableau#1265)
* pin black and mypy versions * drop python 3.7 support - update build + dependencies to latest versions - check mypy warnings, fix 2 typing complaints * update python versions used in actions to 3.8 -- 3.12 ( github doesn't have an image for 3.12 yet b/c it is still in beta?)
1 parent 574118a commit 4caf0a5

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

.github/workflows/run-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
fail-fast: false
99
matrix:
1010
os: [ubuntu-latest, macos-latest, windows-latest]
11-
python-version: ['3.7', '3.8', '3.9', '3.10']
11+
python-version: ['3.8', '3.9', '3.10', '3.11']
1212

1313
runs-on: ${{ matrix.os }}
1414

@@ -33,4 +33,4 @@ jobs:
3333
- name: Test build
3434
if: always()
3535
run: |
36-
python -m build
36+
python -m build

pyproject.toml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=45.0", "versioneer>=0.24", "wheel"]
2+
requires = ["setuptools>=68.0", "versioneer>=0.29", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -12,39 +12,41 @@ license = {file = "LICENSE"}
1212
readme = "README.md"
1313

1414
dependencies = [
15-
'defusedxml>=0.7.1',
16-
'packaging>=22.0', # bumping to minimum version required by black
17-
'requests>=2.28',
18-
'urllib3~=1.26.8',
15+
'defusedxml>=0.7.1', # latest as at 7/31/23
16+
'packaging>=23.1', # latest as at 7/31/23
17+
'requests>=2.31', # latest as at 7/31/23
18+
'urllib3==2.0.4', # latest as at 7/31/23
1919
]
2020
requires-python = ">=3.7"
2121
classifiers = [
2222
"Programming Language :: Python",
2323
"Programming Language :: Python :: 3",
24-
"Programming Language :: Python :: 3.7",
2524
"Programming Language :: Python :: 3.8",
2625
"Programming Language :: Python :: 3.9",
27-
"Programming Language :: Python :: 3.10"
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3.12"
2829
]
2930
[project.urls]
3031
repository = "https://github.com/tableau/server-client-python"
3132

3233
[project.optional-dependencies]
33-
test = ["argparse", "black", "mock", "mypy", "pytest>=7.0", "pytest-subtests", "requests-mock>=1.0,<2.0"]
34+
test = ["argparse", "black==23.7", "mock", "mypy==1.4", "pytest>=7.0", "pytest-subtests", "requests-mock>=1.0,<2.0"]
3435

3536
[tool.black]
3637
line-length = 120
37-
target-version = ['py37', 'py38', 'py39', 'py310']
38+
target-version = ['py37', 'py38', 'py39', 'py310', 'py311', 'py312']
3839

3940
[tool.mypy]
41+
check_untyped_defs = false
4042
disable_error_code = [
4143
'misc',
42-
'import'
44+
# tableauserverclient\server\endpoint\datasources_endpoint.py:48: error: Cannot assign multiple types to name "FilePath" without an explicit "Type[...]" annotation [misc]
45+
'annotation-unchecked' # can be removed when check_untyped_defs = true
4346
]
4447
files = ["tableauserverclient", "test"]
4548
show_error_codes = true
46-
ignore_missing_imports = true
47-
49+
ignore_missing_imports = true # defusedxml library has no types
4850
[tool.pytest.ini_options]
4951
testpaths = ["test"]
5052
addopts = "--junitxml=./test.junit.xml"

test/models/test_repr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from unittest import TestCase
4-
import _models
4+
import _models # type: ignore # did not set types for this
55

66

77
# ensure that all models have a __repr__ method implemented

test/test_datasource.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
import tempfile
33
import unittest
44
from io import BytesIO
5+
from typing import Optional
56
from zipfile import ZipFile
67

78
import requests_mock
89
from defusedxml.ElementTree import fromstring
910

1011
import tableauserverclient as TSC
12+
from tableauserverclient import ConnectionItem
1113
from tableauserverclient.datetime_helpers import format_datetime
1214
from tableauserverclient.server.endpoint.exceptions import InternalServerError
1315
from tableauserverclient.server.endpoint.fileuploads_endpoint import Fileuploads
@@ -167,9 +169,9 @@ def test_populate_connections(self) -> None:
167169
single_datasource._id = "9dbd2263-16b5-46e1-9c43-a76bb8ab65fb"
168170
self.server.datasources.populate_connections(single_datasource)
169171
self.assertEqual("9dbd2263-16b5-46e1-9c43-a76bb8ab65fb", single_datasource.id)
170-
connections = single_datasource.connections
172+
connections: Optional[list[ConnectionItem]] = single_datasource.connections
171173

172-
self.assertTrue(connections)
174+
self.assertIsNotNone(connections)
173175
ds1, ds2 = connections
174176
self.assertEqual("be786ae0-d2bf-4a4b-9b34-e2de8d2d4488", ds1.id)
175177
self.assertEqual("textscan", ds1.connection_type)

0 commit comments

Comments
 (0)
0