From f0ea7eb17123458acc9542d148007f6ea9d287b3 Mon Sep 17 00:00:00 2001 From: "S. Co1" Date: Thu, 2 Nov 2023 16:53:41 -0400 Subject: [PATCH] Add release pipeline Closes: #5 --- .github/workflows/release_artifacts.yml | 55 +++++ README.md | 16 +- .../airplane_icons.bmp | Bin default_map.bmp => assets/default_map.bmp | Bin heli_icons.bmp => assets/heli_icons.bmp | Bin splash.bmp => assets/splash.bmp | Bin compile.py | 31 +++ lib/adafruit_bitmapsaver.mpy | Bin 0 -> 1652 bytes poetry.lock | 222 ++++-------------- pyproject.toml | 4 +- skyportal/aircraftlib.py | 4 +- skyportal/displaylib.py | 4 +- skyportal/maplib.py | 6 +- 13 files changed, 151 insertions(+), 191 deletions(-) create mode 100644 .github/workflows/release_artifacts.yml rename airplane_icons.bmp => assets/airplane_icons.bmp (100%) rename default_map.bmp => assets/default_map.bmp (100%) rename heli_icons.bmp => assets/heli_icons.bmp (100%) rename splash.bmp => assets/splash.bmp (100%) create mode 100644 compile.py create mode 100644 lib/adafruit_bitmapsaver.mpy diff --git a/.github/workflows/release_artifacts.yml b/.github/workflows/release_artifacts.yml new file mode 100644 index 0000000..08e9f76 --- /dev/null +++ b/.github/workflows/release_artifacts.yml @@ -0,0 +1,55 @@ +name: Build Release Artifacts + +on: + release: + types: [published] + +jobs: + artifacts: + name: Package & upload release artifacts + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Compile skyportal lib + run: | + python -m pip install mpy-cross + python ./compile.py + + - name: Build base bundle + run: | + tar -cvf bundle_base.tar \ + ./assets/* \ + ./lib/* \ + ./boot.py \ + ./code.py \ + ./constants.py \ + ./pyportal_startup.bmp \ + ./pyportal_startup.wav \ + ./secrets.py + + - name: Create non-compiled bundle + run: | + cp bundle_base.tar skyportal_bundle.tar + tar -rvf skyportal_bundle.tar ./skyportal/* + gzip skyportal_bundle.tar + + - name: Create compiled bundle + run: | + cp bundle_base.tar skyportal_bundle_compiled.tar + tar -rvf skyportal_bundle_compiled.tar -C ./dist/ . + gzip skyportal_bundle_compiled.tar + + - name: Upload artifacts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: + gh release upload ${{ github.event.release.tag_name }} skyportal_bundle.tar.gz skyportal_bundle_compiled.tar.gz diff --git a/README.md b/README.md index 72d34db..8c59661 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,28 @@ Heavily inspired by Bob Hammell"s PyPortal Flight Tracker ([GH](https://github.c Thank you to [markleoart](https://www.fiverr.com/markleoart) for creating the aircraft icon sprite sheets! ## Getting Started -Users are assumed have read through [Adafruit"s PyPortal learning guide](https://learn.adafruit.com/adafruit-pyportal). CircuitPython v8.2 is currently in use for this repository, no other versions are evaluated. +Users are assumed have read through [Adafruit's PyPortal learning guide](https://learn.adafruit.com/adafruit-pyportal). CircuitPython v8.2 is currently in use for this repository, no other versions are evaluated. -To get up and running, copy the following files to your PyPortal: +**WARNING:** In order to generate the background map tile, this project's `boot.py` modifies the boot process to allow the filesystem to be used as a writeable cache. In the unlikely event that things go horribly awry you may lose the existing contents of your device, so be sure to back them up before working with this project. + +### Installation +#### From Source +To get up and running, copy the following files from the repository to your PyPortal: ``` +assets/ lib/ skyportal/ -airplane_icons.bmp boot.py code.py constants.py -default_map.bmp -heli_icons.bmp pyportal_startup.bmp pyportal_startup.wav secrets.py -splash.bmp ``` -**WARNING:** In order to generate the background map tile, this project's `boot.py` modifies the boot process to allow the filesystem to be used as a writeable cache. In the unlikely event that things go horribly awry you may lose the existing contents of your device, so be sure to back them up before working with this project. +#### From GH Release +The Skyportal [Releases page](https://github.com/sco1/skyportal/releases) contains bundled `*.tar.gz` archives, built in CI, that can be downloaded and extracted directly onto the device. Bundles come in two flavors: one pure-python implementation and one compiled `*.mpy` version, which has a decreased overall file size. ### Secrets The following secrets are required for functionality: diff --git a/airplane_icons.bmp b/assets/airplane_icons.bmp similarity index 100% rename from airplane_icons.bmp rename to assets/airplane_icons.bmp diff --git a/default_map.bmp b/assets/default_map.bmp similarity index 100% rename from default_map.bmp rename to assets/default_map.bmp diff --git a/heli_icons.bmp b/assets/heli_icons.bmp similarity index 100% rename from heli_icons.bmp rename to assets/heli_icons.bmp diff --git a/splash.bmp b/assets/splash.bmp similarity index 100% rename from splash.bmp rename to assets/splash.bmp diff --git a/compile.py b/compile.py new file mode 100644 index 0000000..7b5f8f9 --- /dev/null +++ b/compile.py @@ -0,0 +1,31 @@ +import time +from pathlib import Path + +import mpy_cross + +SOURCE_DIR = Path("./skyportal") +DEST_DIR = Path("./dist/lib/skyportal") + + +if __name__ == "__main__": + DEST_DIR.mkdir(parents=True, exist_ok=True) + + to_compile = list(SOURCE_DIR.glob("*.py")) + print(f"Found {len(to_compile)} *.py files to compile") + for filepath in to_compile: + mpy_cross.run(filepath) + + time.sleep(1) # Lazy wait for subprocesses to finish + + compiled = list(SOURCE_DIR.glob("*.mpy")) + if len(compiled) != len(to_compile): + raise RuntimeError( + f"Number of compiled files less than original source ({len(compiled)} < {len(to_compile)}), may need a longer wait" # noqa: E501 + ) + + print(f"Compiled {len(compiled)} files ... moving to {DEST_DIR}") + for filepath in compiled: + dest = DEST_DIR / filepath.name + dest.unlink(missing_ok=True) + + filepath.rename(DEST_DIR / filepath.name) diff --git a/lib/adafruit_bitmapsaver.mpy b/lib/adafruit_bitmapsaver.mpy new file mode 100644 index 0000000000000000000000000000000000000000..fe051a92ab5b8c54cc6d756ac16791609a0daab5 GIT binary patch literal 1652 zcmb7E-*3}a6ux$nwF*t^x|s{Ks3FPHBn>GECae|GiW7-nV{24O@C3Rzj+@jHz9UB^gZj>^%J$BM2@iO*;rn1rp9(U~|osjmjNX|L_?m6G_ zx!=7f=^zI@pI(V@pe-uogek2e8!#&yB|+7N>yj2#XRnQ+1HoW$An62wD!iR0n5~QJv#LQ8EmP>P*SHS`=o(wmv%7 zaAl>xjUieOf95zql=EUmElL#ip=!uVStwG@$uf3uR);aG%H@13+_XHR`nk%~l%z?y zj3yhB7AE@anAV2Z&bdIQ8w8%E?1(={fU8tTEEb$#IZF5L(1VGIbSfKP|m?= zIcF5&4kie-eD-+aI5ZTP&1=vwyNtiZ9BdX;R$)CK7ErS1=4! z9~~af%SNG+jfzTXxFy^0sg{08Srf62`|P%8$U zlCgf~pDy2!vLpcJv*8;LeKd3GI?X7;Y{jj!#?acOieR(Bp z!--B&DJt4h@i%Jhhy(HAaKsz%rUpa)K+u09G&C4H5{d==p{V&$b-H=gSaO|yyUr3v z$?t!l!5DpDl_gl>(fGz~ZWCo5qs^7n7+OW#QIvU7|K{uJt1vnF}a}x*?dp`#(u~B!M8W+v8kEzxY z0kBCZ{Cp|$&$8X-G4gvJxc-HErRD2YY_@N>^I=+|V-)EI!ny`5@f(tP&ri+N)7 zL@z?9-5(8}jzoqcL%vAK!-XTk(B%lIClBF1c)BsH@L)PSG5-E3o+Xp*7(d~&v4lk1 zdTbA@-R;AY_hMXFrdzXYFVc=9Icu>_hcLR&%6FJ3KxaMx)|mlcUGVdh?W#G{R@~q;-iown10M6vK}EAJU|A?h0|WZdgd{5EoJY{|m6B98Jf(_mc(Rg5 j@HEDQN6|dZ!K}wG7G&)|W1BPFGliq~GR+zFzY6>V-yju) literal 0 HcmV?d00001 diff --git a/poetry.lock b/poetry.lock index 32d529e..430a764 100644 --- a/poetry.lock +++ b/poetry.lock @@ -20,29 +20,29 @@ tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pyte [[package]] name = "black" -version = "23.10.0" +version = "23.10.1" description = "The uncompromising code formatter." optional = false python-versions = ">=3.8" files = [ - {file = "black-23.10.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:f8dc7d50d94063cdfd13c82368afd8588bac4ce360e4224ac399e769d6704e98"}, - {file = "black-23.10.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:f20ff03f3fdd2fd4460b4f631663813e57dc277e37fb216463f3b907aa5a9bdd"}, - {file = "black-23.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d3d9129ce05b0829730323bdcb00f928a448a124af5acf90aa94d9aba6969604"}, - {file = "black-23.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:960c21555be135c4b37b7018d63d6248bdae8514e5c55b71e994ad37407f45b8"}, - {file = "black-23.10.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:30b78ac9b54cf87bcb9910ee3d499d2bc893afd52495066c49d9ee6b21eee06e"}, - {file = "black-23.10.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:0e232f24a337fed7a82c1185ae46c56c4a6167fb0fe37411b43e876892c76699"}, - {file = "black-23.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:31946ec6f9c54ed7ba431c38bc81d758970dd734b96b8e8c2b17a367d7908171"}, - {file = "black-23.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:c870bee76ad5f7a5ea7bd01dc646028d05568d33b0b09b7ecfc8ec0da3f3f39c"}, - {file = "black-23.10.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:6901631b937acbee93c75537e74f69463adaf34379a04eef32425b88aca88a23"}, - {file = "black-23.10.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:481167c60cd3e6b1cb8ef2aac0f76165843a374346aeeaa9d86765fe0dd0318b"}, - {file = "black-23.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f74892b4b836e5162aa0452393112a574dac85e13902c57dfbaaf388e4eda37c"}, - {file = "black-23.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:47c4510f70ec2e8f9135ba490811c071419c115e46f143e4dce2ac45afdcf4c9"}, - {file = "black-23.10.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:76baba9281e5e5b230c9b7f83a96daf67a95e919c2dfc240d9e6295eab7b9204"}, - {file = "black-23.10.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:a3c2ddb35f71976a4cfeca558848c2f2f89abc86b06e8dd89b5a65c1e6c0f22a"}, - {file = "black-23.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db451a3363b1e765c172c3fd86213a4ce63fb8524c938ebd82919bf2a6e28c6a"}, - {file = "black-23.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:7fb5fc36bb65160df21498d5a3dd330af8b6401be3f25af60c6ebfe23753f747"}, - {file = "black-23.10.0-py3-none-any.whl", hash = "sha256:e223b731a0e025f8ef427dd79d8cd69c167da807f5710add30cdf131f13dd62e"}, - {file = "black-23.10.0.tar.gz", hash = "sha256:31b9f87b277a68d0e99d2905edae08807c007973eaa609da5f0c62def6b7c0bd"}, + {file = "black-23.10.1-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:ec3f8e6234c4e46ff9e16d9ae96f4ef69fa328bb4ad08198c8cee45bb1f08c69"}, + {file = "black-23.10.1-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:1b917a2aa020ca600483a7b340c165970b26e9029067f019e3755b56e8dd5916"}, + {file = "black-23.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c74de4c77b849e6359c6f01987e94873c707098322b91490d24296f66d067dc"}, + {file = "black-23.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:7b4d10b0f016616a0d93d24a448100adf1699712fb7a4efd0e2c32bbb219b173"}, + {file = "black-23.10.1-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:b15b75fc53a2fbcac8a87d3e20f69874d161beef13954747e053bca7a1ce53a0"}, + {file = "black-23.10.1-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:e293e4c2f4a992b980032bbd62df07c1bcff82d6964d6c9496f2cd726e246ace"}, + {file = "black-23.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d56124b7a61d092cb52cce34182a5280e160e6aff3137172a68c2c2c4b76bcb"}, + {file = "black-23.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:3f157a8945a7b2d424da3335f7ace89c14a3b0625e6593d21139c2d8214d55ce"}, + {file = "black-23.10.1-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:cfcce6f0a384d0da692119f2d72d79ed07c7159879d0bb1bb32d2e443382bf3a"}, + {file = "black-23.10.1-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:33d40f5b06be80c1bbce17b173cda17994fbad096ce60eb22054da021bf933d1"}, + {file = "black-23.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:840015166dbdfbc47992871325799fd2dc0dcf9395e401ada6d88fe11498abad"}, + {file = "black-23.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:037e9b4664cafda5f025a1728c50a9e9aedb99a759c89f760bd83730e76ba884"}, + {file = "black-23.10.1-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:7cb5936e686e782fddb1c73f8aa6f459e1ad38a6a7b0e54b403f1f05a1507ee9"}, + {file = "black-23.10.1-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:7670242e90dc129c539e9ca17665e39a146a761e681805c54fbd86015c7c84f7"}, + {file = "black-23.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5ed45ac9a613fb52dad3b61c8dea2ec9510bf3108d4db88422bacc7d1ba1243d"}, + {file = "black-23.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:6d23d7822140e3fef190734216cefb262521789367fbdc0b3f22af6744058982"}, + {file = "black-23.10.1-py3-none-any.whl", hash = "sha256:d431e6739f727bb2e0495df64a6c7a5310758e87505f5f8cde9ff6c0f2d7e4fe"}, + {file = "black-23.10.1.tar.gz", hash = "sha256:1f8ce316753428ff68749c65a5f7844631aa18c8679dfd3ca9dc1a289979c258"}, ] [package.dependencies] @@ -105,70 +105,6 @@ files = [ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] -[[package]] -name = "coverage" -version = "7.3.2" -description = "Code coverage measurement for Python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "coverage-7.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d872145f3a3231a5f20fd48500274d7df222e291d90baa2026cc5152b7ce86bf"}, - {file = "coverage-7.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:310b3bb9c91ea66d59c53fa4989f57d2436e08f18fb2f421a1b0b6b8cc7fffda"}, - {file = "coverage-7.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f47d39359e2c3779c5331fc740cf4bce6d9d680a7b4b4ead97056a0ae07cb49a"}, - {file = "coverage-7.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:aa72dbaf2c2068404b9870d93436e6d23addd8bbe9295f49cbca83f6e278179c"}, - {file = "coverage-7.3.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:beaa5c1b4777f03fc63dfd2a6bd820f73f036bfb10e925fce067b00a340d0f3f"}, - {file = "coverage-7.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:dbc1b46b92186cc8074fee9d9fbb97a9dd06c6cbbef391c2f59d80eabdf0faa6"}, - {file = "coverage-7.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:315a989e861031334d7bee1f9113c8770472db2ac484e5b8c3173428360a9148"}, - {file = "coverage-7.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d1bc430677773397f64a5c88cb522ea43175ff16f8bfcc89d467d974cb2274f9"}, - {file = "coverage-7.3.2-cp310-cp310-win32.whl", hash = "sha256:a889ae02f43aa45032afe364c8ae84ad3c54828c2faa44f3bfcafecb5c96b02f"}, - {file = "coverage-7.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:c0ba320de3fb8c6ec16e0be17ee1d3d69adcda99406c43c0409cb5c41788a611"}, - {file = "coverage-7.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ac8c802fa29843a72d32ec56d0ca792ad15a302b28ca6203389afe21f8fa062c"}, - {file = "coverage-7.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:89a937174104339e3a3ffcf9f446c00e3a806c28b1841c63edb2b369310fd074"}, - {file = "coverage-7.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e267e9e2b574a176ddb983399dec325a80dbe161f1a32715c780b5d14b5f583a"}, - {file = "coverage-7.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2443cbda35df0d35dcfb9bf8f3c02c57c1d6111169e3c85fc1fcc05e0c9f39a3"}, - {file = "coverage-7.3.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4175e10cc8dda0265653e8714b3174430b07c1dca8957f4966cbd6c2b1b8065a"}, - {file = "coverage-7.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0cbf38419fb1a347aaf63481c00f0bdc86889d9fbf3f25109cf96c26b403fda1"}, - {file = "coverage-7.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:5c913b556a116b8d5f6ef834038ba983834d887d82187c8f73dec21049abd65c"}, - {file = "coverage-7.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1981f785239e4e39e6444c63a98da3a1db8e971cb9ceb50a945ba6296b43f312"}, - {file = "coverage-7.3.2-cp311-cp311-win32.whl", hash = "sha256:43668cabd5ca8258f5954f27a3aaf78757e6acf13c17604d89648ecc0cc66640"}, - {file = "coverage-7.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:e10c39c0452bf6e694511c901426d6b5ac005acc0f78ff265dbe36bf81f808a2"}, - {file = "coverage-7.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:4cbae1051ab791debecc4a5dcc4a1ff45fc27b91b9aee165c8a27514dd160836"}, - {file = "coverage-7.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:12d15ab5833a997716d76f2ac1e4b4d536814fc213c85ca72756c19e5a6b3d63"}, - {file = "coverage-7.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3c7bba973ebee5e56fe9251300c00f1579652587a9f4a5ed8404b15a0471f216"}, - {file = "coverage-7.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fe494faa90ce6381770746077243231e0b83ff3f17069d748f645617cefe19d4"}, - {file = "coverage-7.3.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f6e9589bd04d0461a417562649522575d8752904d35c12907d8c9dfeba588faf"}, - {file = "coverage-7.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d51ac2a26f71da1b57f2dc81d0e108b6ab177e7d30e774db90675467c847bbdf"}, - {file = "coverage-7.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:99b89d9f76070237975b315b3d5f4d6956ae354a4c92ac2388a5695516e47c84"}, - {file = "coverage-7.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fa28e909776dc69efb6ed975a63691bc8172b64ff357e663a1bb06ff3c9b589a"}, - {file = "coverage-7.3.2-cp312-cp312-win32.whl", hash = "sha256:289fe43bf45a575e3ab10b26d7b6f2ddb9ee2dba447499f5401cfb5ecb8196bb"}, - {file = "coverage-7.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:7dbc3ed60e8659bc59b6b304b43ff9c3ed858da2839c78b804973f613d3e92ed"}, - {file = "coverage-7.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f94b734214ea6a36fe16e96a70d941af80ff3bfd716c141300d95ebc85339738"}, - {file = "coverage-7.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:af3d828d2c1cbae52d34bdbb22fcd94d1ce715d95f1a012354a75e5913f1bda2"}, - {file = "coverage-7.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:630b13e3036e13c7adc480ca42fa7afc2a5d938081d28e20903cf7fd687872e2"}, - {file = "coverage-7.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c9eacf273e885b02a0273bb3a2170f30e2d53a6d53b72dbe02d6701b5296101c"}, - {file = "coverage-7.3.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d8f17966e861ff97305e0801134e69db33b143bbfb36436efb9cfff6ec7b2fd9"}, - {file = "coverage-7.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b4275802d16882cf9c8b3d057a0839acb07ee9379fa2749eca54efbce1535b82"}, - {file = "coverage-7.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:72c0cfa5250f483181e677ebc97133ea1ab3eb68645e494775deb6a7f6f83901"}, - {file = "coverage-7.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:cb536f0dcd14149425996821a168f6e269d7dcd2c273a8bff8201e79f5104e76"}, - {file = "coverage-7.3.2-cp38-cp38-win32.whl", hash = "sha256:307adb8bd3abe389a471e649038a71b4eb13bfd6b7dd9a129fa856f5c695cf92"}, - {file = "coverage-7.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:88ed2c30a49ea81ea3b7f172e0269c182a44c236eb394718f976239892c0a27a"}, - {file = "coverage-7.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b631c92dfe601adf8f5ebc7fc13ced6bb6e9609b19d9a8cd59fa47c4186ad1ce"}, - {file = "coverage-7.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d3d9df4051c4a7d13036524b66ecf7a7537d14c18a384043f30a303b146164e9"}, - {file = "coverage-7.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f7363d3b6a1119ef05015959ca24a9afc0ea8a02c687fe7e2d557705375c01f"}, - {file = "coverage-7.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2f11cc3c967a09d3695d2a6f03fb3e6236622b93be7a4b5dc09166a861be6d25"}, - {file = "coverage-7.3.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:149de1d2401ae4655c436a3dced6dd153f4c3309f599c3d4bd97ab172eaf02d9"}, - {file = "coverage-7.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:3a4006916aa6fee7cd38db3bfc95aa9c54ebb4ffbfc47c677c8bba949ceba0a6"}, - {file = "coverage-7.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9028a3871280110d6e1aa2df1afd5ef003bab5fb1ef421d6dc748ae1c8ef2ebc"}, - {file = "coverage-7.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9f805d62aec8eb92bab5b61c0f07329275b6f41c97d80e847b03eb894f38d083"}, - {file = "coverage-7.3.2-cp39-cp39-win32.whl", hash = "sha256:d1c88ec1a7ff4ebca0219f5b1ef863451d828cccf889c173e1253aa84b1e07ce"}, - {file = "coverage-7.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b4767da59464bb593c07afceaddea61b154136300881844768037fd5e859353f"}, - {file = "coverage-7.3.2-pp38.pp39.pp310-none-any.whl", hash = "sha256:ae97af89f0fbf373400970c0a21eef5aa941ffeed90aee43650b81f7d7f47637"}, - {file = "coverage-7.3.2.tar.gz", hash = "sha256:be32ad29341b0170e795ca590e1c07e81fc061cb5b10c74ce7203491484404ef"}, -] - -[package.extras] -toml = ["tomli"] - [[package]] name = "distlib" version = "0.3.7" @@ -182,19 +118,19 @@ files = [ [[package]] name = "filelock" -version = "3.12.4" +version = "3.13.1" description = "A platform independent file lock." optional = false python-versions = ">=3.8" files = [ - {file = "filelock-3.12.4-py3-none-any.whl", hash = "sha256:08c21d87ded6e2b9da6728c3dff51baf1dcecf973b768ef35bcbc3447edb9ad4"}, - {file = "filelock-3.12.4.tar.gz", hash = "sha256:2e6f249f1f3654291606e046b09f1fd5eac39b360664c27f5aad072012f8bcbd"}, + {file = "filelock-3.13.1-py3-none-any.whl", hash = "sha256:57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c"}, + {file = "filelock-3.13.1.tar.gz", hash = "sha256:521f5f56c50f8426f5e03ad3b281b490a87ef15bc6c526f168290f0c7148d44e"}, ] [package.extras] -docs = ["furo (>=2023.7.26)", "sphinx (>=7.1.2)", "sphinx-autodoc-typehints (>=1.24)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.3)", "diff-cover (>=7.7)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)", "pytest-timeout (>=2.1)"] -typing = ["typing-extensions (>=4.7.1)"] +docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.24)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"] +typing = ["typing-extensions (>=4.8)"] [[package]] name = "flake8" @@ -273,29 +209,18 @@ files = [ [[package]] name = "identify" -version = "2.5.30" +version = "2.5.31" description = "File identification library for Python" optional = false python-versions = ">=3.8" files = [ - {file = "identify-2.5.30-py2.py3-none-any.whl", hash = "sha256:afe67f26ae29bab007ec21b03d4114f41316ab9dd15aa8736a167481e108da54"}, - {file = "identify-2.5.30.tar.gz", hash = "sha256:f302a4256a15c849b91cfcdcec052a8ce914634b2f77ae87dad29cd749f2d88d"}, + {file = "identify-2.5.31-py2.py3-none-any.whl", hash = "sha256:90199cb9e7bd3c5407a9b7e81b4abec4bb9d249991c79439ec8af740afc6293d"}, + {file = "identify-2.5.31.tar.gz", hash = "sha256:7736b3c7a28233637e3c36550646fc6389bedd74ae84cb788200cc8e2dd60b75"}, ] [package.extras] license = ["ukkonen"] -[[package]] -name = "iniconfig" -version = "2.0.0" -description = "brain-dead simple config-ini parsing" -optional = false -python-versions = ">=3.7" -files = [ - {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, - {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, -] - [[package]] name = "isort" version = "5.12.0" @@ -324,6 +249,22 @@ files = [ {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, ] +[[package]] +name = "mpy-cross" +version = "1.20.0" +description = "micropython mpy-cross distribution" +optional = false +python-versions = "*" +files = [ + {file = "mpy_cross-1.20.0-py2.py3-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:8161edb01c0b7eda6a70c85301615f076fae329e038cc7d5c42865a13535a2a8"}, + {file = "mpy_cross-1.20.0-py2.py3-none-manylinux1_i686.whl", hash = "sha256:f34f6b29486a45ded52e9525692a0db925d4d61e50c8620e5f979dd21e8fcb7e"}, + {file = "mpy_cross-1.20.0-py2.py3-none-manylinux1_x86_64.whl", hash = "sha256:cd5dc8c00e58c4fde3330c3bb3ee66d1e12749a983d14ab58784002c5e52ec90"}, + {file = "mpy_cross-1.20.0-py2.py3-none-manylinux2014_aarch64.whl", hash = "sha256:09f9d28b103468aad3d243e7767ad216e5a169f63acbd3a3dd21eac57ebb703a"}, + {file = "mpy_cross-1.20.0-py2.py3-none-manylinux2014_armv7l.whl", hash = "sha256:04f0ad333a168cbe2f6a9753f2d74bcf89d6ced25e14cef2585fd154d7975e09"}, + {file = "mpy_cross-1.20.0-py2.py3-none-win32.whl", hash = "sha256:08fc7808abecc4586a03d3a9e519c9f7f257aa865b77aad40e5948a52c81b14b"}, + {file = "mpy_cross-1.20.0-py2.py3-none-win_amd64.whl", hash = "sha256:074fb79da38ca699440cb9001ffbe2e84dab33256349e589c457ac5ea7fe5ada"}, +] + [[package]] name = "mypy" version = "1.6.1" @@ -445,21 +386,6 @@ files = [ docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"] -[[package]] -name = "pluggy" -version = "1.3.0" -description = "plugin and hook calling mechanisms for python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, - {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, -] - -[package.extras] -dev = ["pre-commit", "tox"] -testing = ["pytest", "pytest-benchmark"] - [[package]] name = "pre-commit" version = "3.5.0" @@ -517,58 +443,6 @@ files = [ {file = "pyflakes-3.1.0.tar.gz", hash = "sha256:a0aae034c444db0071aa077972ba4768d40c830d9539fd45bf4cd3f8f6992efc"}, ] -[[package]] -name = "pytest" -version = "7.4.2" -description = "pytest: simple powerful testing with Python" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pytest-7.4.2-py3-none-any.whl", hash = "sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002"}, - {file = "pytest-7.4.2.tar.gz", hash = "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "sys_platform == \"win32\""} -iniconfig = "*" -packaging = "*" -pluggy = ">=0.12,<2.0" - -[package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] - -[[package]] -name = "pytest-cov" -version = "4.1.0" -description = "Pytest plugin for measuring coverage." -optional = false -python-versions = ">=3.7" -files = [ - {file = "pytest-cov-4.1.0.tar.gz", hash = "sha256:3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6"}, - {file = "pytest_cov-4.1.0-py3-none-any.whl", hash = "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a"}, -] - -[package.dependencies] -coverage = {version = ">=5.2.1", extras = ["toml"]} -pytest = ">=4.6" - -[package.extras] -testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] - -[[package]] -name = "pytest-randomly" -version = "3.15.0" -description = "Pytest plugin to randomly order tests and control random.seed." -optional = false -python-versions = ">=3.8" -files = [ - {file = "pytest_randomly-3.15.0-py3-none-any.whl", hash = "sha256:0516f4344b29f4e9cdae8bce31c4aeebf59d0b9ef05927c33354ff3859eeeca6"}, - {file = "pytest_randomly-3.15.0.tar.gz", hash = "sha256:b908529648667ba5e54723088edd6f82252f540cc340d748d1fa985539687047"}, -] - -[package.dependencies] -pytest = "*" - [[package]] name = "pyyaml" version = "6.0.1" @@ -658,13 +532,13 @@ files = [ [[package]] name = "virtualenv" -version = "20.24.5" +version = "20.24.6" description = "Virtual Python Environment builder" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.24.5-py3-none-any.whl", hash = "sha256:b80039f280f4919c77b30f1c23294ae357c4c8701042086e3fc005963e4e537b"}, - {file = "virtualenv-20.24.5.tar.gz", hash = "sha256:e8361967f6da6fbdf1426483bfe9fca8287c242ac0bc30429905721cefbff752"}, + {file = "virtualenv-20.24.6-py3-none-any.whl", hash = "sha256:520d056652454c5098a00c0f073611ccbea4c79089331f60bf9d7ba247bb7381"}, + {file = "virtualenv-20.24.6.tar.gz", hash = "sha256:02ece4f56fbf939dbbc33c0715159951d6bf14aaf5457b092e4548e1382455af"}, ] [package.dependencies] @@ -679,4 +553,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "6722107944c0f81954ccc86404ec50d0405440c1420dffe3bcb4750dbbc83e13" +content-hash = "6137e7da0868fc6f6c58b2b0f53329f1b5f7f066bad2d24e1da44748ae2378e1" diff --git a/pyproject.toml b/pyproject.toml index 8a198fe..195fbef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,12 +32,10 @@ flake8-bugbear = "^23.1" flake8-docstrings = "^1.7" flake8-fixme = "^1.1" isort = "^5.12" +mpy-cross = "^1.20" mypy = "^1.0" pep8-naming = "^0.13" pre-commit = "^3.0" -pytest = "^7.2" -pytest-cov = "^4.0" -pytest-randomly = "^3.12" [tool.black] line-length = 100 diff --git a/skyportal/aircraftlib.py b/skyportal/aircraftlib.py index f32e52f..8e0b749 100644 --- a/skyportal/aircraftlib.py +++ b/skyportal/aircraftlib.py @@ -122,7 +122,7 @@ def from_file(cls, filepath: str, rotation_resolution_deg: int = 30) -> Aircraft # Current icon tiles are made using primary colors #ffff00 (yellow) and #25FF00 (green, background) ICON_TILE_SIZE = 16 -BASE_ICON = AircraftIcon.from_file("./airplane_icons.bmp") +BASE_ICON = AircraftIcon.from_file("./assets/airplane_icons.bmp") AIRCRAFT_ICONS = { - AircraftCategory.ROTORCRAFT: AircraftIcon.from_file("./heli_icons.bmp"), + AircraftCategory.ROTORCRAFT: AircraftIcon.from_file("./assets/heli_icons.bmp"), } diff --git a/skyportal/displaylib.py b/skyportal/displaylib.py index a9f9c04..ce21ede 100644 --- a/skyportal/displaylib.py +++ b/skyportal/displaylib.py @@ -18,8 +18,8 @@ SKYPORTAL_DISPLAY = board.DISPLAY -SPLASH = "./splash.bmp" -DEFAULT_BASE_MAP = "./default_map.bmp" +SPLASH = "./assets/splash.bmp" +DEFAULT_BASE_MAP = "./assets/default_map.bmp" class ScreenshotHandler: diff --git a/skyportal/maplib.py b/skyportal/maplib.py index 45da275..68f1fe7 100644 --- a/skyportal/maplib.py +++ b/skyportal/maplib.py @@ -133,15 +133,15 @@ def get_base_map(grid_bounds: tuple[float, float, float, float]) -> displayio.On if r.status_code != 200: raise RuntimeError(f"Bad response received from AdaIO: {r.status_code}, {r.text}") - with open("./generated_map.bmp", "wb") as f: + with open("./assets/generated_map.bmp", "wb") as f: for chunk in r.iter_content(chunk_size=4096): f.write(chunk) - map_img = displayio.OnDiskBitmap("./generated_map.bmp") + map_img = displayio.OnDiskBitmap("./assets/generated_map.bmp") print("Geoapify map tile successfully generated") except Exception as e: print("Failed to download map:", e) print("Falling back to default tile") - map_img = displayio.OnDiskBitmap("./default_map.bmp") + map_img = displayio.OnDiskBitmap("./assets/default_map.bmp") return map_img