infomankit 0.3.23__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.
Files changed (143) hide show
  1. infoman/__init__.py +1 -0
  2. infoman/cli/README.md +378 -0
  3. infoman/cli/__init__.py +7 -0
  4. infoman/cli/commands/__init__.py +3 -0
  5. infoman/cli/commands/init.py +312 -0
  6. infoman/cli/scaffold.py +634 -0
  7. infoman/cli/templates/Makefile.template +132 -0
  8. infoman/cli/templates/app/__init__.py.template +3 -0
  9. infoman/cli/templates/app/app.py.template +4 -0
  10. infoman/cli/templates/app/models_base.py.template +18 -0
  11. infoman/cli/templates/app/models_entity_init.py.template +11 -0
  12. infoman/cli/templates/app/models_schemas_init.py.template +11 -0
  13. infoman/cli/templates/app/repository_init.py.template +11 -0
  14. infoman/cli/templates/app/routers_init.py.template +15 -0
  15. infoman/cli/templates/app/services_init.py.template +11 -0
  16. infoman/cli/templates/app/static_index.html.template +39 -0
  17. infoman/cli/templates/app/static_main.js.template +31 -0
  18. infoman/cli/templates/app/static_style.css.template +111 -0
  19. infoman/cli/templates/app/utils_init.py.template +11 -0
  20. infoman/cli/templates/config/.env.dev.template +43 -0
  21. infoman/cli/templates/config/.env.prod.template +43 -0
  22. infoman/cli/templates/config/README.md.template +28 -0
  23. infoman/cli/templates/docker/.dockerignore.template +60 -0
  24. infoman/cli/templates/docker/Dockerfile.template +47 -0
  25. infoman/cli/templates/docker/README.md.template +240 -0
  26. infoman/cli/templates/docker/docker-compose.yml.template +81 -0
  27. infoman/cli/templates/docker/mysql_custom.cnf.template +42 -0
  28. infoman/cli/templates/docker/mysql_init.sql.template +15 -0
  29. infoman/cli/templates/project/.env.example.template +1 -0
  30. infoman/cli/templates/project/.gitignore.template +60 -0
  31. infoman/cli/templates/project/Makefile.template +38 -0
  32. infoman/cli/templates/project/README.md.template +137 -0
  33. infoman/cli/templates/project/deploy.sh.template +97 -0
  34. infoman/cli/templates/project/main.py.template +10 -0
  35. infoman/cli/templates/project/manage.sh.template +97 -0
  36. infoman/cli/templates/project/pyproject.toml.template +47 -0
  37. infoman/cli/templates/project/service.sh.template +203 -0
  38. infoman/config/__init__.py +25 -0
  39. infoman/config/base.py +67 -0
  40. infoman/config/db_cache.py +237 -0
  41. infoman/config/db_relation.py +181 -0
  42. infoman/config/db_vector.py +39 -0
  43. infoman/config/jwt.py +16 -0
  44. infoman/config/llm.py +16 -0
  45. infoman/config/log.py +627 -0
  46. infoman/config/mq.py +26 -0
  47. infoman/config/settings.py +65 -0
  48. infoman/llm/__init__.py +0 -0
  49. infoman/llm/llm.py +297 -0
  50. infoman/logger/__init__.py +57 -0
  51. infoman/logger/context.py +191 -0
  52. infoman/logger/core.py +358 -0
  53. infoman/logger/filters.py +157 -0
  54. infoman/logger/formatters.py +138 -0
  55. infoman/logger/handlers.py +276 -0
  56. infoman/logger/metrics.py +160 -0
  57. infoman/performance/README.md +583 -0
  58. infoman/performance/__init__.py +19 -0
  59. infoman/performance/cli.py +215 -0
  60. infoman/performance/config.py +166 -0
  61. infoman/performance/reporter.py +519 -0
  62. infoman/performance/runner.py +303 -0
  63. infoman/performance/standards.py +222 -0
  64. infoman/service/__init__.py +8 -0
  65. infoman/service/app.py +67 -0
  66. infoman/service/core/__init__.py +0 -0
  67. infoman/service/core/auth.py +105 -0
  68. infoman/service/core/lifespan.py +132 -0
  69. infoman/service/core/monitor.py +57 -0
  70. infoman/service/core/response.py +37 -0
  71. infoman/service/exception/__init__.py +7 -0
  72. infoman/service/exception/error.py +274 -0
  73. infoman/service/exception/exception.py +25 -0
  74. infoman/service/exception/handler.py +238 -0
  75. infoman/service/infrastructure/__init__.py +8 -0
  76. infoman/service/infrastructure/base.py +212 -0
  77. infoman/service/infrastructure/db_cache/__init__.py +8 -0
  78. infoman/service/infrastructure/db_cache/manager.py +194 -0
  79. infoman/service/infrastructure/db_relation/__init__.py +41 -0
  80. infoman/service/infrastructure/db_relation/manager.py +300 -0
  81. infoman/service/infrastructure/db_relation/manager_pro.py +408 -0
  82. infoman/service/infrastructure/db_relation/mysql.py +52 -0
  83. infoman/service/infrastructure/db_relation/pgsql.py +54 -0
  84. infoman/service/infrastructure/db_relation/sqllite.py +25 -0
  85. infoman/service/infrastructure/db_vector/__init__.py +40 -0
  86. infoman/service/infrastructure/db_vector/manager.py +201 -0
  87. infoman/service/infrastructure/db_vector/qdrant.py +322 -0
  88. infoman/service/infrastructure/mq/__init__.py +15 -0
  89. infoman/service/infrastructure/mq/manager.py +178 -0
  90. infoman/service/infrastructure/mq/nats/__init__.py +0 -0
  91. infoman/service/infrastructure/mq/nats/nats_client.py +57 -0
  92. infoman/service/infrastructure/mq/nats/nats_event_router.py +25 -0
  93. infoman/service/launch.py +284 -0
  94. infoman/service/middleware/__init__.py +7 -0
  95. infoman/service/middleware/base.py +41 -0
  96. infoman/service/middleware/logging.py +51 -0
  97. infoman/service/middleware/rate_limit.py +301 -0
  98. infoman/service/middleware/request_id.py +21 -0
  99. infoman/service/middleware/white_list.py +24 -0
  100. infoman/service/models/__init__.py +8 -0
  101. infoman/service/models/base.py +441 -0
  102. infoman/service/models/type/embed.py +70 -0
  103. infoman/service/routers/__init__.py +18 -0
  104. infoman/service/routers/health_router.py +311 -0
  105. infoman/service/routers/monitor_router.py +44 -0
  106. infoman/service/utils/__init__.py +8 -0
  107. infoman/service/utils/cache/__init__.py +0 -0
  108. infoman/service/utils/cache/cache.py +192 -0
  109. infoman/service/utils/module_loader.py +10 -0
  110. infoman/service/utils/parse.py +10 -0
  111. infoman/service/utils/resolver/__init__.py +8 -0
  112. infoman/service/utils/resolver/base.py +47 -0
  113. infoman/service/utils/resolver/resp.py +102 -0
  114. infoman/service/vector/__init__.py +20 -0
  115. infoman/service/vector/base.py +56 -0
  116. infoman/service/vector/qdrant.py +125 -0
  117. infoman/service/vector/service.py +67 -0
  118. infoman/utils/__init__.py +2 -0
  119. infoman/utils/decorators/__init__.py +8 -0
  120. infoman/utils/decorators/cache.py +137 -0
  121. infoman/utils/decorators/retry.py +99 -0
  122. infoman/utils/decorators/safe_execute.py +99 -0
  123. infoman/utils/decorators/timing.py +99 -0
  124. infoman/utils/encryption/__init__.py +8 -0
  125. infoman/utils/encryption/aes.py +66 -0
  126. infoman/utils/encryption/ecc.py +108 -0
  127. infoman/utils/encryption/rsa.py +112 -0
  128. infoman/utils/file/__init__.py +0 -0
  129. infoman/utils/file/handler.py +22 -0
  130. infoman/utils/hash/__init__.py +0 -0
  131. infoman/utils/hash/hash.py +61 -0
  132. infoman/utils/http/__init__.py +8 -0
  133. infoman/utils/http/client.py +62 -0
  134. infoman/utils/http/info.py +94 -0
  135. infoman/utils/http/result.py +19 -0
  136. infoman/utils/notification/__init__.py +8 -0
  137. infoman/utils/notification/feishu.py +35 -0
  138. infoman/utils/text/__init__.py +8 -0
  139. infoman/utils/text/extractor.py +111 -0
  140. infomankit-0.3.23.dist-info/METADATA +632 -0
  141. infomankit-0.3.23.dist-info/RECORD +143 -0
  142. infomankit-0.3.23.dist-info/WHEEL +4 -0
  143. infomankit-0.3.23.dist-info/entry_points.txt +5 -0
