Skip to content

Commit e087257

Browse files
committed
fixing tests
renaming package ispprogrammer to match pypi
1 parent a19602f commit e087257

21 files changed

+178
-121
lines changed

.github/workflows/cd.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution 📦
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.x"
18+
- name: Install pypa/build
19+
run: >-
20+
python3 -m
21+
pip install
22+
build
23+
--user
24+
- name: Build a binary wheel and a source tarball
25+
run: python3 -m build
26+
- name: Store the distribution packages
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: python-package-distributions
30+
path: dist/
31+
32+
publish-to-pypi:
33+
name: >-
34+
Publish Python 🐍 distribution 📦 to PyPI
35+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
36+
needs:
37+
- build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/ISPProgrammer # Replace <package-name> with your PyPI project name
42+
permissions:
43+
id-token: write # IMPORTANT: mandatory for trusted publishing
44+
45+
steps:
46+
- name: Download all the dists
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: python-package-distributions
50+
path: dist/
51+
- name: Publish distribution 📦 to PyPI
52+
uses: pypa/gh-action-pypi-publish@release/v1
53+
54+
publish-to-testpypi:
55+
name: Publish Python 🐍 distribution 📦 to TestPyPI
56+
needs:
57+
- build
58+
runs-on: ubuntu-latest
59+
60+
environment:
61+
name: testpypi
62+
url: https://test.pypi.org/p/ISPProgrammer
63+
64+
permissions:
65+
id-token: write # IMPORTANT: mandatory for trusted publishing
66+
67+
steps:
68+
- name: Download all the dists
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: python-package-distributions
72+
path: dist/
73+
- name: Publish distribution 📦 to TestPyPI
74+
uses: pypa/gh-action-pypi-publish@release/v1
75+
with:
76+
repository-url: https://test.pypi.org/legacy/

.github/workflows/pyinstaller-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
3232
- name: Verify Installations
3333
run: |
34-
python3 -m pip show isp_programmer
34+
python3 -m pip show ispprogrammer
3535
python3 -m pip show pyserial
3636
3737
- name: Make executable

.github/workflows/python-app.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python application
5+
6+
on:
7+
push:
8+
branches: [ "master" ]
9+
pull_request:
10+
branches: [ "master" ]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up Python 3.9
23+
uses: actions/setup-python@v3
24+
with:
25+
python-version: "3.9"
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install .
30+
pip install ruff pytest
31+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32+
- name: Lint with ruff
33+
run: |
34+
# stop the build if there are Python syntax errors or undefined names
35+
ruff check --exit-non-zero-on-fix
36+
- name: Test with pytest
37+
run: |
38+
pytest

.github/workflows/python-package.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/pythonpublish.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The configuration file is identical to that used by the [lpctools project](http:
4646
### From PyPI
4747

4848
```bash
49-
pip install isp_programmer
49+
pip install ispprogrammer
5050
```
5151

5252
### From Source
@@ -62,17 +62,17 @@ pip install .
6262
## Usage
6363
### Erase Entire Flash
6464
```bash
65-
isp_programmer --device /dev/ttyUSB0 -b 9600 -crystal_frequency 12000 masserase
65+
ispprogrammer --device /dev/ttyUSB0 -b 9600 -crystal_frequency 12000 masserase
6666
```
6767

6868
### Program Flash Image
6969
```bash
70-
isp_programmer --device /dev/ttyUSB0 -b 9600 -crystal_frequency 12000 writeimage --imagein blinky804.hex
70+
ispprogrammer --device /dev/ttyUSB0 -b 9600 -crystal_frequency 12000 writeimage --imagein blinky804.hex
7171
```
7272

7373
### Read Chip Info
7474
```bash
75-
isp_programmer --device /dev/ttyUSB0 -b 9600 -crystal_frequency 12000 querychip
75+
ispprogrammer --device /dev/ttyUSB0 -b 9600 -crystal_frequency 12000 querychip
7676
```
7777

7878
## Similar Projects

packaging/gui-tk.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from PyInstaller.utils.hooks import collect_all
44
datas = []
55
binaries = []
66
hiddenimports = []
7-
tmp_ret = collect_all('isp_programmer')
7+
tmp_ret = collect_all('ispprogrammer')
88
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
99
tmp_ret = collect_all('serial')
1010
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]

packaging/gui.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
import queue
1212
import serial
1313
import serial.tools.list_ports
14-
import isp_programmer.cli
14+
import ispprogrammer.cli
1515

1616
__version__ = "v1.2.1"
1717

18-
_log = logging.getLogger("isp_programmer_gui")
18+
_log = logging.getLogger("ispprogrammer_gui")
1919
_min_frame_size = (200, 300)
2020
_frame_size = (600, 800)
2121

@@ -54,8 +54,8 @@ def setup_log_handler(log, output_queue, level=logging.INFO):
5454
log.setLevel(level)
5555
log.addHandler(handler)
5656

