Skip to content
Merged
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
57 changes: 46 additions & 11 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,53 @@ on:
jobs:
security:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Run Bandit security scan

# Match your project target
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Poetry
run: |
pipx install poetry
poetry --version
# (Optional) cache to speed up installs
- name: Cache Poetry
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
~/.local/share/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-

# Install your project + dev tools in the Poetry venv
- name: Install dependencies with Poetry
run: |
pip install bandit
bandit -r min_ratio_cycle/
- name: Run Safety check
poetry install --with dev --no-interaction --no-ansi
# Keep the venv's tooling up to date (reduces false positives)
- name: Update security tooling in venv
run: |
poetry run python -m pip install --upgrade pip setuptools wheel
poetry run python -m pip install --upgrade safety pip-audit
# Bandit scans your source tree
- name: Bandit (security linter)
run: |
pip install safety
safety check
- name: Dependency vulnerability scan
uses: pypa/[email protected]
poetry run bandit -r min_ratio_cycle/ --severity-level medium --confidence-level high
# Safety scans the installed packages in the Poetry venv
- name: Safety (scan installed env)
run: |
poetry run safety check --full-report
# pip-audit scans the installed packages in the Poetry venv
# - name: pip-audit (strict)
# run: |
# poetry run pip-audit --strict
13 changes: 13 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

python:
install:
- requirements: docs/requirements.txt

sphinx:
configuration: docs/source/conf.py
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ import subprocess
import sys

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

start_time = time.time()
result = subprocess.run(['python', 'run_tests.py', '--quick'],
result = subprocess.run(['python', 'run_tests.py', '--quick'],
capture_output=True)
elapsed = time.time() - start_time

Expand Down
19 changes: 10 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import os
import sys
sys.path.insert(0, os.path.abspath('..'))

project = 'Min Ratio Cycle'
author = 'Diogo Ribeiro'
release = '0.1.0'
sys.path.insert(0, os.path.abspath(".."))

project = "Min Ratio Cycle"
author = "Diogo Ribeiro"
release = "0.1.0"

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
]

templates_path = ['_templates']
templates_path = ["_templates"]
exclude_patterns = []

html_theme = 'alabaster'
html_theme = "alabaster"
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx
myst-parser
2 changes: 1 addition & 1 deletion min_ratio_cycle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
__version__ = "0.1.0"
__author__ = "Diogo Ribeiro"

from .solver import MinRatioCycleSolver, Edge
from .solver import Edge, MinRatioCycleSolver

__all__ = ["MinRatioCycleSolver", "Edge"]
30 changes: 14 additions & 16 deletions min_ratio_cycle/monitoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,27 @@
- progress_tracker: Progress tracking context manager
"""

from .metrics import SolverMetrics, MetricsCollector, PerformanceAnalyzer
from .health import SolverHealthCheck, run_health_check
from .logging import SolverLogger, setup_logging
from .metrics import MetricsCollector, PerformanceAnalyzer, SolverMetrics
from .profiler import SolverProfiler, profile_operation
from .health import SolverHealthCheck, run_health_check
from .progress import progress_tracker, ProgressTracker
from .progress import ProgressTracker, progress_tracker

__all__ = [
# Core monitoring classes
'SolverMetrics',
'SolverLogger',
'SolverProfiler',
'SolverHealthCheck',

"SolverMetrics",
"SolverLogger",
"SolverProfiler",
"SolverHealthCheck",
# Utility classes
'MetricsCollector',
'PerformanceAnalyzer',
'ProgressTracker',

"MetricsCollector",
"PerformanceAnalyzer",
"ProgressTracker",
# Convenience functions
'setup_logging',
'profile_operation',
'run_health_check',
'progress_tracker',
"setup_logging",
"profile_operation",
"run_health_check",
"progress_tracker",
]

# Version info
Expand Down
Loading
Loading