Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pyproject.toml, poetry, ruff #771

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base
name: General Linting

#
# Documentation:
Expand Down Expand Up @@ -48,7 +48,6 @@ jobs:
uses: github/super-linter/slim@v4
env:
VALIDATE_ALL_CODEBASE: true
VALIDATE_PYTHON_FLAKE8: true
VALIDATE_BASH: true
VALIDATE_JSON: true
VALIDATE_DOCKERFILE_HADOLINT: true
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/python-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Python Linting

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.4.2
- name: Install dependencies
run: |
poetry install --with dev
- name: Lint with ruff
run: |
poetry run ruff check .
22 changes: 15 additions & 7 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Run PyTest
python-version: 3.11

- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.4.2

- name: Install dependencies
run: |
poetry install --with dev

- name: Unit tests
run: |
pip install -r test-requirements.txt
pip install -r requirements.txt
export PYTHONPATH=`pwd`
pytest . --cov=. --cov-fail-under=90
poetry run pytest . --cov=. --cov-fail-under=90
18 changes: 14 additions & 4 deletions .github/workflows/security-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11

- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.4.2

- name: Install dependencies
run: |
poetry install --with dev

- name: Run bandit against code base
run: |
pip install bandit
bandit -r . -x "./tests/*"
poetry run bandit -r . -c pyproject.toml
804 changes: 804 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "helium-miner-software"
version = "0.14.10"
description = "Helium Miner Software"
authors = ["Nebra Ltd <[email protected]>"]
readme = "README.md"
packages = []

[tool.poetry.dependencies]
python = "^3.11"
jinja2 = "^3.1.2"
hm-pyhelper = "^0.14"
grpcio = "^1.53.0"

[tool.poetry.group.dev.dependencies]
bandit = { version = "~1.7.4", extras = ["toml"] }
mock = "^5.0.0"
pytest = "^7.2.0"
pytest-cov = "^4.0.0"
ruff = "~0.0.265"

[tool.ruff]
line-length = 120

[tool.ruff.mccabe]
max-complexity = 10

[tool.bandit]
exclude_dirs = ["tests"]
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions test-requirements.txt

This file was deleted.