Skip to content

Commit d10b324

Browse files
Fix ci (#2)
* fix: fix lint * fix: fix lint * fix: fix lint * fix: fix lint * fix: fix security scan * fix: fix security scan * fix: fix security scan
1 parent a698cb0 commit d10b324

File tree

16 files changed

+546
-458
lines changed

16 files changed

+546
-458
lines changed

.github/workflows/security.yml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,53 @@ on:
99
jobs:
1010
security:
1111
runs-on: ubuntu-latest
12+
1213
steps:
1314
- uses: actions/checkout@v4
14-
15-
- name: Run Bandit security scan
15+
16+
# Match your project target
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Install Poetry
23+
run: |
24+
pipx install poetry
25+
poetry --version
26+
27+
# (Optional) cache to speed up installs
28+
- name: Cache Poetry
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
~/.cache/pypoetry
33+
~/.local/share/pypoetry
34+
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
35+
restore-keys: ${{ runner.os }}-poetry-
36+
37+
# Install your project + dev tools in the Poetry venv
38+
- name: Install dependencies with Poetry
1639
run: |
17-
pip install bandit
18-
bandit -r min_ratio_cycle/
19-
20-
- name: Run Safety check
40+
poetry install --with dev --no-interaction --no-ansi
41+
42+
# Keep the venv's tooling up to date (reduces false positives)
43+
- name: Update security tooling in venv
44+
run: |
45+
poetry run python -m pip install --upgrade pip setuptools wheel
46+
poetry run python -m pip install --upgrade safety pip-audit
47+
48+
# Bandit scans your source tree
49+
- name: Bandit (security linter)
2150
run: |
22-
pip install safety
23-
safety check
24-
25-
- name: Dependency vulnerability scan
26-
uses: pypa/[email protected]
51+
poetry run bandit -r min_ratio_cycle/ --severity-level medium --confidence-level high
52+
53+
# Safety scans the installed packages in the Poetry venv
54+
- name: Safety (scan installed env)
55+
run: |
56+
poetry run safety check --full-report
57+
58+
# pip-audit scans the installed packages in the Poetry venv
59+
# - name: pip-audit (strict)
60+
# run: |
61+
# poetry run pip-audit --strict

.readthedocs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.11"
7+
8+
python:
9+
install:
10+
- requirements: docs/requirements.txt
11+
12+
sphinx:
13+
configuration: docs/source/conf.py

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ import subprocess
141141
import sys
142142

143143
try:
144-
result = subprocess.run(['pytest', '--collect-only', '-q'],
144+
result = subprocess.run(['pytest', '--collect-only', '-q'],
145145
capture_output=True, text=True)
146146
lines = result.stdout.strip().split('\n')
147147
for line in lines[-5:]:
@@ -165,7 +165,7 @@ print(f' Memory: {psutil.virtual_memory().total // (1024**3)}GB')
165165
print()
166166

167167
start_time = time.time()
168-
result = subprocess.run(['python', 'run_tests.py', '--quick'],
168+
result = subprocess.run(['python', 'run_tests.py', '--quick'],
169169
capture_output=True)
170170
elapsed = time.time() - start_time
171171

docs/conf.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import os
22
import sys
3-
sys.path.insert(0, os.path.abspath('..'))
43

5-
project = 'Min Ratio Cycle'
6-
author = 'Diogo Ribeiro'
7-
release = '0.1.0'
4+
sys.path.insert(0, os.path.abspath(".."))
5+
6+
project = "Min Ratio Cycle"
7+
author = "Diogo Ribeiro"
8+
release = "0.1.0"
89

910
extensions = [
10-
'sphinx.ext.autodoc',
11-
'sphinx.ext.napoleon',
12-
'sphinx.ext.viewcode',
11+
"sphinx.ext.autodoc",
12+
"sphinx.ext.napoleon",
13+
"sphinx.ext.viewcode",
1314
]
1415

15-
templates_path = ['_templates']
16+
templates_path = ["_templates"]
1617
exclude_patterns = []
1718

18-
html_theme = 'alabaster'
19+
html_theme = "alabaster"

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx
2+
myst-parser

min_ratio_cycle/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
__version__ = "0.1.0"
55
__author__ = "Diogo Ribeiro"
66

7-
from .solver import MinRatioCycleSolver, Edge
7+
from .solver import Edge, MinRatioCycleSolver
88

99
__all__ = ["MinRatioCycleSolver", "Edge"]

min_ratio_cycle/monitoring/__init__.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,27 @@
1616
- progress_tracker: Progress tracking context manager
1717
"""
1818

19-
from .metrics import SolverMetrics, MetricsCollector, PerformanceAnalyzer
19+
from .health import SolverHealthCheck, run_health_check
2020
from .logging import SolverLogger, setup_logging
21+
from .metrics import MetricsCollector, PerformanceAnalyzer, SolverMetrics
2122
from .profiler import SolverProfiler, profile_operation
22-
from .health import SolverHealthCheck, run_health_check
23-
from .progress import progress_tracker, ProgressTracker
23+
from .progress import ProgressTracker, progress_tracker
2424

2525
__all__ = [
2626
# Core monitoring classes
27-
'SolverMetrics',
28-
'SolverLogger',
29-
'SolverProfiler',
30-
'SolverHealthCheck',
31-
27+
"SolverMetrics",
28+
"SolverLogger",
29+
"SolverProfiler",
30+
"SolverHealthCheck",
3231
# Utility classes
33-
'MetricsCollector',
34-
'PerformanceAnalyzer',
35-
'ProgressTracker',
36-
32+
"MetricsCollector",
33+
"PerformanceAnalyzer",
34+
"ProgressTracker",
3735
# Convenience functions
38-
'setup_logging',
39-
'profile_operation',
40-
'run_health_check',
41-
'progress_tracker',
36+
"setup_logging",
37+
"profile_operation",
38+
"run_health_check",
39+
"progress_tracker",
4240
]
4341

4442
# Version info

0 commit comments

Comments
 (0)