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
62 changes: 62 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Development Guidelines

## Environment Setup

### Prerequisites

- Python 3.10+
- Docker
- Make

### Installation

Create a virtual environment and install dependencies:

```bash
make venv
make setup
```

This will install the project in editable mode, install dev tools, and set up git hooks.

## Workflow

### Dependency Management

- **Lock dependencies**: Generates `requirements.txt` from `pyproject.toml`.
```bash
make lock
```
- **Upgrade dependencies**: Updates packages to latest allowed versions.
```bash
make upgrade
```
- **Verify compatibility of dependencies**: Checks each of the dependencies for python version compatibility, and marks dependencies that are not compatible with the given target version.
```bash
# adjust py_version=3.xy as needed
make compatibility py_version=3.10
```
- **Update SBOM**: Generate a Software Bill of Materials (SBOM) in `sbom.json` when dependencies are updated (tracked).
```bash
make sbom
```
- **Audit dependencies**: Generates a security audit report in `audit.json` when dependencies are updated and review it (untracked).
```bash
make audit
```

### Quality Assurance

- **Linting**: `make lint`
- **Formatting**: `make format`
- **Testing**: `make test`
- **Security Scan**: `make security`

## Branch Naming Convention

- `feature/`: For new features or functionality (e.g., `feature/add-login-page`).
- `fix/` or `bugfix/`: For fixing issues or bugs (e.g., `fix/header-formatting-issue`).
- `hotfix/`: For urgent, critical fixes in production (e.g., `hotfix/fix-db-connection-bug`).
- `release/`: For preparing new production releases (e.g., `release/v1.0.0` or `release/1.0.0`).
- `docs/`: For updating documentation.
- `chore/`: For maintenance tasks, dependency updates, or build improvements.
19 changes: 11 additions & 8 deletions check_compatibility.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
import re
import sys
import urllib.request
from typing import List, Tuple

import httpx


def parse_dependencies(file_path: str) -> List[Tuple[str, str]]:
dependencies = []
Expand Down Expand Up @@ -41,23 +41,26 @@ def extract_deps_from_string(raw_string: str) -> List[Tuple[str, str]]:
return deps


def get_requires_python_data(url: str) -> str:
response = httpx.get(url)
response.raise_for_status()
data = response.json()
return data["info"].get("requires_python") or "Unknown"


def get_python_requires(package: str, version: str) -> str:
if version == "latest":
url = f"https://pypi.org/pypi/{package}/json"
else:
url = f"https://pypi.org/pypi/{package}/{version}/json"

try:
with urllib.request.urlopen(url) as response: # nosec B310
data = json.loads(response.read().decode())
return data["info"].get("requires_python") or "Unknown"
return get_requires_python_data(url)
except Exception:
# Fallback to latest if specific version fails
try:
url = f"https://pypi.org/pypi/{package}/json"
with urllib.request.urlopen(url) as response: # nosec B310
data = json.loads(response.read().decode())
return data["info"].get("requires_python") or "Unknown"
return get_requires_python_data(url)
except Exception as e:
return f"Error: {e}"

Expand Down