Skip to content

Commit 2b70107

Browse files
X2CscopeedrasEdras Pacola
authored
Milestone v0.5.0 (#102)
* Websockets for webx2c (#101) * fixed html files name pattern on webx2cscope * convert to bootstrap 5 * update mchplnet pointer main@v0.2.2 * fixed bug removing variables from scope view web * visual fix on mobile view * fixed overlay of dropdown and header of table * variable hide on scope_view.js * adding variable legends to the chart. when you click on the legend item, it hides or shows the line chart. * fixing demos * websockets for watch-view and scope-view * pointing to mchplnet v0.3.0 * bug fix - trigger_level trigger_level must be in range of variable if trigger_level is outside this range, it clamps to max or min accordingly * removing prints * fix doc misspelling * fixing example readability * when adding a variable on watch-view, read the value before * fixed labels on x-axis on webview * fix views when connect/disconnect * default log level for x2cscope is error * enhancing serial_stub.py for get_ram and put_ram * included test for thread safety * fixing interface on mchplnet * enhancing examples * enhancing existing tests * enhancing github actions documentation.yml - if the merging branch is the main, check if we have a new version * fixing to default snake_case on mchplnet * update mchplnet pointer * fix docstrings * fix imports format * fix docstring on tests * removing elf16 parser - elf16_parser.py was deprecated on previous versions and now it was removed. - The current elf parser implementation handles both 16 and 32 bit architectures and is based on pyelftools. * include linter ignore. - generic gui needs to be refactored. * removing debug prints * including version check and auto-update of version on __init__.py on pre commit * update mchplnet to version 0.3.0 * fix mchplnet dependency * enhancing enum_variables added specific methods for enum: - get_enum_list - set_enum_value - get_enum_value * importing eventlet in case webinterface is called --------- Co-authored-by: Edras Pacola <edras.pacola@gmail.com> Co-authored-by: Edras Pacola <edras.pacola@microchip.com>
1 parent d20aa1c commit 2b70107

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2217
-1708
lines changed

.github/workflows/documentation.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,41 @@ jobs:
9696
run: |
9797
sphinx-build -M html doc build --keep-going
9898
99+
version-check:
100+
runs-on: ubuntu-latest
101+
if: github.base_ref == 'main'
102+
steps:
103+
- uses: actions/checkout@v4
104+
with:
105+
fetch-depth: 0
99106

107+
- name: Check version consistency
108+
run: |
109+
# Get version from pyproject.toml
110+
PYPROJECT_VERSION=$(grep -oP 'version\s*=\s*"\K[^"]+' pyproject.toml)
111+
# Get version from __init__.py
112+
INIT_VERSION=$(grep -oP '__version__\s*=\s*["\x27]\K[^"\x27]+' pyx2cscope/__init__.py)
113+
114+
if [ "$PYPROJECT_VERSION" != "$INIT_VERSION" ]; then
115+
echo "❌ Version mismatch between pyproject.toml ($PYPROJECT_VERSION) and __init__.py ($INIT_VERSION)"
116+
echo "Run 'python scripts/update_version.py' to synchronize versions"
117+
exit 1
118+
fi
119+
echo "✅ Version consistency verified: $PYPROJECT_VERSION"
120+
121+
- name: Check version has been updated
122+
if: github.base_ref == 'main'
123+
run: |
124+
# Get PR version
125+
PR_VERSION=$(grep -oP 'version\s*=\s*"\K[^"]+' pyproject.toml)
126+
127+
# Get main branch version
128+
git fetch origin main:main
129+
MAIN_VERSION=$(git show main:pyproject.toml | grep -oP 'version\s*=\s*"\K[^"]+')
130+
131+
if [ "$PR_VERSION" == "$MAIN_VERSION" ]; then
132+
echo "❌ ERROR: Version in PR ($PR_VERSION) is the same as in main branch ($MAIN_VERSION)"
133+
echo "Please update the version in pyproject.toml"
134+
exit 1
135+
fi
136+
echo "✅ Version check passed: $PR_VERSION (PR) vs $MAIN_VERSION (main)"

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: update-version
5+
name: Update version in __init__.py
6+
entry: python scripts/update_version.py
7+
language: python
8+
files: ^pyproject.toml$
9+
types: [toml]
10+
always_run: true

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
("py:class", "mchplnet.lnet.LNet"),
5555
("py:class", "mchplnet.services.scope.ScopeChannel"),
5656
("py:class", "mchplnet.interfaces.factory.InterfaceType"),
57-
("py:class", "mchplnet.interfaces.abstract_interface.InterfaceABC"),
57+
("py:class", "mchplnet.interfaces.abstract_interface.Interface"),
5858
]
5959

6060
intersphinx_mapping = {

doc/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Create a virtual environment and install pyx2cscope using the following commands
1212
1313
It is highly recommended to install python libraries underneath a virtual environment.
1414

15-
Nevertheless, to install at system level, we advise to install it on user area. (Global insallation may not work.)
15+
Nevertheless, to install at system level, we advise to install it on user area. (Global installation may not work.)
1616
Execute the following lines:
1717

1818
.. code-block:: python

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "pyx2cscope"
7-
version = "0.4.4"
7+
version = "0.5.0"
88
description = "python implementation of X2Cscope"
99
authors = [
1010
"Yash Agarwal",
@@ -33,7 +33,7 @@ numpy = "^1.26.0"
3333
matplotlib = "^3.7.2"
3434
PyQt5 = "^5.15.9"
3535
pyqtgraph= "^0.13.7"
36-
mchplnet = "0.2.1"
36+
mchplnet = "0.3.0"
3737
flask = "^3.0.3"
3838

3939

@@ -49,6 +49,6 @@ lint.select = ["D"]
4949
# PL - pylint
5050
lint.extend-select = ["I", "N", "F", "PL", "D"]
5151
exclude = ["mchplnet/*"]
52-
lint.ignore = ["I001", "PLW0603", "PLW0602", "PLR0913"] #TODO fix the import issue. no errors on local machine and errors on github action.
52+
lint.ignore = ["PLR0913"]
5353

5454

pyx2cscope/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
"""This module contains the pyx2cscope package.
22
3-
Version: 0.4.4
3+
Version: 0.5.0
44
"""
55

6+
# Apply eventlet monkey patch before any other imports if web interface is requested
7+
import sys
8+
9+
if "-w" in sys.argv or "--web" in sys.argv:
10+
import eventlet
11+
eventlet.monkey_patch()
12+
613
import logging
714

8-
__version__ = "0.4.4"
15+
__version__ = "0.5.0"
916

1017

1118
def set_logger(

pyx2cscope/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import argparse
1212

1313
import pyx2cscope
14-
from pyx2cscope import utils
15-
from pyx2cscope import gui
14+
from pyx2cscope import gui, utils
1615

1716

1817
def parse_arguments():

pyx2cscope/examples/SFR_Example.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import logging
44
import time
55

6+
from variable.variable import VariableInfo
7+
68
from pyx2cscope.utils import get_com_port, get_elf_file_path
79
from pyx2cscope.x2cscope import X2CScope
8-
from variable.variable import VariableInfo
910

1011
# Configuration for serial port communication
1112
serial_port = get_com_port() # Select COM port

pyx2cscope/examples/demo.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
"""Demo scripting for user to get started."""
2+
import time
3+
24
from pyx2cscope.x2cscope import X2CScope
35

46
elf_file =r"path to your elf file.elf"
57

6-
x2cscope = X2CScope(port="COM39", elf_file=elf_file)
8+
x2cscope = X2CScope(port="COM4", elf_file=elf_file)
79

810
phase_current = x2cscope.get_variable("motor.iabc.a")
911
phase_voltage = x2cscope.get_variable("motor.vabc.a")
@@ -15,4 +17,6 @@
1517

1618
while True:
1719
if x2cscope.is_scope_data_ready():
18-
print(x2cscope.get_scope_channel_data())
20+
print(x2cscope.get_scope_channel_data())
21+
x2cscope.request_scope_data()
22+
time.sleep(0.1)

0 commit comments

Comments
 (0)