Skip to content

Commit 71b5731

Browse files
author
JPOSADA202020
committed
compatibility_cp9
1 parent e39e092 commit 71b5731

Some content is hidden

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

48 files changed

+258
-73
lines changed

.github/workflows/build.yml

+105-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,113 @@
1-
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
1+
# SPDX-FileCopyrightText: 2023 Jose D. Montoya
22
#
3-
# SPDX-License-Identifier: MIT
3+
# SPDX-License-Identifier: Unlicense
44

55
name: Build CI
66

7-
on: [pull_request, push]
7+
on:
8+
pull_request:
9+
types: [opened, reopened]
10+
push:
811

912
jobs:
10-
test:
13+
build-wheel:
1114
runs-on: ubuntu-latest
1215
steps:
13-
- name: Run Build CI workflow
14-
uses: jposada202020/workflows-circuitpython-libs/build@main
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: "3.x"
19+
20+
- uses: actions/checkout@v3
21+
22+
- name: Build wheel
23+
run: pip wheel -w dist --no-deps .
24+
25+
- name: check dist
26+
run: pipx run twine check dist/*
27+
28+
- name: Archive wheel
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: wheel
32+
path: ${{ github.workspace }}/dist/
33+
34+
linters:
35+
runs-on: ubuntu-latest
36+
steps:
37+
38+
- uses: actions/setup-python@v4
39+
with:
40+
python-version: "3.x"
41+
42+
- uses: actions/checkout@v3
43+
44+
- name: Install pre-commit and deps
45+
run: pip install pre-commit -r requirements.txt
46+
47+
- name: Setup problem matchers
48+
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1
49+
50+
- name: Pre-commit hooks
51+
run: pre-commit run --all-files
52+
53+
build-bundles:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Translate Repo Name For Build Tools filename_prefix
57+
id: repo-name
58+
run: |
59+
echo repo-name=$(
60+
echo ${{ github.repository }} |
61+
awk -F '\/' '{ print tolower($2) }' |
62+
tr '_' '-'
63+
) >> $GITHUB_OUTPUT
64+
65+
- uses: actions/checkout@v3
66+
67+
- name: Set up Python 3.x
68+
uses: actions/setup-python@v4
69+
with:
70+
python-version: "3.x"
71+
72+
- name: Checkout tools repo
73+
uses: actions/checkout@v3
74+
with:
75+
repository: adafruit/actions-ci-circuitpython-libs
76+
path: actions-ci
77+
78+
- name: Install deps
79+
run: |
80+
source actions-ci/install.sh
81+
82+
- name: Build assets
83+
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
84+
85+
- name: Archive bundles
86+
uses: actions/upload-artifact@v3
87+
with:
88+
name: bundles
89+
path: ${{ github.workspace }}/bundles/
90+
91+
build-docs:
92+
runs-on: ubuntu-latest
93+
steps:
94+
- uses: actions/checkout@v3
95+
96+
- name: Set up Python 3.x
97+
uses: actions/setup-python@v4
98+
with:
99+
python-version: "3.x"
100+
101+
- name: Install deps
102+
run: |
103+
pip install -r docs/requirements.txt -r requirements.txt
104+
105+
- name: Build docs
106+
working-directory: docs
107+
run: sphinx-build -E -W -b html . _build/html
108+
109+
- name: Archive docs
110+
uses: actions/upload-artifact@v3
111+
with:
112+
name: docs
113+
path: ${{ github.workspace }}/docs/_build/html

.github/workflows/release_pypi.yml

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
1+
# SPDX-FileCopyrightText: 2025 Jose D. Montoya
22
#
33
# SPDX-License-Identifier: MIT
44

@@ -9,11 +9,28 @@ on:
99
types: [published]
1010

1111
jobs:
12-
upload-release-assets:
12+
pypi-publish:
13+
name: Publish release to PyPI
1314
runs-on: ubuntu-latest
15+
environment:
16+
name: pypi
17+
url: https://pypi.org/p/circuitpython-uplot
18+
permissions:
19+
id-token: write
1420
steps:
15-
- name: Run PyPI Release CI workflow
16-
uses: adafruit/workflows-circuitpython-libs/release-pypi@main
17-
with:
18-
pypi-username: ${{ secrets.pypi_username }}
19-
pypi-password: ${{ secrets.pypi_password }}
21+
- uses: actions/checkout@v4
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: "3.x"
26+
- name: Install dependencies
27+
shell: bash
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install --upgrade build
31+
- name: Build package
32+
run: |
33+
find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" {} +
34+
python -m build
35+
- name: Publish package distributions to PyPI
36+
uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
1-
# SPDX-FileCopyrightText: 2023 Jose D. Montoya
1+
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
22
#
33
# SPDX-License-Identifier: Unlicense
44

55
repos:
66
- repo: https://github.com/python/black
7-
rev: 23.3.0
7+
rev: 24.10.0
88
hooks:
99
- id: black
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.4.0
11+
rev: v5.0.0
1212
hooks:
1313
- id: check-yaml
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
16+
- id: mixed-line-ending
17+
args:
18+
- --fix=lf
1619
- repo: https://github.com/pycqa/pylint
17-
rev: v2.17.4
20+
rev: v3.3.1
1821
hooks:
1922
- id: pylint
2023
name: pylint (library code)
2124
types: [python]
2225
args:
2326
- --disable=consider-using-f-string
24-
exclude: "^(docs/|examples/|tests/)"
27+
exclude: "^(docs/|examples/|tests/|setup.py$)"
2528
- id: pylint
2629
name: pylint (example code)
2730
description: Run pylint rules on "examples/*.py" files
2831
types: [python]
2932
files: "^examples/"
3033
args:
3134
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
35+
- id: pylint
36+
name: pylint (test code)
37+
description: Run pylint rules on "tests/*.py" files
38+
types: [python]
39+
files: "^tests/"
40+
args:
41+
- --disable=missing-docstring,consider-using-f-string,duplicate-code

.pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ unsafe-load-any-extension=no
1414

1515
[MESSAGES CONTROL]
1616
confidence=
17-
disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding,protected-access,unnecessary-list-index-lookup,duplicate-code,import-outside-toplevel,attribute-defined-outside-init
17+
disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding,protected-access,unnecessary-list-index-lookup,duplicate-code,import-outside-toplevel,attribute-defined-outside-init, too-many-positional-arguments
1818
enable=
1919

2020
[REPORTS]

examples/bar_3Dbars.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@
1818
b = [3, 5, 1, 9, 7]
1919

2020
# Creating a 3D bar
21-
Bar(plot, a, b, color=0xFF1000, fill=True, bar_space=30, xstart=70, projection=True)
21+
Bar(
22+
plot,
23+
a,
24+
b,
25+
color=0xFF1000,
26+
fill=True,
27+
bar_space=30,
28+
xstart=70,
29+
projection=True,
30+
)
2231

2332
# Plotting and showing the plot
24-
display.show(plot)
33+
display.root_group = plot

examples/bar_color_changing.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
a = ["a", "b", "c", "d", "e", "f"]
3333

3434
# Showing the plot
35-
display.show(plot)
35+
display.root_group = plot
3636

3737
# Creating the bar
3838
my_bar = Bar(
@@ -47,7 +47,14 @@
4747
time.sleep(2)
4848
# Changing all the bars to Yellow
4949
my_bar.update_colors(
50-
[color.YELLOW, color.YELLOW, color.YELLOW, color.YELLOW, color.YELLOW, color.YELLOW]
50+
[
51+
color.YELLOW,
52+
color.YELLOW,
53+
color.YELLOW,
54+
color.YELLOW,
55+
color.YELLOW,
56+
color.YELLOW,
57+
]
5158
)
5259

5360
time.sleep(2)

examples/bar_colorpalette.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@
3939
)
4040

4141
# Showing the plot
42-
display.show(plot)
42+
display.root_group = plot

examples/bar_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
Bar(plot, a, b, 0xFF1000, True)
2020

2121
# Plotting and showing the plot
22-
display.show(plot)
22+
display.root_group = plot

examples/bar_scale_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
group.append(plot_scale1)
3030
group.append(plot_scale2)
3131

32-
display.show(group)
32+
display.root_group = group

examples/bar_updating_values.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
add = 1
3333
# Showing the plot
34-
display.show(plot)
34+
display.root_group = plot
3535

3636
# Creating the bar
3737
my_bar = Bar(

examples/cartersian_and_scatter_polyfit_example.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@
2626
plot = Plot(0, 0, display.width - table_width, display.height, padding=1)
2727
plot.tick_params(tickx_height=12, ticky_height=12, tickcolor=0x939597, tickgrid=True)
2828
plot_table = Plot(
29-
display.width - table_width - 1, 0, table_width - 1, display.height, padding=1
29+
display.width - table_width - 1,
30+
0,
31+
table_width - 1,
32+
display.height,
33+
padding=1,
3034
)
3135

32-
display.show(g)
36+
display.root_group = g
3337
g.append(plot)
3438
g.append(plot_table)
3539

examples/cartesian_advanced.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
Cartesian(plot, x, y, rangex=[-5, 5], rangey=[0, 1], line_color=0x00FF00)
2727

2828
# Plotting and showing the plot
29-
display.show(plot)
29+
display.root_group = plot

examples/cartesian_fill.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Adding the plot area
1515
plot = Plot(0, 0, display.width - 125, display.height, padding=25)
1616

17-
display.show(plot)
17+
display.root_group = plot
1818

1919
# Creating the values
2020
x = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])

examples/cartesian_koch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ def rotate(vector: numpy.ndarray, angle_in_degrees: float) -> numpy.ndarray:
6060

6161
# Adding the Cartesian plot
6262
Cartesian(plot, x_coordinates, y_coordinates)
63-
display.show(plot)
63+
display.root_group = plot

examples/cartesian_koch_2.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ def R(angle, coords, jump):
2626

2727
def F(angle, coords, jump):
2828
coords.append(
29-
(coords[-1][0] + jump * cosin[angle], coords[-1][1] + jump * sines[angle])
29+
(
30+
coords[-1][0] + jump * cosin[angle],
31+
coords[-1][1] + jump * sines[angle],
32+
)
3033
)
3134
return angle
3235

@@ -57,4 +60,4 @@ def koch(steps, length=200, startPos=(0, 0)):
5760

5861
# Adding the Cartesian plot
5962
Cartesian(plot, x_coordinates, y_coordinates)
60-
display.show(plot)
63+
display.root_group = plot

examples/cartesian_logging_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
g.append(plot_1)
8080
g.append(plot_2)
8181

82-
display.show(g)
82+
display.root_group = g
8383
display.refresh()
8484

8585
for i, element in enumerate(x):

examples/cartesian_table.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,4 @@ def heat_index(temp, humidity):
119119
color.BLUE,
120120
)
121121
g.append(my_table)
122-
display.show(g)
122+
display.root_group = g

examples/cartesian_trig_functions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@
3939
g.append(text_area)
4040
g.append(text2_area)
4141

42-
display.show(g)
42+
display.root_group = g

examples/display_shapes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@
4141
plot.append(roundrect)
4242

4343
# Plotting and showing the plot
44-
display.show(plot)
44+
display.root_group = plot

examples/fillbetween.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020

2121
Fillbetween(plot, x, y1, y2)
2222

23-
display.show(plot)
23+
display.root_group = plot

examples/integration_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
plot.draw_circle(radius=8, x=120, y=120)
3232

3333
# Showing in the screen
34-
display.show(plot)
34+
display.root_group = plot

examples/lissajous_curves.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def create_curve(a=1, b=2, mul_factor=10, delta=3.14 / 2):
4848
g.append(plot4)
4949

5050
# Plotting and showing the plot
51-
display.show(g)
51+
display.root_group = g
5252

5353

5454
# Some Variables

0 commit comments

Comments
 (0)