@@ -0,0 +1,132 @@
1
+ # Makefile for infomankit-based project
2
+ # Generated by: infomankit makefile
3
+ .PHONY: help install dev test lint format clean docker-build docker-up docker-down
4
+
5
+ .DEFAULT_GOAL := help
6
+
7
+ # Variables
8
+ PYTHON := python3
9
+ PIP := pip
10
+ PYTEST := pytest
11
+ DOCKER_COMPOSE := docker compose
12
+ PROJECT_NAME := {{PROJECT_NAME}}
13
+
14
+ help: ## Show this help message
15
+ @echo '════════════════════════════════════════════════════════'
16
+ @echo ' $(PROJECT_NAME) - Development Commands '
17
+ @echo '════════════════════════════════════════════════════════'
18
+ @echo ''
19
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
20
+ @echo ''
21
+
22
+ # ==================== Installation ====================
23
+
24
+ install: ## Install dependencies
25
+ $(PIP) install -e .
26
+
27
+ install-dev: ## Install with dev dependencies
28
+ $(PIP) install -e ".[dev]"
29
+
30
+ install-full: ## Install with all features
31
+ $(PIP) install -e ".[full]"
32
+
33
+ upgrade: ## Upgrade dependencies
34
+ $(PIP) install --upgrade pip
35
+ $(PIP) install --upgrade -e .
36
+
37
+ # ==================== Development ====================
38
+
39
+ dev: ## Run development server
40
+ infoman-serve run main:app --host 0.0.0.0 --port 8000 --reload
41
+
42
+ run: ## Run production server
43
+ infoman-serve run main:app --host 0.0.0.0 --port 8000
44
+
45
+ # ==================== Testing ====================
46
+
47
+ test: ## Run tests
48
+ $(PYTEST) tests/ -v
49
+
50
+ test-cov: ## Run tests with coverage
51
+ $(PYTEST) tests/ -v --cov --cov-report=term-missing --cov-report=html
52
+
53
+ test-watch: ## Run tests in watch mode
54
+ $(PYTEST) tests/ -v --watch
55
+
56
+ # ==================== Code Quality ====================
57
+
58
+ lint: ## Run linting
59
+ ruff check .
60
+
61
+ lint-fix: ## Fix linting issues
62
+ ruff check . --fix
63
+
64
+ format: ## Format code
65
+ ruff format .
66
+
67
+ format-check: ## Check formatting
68
+ ruff format . --check
69
+
70
+ typecheck: ## Run type checking (if mypy installed)
71
+ @command -v mypy >/dev/null 2>&1 && mypy . || echo "mypy not installed, skipping"
72
+
73
+ qa: lint format-check ## Run all quality checks
74
+
75
+ # ==================== Docker ====================
76
+
77
+ docker-build: ## Build Docker image
78
+ docker build -t $(PROJECT_NAME):latest .
79
+
80
+ docker-up: ## Start services
81
+ $(DOCKER_COMPOSE) up -d
82
+
83
+ docker-down: ## Stop services
84
+ $(DOCKER_COMPOSE) down
85
+
86
+ docker-logs: ## Show logs
87
+ $(DOCKER_COMPOSE) logs -f
88
+
89
+ docker-clean: ## Clean Docker resources
90
+ $(DOCKER_COMPOSE) down -v --remove-orphans
91
+
92
+ docker-restart: docker-down docker-up ## Restart services
93
+
94
+ # ==================== Database ====================
95
+
96
+ db-migrate: ## Run database migrations
97
+ @echo "Run your migration command here"
98
+ @echo "e.g., alembic upgrade head"
99
+
100
+ db-rollback: ## Rollback last migration
101
+ @echo "Run your rollback command here"
102
+ @echo "e.g., alembic downgrade -1"
103
+
104
+ # ==================== Utilities ====================
105
+
106
+ clean: ## Clean build artifacts
107
+ rm -rf build/ dist/ *.egg-info
108
+ rm -rf .pytest_cache/ .ruff_cache/ .mypy_cache/
109
+ rm -rf htmlcov/ .coverage coverage.xml
110
+ find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
111
+ find . -type f -name '*.pyc' -delete
112
+ find . -type f -name '*.pyo' -delete
113
+
114
+ clean-logs: ## Clean log files
115
+ rm -rf logs/*.log
116
+
117
+ clean-all: clean clean-logs docker-clean ## Clean everything
118
+
119
+ init-env: ## Initialize .env from example
120
+ @if [ ! -f .env ]; then \
121
+ cp .env.example .env && \
122
+ echo "✅ .env file created" && \
123
+ echo "⚠️ Update .env with your configuration"; \
124
+ else \
125
+ echo "⚠️ .env already exists"; \
126
+ fi
127
+
128
+ tree: ## Show project structure
129
+ @tree -I '__pycache__|*.pyc|*.egg-info|.git|.venv|node_modules' -L 3 || echo "tree command not found"
130
+
131
+ lines: ## Count lines of code
132
+ @find . -name '*.py' -not -path "./.venv/*" -not -path "./build/*" | xargs wc -l | tail -1
@@ -0,0 +1,3 @@
1
+ """
2
+ {project_name} Application Package
3
+ """
@@ -0,0 +1,4 @@
1
+ from infoman.service.app import application
2
+ from app.routers import api_router
3
+
4
+ application.include_router(api_router)
@@ -0,0 +1,18 @@
1
+ """
2
+ Base Model
3
+
4
+ Base class for all ORM models with common fields.
5
+ """
6
+
7
+ from sqlalchemy import Column, Integer, DateTime, func
8
+ from app.core.database import Base
9
+
10
+
11
+ class BaseModel(Base):
12
+ """Base model with common fields"""
13
+
14
+ __abstract__ = True
15
+
16
+ id = Column(Integer, primary_key=True, index=True, autoincrement=True)
17
+ created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
18
+ updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False)
@@ -0,0 +1,11 @@
1
+ """
2
+ Entity Models
3
+
4
+ Import all entity models here for Alembic auto-generation.
5
+ """
6
+
7
+ # Example:
8
+ # from app.models.entity.user import User
9
+ # from app.models.entity.product import Product
10
+
11
+ __all__ = []
@@ -0,0 +1,11 @@
1
+ """
2
+ Pydantic Schemas
3
+
4
+ Import all schemas here for easy access.
5
+ """
6
+
7
+ # Example:
8
+ # from app.models.schemas.user import UserCreate, UserUpdate, UserResponse
9
+ # from app.models.schemas.product import ProductCreate, ProductUpdate, ProductResponse
10
+
11
+ __all__ = []
@@ -0,0 +1,11 @@
1
+ """
2
+ Data Access Layer
3
+
4
+ Import all repository classes here for easy access.
5
+ """
6
+
7
+ # Example:
8
+ # from app.repository.user_repository import UserRepository
9
+ # from app.repository.product_repository import ProductRepository
10
+
11
+ __all__ = []
@@ -0,0 +1,15 @@
1
+ """
2
+ API Routers
3
+
4
+ Central router registration.
5
+ """
6
+
7
+ from fastapi import APIRouter
8
+
9
+ # Create main API router
10
+ api_router = APIRouter()
11
+
12
+ # Import and register sub-routers here
13
+ # Example:
14
+ # from app.routers import user_router
15
+ # api_router.include_router(user_router.router, prefix="/users", tags=["Users"])
@@ -0,0 +1,11 @@
1
+ """
2
+ Business Logic Services
3
+
4
+ Import all service classes here for easy access.
5
+ """
6
+
7
+ # Example:
8
+ # from app.services.user_service import UserService
9
+ # from app.services.auth_service import AuthService
10
+
11
+ __all__ = []
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>{project_name}</title>
7
+ <link rel="stylesheet" href="/static/css/style.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <header>
12
+ <h1>Welcome to {project_name}</h1>
13
+ <p>FastAPI application built with infomankit</p>
14
+ </header>
15
+
16
+ <main>
17
+ <section class="links">
18
+ <h2>Quick Links</h2>
19
+ <ul>
20
+ <li><a href="/docs">API Documentation (Swagger UI)</a></li>
21
+ <li><a href="/redoc">API Documentation (ReDoc)</a></li>
22
+ <li><a href="/health">Health Check</a></li>
23
+ </ul>
24
+ </section>
25
+
26
+ <section class="info">
27
+ <h2>Getting Started</h2>
28
+ <p>Your API is up and running! Visit the documentation links above to explore available endpoints.</p>
29
+ </section>
30
+ </main>
31
+
32
+ <footer>
33
+ <p>Built with <a href="https://github.com/ai-infoman/infoman-pykit" target="_blank">infomankit</a></p>
34
+ </footer>
35
+ </div>
36
+
37
+ <script src="/static/js/main.js"></script>
38
+ </body>
39
+ </html>
@@ -0,0 +1,31 @@
1
+ // Main JavaScript for {project_name}
2
+
3
+ document.addEventListener('DOMContentLoaded', function() {{
4
+ console.log('{project_name} loaded successfully');
5
+
6
+ // Add smooth scrolling
7
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {{
8
+ anchor.addEventListener('click', function (e) {{
9
+ e.preventDefault();
10
+ const target = document.querySelector(this.getAttribute('href'));
11
+ if (target) {{
12
+ target.scrollIntoView({{
13
+ behavior: 'smooth'
14
+ }});
15
+ }}
16
+ }});
17
+ }});
18
+
19
+ // Check API health
20
+ checkHealth();
21
+ }});
22
+
23
+ async function checkHealth() {{
24
+ try {{
25
+ const response = await fetch('/health');
26
+ const data = await response.json();
27
+ console.log('Health check:', data);
28
+ }} catch (error) {{
29
+ console.error('Health check failed:', error);
30
+ }}
31
+ }}
@@ -0,0 +1,111 @@
1
+ /* Basic styles for {project_name} */
2
+
3
+ * {{
4
+ margin: 0;
5
+ padding: 0;
6
+ box-sizing: border-box;
7
+ }}
8
+
9
+ body {{
10
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
11
+ line-height: 1.6;
12
+ color: #333;
13
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
14
+ min-height: 100vh;
15
+ padding: 20px;
16
+ }}
17
+
18
+ .container {{
19
+ max-width: 800px;
20
+ margin: 0 auto;
21
+ background: white;
22
+ border-radius: 10px;
23
+ box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
24
+ overflow: hidden;
25
+ }}
26
+
27
+ header {{
28
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
29
+ color: white;
30
+ padding: 40px;
31
+ text-align: center;
32
+ }}
33
+
34
+ header h1 {{
35
+ font-size: 2.5rem;
36
+ margin-bottom: 10px;
37
+ }}
38
+
39
+ header p {{
40
+ font-size: 1.2rem;
41
+ opacity: 0.9;
42
+ }}
43
+
44
+ main {{
45
+ padding: 40px;
46
+ }}
47
+
48
+ section {{
49
+ margin-bottom: 30px;
50
+ }}
51
+
52
+ h2 {{
53
+ color: #667eea;
54
+ margin-bottom: 15px;
55
+ font-size: 1.8rem;
56
+ }}
57
+
58
+ .links ul {{
59
+ list-style: none;
60
+ }}
61
+
62
+ .links li {{
63
+ margin: 10px 0;
64
+ }}
65
+
66
+ .links a {{
67
+ display: inline-block;
68
+ padding: 12px 24px;
69
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
70
+ color: white;
71
+ text-decoration: none;
72
+ border-radius: 5px;
73
+ transition: transform 0.2s, box-shadow 0.2s;
74
+ }}
75
+
76
+ .links a:hover {{
77
+ transform: translateY(-2px);
78
+ box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
79
+ }}
80
+
81
+ .info p {{
82
+ font-size: 1.1rem;
83
+ color: #666;
84
+ }}
85
+
86
+ footer {{
87
+ background: #f8f9fa;
88
+ padding: 20px;
89
+ text-align: center;
90
+ color: #666;
91
+ border-top: 1px solid #eee;
92
+ }}
93
+
94
+ footer a {{
95
+ color: #667eea;
96
+ text-decoration: none;
97
+ }}
98
+
99
+ footer a:hover {{
100
+ text-decoration: underline;
101
+ }}
102
+
103
+ @media (max-width: 768px) {{
104
+ header h1 {{
105
+ font-size: 2rem;
106
+ }}
107
+
108
+ main {{
109
+ padding: 20px;
110
+ }}
111
+ }}
@@ -0,0 +1,11 @@
1
+ """
2
+ Utility Functions
3
+
4
+ Common utility functions and helpers.
5
+ """
6
+
7
+ # Example:
8
+ # from app.utils.time_utils import format_datetime, parse_datetime
9
+ # from app.utils.string_utils import slugify, sanitize
10
+
11
+ __all__ = []
@@ -0,0 +1,43 @@
1
+ # Application Settings
2
+ APP_NAME={project_name}
3
+ APP_ENV=dev
4
+ APP_PORT=8000
5
+ APP_DEBUG=true
6
+
7
+ LOG_DIR=logs
8
+ LOG_LEVEL=DEBUG
9
+ LOG_FORMAT=simple
10
+
11
+ USE_TEMPLATES=1
12
+ USE_PRO_ORM=1
13
+ TEMPLATE_DIR=./app/template
14
+ #USE_STATIC=1
15
+
16
+ # Database Configuration (infomankit format)
17
+ MYSQL_ENABLED=true
18
+ MYSQL_HOST=127.0.0.1
19
+ MYSQL_PORT=3306
20
+ MYSQL_DB=XXX
21
+ MYSQL_USER=XXX
22
+ MYSQL_PASSWORD=XXX
23
+ MYSQL_CHARSET=utf8mb4
24
+ MYSQL_POOL_MAX_SIZE=10
25
+ MYSQL_POOL_RECYCLE=3600
26
+ MYSQL_ECHO=false
27
+ MYSQL_MODELS_PATH=app.models
28
+ MYSQL_MODELS=entity
29
+
30
+
31
+ # JWT Configuration
32
+ JWT_SECRET_KEY=your-secret-key-change-this-in-production
33
+ JWT_ALGORITHM=HS256
34
+ JWT_ACCESS_TOKEN_EXPIRE_MINUTES=30
35
+
36
+ # CORS Configuration (comma-separated origins)
37
+ CORS_ORIGINS=http://localhost:3000,http://localhost:8000
38
+
39
+ # Redis Configuration (Optional)
40
+ REDIS_HOST=localhost
41
+ REDIS_PORT=6379
42
+ REDIS_DB=0
43
+ REDIS_PASSWORD=
@@ -0,0 +1,43 @@
1
+ # Application Settings
2
+ APP_NAME={project_name}
3
+ APP_ENV=prod
4
+ APP_PORT=8000
5
+ APP_DEBUG=false
6
+
7
+ LOG_DIR=logs
8
+ LOG_LEVEL=INFO
9
+ LOG_FORMAT=json
10
+
11
+ USE_TEMPLATES=1
12
+ USE_PRO_ORM=1
13
+ TEMPLATE_DIR=./app/template
14
+ #USE_STATIC=1
15
+
16
+ # Database Configuration (infomankit format)
17
+ MYSQL_ENABLED=true
18
+ MYSQL_HOST=127.0.0.1
19
+ MYSQL_PORT=3306
20
+ MYSQL_DB=XXX
21
+ MYSQL_USER=XXX
22
+ MYSQL_PASSWORD=XXX
23
+ MYSQL_CHARSET=utf8mb4
24
+ MYSQL_POOL_MAX_SIZE=20
25
+ MYSQL_POOL_RECYCLE=3600
26
+ MYSQL_ECHO=false
27
+ MYSQL_MODELS_PATH=app.models
28
+ MYSQL_MODELS=entity
29
+
30
+
31
+ # JWT Configuration
32
+ JWT_SECRET_KEY=your-secret-key-change-this-in-production
33
+ JWT_ALGORITHM=HS256
34
+ JWT_ACCESS_TOKEN_EXPIRE_MINUTES=30
35
+
36
+ # CORS Configuration (comma-separated origins)
37
+ CORS_ORIGINS=https://your-domain.com
38
+
39
+ # Redis Configuration (Optional)
40
+ REDIS_HOST=localhost
41
+ REDIS_PORT=6379
42
+ REDIS_DB=0
43
+ REDIS_PASSWORD=
@@ -0,0 +1,28 @@
1
+ # Configuration Files
2
+
3
+ This directory contains environment-specific configuration files for the application.
4
+
5
+ ## Files
6
+
7
+ - `.env.dev` - Development environment configuration
8
+ - `.env.prod` - Production environment configuration
9
+
10
+ ## Usage
11
+
12
+ 1. Copy the appropriate config to project root:
13
+ ```bash
14
+ cp config/.env.dev .env # For development
15
+ cp config/.env.prod .env # For production
16
+ ```
17
+
18
+ 2. Update the values in `.env` according to your environment:
19
+ - Database credentials (MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB)
20
+ - JWT secret key
21
+ - Redis password (if applicable)
22
+ - CORS origins
23
+
24
+ 3. Never commit `.env` files to version control
25
+
26
+ ## Environment Variables
27
+
28
+ See individual `.env.*` files for detailed documentation of each variable.
@@ -0,0 +1,60 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+
11
+ # Virtual Environment
12
+ venv/
13
+ env/
14
+ .venv/
15
+ ENV/
16
+
17
+ # IDE
18
+ .vscode/
19
+ .idea/
20
+ *.swp
21
+ *.swo
22
+
23
+ # Environment
24
+ .env
25
+ .env.local
26
+ .env.*.local
27
+
28
+ # Logs
29
+ logs/
30
+ *.log
31
+
32
+ # Testing
33
+ .pytest_cache/
34
+ .coverage
35
+ htmlcov/
36
+ .tox/
37
+
38
+ # Documentation
39
+ doc/
40
+ *.md
41
+ !README.md
42
+
43
+ # Git
44
+ .git/
45
+ .gitignore
46
+
47
+ # Docker
48
+ docker/
49
+ Dockerfile
50
+ docker-compose*.yml
51
+ .dockerignore
52
+
53
+ # OS
54
+ .DS_Store
55
+ Thumbs.db
56
+
57
+ # Database
58
+ *.db
59
+ *.sqlite
60
+ *.sqlite3
@@ -0,0 +1,47 @@
1
+ # Multi-stage build for optimal image size
2
+ FROM python:3.11-slim as builder
3
+
4
+ WORKDIR /app
5
+
6
+ # Install build dependencies
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ gcc \
9
+ g++ \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements
13
+ COPY pyproject.toml ./
14
+
15
+ # Install Python dependencies
16
+ RUN pip install --no-cache-dir --upgrade pip && \
17
+ pip install --no-cache-dir -e .
18
+
19
+ # Runtime stage
20
+ FROM python:3.11-slim
21
+
22
+ WORKDIR /app
23
+
24
+ # Install runtime dependencies
25
+ RUN apt-get update && apt-get install -y --no-install-recommends \
26
+ curl \
27
+ && rm -rf /var/lib/apt/lists/*
28
+
29
+ # Copy Python packages from builder
30
+ COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
31
+ COPY --from=builder /usr/local/bin /usr/local/bin
32
+
33
+ # Copy application code
34
+ COPY . .
35
+
36
+ # Create logs directory
37
+ RUN mkdir -p logs
38
+
39
+ # Expose port
40
+ EXPOSE 8000
41
+
42
+ # Health check
43
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
44
+ CMD curl -f http://localhost:8000/health || exit 1
45
+
46
+ # Run application
47
+ CMD ["infoman-serve", "run", "app.app:app", "--host", "0.0.0.0", "--port", "8000"]