diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 33c2a61..2b59355 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -13,6 +13,9 @@ build: tools: python: "3" +sphinx: + configuration: docs/conf.py + python: install: - requirements: docs/requirements.txt diff --git a/README.rst b/README.rst index 9bd113f..288b456 100644 --- a/README.rst +++ b/README.rst @@ -23,9 +23,15 @@ Introduction Reduced version of the decimal library for CircuitPython +Important Note +============== +From version 1.0.9 through 1.0.12, this package was incorrectly published on pypi under the name +`circuitpython-jepler-udecimal `_. +The correct package name is +`jepler-circuitpython-udecimal `_. Dependencies -============= +============ This library depends on: * `Adafruit CircuitPython `_ diff --git a/build.sh b/build.sh index a314d47..00dc322 100755 --- a/build.sh +++ b/build.sh @@ -1,54 +1,80 @@ #!/bin/bash set -eo pipefail +in_section=false +if [ "${CI}" -eq "true" ]; then + start_section () { + if $in_section; then end_section; fi + echo "::group::$*" + export in_section=true + } + end_section () { + echo "::endgroup::$*" + in_section=false + } +else + start_section () { + if $in_section; then end_section; fi + echo "=== $*" + export in_section=true + } + end_section () { + echo + in_section=false + } +fi + repo_name=`git config remote.origin.url | sed -e 's,^.*/,,;s/\.git$//' | tr A-Z_ a-z-` -echo "=== Building package: $repo_name" +echo "*** Building package: $repo_name" -echo "=== Create and set up virtual environment" +start_section "Create and set up virtual environment" [ -d .venv ] || python3 -m venv .env . .env/bin/activate -echo "=== Install requirements" +start_section "Install requirements" pip3 install wheel -pip3 install -r requirements_dev.txt -echo "=== Run pre-commit" +pip3 install -r optional_requirements.txt +start_section "Run pre-commit" pre-commit run --all-files -echo "=== Clone and build circuitpython unix port" +start_section "Clone and build circuitpython unix port" [ -e circuitpython/py/py.mk ] || git clone --shallow-since=2021-07-01 https://github.com/adafruit/circuitpython [ -e circuitpython/lib/libffi/autogen.sh ] || (cd circuitpython && git submodule update --init lib/libffi lib/axtls lib/berkeley-db-1.xx tools/huffman lib/uzlib extmod/ulab) [ -x circuitpython/ports/unix/micropython ] || ( make -C circuitpython/mpy-cross -j$(nproc) -make -C circuitpython/ports/unix -j$(nproc) deplibs +make -C circuitpython/ports/unix -j$(nproc) deplibs submodules make -C circuitpython/ports/unix -j$(nproc) DEBUG=1 STRIP=: ) -echo "=== Run tests" +start_section "Run tests" python -m jepler_udecimal.test -run-tests () { - env MICROPYPATH=. PYTHONPATH=. MICROPY_MICROPYTHON=circuitpython/ports/unix/micropython circuitpython/tests/run-tests.py "$@" +run_tests () { + env MICROPYPATH="`readlink -f .`" PYTHONPATH="`readlink -f .`" MICROPY_MICROPYTHON=circuitpython/ports/unix/build-standard/micropython circuitpython/tests/run-tests.py --keep-path "$@" } -run-tests --clean-failures -if ! run-tests -d examples; then - run-tests --print-failures +run_tests --clean-failures +if ! run_tests -d examples; then + run_tests --print-failures exit 1 fi PYTHONPATH=. python examples/test_udecimal.py > test_udecimal.exp -echo "=== Build CircuitPython bundle" +start_section "Build CircuitPython bundle" circuitpython-build-bundles --package_folder_prefix jepler --filename_prefix $repo_name --library_location . -echo "=== Build docs" +start_section "Build docs" rm -rf docs/_build (cd docs && sphinx-build -E -W -b html . _build/html) -echo "=== Build pypi files" -python setup.py sdist -python setup.py bdist_wheel --universal +start_section "Build pypi files" +python -m build -echo "=== Check pypi files" +start_section "Check pypi files" twine check dist/* +end_section + +echo "=== Success" + # SPDX-FileCopyrightText: Copyright (c) 2020 jepler for Unpythonic Networks # # SPDX-License-Identifier: MIT diff --git a/docs/conf.py b/docs/conf.py index 24510c2..b7c4b6f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,6 +19,7 @@ "sphinx.ext.intersphinx", "sphinx.ext.napoleon", "sphinx.ext.todo", + "sphinx_rtd_theme", ] autoapi_keep_files = True @@ -107,7 +108,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -on_rtd = os.environ.get("READTHEDOCS", None) == "True" +html_theme = "sphinx_rtd_theme" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/docs/requirements.txt b/docs/requirements.txt index 8912f83..b187142 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,3 +4,4 @@ sphinx>=4.0.0 sphinx-autoapi +sphinx-rtd-theme diff --git a/optional_requirements.txt b/optional_requirements.txt index 7913ee8..6000f3f 100644 --- a/optional_requirements.txt +++ b/optional_requirements.txt @@ -2,6 +2,7 @@ # SPDX-FileCopyrightText: Copyright (c) 2020 jepler for Unpythonic Networks # # SPDX-License-Identifier: MIT +build pre-commit recommonmark==0.6.0 sphinx