Compare commits

..

1 commit

Author SHA1 Message Date
435d5f14b0
Update metadata to match reality
This is needed so that we can rely on the metadata in https://github.com/adafruit/circuitpython-build-tools/pull/101

Please make a new tagged release after incorporating this change.

If you don't think you'll be able to deal with this in a timely fashion, please let me know.
2023-11-30 09:32:23 -06:00
13 changed files with 217 additions and 77 deletions

View file

@ -10,5 +10,73 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Run Build CI workflow
uses: adafruit/workflows-circuitpython-libs/build@main
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v3
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install dependencies
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
run: |
source actions-ci/install.sh
- name: Pip install Sphinx, pre-commit
run: |
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
- name: Library version
run: git describe --dirty --always --tags
- name: Setup problem matchers
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1
- name: Pre-commit hooks
run: |
pre-commit run --all-files
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --package_folder_prefix cedargrove_ --library_location .
- name: Archive bundles
uses: actions/upload-artifact@v2
with:
name: bundles
path: ${{ github.workspace }}/bundles/
- name: Check for docs folder
id: need-docs
run: |
echo ::set-output name=docs::$( find . -wholename './docs' )
- name: Build docs
if: contains(steps.need-docs.outputs.docs, 'docs')
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- name: Check For pyproject.toml
id: need-pypi
run: |
echo ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' )
- name: Build Python package
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
run: |
pip install --upgrade build twine
for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
sed -i -e "s/0.0.0+auto.0/1.2.3/" $file;
done;
python -m build
twine check dist/*

88
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,88 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v3
with:
submodules: true
- 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 }} --package_folder_prefix cedargrove_ --library_location .
- name: Upload Release Assets
# the 'official' actions version does not yet support dynamically
# supplying asset names to upload. @csexton's version chosen based on
# discussion in the issue below, as its the simplest to implement and
# allows for selecting files with a pattern.
# https://github.com/actions/upload-release-asset/issues/4
#uses: actions/upload-release-asset@v1.0.1
uses: csexton/release-asset-action@master
with:
pattern: "bundles/*"
github-token: ${{ secrets.GITHUB_TOKEN }}
upload-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check For pyproject.toml
id: need-pypi
run: |
echo ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' )
- name: Set up Python
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
run: |
python -m pip install --upgrade pip
pip install --upgrade build twine
- name: Build and publish
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" $file;
done;
python -m build
twine upload dist/*

View file

@ -1,19 +0,0 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: GitHub Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Run GitHub Release CI workflow
uses: adafruit/workflows-circuitpython-libs/release-gh@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
upload-url: ${{ github.event.release.upload_url }}

View file

@ -1,19 +0,0 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: PyPI Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
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 }}

View file

@ -18,7 +18,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: v2.15.5
rev: v2.11.1
hooks:
- id: pylint
name: pylint (library code)

View file

@ -26,7 +26,7 @@ jobs=1
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=pylint.extensions.no_self_use
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
@ -54,8 +54,8 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# disable=import-error,raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,deprecated-str-translate-call
disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,pointless-string-statement,unspecified-encoding
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
@ -225,6 +225,12 @@ max-line-length=100
# Maximum number of lines in a module
max-module-lines=1000
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
@ -251,22 +257,38 @@ min-similarity-lines=12
[BASIC]
# Naming hint for argument names
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct argument names
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for attribute names
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct attribute names
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Naming hint for class names
# class-name-hint=[A-Z_][a-zA-Z0-9]+$
class-name-hint=[A-Z_][a-zA-Z0-9_]+$
# Regular expression matching correct class names
# class-rgx=[A-Z_][a-zA-Z0-9]+$
class-rgx=[A-Z_][a-zA-Z0-9_]+$
# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
@ -274,6 +296,9 @@ const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# ones are exempt.
docstring-min-length=-1
# Naming hint for function names
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct function names
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
@ -284,12 +309,21 @@ good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
# Include a hint for the correct naming format with invalid-name
include-naming-hint=no
# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Naming hint for method names
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct method names
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
@ -305,6 +339,9 @@ no-docstring-rgx=^_
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty
# Naming hint for variable names
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct variable names
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

View file

@ -67,9 +67,9 @@ Usage Example
``grayscale(index, gamma)``
Translates the normalized index value into a 24-bit RGB integer with gamma
visual perception control. The spectral index is a floating point value in the
range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0
to 1.0 (inclusive); default is 0.8, tuned for TFT displays. If the index or gamma
adjustment. The spectral index is a floating point value in the range of 0.0 to
1.0 (inclusive); default is 0.0. The gamma value can be from 0.0 to 1.0
(inclusive); default is 0.8, tuned for TFT displays. If the index or gamma
value is outside of the specified range, the 24-bit RGB output will be limited
to the minimum (0x0) or maximum (0xFFFFFF) value.
@ -83,9 +83,9 @@ to the minimum (0x0) or maximum (0xFFFFFF) value.
``iron(index, gamma)``
Translates the normalized index value into a 24-bit RGB integer with gamma
visual perception control. The spectral index is a floating point value in the
range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0
to 1.0 (inclusive); default is 0.5, tuned for TFT displays. If the index or gamma
adjustment. The spectral index is a floating point value in the range of 0.0 to
1.0 (inclusive); default is 0.0. The gamma value can be from 0.0 to 1.0
(inclusive); default is 0.5, tuned for TFT displays. If the index or gamma
value is outside of the specified range, the 24-bit RGB output will be limited
to the minimum (0x0) or maximum (0xFFFFFF) value.
@ -99,9 +99,9 @@ to the minimum (0x0) or maximum (0xFFFFFF) value.
``stoplight(index, gamma)``
Translates the normalized index value into a 24-bit RGB integer with gamma
visual perception control. The spectral index is a floating point value in the
range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0
to 1.0 (inclusive); default is 0.5, tuned for TFT displays. If the index or gamma
adjustment. The spectral index is a floating point value in the range of 0.0 to
1.0 (inclusive); default is 0.0. The gamma value can be from 0.0 to 1.0
(inclusive); default is 0.5, tuned for TFT displays. If the index or gamma
value is outside of the specified range, the 24-bit RGB output will be limited
to the minimum (0x0) or maximum (0xFFFFFF) value.
@ -115,9 +115,9 @@ to the minimum (0x0) or maximum (0xFFFFFF) value.
``visible(index, gamma)``
Translates the normalized index value into a 24-bit RGB integer with gamma
visual perception control. The spectral index is a floating point value in the
range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0
to 1.0 (inclusive); default is 0.5, tuned for TFT displays. If the index or gamma
adjustment. The spectral index is a floating point value in the range of 0.0 to
1.0 (inclusive); default is 0.0. The gamma value can be from 0.0 to 1.0
(inclusive); default is 0.5, tuned for TFT displays. If the index or gamma
value is outside of the specified range, the 24-bit RGB output will be limited
to the minimum (0x0) or maximum (0xFFFFFF) value.
@ -131,11 +131,11 @@ to the minimum (0x0) or maximum (0xFFFFFF) value.
``n_color(index, gamma)``
A class that translates the normalized index value into a 24-bit RGB integer
with gamma visual perception control. The spectral index is a floating point
value in the range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value
can be from 0.0 to 3.0 (inclusive); default is 0.55, tuned for TFT displays. If
the index or gamma value is outside of the specified range, the 24-bit RGB
output will be limited to the minimum (0x0) or maximum (0xFFFFFF) value.
with gamma adjustment. The spectral index is a floating point value in the
range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from
0.0 to 3.0 (inclusive); default is 0.55, tuned for TFT displays. If the index
or gamma value is outside of the specified range, the 24-bit RGB output will be
limited to the minimum (0x0) or maximum (0xFFFFFF) value.
The class converts a spectrum index value consisting of a positive numeric
value (0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the
@ -160,7 +160,7 @@ consumption with a slight speed performance sacrifice. Use the
0xff9c00
``n_color_table(index, gamma)``
``n_color(index, gamma)``
This class functions the same as the ``n_color.Spectrum`` class, calculating
resultant color values from a pre-compiled internal color list to improve speed

View file

@ -25,7 +25,6 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
"""
Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio)
@ -55,7 +54,6 @@ def map_range(x, in_min, in_max, out_min, out_max):
def index_to_rgb(index=0, gamma=0.8):
# pylint: disable = duplicate-code
"""
Converts a spectral index to a grayscale RGB value. Spectral index in
range of 0.0 to 1.0. Gamma in range of 0.0 to 1.0 (1.0=linear),

View file

@ -24,7 +24,6 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
"""
Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio)
@ -54,7 +53,6 @@ def map_range(x, in_min, in_max, out_min, out_max):
def index_to_rgb(index=0, gamma=0.5):
# pylint: disable = duplicate-code
"""
Converts a temperature index to an iron thermographic pseudocolor spectrum
RGB value. Temperature index in range of 0.0 to 1.0. Gamma in range of

View file

@ -24,7 +24,6 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
"""Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio)
@ -52,9 +51,7 @@ def map_range(x, in_min, in_max, out_min, out_max):
return min(max(mapped, out_max), out_min)
# pylint: disable = duplicate-code
class Spectrum:
# pylint: disable = duplicate-code
"""Converts a spectrum index value consisting of a positive numeric value
(0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the
index position on a graduated and blended multicolor spectrum.
@ -93,7 +90,6 @@ class Spectrum:
"""
def __init__(self, colors=None, mode="continuous", gamma=0.55):
# pylint: disable = duplicate-code
self._colors = colors
self._mode = mode
self._gamma = min(max(gamma, 0), 3.0)

View file

@ -24,7 +24,6 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
"""Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio)
@ -52,9 +51,7 @@ def map_range(x, in_min, in_max, out_min, out_max):
return min(max(mapped, out_max), out_min)
# pylint: disable = duplicate-code
class Spectrum:
# pylint: disable = duplicate-code
"""Converts a spectrum index value consisting of a positive numeric value
(0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the
index position on a graduated and blended multicolor spectrum.
@ -92,7 +89,6 @@ class Spectrum:
"""
def __init__(self, colors=None, mode="normal", gamma=0.55):
# pylint: disable = duplicate-code
self._colors = colors
self._mode = mode
self._gamma = min(max(gamma, 0), 3.0)

View file

@ -24,7 +24,6 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def map_range(x, in_min, in_max, out_min, out_max):
# pylint: disable = duplicate-code
"""
Maps and constrains an input value from one range of values to another.
(from adafruit_simpleio)
@ -54,7 +53,6 @@ def map_range(x, in_min, in_max, out_min, out_max):
def index_to_rgb(index=0, gamma=0.5):
# pylint: disable = duplicate-code
"""
Converts a spectral index to "stop light" (green -> yellow -> red)
spectrum to an RGB value. Spectral index in range of 0.0 to 1.0

View file

@ -27,7 +27,6 @@ __repo__ = "https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools
def index_to_rgb(index=0, gamma=0.5):
# pylint: disable = duplicate-code
"""
Converts a spectral index to rainbow (visible light wavelength)
spectrum to an RGB value. Spectral index in range of 0.0 to 1.0