Skip to content

Commit

Permalink
refactor: granularity in the installation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianpfischer committed Jan 22, 2023
1 parent a07c40c commit 8ade4cc
Show file tree
Hide file tree
Showing 18 changed files with 158 additions and 127 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

# Runs the preparation
- name: Prepare working environement
run: poetry install
run: poetry install --all-extras

# Runs the test
- name: Run unittests
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pipeline
checkout scm
// TODO remove once new docker image is available
sh 'python3 -m pip install poetry'
sh 'poetry install'
sh 'poetry install --all-extras'
}
}
stage('Format check')
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ The project will contain:
## Install ##

```bash
pip install pykiso
pip install pykiso # Core framework
pip install pykiso[plugins] # For installing all plugins
pip install pykiso[all] # For installing all what we have to offer
```

[Poetry](https://python-poetry.org/) is more appropriate for developers as it automatically creates virtual environments.

```bash
cd kiso-testing
poetry install
poetry install --all-extras
poetry shell
```

Expand Down
10 changes: 8 additions & 2 deletions docs/getting_started/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ Install

.. code:: bash
pip install pykiso
pip install pykiso # Core framework
pip install pykiso[plugins] # To install all plugins
pip install pykiso[can] # To enable you to use CAN related plugins
pip install pykiso[debugger] # To enable you to use JLINK and else related plugins
pip install pykiso[instrument] # To enable you to use instrument control plugins
pip install pykiso[all] # To enable you to install everything we have to offer
`Poetry <https://python-poetry.org/>`__ is more appropriate for
developers as it automatically creates virtual environments.
Expand All @@ -24,7 +30,7 @@ developers as it automatically creates virtual environments.
git clone https://github.com/eclipse/kiso-testing.git
cd kiso-testing
poetry install
poetry install --all-extras
poetry shell
Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/getting_started_dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Install
git clone https://github.com/eclipse/kiso-testing.git
cd kiso-testing
poetry install
poetry install --all-extras
poetry shell
Pre-Commit
Expand Down
138 changes: 43 additions & 95 deletions poetry.lock

Large diffs are not rendered by default.

48 changes: 41 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,54 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.7"
PyYAML = "^6.0"
pylink-square = ">=0.12,<0.15"
pyserial = "^3.0"
python-can = {version = "^4.0.0", extras = ["pcan"]}
PyVISA = "^1.12.0"
PyVISA-py = "~0.5.3"
robotframework = "3.2.2"
unittest-xml-reporting = "^3.2.0"
click = ">=7.0.0,<9.0.0"
pykiso-python-uds = "~3.0.2"
tabulate = ">=0.8.9,<0.10.0"
Jinja2 = ">=2.11.0,<4.0.0"
MarkupSafe = "~2.0.1" # Allow support for Jinja2 between 2.11 < x < 3
importlib-metadata = {version = ">=4.12,<6.0", python = "<3.8"}
pylink-square = {version = ">=0.12,<0.15", optional = true}
pykiso-python-uds = {version = "~3.0.2", optional = true}
pyserial = {version = "^3.0", optional = true}
PyVISA = {version = "^1.12.0", optional = true}
PyVISA-py = {version = "~0.5.3", optional = true}
python-can = {version = "^4.0.0", optional = true, extras = ["pcan,vector"]}

[tool.poetry.dev-dependencies]
[tool.poetry.extras]
plugins = [
"pylink-square",
"pykiso-python-uds",
"python-can",
"pyserial",
"PyVISA",
"PyVISA-py",
]
can = [
"pykiso-python-uds",
"python-can",
]
debugger = [
"pylink-square",
]
instrument = [
"PyVISA",
"PyVISA-py",
]
serial = [
"pyserial",
]
all = [
"pylink-square",
"pykiso-python-uds",
"python-can",
"pyserial",
"PyVISA",
"PyVISA-py",
]


[tool.poetry.group.dev.dependencies]
black = "22.10.0"
bump2version = "*"
coverage = { version = "^6.5", extras = ["toml"] }
Expand All @@ -71,6 +104,7 @@ sphinx-rtd-theme = "*"
sphinxcontrib-programoutput = "*"
sphinx-autodoc-typehints = "*"


[tool.poetry.scripts]
pykiso = 'pykiso.cli:main'
pykiso-tags = 'pykiso.tool.show_tag:main'
Expand Down
7 changes: 5 additions & 2 deletions src/pykiso/lib/auxiliaries/udsaux/uds_auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@
from pathlib import Path
from typing import Iterator, List, Optional, Union

import can
from uds import IsoServices
try:
import can
from uds import IsoServices
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[can]'")

from pykiso.connector import CChannel

Expand Down
10 changes: 7 additions & 3 deletions src/pykiso/lib/connectors/cc_pcan_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@
from pathlib import Path
from typing import Dict, Union

import can
import can.bus
import can.interfaces.pcan.basic as PCANBasic
try:
import can
import can.bus
import can.interfaces.pcan.basic as PCANBasic
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[can]'")


from pykiso import CChannel, Message

Expand Down
6 changes: 5 additions & 1 deletion src/pykiso/lib/connectors/cc_rtt_segger.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
from pathlib import Path
from typing import Dict, Optional, Union

import pylink
try:
import pylink
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[debugger]'")


from pykiso import connector
from pykiso.message import Message
Expand Down
6 changes: 5 additions & 1 deletion src/pykiso/lib/connectors/cc_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
from enum import Enum, IntEnum
from typing import ByteString, Dict, Optional, Union

import serial
try:
import serial
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[serial]'")


from pykiso import Message, connector

Expand Down
8 changes: 6 additions & 2 deletions src/pykiso/lib/connectors/cc_socket_can/cc_socket_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
from pathlib import Path
from typing import Dict, Union

import can
import can.bus
try:
import can
import can.bus
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[can]'")


from pykiso import CChannel, Message
from pykiso.lib.connectors.cc_socket_can.socketcan_to_trc import (
Expand Down
6 changes: 5 additions & 1 deletion src/pykiso/lib/connectors/cc_socket_can/socketcan_to_trc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
import time
from textwrap import dedent

import can
try:
import can
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[can]'")


log = logging.getLogger(__name__)

Expand Down
5 changes: 4 additions & 1 deletion src/pykiso/lib/connectors/cc_uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
import struct
import time

import serial
try:
import serial
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[serial]'")

from pykiso import connector, message

Expand Down
5 changes: 4 additions & 1 deletion src/pykiso/lib/connectors/cc_usb.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
.. warning: Still under test
"""

import serial
try:
import serial
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[serial]'")

from pykiso.lib.connectors import cc_uart

Expand Down
12 changes: 8 additions & 4 deletions src/pykiso/lib/connectors/cc_vector_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
import logging
from typing import Dict, Union

import can
import can.bus
import can.interfaces.vector
from can.interfaces.vector.canlib import get_channel_configs
try:
import can
import can.bus
import can.interfaces.vector
from can.interfaces.vector.canlib import get_channel_configs
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[can]'")


from pykiso import CChannel, Message

Expand Down
6 changes: 5 additions & 1 deletion src/pykiso/lib/connectors/cc_visa.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
import abc
import logging

import pyvisa
try:
import pyvisa
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[instrument]'")


from pykiso import CChannel
from pykiso.types import MsgType
Expand Down
6 changes: 5 additions & 1 deletion src/pykiso/lib/connectors/flash_jlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
import pathlib
import typing

import pylink
try:
import pylink
except ImportError as e:
raise ImportError(f"{e.name} dependency missing, consider installing pykiso with 'pip install pykiso[debugger]'")


from pykiso import Flasher

Expand Down

0 comments on commit 8ade4cc

Please sign in to comment.