fast-clean-architecture 1.1.0__py3-none-any.whl → 1.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  """Fast Clean Architecture - CLI tool for scaffolding clean architecture in FastAPI projects."""
2
2
 
3
- __version__ = "1.0.0"
3
+ __version__ = "1.1.2"
4
4
  __author__ = "Agoro, Adegbenga. B (IAM)"
5
- __email__ = "adegbenga@alden-technologies.com"
5
+ __email__ = "opensource@aldentechnologies.com"
6
6
 
7
7
  from .cli import app
8
8
  from .config import Config
@@ -335,11 +335,23 @@ def create_module(
335
335
  if not validate_python_identifier(sanitized_module):
336
336
  raise ValidationError(f"Invalid module name: {module_name}")
337
337
 
338
- # Initialize generators
338
+ # Initialize config updater for validation
339
339
  config_updater = ConfigUpdater(config_path, console)
340
+
341
+ # Validate system exists BEFORE creating any directory structure
342
+ if sanitized_system not in config_updater.config.project.systems:
343
+ raise ValidationError(
344
+ f"System '{sanitized_system}' not found.\n\n"
345
+ f"To create the module, first create the system:\n"
346
+ f' fca-scaffold create-system-context {sanitized_system} --description "[SYSTEM_DESCRIPTION]"\n\n'
347
+ f"Then create your module:\n"
348
+ f" fca-scaffold create-module {sanitized_system} {sanitized_module}"
349
+ )
350
+
351
+ # Initialize package generator
340
352
  package_generator = PackageGenerator(console)
341
353
 
342
- # Create module structure
354
+ # Create module structure (only after validation passes)
343
355
  package_generator.create_module_structure(
344
356
  base_path=project_root,
345
357
  system_name=sanitized_system,
@@ -348,7 +360,7 @@ def create_module(
348
360
  )
349
361
 
350
362
  if not dry_run:
351
- # Update configuration
363
+ # Update configuration (system existence already validated)
352
364
  config_updater.add_module(sanitized_system, sanitized_module, description)
353
365
 
354
366
  console.print(
@@ -878,8 +890,8 @@ def system_status(
878
890
 
879
891
  console.print("\n[bold blue]📊 Fast Clean Architecture Status[/bold blue]\n")
880
892
 
881
- # Health Status
882
- console.print("[bold yellow]🏥 System Health[/bold yellow]")
893
+ # FCA System Health
894
+ console.print("[bold yellow]🏥 FCA System Health[/bold yellow]")
883
895
  health_monitor = get_health_monitor()
884
896
  health_data = health_monitor.get_system_health()
885
897
 
@@ -887,20 +899,13 @@ def system_status(
887
899
  console.print(f"[red]❌ Health check failed: {health_data['error']}[/red]")
888
900
  else:
889
901
  process_data = health_data.get("process", {})
890
- system_data = health_data.get("system", {})
891
902
 
892
903
  console.print(
893
904
  f" • Memory Usage: {process_data.get('memory_rss_mb', 0):.1f} MB ({process_data.get('memory_percent', 0):.1f}%)"
894
905
  )
895
906
  console.print(f" • CPU Usage: {process_data.get('cpu_percent', 0):.1f}%")
896
907
  console.print(
897
- f" • System Memory: {system_data.get('memory_used_percent', 0):.1f}% used"
898
- )
899
- console.print(
900
- f" • Disk Space: {system_data.get('disk_used_percent', 0):.1f}% used"
901
- )
902
- console.print(
903
- f" • Uptime: {health_data.get('uptime_seconds', 0):.1f} seconds"
908
+ f" • Session Duration: {health_data.get('uptime_seconds', 0):.1f} seconds"
904
909
  )
905
910
 
906
911
  # Error Tracking
@@ -39,9 +39,9 @@ class ValidationConfig:
39
39
 
40
40
  # Basic monitoring
41
41
  enable_metrics: bool = False # Disabled by default to reduce complexity
42
- log_level: Literal[
43
- "DEBUG", "INFO", "WARNING", "ERROR"
44
- ] = "WARNING" # Reduced logging
42
+ log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR"] = (
43
+ "WARNING" # Reduced logging
44
+ )
45
45
 
46
46
  def __post_init__(self) -> None:
47
47
  """Validate configuration after initialization."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-clean-architecture
3
- Version: 1.1.0
3
+ Version: 1.1.2
4
4
  Summary: CLI tool for scaffolding clean architecture in FastAPI projects
5
5
  Project-URL: Homepage, https://github.com/alden-technologies/fast-clean-architecture
6
6
  Project-URL: Repository, https://github.com/alden-technologies/fast-clean-architecture
@@ -37,7 +37,7 @@ Description-Content-Type: text/markdown
37
37
 
38
38
  # Fast Clean Architecture
39
39
 
40
- [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
40
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
41
41
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
42
42
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
43
43
 
@@ -50,7 +50,10 @@ A powerful CLI tool for scaffolding clean architecture in FastAPI projects. Gene
50
50
  - **Code Generation**: Automated scaffolding for entities, repositories, services, and more
51
51
  - **Template System**: Customizable Jinja2 templates for code generation
52
52
  - **Type Safety**: Full type hints and Pydantic validation
53
- - **Modern Python**: Built for Python 3.8+ with async/await support
53
+ - **Modern Python**: Built for Python 3.9+ with async/await support
54
+ - **Analytics & Monitoring**: Built-in usage analytics, error tracking, and health monitoring
55
+ - **Security Features**: Template validation, input sanitization, and secure file operations
56
+ - **Batch Operations**: Create multiple components from YAML specifications
54
57
  - **CLI Interface**: Intuitive command-line interface with rich output
55
58
  - **Configuration Management**: YAML-based project configuration with versioning
56
59
 
@@ -68,52 +71,6 @@ pip install fast-clean-architecture
68
71
  poetry add fast-clean-architecture
69
72
  ```
70
73
 
71
- ### From Source
72
-
73
- #### Using Poetry (Recommended)
74
- ```bash
75
- git clone https://github.com/alden-technologies/fast-clean-architecture.git
76
- cd fast-clean-architecture
77
- poetry install
78
- ```
79
-
80
- #### Using pip with requirements.txt
81
- ```bash
82
- git clone https://github.com/alden-technologies/fast-clean-architecture.git
83
- cd fast-clean-architecture
84
- pip install -r requirements.txt
85
- ```
86
-
87
- #### Using pip (editable install)
88
- ```bash
89
- git clone https://github.com/alden-technologies/fast-clean-architecture.git
90
- cd fast-clean-architecture
91
- pip install -e .
92
- ```
93
-
94
- ### Development Installation
95
-
96
- #### Using Poetry (Recommended)
97
- ```bash
98
- git clone https://github.com/alden-technologies/fast-clean-architecture.git
99
- cd fast-clean-architecture
100
- poetry install --extras dev
101
- ```
102
-
103
- #### Using pip with dev requirements
104
- ```bash
105
- git clone https://github.com/alden-technologies/fast-clean-architecture.git
106
- cd fast-clean-architecture
107
- pip install -r requirements-dev.txt
108
- ```
109
-
110
- #### Using pip (editable install with dev dependencies)
111
- ```bash
112
- git clone https://github.com/alden-technologies/fast-clean-architecture.git
113
- cd fast-clean-architecture
114
- pip install -e ".[dev]"
115
- ```
116
-
117
74
  **Note**: This project uses Poetry for dependency management. The `requirements.txt` and `requirements-dev.txt` files are provided for convenience and compatibility with pip-based workflows.
118
75
 
119
76
  ## 🏗️ Architecture Overview
@@ -147,7 +104,7 @@ Fast Clean Architecture follows the clean architecture pattern with these layers
147
104
 
148
105
  **Important**: This tool is designed to scaffold clean architecture components for FastAPI projects. You should have:
149
106
 
150
- - **Python 3.8+** installed on your system
107
+ - **Python 3.9+** installed on your system
151
108
  - **Basic understanding of FastAPI** and web API development
152
109
  - **Familiarity with clean architecture principles** (recommended but not required)
153
110
  - **A new or existing directory** where you want to create your FastAPI project structure
@@ -316,19 +273,47 @@ Your API will be available at `http://localhost:8000` with automatic documentati
316
273
  | **Presentation** | `api` | FastAPI routers and endpoints |
317
274
  | | `schemas` | Pydantic request/response schemas |
318
275
 
319
- ### CLI Options
276
+ ### CLI Commands
277
+
278
+ #### Core Commands
279
+ ```bash
280
+ # Project initialization
281
+ fca-scaffold init # Initialize new project
282
+ fca-scaffold create-system-context # Create system (bounded context)
283
+ fca-scaffold create-module # Create module within system
284
+ fca-scaffold create-component # Create individual components
285
+ ```
286
+
287
+ #### Batch Operations
288
+ ```bash
289
+ # Create multiple components from YAML specification
290
+ fca-scaffold batch-create components_spec.yaml
291
+ fca-scaffold batch-create my-spec.yaml --dry-run # Preview only
292
+ ```
320
293
 
294
+ #### Project Management
321
295
  ```bash
322
- # Global options
323
- fca-scaffold --help
324
- fca-scaffold --version
325
- fca-scaffold --dry-run # Preview changes without writing files
326
- fca-scaffold --force # Overwrite existing files
327
- fca-scaffold --verbose # Detailed output
328
-
329
- # Command-specific help
330
- fca-scaffold init --help
331
- fca-scaffold create-component --help
296
+ # Project status and configuration
297
+ fca-scaffold status # Show project overview
298
+ fca-scaffold config show # Display configuration
299
+ fca-scaffold config validate # Validate configuration
300
+ fca-scaffold system-status # Show system health and analytics
301
+ ```
302
+
303
+ #### Help and Information
304
+ ```bash
305
+ # Get help and version info
306
+ fca-scaffold version # Show version information
307
+ fca-scaffold --help # General help
308
+ ```
309
+
310
+ #### Global Options
311
+ ```bash
312
+ # Available for most commands
313
+ --dry-run # Preview changes without writing files
314
+ --force # Overwrite existing files
315
+ --verbose # Detailed output
316
+ --config # Specify custom config file
332
317
  ```
333
318
 
334
319
  ### Configuration File
@@ -362,6 +347,71 @@ project:
362
347
  api: ["user"]
363
348
  ```
364
349
 
350
+ ## 📊 Batch Component Creation
351
+
352
+ ### YAML Specification Format
353
+
354
+ Create multiple components efficiently using YAML specifications:
355
+
356
+ ```yaml
357
+ # components_spec.yaml
358
+ systems:
359
+ - name: admin
360
+ description: "Admin management system"
361
+ modules:
362
+ - name: authentication
363
+ description: "Admin authentication module"
364
+ components:
365
+ domain:
366
+ entities: [AdminUser, AdminRole]
367
+ value_objects: [AdminEmail, AdminPassword]
368
+ repositories: [AdminUserRepository]
369
+ application:
370
+ services: [AdminAuthService]
371
+ commands: [CreateAdminUser, UpdateAdminUser]
372
+ queries: [GetAdminUser, ListAdminUsers]
373
+ infrastructure:
374
+ repositories: [AdminUserRepository]
375
+ models: [AdminUserModel]
376
+ external: [AdminEmailService]
377
+ presentation:
378
+ api: [AdminAuthRouter]
379
+ schemas: [AdminUserSchema, AdminAuthSchema]
380
+ ```
381
+
382
+ ### Usage
383
+
384
+ ```bash
385
+ # Create all components from specification
386
+ fca-scaffold batch-create components_spec.yaml
387
+
388
+ # Preview what would be created
389
+ fca-scaffold batch-create components_spec.yaml --dry-run
390
+
391
+ # Force overwrite existing files
392
+ fca-scaffold batch-create components_spec.yaml --force
393
+ ```
394
+
395
+ ## 📊 System Monitoring
396
+
397
+ ### Health and Analytics
398
+
399
+ Fast Clean Architecture includes built-in monitoring capabilities:
400
+
401
+ ```bash
402
+ # View system health and usage analytics
403
+ fca-scaffold system-status
404
+
405
+ # Detailed system information
406
+ fca-scaffold system-status --verbose
407
+ ```
408
+
409
+ **Features:**
410
+ - **Usage Analytics**: Track command usage and component creation patterns
411
+ - **Error Tracking**: Monitor and log errors with detailed context
412
+ - **Health Monitoring**: System resource usage and performance metrics
413
+ - **Security Monitoring**: Template validation and input sanitization tracking
414
+
365
415
  ## 🎨 Customization
366
416
 
367
417
  ### Custom Templates
@@ -433,9 +483,7 @@ pytest -v
433
483
  ```bash
434
484
  git clone https://github.com/alden-technologies/fast-clean-architecture.git
435
485
  cd fast-clean-architecture
436
- python -m venv venv
437
- source venv/bin/activate # On Windows: venv\Scripts\activate
438
- pip install -e ".[dev]"
486
+ poetry install --with dev
439
487
  ```
440
488
 
441
489
  ### Code Quality
@@ -457,11 +505,20 @@ bandit -r fast_clean_architecture
457
505
  safety check
458
506
  ```
459
507
 
508
+ ### Security Updates
509
+
510
+ This project maintains up-to-date dependencies with security patches:
511
+
512
+ - **Black 24.3.0+**: Fixes CVE-2024-21503 (ReDoS vulnerability)
513
+ - **Pip 25.0+**: Fixes PVE-2025-75180 (malicious wheel execution)
514
+ - **Setuptools 78.1.1+**: Fixes CVE-2025-47273 (path traversal vulnerability)
515
+
516
+ All dependencies are pinned with SHA256 hashes for supply chain security.
517
+
460
518
  ### Pre-commit Hooks
461
519
 
462
520
  ```bash
463
- pip install pre-commit
464
- pre-commit install
521
+ poetry run pre-commit install
465
522
  ```
466
523
 
467
524
  ## 📖 Examples
@@ -548,4 +605,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
548
605
 
549
606
  ---
550
607
 
551
- **Made with ❤️ by [Alden Technologies](https://aldentechnologies.com)**
608
+ **Made with ❤️ by [Adegbenga Agoro](https://www.adegbengaagoro.co), [Founder of Alden Technologies](https://www.aldentechnologies.com)**
@@ -1,6 +1,6 @@
1
- fast_clean_architecture/__init__.py,sha256=VOCrdvUXRx1IOKghlxhkzuKY4KFcU7s_RlLtjL10rFE,533
1
+ fast_clean_architecture/__init__.py,sha256=Px5-n1SqwkAYF2UnNimI1zdixKV6Kx5UEm6DVvgQ_Z8,533
2
2
  fast_clean_architecture/analytics.py,sha256=2EC8iF1WERhoJm_XCATkUnkBvLIm8lxp9-Ukl4sf4dU,8733
3
- fast_clean_architecture/cli.py,sha256=S_GViX0gYFQJmmorqSk2nPunHRGL-8VpAmannJMFS-c,37263
3
+ fast_clean_architecture/cli.py,sha256=JIeRpUPG44ISNJX3O1sgvDO1eTFw3GM6NdN4kniZr0I,37662
4
4
  fast_clean_architecture/config.py,sha256=UAyzEifdqrbpZDDirVR_E2yq5rlTJyv19Iixd01ufiI,19969
5
5
  fast_clean_architecture/error_tracking.py,sha256=uyOEg6IZLNd-1u57bCCLpTzeBwP02pjVxRivXy1GyVM,6034
6
6
  fast_clean_architecture/exceptions.py,sha256=0CTkgDjG-Ilqc9Vex02ofgPCSBfmNNceK6ZGwCIF8n0,16578
@@ -16,7 +16,7 @@ fast_clean_architecture/generators/config_updater.py,sha256=faSjwPX_sFWl8-qq4rl0
16
16
  fast_clean_architecture/generators/generator_factory.py,sha256=YB_qlGcdNWJsu1ZFP46ik3eK7fjZFCCFo4hfSkwQYMc,7746
17
17
  fast_clean_architecture/generators/package_generator.py,sha256=S234nCTHezdGMor0IaxbyWUyO3T68kAx_pJuHVKJHog,5978
18
18
  fast_clean_architecture/generators/template_validator.py,sha256=7N1_Sn3BqPIWnv0oKZvSvGgi3y64FKShSIvkFlrlbVA,23651
19
- fast_clean_architecture/generators/validation_config.py,sha256=ryqlEnE0tGIG5Ste9QsQccr_5HCS1Bl-gn422faDXug,2392
19
+ fast_clean_architecture/generators/validation_config.py,sha256=KmFL1WxDpZ989sPOnREN7fpw1emgRQnKw2aswyTr93U,2394
20
20
  fast_clean_architecture/generators/validation_metrics.py,sha256=mQ5pUVH2zg-gfaTHm0lf7-n6X7evTEGPeN__OPeaqS0,6644
21
21
  fast_clean_architecture/templates/__init__.py,sha256=uweRUmrNZosbwDlnM10Nfu9rKzPcEqXEr6BchsSAr58,146
22
22
  fast_clean_architecture/templates/__init__.py.j2,sha256=ogycgpBmYv-O1yoyQK9-Ki_x4FlYgb58mvhPrhiQNpA,618
@@ -31,8 +31,8 @@ fast_clean_architecture/templates/repository.py.j2,sha256=YsjPpVakZR2A-JmsK-VYE6
31
31
  fast_clean_architecture/templates/schemas.py.j2,sha256=iwZT42LxqgNL4ms_-uQkWKWQWaiMDflWzdlWMBke_3M,755
32
32
  fast_clean_architecture/templates/service.py.j2,sha256=utNp_E7bywlMfjY9SHzzrH4isr-WeXpnRIb15XkZrj4,3926
33
33
  fast_clean_architecture/templates/value_object.py.j2,sha256=IVI69cuYTa_7g1s9T5guigIqeSl1lXFapWFu-XKzYjE,919
34
- fast_clean_architecture-1.1.0.dist-info/METADATA,sha256=mqX8xt3q2b-miLJHwU5S0el4gaiXfXhPQ38K4JrZwhQ,17096
35
- fast_clean_architecture-1.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
36
- fast_clean_architecture-1.1.0.dist-info/entry_points.txt,sha256=5R_7kBX0dYEq6n8lyTmv7Sn4Rs3pjpLqGX-mB_3FL1w,65
37
- fast_clean_architecture-1.1.0.dist-info/licenses/LICENSE,sha256=wpM1B1Znw_YrC9L_R0jiXPHWz5iM_tNW4UOvBtl026s,1075
38
- fast_clean_architecture-1.1.0.dist-info/RECORD,,
34
+ fast_clean_architecture-1.1.2.dist-info/METADATA,sha256=xh-9NH9spbwIDd5rXdx2SeoeWNLTK-jJzo-w_qJjmOk,19348
35
+ fast_clean_architecture-1.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
36
+ fast_clean_architecture-1.1.2.dist-info/entry_points.txt,sha256=5R_7kBX0dYEq6n8lyTmv7Sn4Rs3pjpLqGX-mB_3FL1w,65
37
+ fast_clean_architecture-1.1.2.dist-info/licenses/LICENSE,sha256=wpM1B1Znw_YrC9L_R0jiXPHWz5iM_tNW4UOvBtl026s,1075
38
+ fast_clean_architecture-1.1.2.dist-info/RECORD,,