57-
logging.getLogger("isp_programmer").addHandler(handler)
58-
logging.getLogger("isp_programmer").setLevel(logging.INFO)
57+
logging.getLogger("ispprogrammer").addHandler(handler)
58+
logging.getLogger("ispprogrammer").setLevel(logging.INFO)
5959

6060

6161
class WorkerThread(threading.Thread):
@@ -126,34 +126,34 @@ def get(self):
126126
return self.file_path.get()
127127

128128

129-
def program_isp_task(
129+
def program_isptask(
130130
image, device, output_queue, baud=115200, crystal_frequency=12000, no_sync=False
131131
):
132132
setup_log_handler(_log, output_queue)
133-
isp, chip = isp_programmer.cli.SetupChip(
133+
isp, chip = ispprogrammer.cli.SetupChip(
134134
baud,
135135
device,
136136
crystal_frequency,
137-
isp_programmer.cli._chip_defs,
137+
ispprogrammer.cli._chip_defs,
138138
no_sync,
139139
)
140-
bin_ = isp_programmer.cli.read_image_file_to_bin(image)
141-
isp_programmer.cli.WriteImage(isp, chip, bin_)
140+
bin_ = ispprogrammer.cli.read_image_file_to_bin(image)
141+
ispprogrammer.cli.WriteImage(isp, chip, bin_)
142142
isp.Go(0)
143143

144144

145145
def erase_task(
146146
device, output_queue, baud=115200, crystal_frequency=12000, no_sync=False
147147
):
148148
setup_log_handler(_log, output_queue)
149-
isp, chip = isp_programmer.cli.SetupChip(
149+
isp, chip = ispprogrammer.cli.SetupChip(
150150
baud,
151151
device,
152152
crystal_frequency,
153-
isp_programmer.cli._chip_defs,
153+
ispprogrammer.cli._chip_defs,
154154
no_sync,
155155
)
156-
isp_programmer.cli.MassErase(isp, chip)
156+
ispprogrammer.cli.MassErase(isp, chip)
157157

158158

159159
class MyFrame(tk.Tk):
@@ -206,10 +206,10 @@ def __init__(self, parent, title):
206206
self.sync_checkbutton.pack(anchor=tk.W, padx=5, pady=5)
207207

208208
# program isp button
209-
self.run_isp_button = tk.Button(
209+
self.run_ispbutton = tk.Button(
210210
self, text="Program", command=self.on_run_program_isp
211211
)
212-
self.run_isp_button.pack(pady=10)
212+
self.run_ispbutton.pack(pady=10)
213213

214214
# erase isp button
215215
self.run_erase_button = tk.Button(self, text="Erase", command=self.on_run_erase)
@@ -298,7 +298,7 @@ def on_run_program_isp(self):
298298
bin_file = self.file_picker.get()
299299
self.update_text(f"Starting task. Device {com_choice}, Bin {bin_file}\n")
300300
command = functools.partial(
301-
program_isp_task,
301+
program_isptask,
302302
image=bin_file,
303303
device=com_choice,
304304
no_sync=(not self.sync_mode.get()),
@@ -339,7 +339,7 @@ def main():
339339

340340
log_format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
341341
logging.basicConfig(format=log_format)
342-
logging.getLogger("isp_programmer").setLevel(logging.DEBUG)
342+
logging.getLogger("ispprogrammer").setLevel(logging.DEBUG)
343343
_log.setLevel(logging.INFO)
344344
app.mainloop()
345345

pyproject.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "isp_programmer"
2+
name = "ispprogrammer"
33
version = "1.2.1"
44
description='NXP ISP Cortex-M programming tool'
55
authors = [
@@ -22,19 +22,20 @@ dependencies = [
2222
]
2323

2424
[project.urls]
25-
repository='https://github.com/snhobbs/NXPISP'
26-
url='https://github.com/snhobbs/NXPISP'
25+
repository='https://github.com/snhobbs/isp-programmer'
26+
url='https://github.com/snhobbs/isp-programmer'
2727

2828
[project.scripts]
29-
isp_programmer = "isp_programmer.cli:main"
30-
ISPProgrammer = "isp_programmer.cli:main"
31-
isp-programmer-gui = "isp_programmer.gui:main"
29+
ispprogrammer = "ispprogrammer.cli:main"
30+
ISPProgrammer = "ispprogrammer.cli:main"
31+
isp-programmer-gui = "ispprogrammer.gui:main"
32+
ispprogrammer-gui = "ispprogrammer.gui:main"
3233

3334
[tool.setuptools]
3435
include-package-data = true
3536

3637
[tool.setuptools.packages.find]
37-
where = ["src", "src/isp_programmer"]
38+
where = ["src", "src/ispprogrammer"]
3839

3940
[build-system]
4041
requires = [
@@ -43,7 +44,7 @@ requires = [
4344
]
4445

4546
[tool.setuptools.package-data]
46-
isp_programmer= ["*.def", "*.ini", "src/isp_programmer/lpctools_parts.def"]
47+
ispprogrammer= ["*.def", "*.ini", "src/ispprogrammer/lpctools_parts.def"]
4748

4849
[tool.pylint]
4950
max-line-length = 200

src/isp_programmer/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)