Skip to content
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

Updated python support - drop 3.8 add 3.11 and 3.12 #326

Merged
merged 5 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.8
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.9

# install test requirements
COPY requirements*.txt /tmp/pip-tmp/
Expand Down
52 changes: 28 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,34 @@
"postCreateCommand": "scripts/setup",
"containerEnv": { "DEVCONTAINER": "1" },
"runArgs": ["-e", "GIT_EDITOR=code --wait"],
"extensions": [
"ms-python.vscode-pylance",
"visualstudioexptteam.vscodeintellicode",
"esbenp.prettier-vscode"
],
// Please keep this file in sync with settings in .vscode/settings.default.json
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.linting.mypyEnabled": true,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
"customizations": {
"vscode": {
"extensions": [
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"ms-python.pylint",
"ms-python.mypy-type-checker",
"visualstudioexptteam.vscodeintellicode",
"esbenp.prettier-vscode"
],
// Please keep this file in sync with settings in .vscode/settings.default.json
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"mypy-type-checker.args": ["--config-file=pyproject.toml"],
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh"
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5.1.1
with:
python-version: "3.10"
python-version: "3.12"

- name: Install build dependencies
run: |
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Check out the repository
uses: actions/checkout@v4.1.7

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v5.1.1
with:
python-version: "3.8"
python-version: "3.9"

- name: Install dependencies
run: |
Expand Down Expand Up @@ -55,9 +55,10 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: "3.8"
- python-version: "3.9"
- python-version: "3.10"
- python-version: "3.11"
- python-version: "3.12"

steps:
- name: Check out the repository
Expand Down Expand Up @@ -90,10 +91,10 @@ jobs:
- name: Check out the repository
uses: actions/checkout@v4.1.7

- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5.1.1
with:
python-version: "3.10"
python-version: "3.12"

- name: Install dependencies
run: |
Expand Down Expand Up @@ -128,7 +129,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5.1.1
with:
python-version: "3.10"
python-version: "3.12"

- name: Install build dependencies
run: |
Expand Down
5 changes: 1 addition & 4 deletions .vscode/settings.default.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"python.formatting.provider": "black",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.linting.mypyEnabled": true
"mypy-type-checker.args": ["--config-file=pyproject.toml"]
}
9 changes: 9 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
"isDefault": true
}
},
{
"label": "coverage",
"type": "shell",
"command": "coverage run --parallel -m pytest ; coverage combine ; coverage report",
"group": {
"kind": "test",
"isDefault": false
}
},
{
"label": "reinstall dependencies",
"type": "shell",
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries",
]
keywords=["synology-dsm", "synology"]
requires-python = ">=3.8.0"
requires-python = ">=3.9"
dependencies = ["aiohttp"]

[project.urls]
Expand Down Expand Up @@ -53,6 +54,9 @@ fail_under = 80
profile = "black"
src_paths = ["src", "tests"]

[tool.mypy]
exclude = ["tests/"]

[tool.pylint.MAIN]
ignore = ["tests"]

Expand Down
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ flake8==7.0.0
mypy==1.10.0
pep8-naming==0.14.1
pre-commit-hooks==4.6.0
pre-commit==3.2.2
pre-commit==3.7.0
Pygments==2.18.0
pylint==3.1.0
pytest-asyncio==0.23.7
Expand Down
27 changes: 27 additions & 0 deletions tests/test_synology_dsm_7.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
# pylint: disable=protected-access
import pytest

from synology_dsm.api.core.external_usb import SynoCoreExternalUSB
from synology_dsm.api.core.security import SynoCoreSecurity
from synology_dsm.api.core.share import SynoCoreShare
from synology_dsm.api.core.system import SynoCoreSystem
from synology_dsm.api.core.upgrade import SynoCoreUpgrade
from synology_dsm.api.core.utilization import SynoCoreUtilization
from synology_dsm.api.download_station import SynoDownloadStation
from synology_dsm.api.dsm.information import SynoDSMInformation
from synology_dsm.api.dsm.network import SynoDSMNetwork
from synology_dsm.api.photos import SynoPhotos
from synology_dsm.api.storage.storage import SynoStorage
from synology_dsm.api.surveillance_station import SynoSurveillanceStation
from synology_dsm.const import API_AUTH
from synology_dsm.exceptions import SynologyDSMLogin2SARequiredException

Expand All @@ -15,6 +27,7 @@
VALID_USER_2SA,
SynologyDSMMock,
)
from .api_data.dsm_7 import DSM_7_API_INFO
from .const import DEVICE_TOKEN, SESSION_ID, SYNO_TOKEN


Expand All @@ -28,6 +41,20 @@ async def test_login(self, dsm_7):
assert dsm_7.apis.get(API_AUTH)
assert dsm_7._session_id == SESSION_ID
assert dsm_7._syno_token == SYNO_TOKEN
assert dsm_7.device_token is None
assert dsm_7.apis == DSM_7_API_INFO["data"]
assert isinstance(dsm_7.download_station, SynoDownloadStation)
assert isinstance(dsm_7.external_usb, SynoCoreExternalUSB)
assert isinstance(dsm_7.information, SynoDSMInformation)
assert isinstance(dsm_7.network, SynoDSMNetwork)
assert isinstance(dsm_7.photos, SynoPhotos)
assert isinstance(dsm_7.security, SynoCoreSecurity)
assert isinstance(dsm_7.share, SynoCoreShare)
assert isinstance(dsm_7.storage, SynoStorage)
assert isinstance(dsm_7.surveillance_station, SynoSurveillanceStation)
assert isinstance(dsm_7.system, SynoCoreSystem)
assert isinstance(dsm_7.upgrade, SynoCoreUpgrade)
assert isinstance(dsm_7.utilisation, SynoCoreUtilization)

@pytest.mark.asyncio
async def test_login_2sa(self):
Expand Down
Loading