Add initial project structure and core functionality for ArchDoc
- Created `.gitignore` files for various directories to exclude unnecessary files. - Added `PLAN.md` to outline the project goals and architecture documentation generation. - Implemented the `archdoc-cli` with a command-line interface for initializing and generating documentation. - Developed the `archdoc-core` library for analyzing Python projects and generating architecture documentation. - Included caching mechanisms to optimize repeated analysis. - Established a comprehensive test suite to ensure functionality and error handling. - Updated `README.md` to provide an overview and installation instructions for ArchDoc.
This commit is contained in:
22
test-project/README.md
Normal file
22
test-project/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Test Project
|
||||
|
||||
A test project for ArchDoc development and testing.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
test-project
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Install development dependencies:
|
||||
|
||||
```bash
|
||||
pip install -e ".[dev]"
|
||||
22
test-project/pyproject.toml
Normal file
22
test-project/pyproject.toml
Normal file
@@ -0,0 +1,22 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=45", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "test-project"
|
||||
version = "0.1.0"
|
||||
description = "A test project for ArchDoc"
|
||||
authors = [
|
||||
{name = "Test Author", email = "test@example.com"}
|
||||
]
|
||||
dependencies = [
|
||||
"requests>=2.25.0",
|
||||
"sqlite3"
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"pytest>=6.0",
|
||||
"black",
|
||||
"flake8"
|
||||
]
|
||||
1
test-project/src/__init__.py
Normal file
1
test-project/src/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Test project package."""
|
||||
42
test-project/src/core.py
Normal file
42
test-project/src/core.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""Core module with database and HTTP integrations."""
|
||||
|
||||
import sqlite3
|
||||
import requests
|
||||
|
||||
class DatabaseManager:
|
||||
"""Manages database connections and operations."""
|
||||
|
||||
def __init__(self, db_path: str):
|
||||
self.db_path = db_path
|
||||
self.connection = None
|
||||
|
||||
def connect(self):
|
||||
"""Connect to the database."""
|
||||
self.connection = sqlite3.connect(self.db_path)
|
||||
|
||||
def execute_query(self, query: str):
|
||||
"""Execute a database query."""
|
||||
if self.connection:
|
||||
cursor = self.connection.cursor()
|
||||
cursor.execute(query)
|
||||
return cursor.fetchall()
|
||||
|
||||
def fetch_external_data(url: str) -> dict:
|
||||
"""Fetch data from an external API."""
|
||||
response = requests.get(url)
|
||||
return response.json()
|
||||
|
||||
def process_user_data(user_id: int) -> dict:
|
||||
"""Process user data with database and external API calls."""
|
||||
# Database interaction
|
||||
db = DatabaseManager("users.db")
|
||||
db.connect()
|
||||
user_data = db.execute_query(f"SELECT * FROM users WHERE id = {user_id}")
|
||||
|
||||
# External API call
|
||||
api_data = fetch_external_data(f"https://api.example.com/users/{user_id}")
|
||||
|
||||
return {
|
||||
"user": user_data,
|
||||
"api": api_data
|
||||
}
|
||||
26
test-project/src/utils.py
Normal file
26
test-project/src/utils.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""Utility functions for the test project."""
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
def load_config(config_path: str) -> dict:
|
||||
"""Load configuration from a JSON file."""
|
||||
with open(config_path, 'r') as f:
|
||||
return json.load(f)
|
||||
|
||||
def save_config(config: dict, config_path: str):
|
||||
"""Save configuration to a JSON file."""
|
||||
with open(config_path, 'w') as f:
|
||||
json.dump(config, f, indent=2)
|
||||
|
||||
def get_file_size(filepath: str) -> int:
|
||||
"""Get the size of a file in bytes."""
|
||||
return os.path.getsize(filepath)
|
||||
|
||||
def format_bytes(size: int) -> str:
|
||||
"""Format bytes into a human-readable string."""
|
||||
for unit in ['B', 'KB', 'MB', 'GB']:
|
||||
if size < 1024.0:
|
||||
return f"{size:.1f} {unit}"
|
||||
size /= 1024.0
|
||||
return f"{size:.1f} TB"
|
||||
Reference in New Issue
Block a user