Skip to content

Commit

Permalink
Update core to new devutils and fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mikahanninen committed Dec 11, 2024
1 parent 1d22a25 commit 43d4238
Show file tree
Hide file tree
Showing 11 changed files with 646 additions and 663 deletions.
110 changes: 67 additions & 43 deletions .github/workflows/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@ jobs:
fail-fast: false
matrix:
name: [
"windows-py38",
"windows-py39",
"windows-py310",
"windows-py39",
"windows-py310",
"windows-py311",
"windows-py312",

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

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

include:
Expand All @@ -49,24 +52,45 @@ jobs:
- name: "windows-py310"
python: "3.10"
os: windows-latest
- name: "ubuntu-py38"
python: "3.8"
os: ubuntu-latest
- name: "windows-py39"
python: "3.9"
os: windows-latest
- name: "windows-py310"
python: "3.10"
os: windows-latest
- name: "windows-py311"
python: "3.11"
os: windows-latest
# - name: "windows-py312"
# python: "3.12"
# node-version: 20.x
# 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-latest
- name: "ubuntu-py311"
python: "3.11"
os: ubuntu-latest
# - name: "ubuntu-py312"
# python: "3.12"
# node-version: 20.x
# os: ubuntu-latest
- name: "macos-py39"
python: "3.9"
os: macos-latest
os: macos-13
- name: "macos-py310"
python: "3.10"
os: macos-latest
os: macos-13
- name: "macos-py311"
python: "3.11"
os: macos-13
# - name: "macos-py312"
# python: "3.12"
# node-version: 20.x
# os: macos-13
env:
INVOKE_IS_CI_CD: 1
steps:
Expand Down Expand Up @@ -98,30 +122,30 @@ jobs:
- name: Test
run: invoke code.test -a

publish:
# Only publish on master workflow runs
if: github.ref == 'refs/heads/master'
needs: test
runs-on: ubuntu-latest
env:
INVOKE_IS_CI_CD: 1
# publish:
# # Only publish on master workflow runs
# if: github.ref == 'refs/heads/master'
# needs: test
# runs-on: ubuntu-latest
# env:
# INVOKE_IS_CI_CD: 1

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.9'
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install invocation prerequisites
run: pip install -Ur ../../invocations/requirements.txt
- name: Install invocation package
run: invoke install-invocations || invoke self.install-invocations
- name: Install dependencies
run: invoke install
- name: Build and publish package
if: success()
run: |
invoke install.setup-poetry --devpi-url ${{ secrets.devpiUrl }} --username ci --password ${{ secrets.devpiPassword }}
invoke build.publish --ci --version=prerelease --yes-to-all
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python
# uses: actions/setup-python@v1
# with:
# python-version: '3.9'
# - name: Upgrade pip
# run: python -m pip install --upgrade pip
# - name: Install invocation prerequisites
# run: pip install -Ur ../../invocations/requirements.txt
# - name: Install invocation package
# run: invoke install-invocations || invoke self.install-invocations
# - name: Install dependencies
# run: invoke install
# - name: Build and publish package
# if: success()
# run: |
# invoke install.setup-poetry --devpi-url ${{ secrets.devpiUrl }} --username ci --password ${{ secrets.devpiPassword }}
# invoke build.publish --ci --version=prerelease --yes-to-all
1,132 changes: 533 additions & 599 deletions packages/core/poetry.lock

Large diffs are not rendered by default.

21 changes: 5 additions & 16 deletions packages/core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "rpaframework-core"
version = "11.3.3"
version = "11.4.0"
description = "Core utilities used by RPA Framework"
authors = ["RPA Framework <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -20,15 +20,16 @@ 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",
]

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

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
selenium = "^4.6.1"
webdriver-manager = ">=4.0.2,<4.1.0"
psutil = { version = "^5.9.0", platform = "win32" }
Expand All @@ -38,23 +39,11 @@ pillow = "^10.2.0"
packaging = "^24.0"

[tool.poetry.group.dev.dependencies]
black = "^24.3.0"
flake8 = "^3.7.9"
rpaframework-devutils = { path = "../devutils/", develop = true }
importlib-metadata = "^4.13.0"
pylint = "^2.4.4, <2.13"
pytest = "^7.2.0"
pytest-cov = "^4.0.0"
mock = "^5.0.0"
mypy = "^1.4.1"
toml = "^0.10.2"
colorama = "^0.4.5"
keyring = "^24.2.0"
PyYAML = ">=5.4.1,<7.0.0"
flake8-docstrings = "^1.6.0"
flake8-rst-docstrings = "^0.2.7"

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

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/RPA/core/locators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=cyclic-import
# flake8: noqa
from dataclasses import fields
from .containers import (
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/RPA/core/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
from typing import Any

IPYTHON_AVAILABLE = False
# Define placeholder objects
display = None
Markdown = None
FileLink = None
FileLinks = None
Image = None
JSON = None
Video = None
Audio = None

ipython_module = util.find_spec("IPython")
if ipython_module:
Expand Down
11 changes: 7 additions & 4 deletions packages/core/src/RPA/core/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
from RPA.core.robocorp import robocorp_home


class UnknownDriverError(Exception):
"""Exception raised for unknown drivers."""

class BrowserType:
"""Constants for the browser types. (expands the internal one)"""

Expand Down Expand Up @@ -199,8 +202,8 @@ def get_url_for_version_and_platform(
self, browser_version: str, driver_platform: str
) -> str:
# This is activated for chromedriver 115 or higher only.
parse_version = lambda ver: version_parser.parse(ver).release # noqa: E731
parse_floating_version = lambda ver: parse_version(ver)[:3] # noqa: E731
parse_version = lambda ver: version_parser.parse(ver).release # noqa: E731, pylint: disable=unnecessary-lambda-assignment
parse_floating_version = lambda ver: parse_version(ver)[:3] # noqa: E731, pylint: disable=unnecessary-lambda-assignment
parsed_floating_version = parse_floating_version(browser_version)
resolve_modern_url = functools.partial(
self._resolve_modern_url, driver_platform=driver_platform
Expand Down Expand Up @@ -228,7 +231,7 @@ def get_url_for_version_and_platform(
if url:
return url

raise Exception(f"No such driver version {browser_version} for {platform}")
raise UnknownDriverError(f"No such driver version {browser_version} for {platform}")

# pylint: disable=arguments-differ
def get_driver_download_url(self, os_type: str, resolve: bool = False) -> str:
Expand Down Expand Up @@ -428,7 +431,7 @@ def start(browser: str, service: Optional[Service] = None, **options) -> WebDriv
@functools.lru_cache(maxsize=1)
def _is_chromium() -> bool:
"""Detects if Chromium is used instead of Chrome no matter the platform."""
is_browser = lambda browser_type: bool( # noqa: E731
is_browser = lambda browser_type: bool( # noqa: E731, pylint: disable=unnecessary-lambda-assignment
_OPS_MANAGER.get_browser_version_from_os(browser_type)
)
with suppress_logging():
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/RPA/core/windows/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

from RPA.core.windows.helpers import IS_WINDOWS

# Define placeholder objects
auto = None
COMError = None
if IS_WINDOWS:
import uiautomation as auto
from comtypes import COMError # noqa
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/RPA/core/windows/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from RPA.core.windows.helpers import IS_WINDOWS
from RPA.core.windows.locators import Locator, MatchObject, WindowsElement

# Define placeholder objects
auto = None
Control = None

if IS_WINDOWS:
import uiautomation as auto
from uiautomation.uiautomation import Control
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/RPA/core/windows/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from RPA.core.windows.locators import MatchObject, WindowsElement
from RPA.core.windows.window import WindowMethods

# Define placeholder objects
auto = None
Control = None

if IS_WINDOWS:
import uiautomation as auto
from uiautomation import Control # pylint: disable=unused-import
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/RPA/core/windows/locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
)
from RPA.core.windows.helpers import IS_WINDOWS

# Define placeholder objects
auto = None
Control = None

if IS_WINDOWS:
import uiautomation as auto
from uiautomation.uiautomation import Control
Expand Down Expand Up @@ -301,7 +305,7 @@ def _get_control_from_path(
search_params = search_params.copy() # to keep idempotent behaviour
path = search_params["path"]
current = root_control
to_path = lambda idx: ( # noqa: E731
to_path = lambda idx: ( # noqa: E731, pylint: disable=unnecessary-lambda-assignment
MatchObject.PATH_SEP.join(str(pos) for pos in path[:idx])
)

Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/RPA/core/windows/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
from RPA.core.windows.context import WindowsContext
from RPA.core.windows.helpers import IS_WINDOWS, get_process_list

# Define placeholder objects
auto = None
win32api = None
win32con = None
win32gui = None
win32process = None
win32ui = None

if IS_WINDOWS:
import uiautomation as auto
import win32api
Expand Down

0 comments on commit 43d4238

Please sign in to comment.