added python project config and reordered folder structure

This commit is contained in:
Sebastian Wendel 2022-11-11 17:31:21 +01:00
parent cd77777085
commit 5cc786bab1
No known key found for this signature in database
GPG key ID: 1422B7DF78144640
80 changed files with 708 additions and 446 deletions

43
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,43 @@
---
name: test
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
jobs:
run:
name: |
Python ${{ matrix.python-version }} on
${{ startsWith(matrix.os, 'macos-') &&
'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Hatch
run: pip install --upgrade hatch
- name: Run tests
run: hatch run cov

144
pyproject.toml Normal file
View file

@ -0,0 +1,144 @@
[build-system]
requires = ["hatchling", "hatch-vcs", "hatch-containers"]
build-backend = "hatchling.build"
[project]
readme = "README.md"
name = "PlanktoScope"
description = "An open and affordable imaging platform for citizen oceanography"
license = { text = "GPL-3.0-or-later" }
requires-python = ">=3.7"
authors = [{ name = "Romain Bazile", email = "planktoscope@gmail.com" }]
keywords = []
classifiers = [
"Development Status :: 5 - Production/Stable",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Image Processing",
"Topic :: Scientific/Engineering :: Image Recognition",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
]
dependencies = [
"Adafruit-Blinka~=6.15.0",
"adafruit-circuitpython-motor~=3.3.1",
"adafruit-circuitpython-motorkit~=1.6.3",
"Adafruit-PlatformDetect~=3.17.2",
"Adafruit-SSD1306~=1.6.2",
"loguru~=0.5.3",
"matplotlib~=3.5.0",
"morphocut~=0.1.2",
"numpy~=1.21.4",
"opencv-contrib-python~=4.5.3.56",
"paho-mqtt~=1.6.1",
"picamera~=1.13",
"picamerax~=21.9.8",
"RPi.GPIO~=0.7.1a4",
"scikit-image~=0.18.3",
"scipy~=1.7.2",
"smbus2~=0.4.1",
]
dynamic = ["version"]
[project.urls]
Homepage = "https://www.planktoscope.org/"
Documentation = "http://PlanktoScope.github.io/PlanktoScope"
Issues = "https://github.com/PlanktoScope/PlanktoScope/issues"
Source = "https://github.com/PlanktoScope/PlanktoScope"
[project.scripts]
planktoscope = "pkg.planktoscope:main"
[tool.hatch.version]
source = "vcs"
[tool.hatch.build]
sources = ["./software/planktoscope-backend/src"]
[tool.hatch.build.hooks.vcs]
version-file = "./software/planktoscope-backend/src/planktoscope_backend/__about__.py"
[tool.hatch.build.targets.sdist]
include = ["main.py", "./planktoscope/*.py", "./planktoscope/**/*.py"]
[tool.hatch.build.targets.wheel]
[tool.hatch.envs.default]
[tool.hatch.envs.dev]
python = "310"
dependencies = [
"black",
"coverage[toml]",
"isort",
"pydocstyle",
"pycodestyle",
"pylint",
"pytest",
"typing",
"pytest-cov",
"pytest-mock",
"pytest-randomly",
"pytest-rerunfailures",
"pytest-xdist",
]
[tool.hatch.envs.test]
dependencies = [
"coverage[toml]",
"pytest",
"pytest-cov",
"pytest-mock",
"pyspelling",
]
[tool.hatch.envs.test.scripts]
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=scripts/planktoscope --cov=tests {args}"
no-cov = "cov --no-cov {args}"
[[tool.hatch.envs.test.matrix]]
python = ["37", "38", "39", "310", "311"]
[tool.hatch.envs.lint]
dependencies = ["flake8", "black", "isort"]
[tool.hatch.envs.lint.scripts]
check = [
"flake8 .",
"black --check --diff software/planktoscope-backend",
"isort --check-only --diff software/planktoscope-backend",
]
fmt = [
"isort software/planktoscope-backend",
"black software/planktoscope-backend",
"check",
]
[tool.hatch.envs.docs]
dependencies = [
"mkdocs",
"mkdocs-charts-plugin",
"mkdocs-glightbox",
"mkdocs-macros-plugin",
"mkdocs-markdownextradata-plugin",
"mkdocs-material-extensions",
"mkdocs-material",
"mkdocs-minify-plugin",
"mkdocs-redirects",
"mkdocs-table-reader-plugin",
"pygments",
"pymdown-extensions",
"linkchecker",
]
[tool.hatch.envs.docs.scripts]
build = "mkdocs build --clean --strict"
serve = "mkdocs serve --dev-addr localhost:8000"
validate = ["linkchecker --config .linkcheckerrc site"]
check = ["build --no-directory-urls", "validate"]

View file

@ -0,0 +1 @@
SPDX-License-Identifier: GPL-3.0-or-later

View file

@ -0,0 +1,14 @@
{
"stepper_reverse": false,
"microsteps": 32,
"focus_steps_per_mm": 40,
"pump_steps_per_ml": 507,
"focus_max_speed": 0.5,
"pump_max_speed": 30,
"stepper_type": "adafruit",
"wb_red_gain": 2,
"wb_blue_gain": 1.41,
"analog_gain": 1.0,
"digital_gain": 1.0,
"acq_fnumber_objective": 16
}

View file

@ -0,0 +1 @@
SPDX-License-Identifier: GPL-3.0-or-later

View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) 2022-present Sebastian Wendel <s.wendel@sourceindex.de>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,21 @@
# planktoscope-backend
[![PyPI - Version](https://img.shields.io/pypi/v/planktoscope-backend.svg)](https://pypi.org/project/planktoscope-backend)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/planktoscope-backend.svg)](https://pypi.org/project/planktoscope-backend)
-----
**Table of Contents**
- [Installation](#installation)
- [License](#license)
## Installation
```console
pip install planktoscope-backend
```
## License
`planktoscope-backend` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

View file

@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-3.0-or-later
RPi.GPIO~=0.7.1a4 RPi.GPIO~=0.7.1a4
Adafruit-Blinka~=6.15.0 Adafruit-Blinka~=6.15.0
adafruit-circuitpython-motorkit~=1.6.3 adafruit-circuitpython-motorkit~=1.6.3

View file

@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2022-present Sebastian Wendel <s.wendel@sourceindex.de>
#
# SPDX-License-Identifier: MIT
__version__ = '0.0.1'

View file

@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2022-present Sebastian Wendel <s.wendel@sourceindex.de>
#
# SPDX-License-Identifier: MIT

View file

@ -0,0 +1,5 @@
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = '0.1.dev643+g3c581f6.d19800101'
__version_tuple__ = version_tuple = (0, 1, 'dev643', 'g3c581f6.d19800101')

View file

@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2022-present Sebastian Wendel <s.wendel@sourceindex.de>
#
# SPDX-License-Identifier: MIT

View file

@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
log="echo -e" log="echo -e"
CURRENT_BRANCH=$(git --git-dir=/home/pi/PlanktoScope/.git rev-parse --abbrev-ref HEAD) CURRENT_BRANCH=$(git --git-dir=/home/pi/PlanktoScope/.git rev-parse --abbrev-ref HEAD)

View file

@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
log="echo -e" log="echo -e"
CURRENT_BRANCH=$(git --git-dir=/home/pi/PlanktoScope/.git rev-parse --abbrev-ref HEAD) CURRENT_BRANCH=$(git --git-dir=/home/pi/PlanktoScope/.git rev-parse --abbrev-ref HEAD)

View file

@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
# Stolen from https://github.com/raamsri/automount-usb/blob/master/usb-mount.sh # Stolen from https://github.com/raamsri/automount-usb/blob/master/usb-mount.sh
# This work is licensed under the Unlicense # This work is licensed under the Unlicense

File diff suppressed because one or more lines are too long

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -2375,7 +2375,7 @@ c21.2002 0 36.7998 -5.5 46.5 -16.7002c18.5996 -21.4004 11.7998 -64.1006 -14.2998
d="M313.6 -26.5996c4.40039 -4.40039 8.10059 -9 13.3008 -12.5c-18.5029 -5.58008 -49.2031 -10.1074 -68.5283 -10.1074c-0.516602 0 -1.35547 0.00292969 -1.87207 0.00683594c-135 0 -244.5 109.5 -244.5 244.601c0 135.1 109.4 244.6 244.5 244.6 d="M313.6 -26.5996c4.40039 -4.40039 8.10059 -9 13.3008 -12.5c-18.5029 -5.58008 -49.2031 -10.1074 -68.5283 -10.1074c-0.516602 0 -1.35547 0.00292969 -1.87207 0.00683594c-135 0 -244.5 109.5 -244.5 244.601c0 135.1 109.4 244.6 244.5 244.6
s244.6 -109.5 244.6 -244.6c0 -35.3008 -6.89941 -67.4004 -20.2998 -97.7002c-3 5.7002 -7.2002 10.2002 -11.2002 15.2998c11.2002 93.5 -62.0996 176.6 -157 176.6c-87.2705 0 -158.1 -70.8281 -158.1 -158.1s70.8291 -158.1 158.1 -158.1h1zM313.5 -26.5 s244.6 -109.5 244.6 -244.6c0 -35.3008 -6.89941 -67.4004 -20.2998 -97.7002c-3 5.7002 -7.2002 10.2002 -11.2002 15.2998c11.2002 93.5 -62.0996 176.6 -157 176.6c-87.2705 0 -158.1 -70.8281 -158.1 -158.1s70.8291 -158.1 158.1 -158.1h1zM313.5 -26.5
l0.400391 -0.0996094zM391.9 142.4c54.7471 0 99.1992 -44.4326 99.1992 -99.1807v-0.0195312c0 -54.7588 -44.4414 -99.2002 -99.1992 -99.2002c-54.7588 0 -99.2002 44.4414 -99.2002 99.2002c0 54.7578 44.4414 99.2002 99.2002 99.2002z" /> l0.400391 -0.0996094zM391.9 142.4c54.7471 0 99.1992 -44.4326 99.1992 -99.1807v-0.0195312c0 -54.7588 -44.4414 -99.2002 -99.1992 -99.2002c-54.7588 0 -99.2002 44.4414 -99.2002 99.2002c0 54.7578 44.4414 99.2002 99.2002 99.2002z" />
<glyph glyph-name="readme" unicode="&#xf4d5;" horiz-adv-x="576" <glyph glyph-name="images/readme" unicode="&#xf4d5;" horiz-adv-x="576"
d="M528.3 401.5c26.4004 -0.200195 47.7002 -21.7002 47.7002 -48.0996v-245.7c0 -26.5 -21.5 -48 -48 -48h-89.7002c-102.1 0 -132.6 -24.4004 -147.3 -75c-0.799805 -2.7998 -5.2998 -2.7998 -6 0c-14.5996 50.5996 -45.0996 75 -147.3 75h-89.7002 d="M528.3 401.5c26.4004 -0.200195 47.7002 -21.7002 47.7002 -48.0996v-245.7c0 -26.5 -21.5 -48 -48 -48h-89.7002c-102.1 0 -132.6 -24.4004 -147.3 -75c-0.799805 -2.7998 -5.2998 -2.7998 -6 0c-14.5996 50.5996 -45.0996 75 -147.3 75h-89.7002
c-26.5 0 -48 21.5 -48 48v245.8c0 26.5 21.5 48 48 48h139.7c48.0996 0 89.7998 -33.2998 100.399 -80.2998c10.5 47 52.3008 80.2998 100.4 80.2998h139.8zM242 136.1h0.0996094v22.9004c0 2 -1.59961 3.5 -3.5 3.5h-160.399c-2 0 -3.5 -1.59961 -3.5 -3.5v-22.9004 c-26.5 0 -48 21.5 -48 48v245.8c0 26.5 21.5 48 48 48h139.7c48.0996 0 89.7998 -33.2998 100.399 -80.2998c10.5 47 52.3008 80.2998 100.4 80.2998h139.8zM242 136.1h0.0996094v22.9004c0 2 -1.59961 3.5 -3.5 3.5h-160.399c-2 0 -3.5 -1.59961 -3.5 -3.5v-22.9004
c0 -2 1.59961 -3.5 3.5 -3.5h160.3c2 0 3.5 1.60059 3.5 3.5zM242 197h0.0996094v22.9004c0 2 -1.59961 3.5 -3.5 3.5h-160.399c-2 0 -3.5 -1.60059 -3.5 -3.5v-22.9004c0 -2 1.59961 -3.5 3.5 -3.5h160.3c2 0 3.5 1.59961 3.5 3.5zM242 257.9h0.0996094v22.8994 c0 -2 1.59961 -3.5 3.5 -3.5h160.3c2 0 3.5 1.60059 3.5 3.5zM242 197h0.0996094v22.9004c0 2 -1.59961 3.5 -3.5 3.5h-160.399c-2 0 -3.5 -1.60059 -3.5 -3.5v-22.9004c0 -2 1.59961 -3.5 3.5 -3.5h160.3c2 0 3.5 1.59961 3.5 3.5zM242 257.9h0.0996094v22.8994

Before

Width:  |  Height:  |  Size: 692 KiB

After

Width:  |  Height:  |  Size: 692 KiB

View file

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

View file

Before

Width:  |  Height:  |  Size: 829 KiB

After

Width:  |  Height:  |  Size: 829 KiB

View file

@ -54,7 +54,7 @@ dtparam=spi=on
#dtoverlay=gpio-ir,gpio_pin=17 #dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18 #dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README # Additional overlays and parameters are documented /boot/overlays/images/readme
# Enable audio (loads snd_bcm2835) # Enable audio (loads snd_bcm2835)
dtparam=audio=on dtparam=audio=on

View file

@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
sudo killall -15 python3 sudo killall -15 python3
sudo killall -15 raspimjpeg sudo killall -15 raspimjpeg
sleep 10 sleep 10