Skip to content

Commit

Permalink
compatibility_cp9
Browse files Browse the repository at this point in the history
  • Loading branch information
JPOSADA202020 committed Jan 5, 2025
1 parent e39e092 commit 71b5731
Show file tree
Hide file tree
Showing 48 changed files with 258 additions and 73 deletions.
111 changes: 105 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,113 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: 2023 Jose D. Montoya
#
# SPDX-License-Identifier: MIT
# SPDX-License-Identifier: Unlicense

name: Build CI

on: [pull_request, push]
on:
pull_request:
types: [opened, reopened]
push:

jobs:
test:
build-wheel:
runs-on: ubuntu-latest
steps:
- name: Run Build CI workflow
uses: jposada202020/workflows-circuitpython-libs/build@main
- uses: actions/setup-python@v4
with:
python-version: "3.x"

- uses: actions/checkout@v3

- name: Build wheel
run: pip wheel -w dist --no-deps .

- name: check dist
run: pipx run twine check dist/*

- name: Archive wheel
uses: actions/upload-artifact@v3
with:
name: wheel
path: ${{ github.workspace }}/dist/

linters:
runs-on: ubuntu-latest
steps:

- uses: actions/setup-python@v4
with:
python-version: "3.x"

- uses: actions/checkout@v3

- name: Install pre-commit and deps
run: pip install pre-commit -r requirements.txt

- name: Setup problem matchers
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1

- name: Pre-commit hooks
run: pre-commit run --all-files

build-bundles:
runs-on: ubuntu-latest
steps:
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo repo-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
) >> $GITHUB_OUTPUT
- uses: actions/checkout@v3

- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci

- name: Install deps
run: |
source actions-ci/install.sh
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .

- name: Archive bundles
uses: actions/upload-artifact@v3
with:
name: bundles
path: ${{ github.workspace }}/bundles/

build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install deps
run: |
pip install -r docs/requirements.txt -r requirements.txt
- name: Build docs
working-directory: docs
run: sphinx-build -E -W -b html . _build/html

- name: Archive docs
uses: actions/upload-artifact@v3
with:
name: docs
path: ${{ github.workspace }}/docs/_build/html
31 changes: 24 additions & 7 deletions .github/workflows/release_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: 2025 Jose D. Montoya
#
# SPDX-License-Identifier: MIT

Expand All @@ -9,11 +9,28 @@ on:
types: [published]

jobs:
upload-release-assets:
pypi-publish:
name: Publish release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/circuitpython-uplot
permissions:
id-token: write
steps:
- name: Run PyPI Release CI workflow
uses: adafruit/workflows-circuitpython-libs/release-pypi@main
with:
pypi-username: ${{ secrets.pypi_username }}
pypi-password: ${{ secrets.pypi_password }}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install --upgrade build
- name: Build package
run: |
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}}/" {} +
python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
20 changes: 15 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
# SPDX-FileCopyrightText: 2023 Jose D. Montoya
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense

repos:
- repo: https://github.com/python/black
rev: 23.3.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
args:
- --fix=lf
- repo: https://github.com/pycqa/pylint
rev: v2.17.4
rev: v3.3.1
hooks:
- id: pylint
name: pylint (library code)
types: [python]
args:
- --disable=consider-using-f-string
exclude: "^(docs/|examples/|tests/)"
exclude: "^(docs/|examples/|tests/|setup.py$)"
- id: pylint
name: pylint (example code)
description: Run pylint rules on "examples/*.py" files
types: [python]
files: "^examples/"
args:
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
- id: pylint
name: pylint (test code)
description: Run pylint rules on "tests/*.py" files
types: [python]
files: "^tests/"
args:
- --disable=missing-docstring,consider-using-f-string,duplicate-code
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ unsafe-load-any-extension=no

[MESSAGES CONTROL]
confidence=
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
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
enable=

[REPORTS]
Expand Down
13 changes: 11 additions & 2 deletions examples/bar_3Dbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@
b = [3, 5, 1, 9, 7]

# Creating a 3D bar
Bar(plot, a, b, color=0xFF1000, fill=True, bar_space=30, xstart=70, projection=True)
Bar(
plot,
a,
b,
color=0xFF1000,
fill=True,
bar_space=30,
xstart=70,
projection=True,
)

# Plotting and showing the plot
display.show(plot)
display.root_group = plot
11 changes: 9 additions & 2 deletions examples/bar_color_changing.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
a = ["a", "b", "c", "d", "e", "f"]

# Showing the plot
display.show(plot)
display.root_group = plot

# Creating the bar
my_bar = Bar(
Expand All @@ -47,7 +47,14 @@
time.sleep(2)
# Changing all the bars to Yellow
my_bar.update_colors(
[color.YELLOW, color.YELLOW, color.YELLOW, color.YELLOW, color.YELLOW, color.YELLOW]
[
color.YELLOW,
color.YELLOW,
color.YELLOW,
color.YELLOW,
color.YELLOW,
color.YELLOW,
]
)

time.sleep(2)
Expand Down
2 changes: 1 addition & 1 deletion examples/bar_colorpalette.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
)

# Showing the plot
display.show(plot)
display.root_group = plot
2 changes: 1 addition & 1 deletion examples/bar_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
Bar(plot, a, b, 0xFF1000, True)

# Plotting and showing the plot
display.show(plot)
display.root_group = plot
2 changes: 1 addition & 1 deletion examples/bar_scale_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
group.append(plot_scale1)
group.append(plot_scale2)

display.show(group)
display.root_group = group
2 changes: 1 addition & 1 deletion examples/bar_updating_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

add = 1
# Showing the plot
display.show(plot)
display.root_group = plot

# Creating the bar
my_bar = Bar(
Expand Down
8 changes: 6 additions & 2 deletions examples/cartersian_and_scatter_polyfit_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@
plot = Plot(0, 0, display.width - table_width, display.height, padding=1)
plot.tick_params(tickx_height=12, ticky_height=12, tickcolor=0x939597, tickgrid=True)
plot_table = Plot(
display.width - table_width - 1, 0, table_width - 1, display.height, padding=1
display.width - table_width - 1,
0,
table_width - 1,
display.height,
padding=1,
)

display.show(g)
display.root_group = g
g.append(plot)
g.append(plot_table)

Expand Down
2 changes: 1 addition & 1 deletion examples/cartesian_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
Cartesian(plot, x, y, rangex=[-5, 5], rangey=[0, 1], line_color=0x00FF00)

# Plotting and showing the plot
display.show(plot)
display.root_group = plot
2 changes: 1 addition & 1 deletion examples/cartesian_fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Adding the plot area
plot = Plot(0, 0, display.width - 125, display.height, padding=25)

display.show(plot)
display.root_group = plot

# Creating the values
x = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])
Expand Down
2 changes: 1 addition & 1 deletion examples/cartesian_koch.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def rotate(vector: numpy.ndarray, angle_in_degrees: float) -> numpy.ndarray:

# Adding the Cartesian plot
Cartesian(plot, x_coordinates, y_coordinates)
display.show(plot)
display.root_group = plot
7 changes: 5 additions & 2 deletions examples/cartesian_koch_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def R(angle, coords, jump):

def F(angle, coords, jump):
coords.append(
(coords[-1][0] + jump * cosin[angle], coords[-1][1] + jump * sines[angle])
(
coords[-1][0] + jump * cosin[angle],
coords[-1][1] + jump * sines[angle],
)
)
return angle

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

# Adding the Cartesian plot
Cartesian(plot, x_coordinates, y_coordinates)
display.show(plot)
display.root_group = plot
2 changes: 1 addition & 1 deletion examples/cartesian_logging_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
g.append(plot_1)
g.append(plot_2)

display.show(g)
display.root_group = g
display.refresh()

for i, element in enumerate(x):
Expand Down
2 changes: 1 addition & 1 deletion examples/cartesian_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ def heat_index(temp, humidity):
color.BLUE,
)
g.append(my_table)
display.show(g)
display.root_group = g
2 changes: 1 addition & 1 deletion examples/cartesian_trig_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
g.append(text_area)
g.append(text2_area)

display.show(g)
display.root_group = g
2 changes: 1 addition & 1 deletion examples/display_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
plot.append(roundrect)

# Plotting and showing the plot
display.show(plot)
display.root_group = plot
2 changes: 1 addition & 1 deletion examples/fillbetween.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

Fillbetween(plot, x, y1, y2)

display.show(plot)
display.root_group = plot
2 changes: 1 addition & 1 deletion examples/integration_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
plot.draw_circle(radius=8, x=120, y=120)

# Showing in the screen
display.show(plot)
display.root_group = plot
2 changes: 1 addition & 1 deletion examples/lissajous_curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create_curve(a=1, b=2, mul_factor=10, delta=3.14 / 2):
g.append(plot4)

# Plotting and showing the plot
display.show(g)
display.root_group = g


# Some Variables
Expand Down
Loading

0 comments on commit 71b5731

Please sign in to comment.