Skip to content

Commit

Permalink
Implement linting recommendations (#5)
Browse files Browse the repository at this point in the history
* Implement linting recommendations
* Refactor project
* Initialize Github auto-linting with pylint.yml
* pylint : disable R,C levels
* pylint use python versions 3.9 and 3.12
  • Loading branch information
Vinalti authored Dec 14, 2023
1 parent 715a1d6 commit e8f5ccc
Show file tree
Hide file tree
Showing 26 changed files with 960 additions and 841 deletions.
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
ignore = E221, W503, E252, E402, E231
per-file-ignores =
__init__.py:F401
icons.py:E501
max-line-length=110
count = true
23 changes: 23 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint --disable=R,C $(git ls-files '*.py')
5 changes: 2 additions & 3 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENTRYPOINT="${INSTALL_DIR}/start.py"
USERNAME=$(id -nu 1000 || (echo 'pi' && echo 'falling back to "pi" username'>&2))
SYS_USER='root'
SYSTEM_DEP_FILE="install/apt-requirements.list"
PIP_DEP_FILE='install/requirements.txt'
PIP_DEP_FILE='install/pip/requirements.txt"
SYSD_FILE="/etc/systemd/system/$SOFT_NAME.service"
opts=$@
Expand Down Expand Up @@ -59,8 +59,7 @@ while getopts "hADStC" arg; do
h) usage ;;
A) DAEMON_INSTALL=1
DEPENDENCIES_INSTALL=1
CONFIG_CHECK=1;;
S) DAEMON_INSTALL=1 ;;
CONFIG_CHECK=1 ;;
D) DEPENDENCIES_INSTALL=1 ;;
C) CONFIG_CHECK=1 ;;
S) DAEMON_INSTALL=1 ;;
Expand Down
7 changes: 4 additions & 3 deletions install/requirements.txt → install/pip/common.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
imutils ~= 0.5
ttkthemes ~= 3.2
Pillow ~= 9.5
picamera ~= 1.13
rpi_ws281x ~= 5.0
adafruit-circuitpython-neopixel ~= 6.3
adafruit-blinka
adafruit-blinka
# Prod only
#picamera ~= 1.13
#rpi_ws281x ~= 5.0
5 changes: 5 additions & 0 deletions install/pip/requirements.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-r common.txt

# dev
pylint ~= 3.0
flake8 ~= 8.6
5 changes: 5 additions & 0 deletions install/pip/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-r common.txt

# Prod
picamera ~= 1.13
rpi_ws281x ~= 5.0
41 changes: 37 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
[project]
name = "OpenMicroView"
version = "0.8.0"
name = "openmicroview"
version = "0.8.1"
description = "GUI for the open source, Raspberry Pi based OpenMicroView Microscope"
license = "GPL-3.0-only"
license = {file = "LICENSE"}
readme = "README.md"
authors = [
"V. Salvadori",
{ name="V. Salvadori" }
]

maintainers = [
{ name = "Space Biology Group" }
]

requires-python = ">=3.7"
classifiers = [
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
Expand All @@ -15,7 +20,35 @@ classifiers = [
"Operating System :: POSIX :: Linux",
"Topic :: Scientific/Engineering"
]
dependencies = [
"imutils",
"ttkthemes",
"Pillow",
"picamera",
"rpi_ws281x",
"adafruit-circuitpython-neopixel",
"adafruit-blinka"
]

keywords = ['raspberrypi', 'microscope']

[project.urls]
Homepage = "https://github.com/Space-Biology-Group/OpenMicroView"
Issues = "https://github.com/Space-Biology-Group/OpenMicroView/issues"

[tool.pyright]
reportMissingModuleSource = "information"
reportMissingImports = "information"

[tool.pylint]

disable = [
"missing-function-docstring",
"missing-module-docstring",
"import-error",
"unspecified-encoding",
"superfluous-parens"
]
suggestion-mode="yes"
py-version = "3.7.0"
max-line-length=110
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# link to prod requirements.txt
-r install/pip/requirements.txt
1 change: 0 additions & 1 deletion sources/open_micro_view/__init__.py

This file was deleted.

50 changes: 0 additions & 50 deletions sources/open_micro_view/assets/theme.py

This file was deleted.

Loading

0 comments on commit e8f5ccc

Please sign in to comment.