Skip to content

Commit e8d2948

Browse files
chore(python): support versions from 3.9 to 3.13 (#162)
1 parent 5e59d67 commit e8d2948

File tree

11 files changed

+69
-62
lines changed

11 files changed

+69
-62
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ jobs:
1212
- name: Setup Python
1313
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
1414
with:
15-
python-version: 3.12
15+
python-version: 3.13
1616
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
1717
build:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
2121
tox_env:
22-
- py38
2322
- py39
2423
- py310
2524
- py311
2625
- py312
26+
- py313
2727
- pypy3
2828
steps:
2929
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ python setup.py install
2424

2525
### Supported Python versions in API v2.6.0
2626

27-
- Python 3.8
2827
- Python 3.9
2928
- Python 3.10
3029
- Python 3.11
3130
- Python 3.12
31+
- Python 3.13
3232
- PyPy3
3333

3434
**Python 2 has been deprecated**
@@ -49,9 +49,9 @@ but are not able to get working, please [contact UpCloud support](https://upclou
4949
```python
5050

5151
import upcloud_api
52-
from upcloud_api import Server, Storage, login_user_block
52+
from upcloud_api import CloudManager, Server, Storage, login_user_block
5353

54-
manager = upcloud_api.CloudManager('api_user', 'password')
54+
manager = CloudManager('api_user', 'password')
5555
manager.authenticate()
5656

5757

@@ -248,10 +248,10 @@ tox
248248
```
249249

250250

251-
The project also supplies a small test suite to test against the live API at `test/live_test.py`.
252-
This suite is NOT run with `py.test` as it will permanently remove all resources related to an account.
251+
The project also supplies a small test suite to test against the live API in `test/test_integration`.
252+
This suite is NOT run with `py.test` dy default as it will permanently remove all resources related to an account.
253253
It should only be run with a throwaway dev-only account when preparing for a new release. It is not shipped with
254-
PyPI releases. See source code on how to run the live test.
254+
PyPI releases. To run the integration tests, append `--integration-tests` flag to the `py.test` command.
255255

256256
## Bugs, Issues, Problems, Ideas
257257

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[tool.black]
22
line-length = 99
3-
target-version = ['py38']
3+
target-version = ['py39']
44
skip-string-normalization = true
55

66
[tool.ruff]
7-
target-version = "py38"
7+
target-version = "py39"
88
exclude = [
99
".git",
1010
"ENV",

requirements-dev.txt

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,67 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.10
2+
# This file is autogenerated by pip-compile with Python 3.9
33
# by the following command:
44
#
55
# pip-compile requirements-dev.in
66
#
7-
build==0.10.0
7+
build==1.2.2.post1
88
# via pip-tools
9-
certifi==2023.7.22
9+
certifi==2024.8.30
1010
# via requests
11-
charset-normalizer==3.2.0
11+
charset-normalizer==3.4.0
1212
# via requests
13-
click==8.1.6
13+
click==8.1.7
1414
# via pip-tools
15-
coverage[toml]==7.2.7
15+
coverage[toml]==7.6.8
1616
# via pytest-cov
17-
exceptiongroup==1.2.1
17+
exceptiongroup==1.2.2
1818
# via pytest
19-
idna==3.7
19+
idna==3.10
2020
# via requests
21+
importlib-metadata==8.5.0
22+
# via build
2123
iniconfig==2.0.0
2224
# via pytest
2325
mock==5.1.0
2426
# via -r requirements-dev.in
25-
packaging==23.1
27+
packaging==24.2
2628
# via
2729
# build
2830
# pytest
29-
pip-tools==6.14.0
31+
pip-tools==7.4.1
3032
# via -r requirements-dev.in
31-
pluggy==1.2.0
33+
pluggy==1.5.0
3234
# via pytest
33-
pyproject-hooks==1.0.0
34-
# via build
35-
pytest==7.4.0
35+
pyproject-hooks==1.2.0
36+
# via
37+
# build
38+
# pip-tools
39+
pytest==8.3.3
3640
# via
3741
# -r requirements-dev.in
3842
# pytest-cov
39-
pytest-cov==4.1.0
43+
pytest-cov==6.0.0
4044
# via -r requirements-dev.in
41-
pyyaml==6.0.1
45+
pyyaml==6.0.2
4246
# via responses
43-
requests==2.32.2
47+
requests==2.32.3
4448
# via responses
45-
responses==0.23.2
49+
responses==0.25.3
4650
# via -r requirements-dev.in
47-
tomli==2.0.1
51+
tomli==2.2.1
4852
# via
4953
# build
5054
# coverage
5155
# pip-tools
52-
# pyproject-hooks
5356
# pytest
54-
types-pyyaml==6.0.12.11
55-
# via responses
56-
urllib3==2.0.7
57+
urllib3==2.2.3
5758
# via
5859
# requests
5960
# responses
60-
wheel==0.41.0
61+
wheel==0.45.1
6162
# via pip-tools
63+
zipp==3.21.0
64+
# via importlib-metadata
6265

6366
# The following packages are considered to be unsafe in a requirements file:
6467
# pip

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ packages=['upcloud_api', 'upcloud_api.cloud_manager']
1111
license = MIT
1212

1313
[options]
14-
python_requires = >=3.8, <4
14+
python_requires = >=3.9, <4
1515
setup_requires =
1616
setuptools
1717
install_requires =

test/conftest.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,21 @@
1010
sys.path.append(HELPERS_PATH)
1111

1212

13+
def pytest_configure(config):
14+
config.addinivalue_line(
15+
"markers", "integration_tests: mark test to run only on if --integration-tests is passed"
16+
)
17+
18+
1319
def pytest_addoption(parser):
14-
parser.addoption('--integration-tests', action='store_true', help='run integration tests')
20+
parser.addoption(
21+
'--integration-tests', action='store_true', default=False, help='run integration tests'
22+
)
23+
24+
25+
def pytest_runtest_setup(item):
26+
if 'integration_tests' in item.keywords and not item.config.getoption("--integration-tests"):
27+
pytest.skip("need --integration-tests option to run this test")
1528

1629

1730
@pytest.fixture(scope='module')

test/helpers/infra.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
zone='uk-lon1',
1313
password_delivery='none',
1414
storage_devices=[
15-
Storage(os='01000000-0000-4000-8000-000030060200', size=10),
15+
Storage(os='01000000-0000-4000-8000-000030240200', size=10),
1616
Storage(size=10, tier='maxiops'),
1717
],
1818
),
@@ -23,7 +23,7 @@
2323
zone='uk-lon1',
2424
password_delivery='none',
2525
storage_devices=[
26-
Storage(os='01000000-0000-4000-8000-000030060200', size=10),
26+
Storage(os='01000000-0000-4000-8000-000030240200', size=10),
2727
Storage(size=10, tier='maxiops'),
2828
],
2929
ip_addresses=[IPAddress(family='IPv6', access='public')],
@@ -35,22 +35,18 @@
3535
zone='uk-lon1',
3636
password_delivery='none',
3737
storage_devices=[
38-
Storage(os='01000000-0000-4000-8000-000050010300', size=10),
39-
Storage(size=10),
38+
Storage(os='01000000-0000-4000-8000-000150020100', size=10),
39+
Storage(size=10, tier='standard'),
4040
],
41-
login_user=login_user_block(
42-
'testuser', ['ssh-rsa AAAAB3NzaC1yc2EAA[...]ptshi44x [email protected]'], True
43-
),
41+
login_user=login_user_block('testuser', ['ssh-ed25519 AAAA'], False),
4442
),
4543
'lb': Server(
4644
plan='1xCPU-1GB',
4745
hostname='balancer.example.com',
4846
zone='uk-lon1',
4947
password_delivery='none',
50-
storage_devices=[Storage(os='Debian 10.0', size=30)],
51-
login_user=login_user_block(
52-
'testuser', ['ssh-rsa AAAAB3NzaC1yc2EAA[...]ptshi44x [email protected]'], True
53-
),
48+
storage_devices=[Storage(os='01000000-0000-4000-8000-000020070100', size=30)],
49+
login_user=login_user_block('testuser', ['ssh-ed25519 AAAA'], False),
5450
),
5551
}
5652

test/helpers/infra_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def server_test(manager, server):
4747
storage = manager.create_storage(size=10, tier='maxiops', zone='uk-lon1')
4848
server.add_storage(storage)
4949

50-
server.start()
50+
server.ensure_started()
5151

5252
# sync new info from API and assert the changes from above have happened
5353
server.populate()

test/test_integration/test_integration_test.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@
1010
USERNAME = os.environ.get('UPCLOUD_API_USER')
1111
PASSWORD = os.environ.get('UPCLOUD_API_PASSWD')
1212

13-
14-
integration_test = pytest.mark.skipif(
15-
True, # TODO: not pytest.request.getoption('--integration-tests'),
16-
reason='need --integration-tests option to run',
17-
)
18-
13+
integration_test = pytest.mark.integration_tests
1914

2015
# globals to store created resources so we can cleanup after tests
2116
CREATED_SERVERS = []

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py38, py39, py310, py311, py312, pypy3
7+
envlist = py39, py310, py311, py312, py313, pypy3
88
skip_missing_interpreters = True
99

1010
[testenv]

0 commit comments

Comments
 (0)