Skip to content

Commit

Permalink
Add Python 3.11 and 3.12 support, update pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
mikahanninen committed Dec 6, 2024
1 parent c8eb858 commit a847c87
Show file tree
Hide file tree
Showing 7 changed files with 400 additions and 454 deletions.
41 changes: 25 additions & 16 deletions .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,55 +26,64 @@ jobs:
fail-fast: false
matrix:
name: [
"windows-py38",
"windows-py39",
"windows-py310",
"windows-py311",
"windows-py312",

"ubuntu-py38",
"ubuntu-py39",
"ubuntu-py310",
"ubuntu-py311",
"ubuntu-py312",

"macos-py38",
"macos-py39",
"macos-py310",
"macos-py311",
"macos-py312",
]

include:
- name: "windows-py38"
python: "3.8"
os: windows-latest
- name: "windows-py39"
python: "3.9"
os: windows-latest
- name: "windows-py310"
python: "3.10"
os: windows-latest
- name: "ubuntu-py38"
python: "3.8"
os: ubuntu-latest
- name: "windows-py311"
python: "3.11"
os: windows-latest
- name: "windows-py312"
python: "3.12"
os: windows-latest
- name: "ubuntu-py39"
python: "3.9"
os: ubuntu-latest
- name: "ubuntu-py310"
python: "3.10"
os: ubuntu-latest
- name: "macos-py38"
python: "3.8"
os: macos-13
- name: "ubuntu-py311"
python: "3.11"
os: ubuntu-latest
- name: "macos-py39"
python: "3.9"
os: macos-13
- name: "macos-py310"
python: "3.10"
os: macos-13
- name: "macos-py311"
python: "3.11"
os: macos-13
- name: "macos-py312"
python: "3.12"
os: macos-13

env:
INVOKE_IS_CI_CD: 1
SYSTEM_VERSION_COMPAT: "0"
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
Expand All @@ -100,9 +109,9 @@ jobs:
INVOKE_IS_CI_CD: 1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Upgrade pip
Expand Down
773 changes: 347 additions & 426 deletions packages/windows/poetry.lock

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions packages/windows/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "rpaframework-windows"
version = "7.5.2"
version = "8.0.0"
description = "Windows library for RPA Framework"
authors = ["RPA Framework <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -20,17 +20,18 @@ classifiers = [
"Topic :: Software Development :: Libraries",
"Framework :: Robot Framework :: Library",
"Framework :: Robot Framework",
"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",
]

include = ["*.libspec"]

packages = [{ include = "RPA", from = "src" }]

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
dataclasses = { version = "^0.7", python = ">=3.6,<3.7" }
rpaframework-core = "^11.3.1"
robotframework = ">=4.0.0,!=4.0.1,!=6.1.0,<7.0.0"
Expand All @@ -40,12 +41,12 @@ uiautomation = "^2.0.15"
comtypes = { version = "^1.1.11", platform = "win32" }
psutil = { version = "^5.9.0", platform = "win32" }
pywin32 = { version = ">=300,<307", platform = "win32", python = "!=3.8.1" }
fire = "^0.4.0"
fire = "^0.7.0"

[tool.poetry.group.dev.dependencies]
black = "^24.3.0"
flake8 = "^3.7.9"
pylint = "^2.4.4, <2.13"
pylint = "^3.3.2"
pytest = "^7.2.0"
mock = "^5.0.0"
pytest-cov = "^4.0.0"
Expand All @@ -62,7 +63,7 @@ flake8-rst-docstrings = "^0.2.7"
windows-record = 'RPA.scripts.record:main'

[tool.black]
target-version = ["py38", "py39", "py310"]
target-version = ["py39", "py310", "py311", "py312"]

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
1 change: 1 addition & 0 deletions packages/windows/src/RPA/Windows/keywords/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=cyclic-import
from robot.api.deco import keyword # imported from here by keyword modules

from .action import ActionKeywords
Expand Down
20 changes: 15 additions & 5 deletions packages/windows/src/RPA/Windows/keywords/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

if utils.IS_WINDOWS:
import uiautomation as auto
else:
auto = None


PatternType = Union["auto.ValuePattern", "auto.LegacyIAccessiblePattern"]
Expand Down Expand Up @@ -270,9 +272,11 @@ def is_selected(self, locator: Locator) -> Optional[bool]:
lib_win = Windows()
value = lib_win.is_selected("type:RadioButtonControl name:Apple")
print(value)
"""
""" # noqa: E501
element = self.ctx.get_element(locator)
get_selection_item_pattern = getattr(element.item, "GetSelectionItemPattern", None)
get_selection_item_pattern = getattr(
element.item, "GetSelectionItemPattern", None
)

if get_selection_item_pattern:
func_name = get_selection_item_pattern.__name__
Expand Down Expand Up @@ -454,8 +458,10 @@ def _set_value_with_keys(
" through keys! (insert them with the `enter` parameter only)"
)
get_text_pattern = getattr(element.item, "GetTextPattern", None)
get_text = lambda: ( # noqa: E731
get_text_pattern().DocumentRange.GetText() if get_text_pattern else None
get_text = (
lambda: ( # noqa: E731, pylint: disable=unnecessary-lambda-assignment
get_text_pattern().DocumentRange.GetText() if get_text_pattern else None
)
)
if append:
current_value: str = get_text() or ""
Expand Down Expand Up @@ -795,7 +801,11 @@ def set_mouse_movement(self, simulate: bool) -> bool:
previous = lib_win.set_mouse_movement(True)
print(f"Previous mouse simulation: {previous} (now enabled)")
"""
to_str = lambda state: "ON" if state else "OFF" # noqa: E731
to_str = (
lambda state: ( # noqa: E731, pylint: disable=unnecessary-lambda-assignment
"ON" if state else "OFF"
)
)
previous = self.ctx.simulate_move
self.logger.info("Previous mouse movement simulation: %s", to_str(previous))
self.ctx.simulate_move = simulate
Expand Down
3 changes: 3 additions & 0 deletions packages/windows/src/RPA/Windows/keywords/locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
if utils.IS_WINDOWS:
import uiautomation as auto
from uiautomation import Control
else:
auto = None
Control = None


class LocatorKeywords(LocatorMethods):
Expand Down
3 changes: 2 additions & 1 deletion packages/windows/src/RPA/Windows/keywords/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ def close_window(
return closed

@keyword(tags=["window"])
def get_os_version(self) -> str:
@staticmethod
def get_os_version() -> str:
"""Returns the current Windows major version as string.
Example:
Expand Down

0 comments on commit a847c87

Please sign in to comment.