sum-cli 3.0.0__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 (72) hide show
  1. sum/__init__.py +1 -0
  2. sum/boilerplate/.env.example +124 -0
  3. sum/boilerplate/.gitea/workflows/ci.yml +33 -0
  4. sum/boilerplate/.gitea/workflows/deploy-production.yml +98 -0
  5. sum/boilerplate/.gitea/workflows/deploy-staging.yml +113 -0
  6. sum/boilerplate/.github/workflows/ci.yml +36 -0
  7. sum/boilerplate/.github/workflows/deploy-production.yml +102 -0
  8. sum/boilerplate/.github/workflows/deploy-staging.yml +115 -0
  9. sum/boilerplate/.gitignore +45 -0
  10. sum/boilerplate/README.md +259 -0
  11. sum/boilerplate/manage.py +34 -0
  12. sum/boilerplate/project_name/__init__.py +5 -0
  13. sum/boilerplate/project_name/home/__init__.py +5 -0
  14. sum/boilerplate/project_name/home/apps.py +20 -0
  15. sum/boilerplate/project_name/home/management/__init__.py +0 -0
  16. sum/boilerplate/project_name/home/management/commands/__init__.py +0 -0
  17. sum/boilerplate/project_name/home/management/commands/populate_demo_content.py +644 -0
  18. sum/boilerplate/project_name/home/management/commands/seed.py +129 -0
  19. sum/boilerplate/project_name/home/management/commands/seed_showroom.py +1661 -0
  20. sum/boilerplate/project_name/home/migrations/__init__.py +3 -0
  21. sum/boilerplate/project_name/home/models.py +13 -0
  22. sum/boilerplate/project_name/settings/__init__.py +5 -0
  23. sum/boilerplate/project_name/settings/base.py +348 -0
  24. sum/boilerplate/project_name/settings/local.py +78 -0
  25. sum/boilerplate/project_name/settings/production.py +106 -0
  26. sum/boilerplate/project_name/urls.py +33 -0
  27. sum/boilerplate/project_name/wsgi.py +16 -0
  28. sum/boilerplate/pytest.ini +5 -0
  29. sum/boilerplate/requirements.txt +25 -0
  30. sum/boilerplate/static/client/.gitkeep +3 -0
  31. sum/boilerplate/templates/overrides/.gitkeep +3 -0
  32. sum/boilerplate/tests/__init__.py +3 -0
  33. sum/boilerplate/tests/test_health.py +51 -0
  34. sum/cli.py +42 -0
  35. sum/commands/__init__.py +10 -0
  36. sum/commands/backup.py +308 -0
  37. sum/commands/check.py +128 -0
  38. sum/commands/init.py +265 -0
  39. sum/commands/promote.py +758 -0
  40. sum/commands/run.py +96 -0
  41. sum/commands/themes.py +56 -0
  42. sum/commands/update.py +301 -0
  43. sum/config.py +61 -0
  44. sum/docs/USER_GUIDE.md +663 -0
  45. sum/exceptions.py +45 -0
  46. sum/setup/__init__.py +17 -0
  47. sum/setup/auth.py +184 -0
  48. sum/setup/database.py +58 -0
  49. sum/setup/deps.py +73 -0
  50. sum/setup/git_ops.py +463 -0
  51. sum/setup/infrastructure.py +576 -0
  52. sum/setup/orchestrator.py +354 -0
  53. sum/setup/remote_themes.py +371 -0
  54. sum/setup/scaffold.py +500 -0
  55. sum/setup/seed.py +110 -0
  56. sum/setup/site_orchestrator.py +441 -0
  57. sum/setup/venv.py +89 -0
  58. sum/system_config.py +330 -0
  59. sum/themes_registry.py +180 -0
  60. sum/utils/__init__.py +25 -0
  61. sum/utils/django.py +97 -0
  62. sum/utils/environment.py +76 -0
  63. sum/utils/output.py +78 -0
  64. sum/utils/project.py +110 -0
  65. sum/utils/prompts.py +36 -0
  66. sum/utils/validation.py +313 -0
  67. sum_cli-3.0.0.dist-info/METADATA +127 -0
  68. sum_cli-3.0.0.dist-info/RECORD +72 -0
  69. sum_cli-3.0.0.dist-info/WHEEL +5 -0
  70. sum_cli-3.0.0.dist-info/entry_points.txt +2 -0
  71. sum_cli-3.0.0.dist-info/licenses/LICENSE +29 -0
  72. sum_cli-3.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,259 @@
1
+ # SUM Client Boilerplate
2
+
3
+ This directory is the **copy-ready template** for new SUM Platform client projects.
4
+
5
+ ## What This Is
6
+
7
+ A minimal, runnable Django/Wagtail project that consumes `sum_core` as its foundation. When you create a new client site, you copy this boilerplate to `/clients/<your-project-name>/` and customize it.
8
+
9
+ ## Quick Start
10
+
11
+ ### 1. Copy the Boilerplate
12
+
13
+ ```bash
14
+ # From the repo root:
15
+ cp -r boilerplate clients/my_client
16
+ cd clients/my_client
17
+ ```
18
+
19
+ ### 2. Rename the Project Module
20
+
21
+ Replace `project_name` with your actual project name throughout:
22
+
23
+ ```bash
24
+ # Rename the directory
25
+ mv project_name my_client
26
+
27
+ # Update all references (Linux/macOS):
28
+ find . -type f \( -name "*.py" -o -name "*.txt" -o -name "pytest.ini" \) \
29
+ -exec sed -i 's/project_name/my_client/g' {} +
30
+
31
+ # Verify no stale references remain:
32
+ grep -r "project_name" .
33
+ ```
34
+
35
+ ### 3. Set Up Your Environment
36
+
37
+ ```bash
38
+ # From the client project directory:
39
+ cp .env.example .env
40
+ # Edit .env with your local/production values
41
+
42
+ # Create virtual environment (or use the repo-level one):
43
+ python -m venv .venv
44
+ source .venv/bin/activate
45
+
46
+ # Install dependencies:
47
+ pip install -r requirements.txt
48
+ ```
49
+
50
+ ### 4. Run Migrations & Start
51
+
52
+ ```bash
53
+ # Run migrations:
54
+ python manage.py migrate
55
+
56
+ # Create a superuser:
57
+ python manage.py createsuperuser
58
+
59
+ # Start the development server:
60
+ python manage.py runserver 8001
61
+ ```
62
+
63
+ Visit:
64
+
65
+ - **Site**: http://localhost:8001/
66
+ - **Admin**: http://localhost:8001/admin/
67
+
68
+ ## What Must Be Changed Per Client
69
+
70
+ | File / Location | What to Change |
71
+ | ------------------------------- | ----------------------------------------------- |
72
+ | `project_name/` directory | Rename to your project name |
73
+ | `project_name/settings/base.py` | Update `WAGTAIL_SITE_NAME` |
74
+ | `project_name/home/apps.py` | Update `name` and `label` to match |
75
+ | `manage.py` | Already uses `DJANGO_SETTINGS_MODULE` correctly |
76
+ | `.env` | Configure for your environment |
77
+
78
+ ### Environment Variables
79
+
80
+ See `.env.example` for all configurable values. Critical production requirements:
81
+
82
+ - `DJANGO_SECRET_KEY` - **Required**: Generate a unique secret key
83
+ - `ALLOWED_HOSTS` - **Required**: Comma-separated list of domains
84
+ - `DJANGO_DB_*` - **Required**: PostgreSQL connection details
85
+ - `REDIS_URL` - Recommended: For cache and Celery
86
+
87
+ ### Email Configuration
88
+
89
+ Email is required for lead notifications (alerting you when forms are submitted) and auto-reply confirmations to visitors. By default, emails are printed to the console in development.
90
+
91
+ **We recommend [Resend](https://resend.com) for production email delivery.**
92
+
93
+ #### Setup Steps
94
+
95
+ 1. **Create a Resend account** at https://resend.com
96
+ 2. **Add and verify your domain** in the Resend dashboard
97
+ 3. **Generate an API key** from Settings → API Keys
98
+ 4. **Update your `.env`** with these values:
99
+
100
+ ```bash
101
+ EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
102
+ EMAIL_HOST=smtp.resend.com
103
+ EMAIL_PORT=587
104
+ EMAIL_HOST_USER=resend
105
+ EMAIL_HOST_PASSWORD=re_YOUR_API_KEY_HERE
106
+ EMAIL_USE_TLS=True
107
+ DEFAULT_FROM_EMAIL=noreply@yourdomain.com
108
+
109
+ # Where lead notifications are sent (required)
110
+ LEAD_NOTIFICATION_EMAIL=leads@yourdomain.com
111
+ ```
112
+
113
+ #### What Gets Sent
114
+
115
+ | Email Type | Trigger | Recipient |
116
+ |------------|---------|-----------|
117
+ | Lead Notification | Form submission | `LEAD_NOTIFICATION_EMAIL` |
118
+ | Form Admin Notification | Dynamic form submission | Per-form configured recipients |
119
+ | Auto-Reply | Form submission (if enabled) | Form submitter |
120
+
121
+ #### Customization
122
+
123
+ Per-site email branding (sender name, from address, reply-to) can be configured in **Wagtail Admin → Settings → Site Settings → Email Notifications**.
124
+
125
+ ## Project Structure
126
+
127
+ ```
128
+ my_client/
129
+ ├── manage.py # Django management command
130
+ ├── pytest.ini # Test configuration
131
+ ├── requirements.txt # Dependencies (includes sum_core)
132
+ ├── .env.example # Environment variable template
133
+
134
+ ├── project_name/ # Your Django project package
135
+ │ ├── __init__.py
136
+ │ ├── urls.py # URL configuration (includes sum_core routes)
137
+ │ ├── wsgi.py # WSGI entry point
138
+ │ │
139
+ │ ├── settings/ # Environment-split settings
140
+ │ │ ├── __init__.py
141
+ │ │ ├── base.py # Shared settings
142
+ │ │ ├── local.py # Local development
143
+ │ │ └── production.py # Production deployment
144
+ │ │
145
+ │ └── home/ # Client-specific home app
146
+ │ ├── __init__.py
147
+ │ ├── apps.py
148
+ │ ├── models.py # HomePage model using sum_core features
149
+ │ └── migrations/
150
+
151
+ ├── templates/
152
+ │ └── overrides/ # Override sum_core templates here
153
+ │ └── .gitkeep
154
+
155
+ ├── static/
156
+ │ └── client/ # Client-specific static files
157
+ │ └── .gitkeep
158
+
159
+ └── tests/
160
+ ├── __init__.py
161
+ └── test_health.py # Integration test for sum_core wiring
162
+ ```
163
+
164
+ ## Template & Static Overrides
165
+
166
+ ### Templates
167
+
168
+ Place template overrides in `templates/overrides/`. To override a sum_core template:
169
+
170
+ ```
171
+ templates/overrides/sum_core/home_page.html
172
+ ```
173
+
174
+ The override path mirrors sum_core's template path.
175
+
176
+ ### Static Files
177
+
178
+ Place client-specific assets in `static/client/`:
179
+
180
+ ```
181
+ static/client/css/custom.css
182
+ static/client/images/logo.png
183
+ ```
184
+
185
+ ## Testing
186
+
187
+ ```bash
188
+ # Run tests:
189
+ pytest
190
+
191
+ # With coverage:
192
+ pytest --cov=.
193
+ ```
194
+
195
+ The boilerplate includes a minimal integration test (`test_health.py`) that verifies sum_core wiring. This test should continue to pass after copying and renaming.
196
+
197
+ ## CI/CD Workflows
198
+
199
+ The boilerplate includes three GitHub Actions workflows:
200
+
201
+ ### CI (`.github/workflows/ci.yml`)
202
+
203
+ Runs on every PR and push to `main`. Executes the test suite to ensure code quality.
204
+
205
+ ### Staging Deploy (`.github/workflows/deploy-staging.yml`)
206
+
207
+ Automatically deploys to staging on every push to `main`. Includes health checks.
208
+
209
+ ### Production Deploy (`.github/workflows/deploy-production.yml`)
210
+
211
+ Deploys on GitHub release publication. Requires manual approval via GitHub environment protection.
212
+
213
+ ### Setup
214
+
215
+ These workflows require GitHub secrets configuration (SSH keys, server details, etc.).
216
+
217
+ ## Production Deployment
218
+
219
+ 1. Set `DJANGO_SETTINGS_MODULE=project_name.settings.production`
220
+ 2. Ensure all required environment variables are set (see `.env.example`)
221
+ 3. Run `python manage.py collectstatic`
222
+ 4. Deploy with gunicorn: `gunicorn project_name.wsgi:application`
223
+
224
+ ## Dependencies
225
+
226
+ This project depends on `sum_core` from the SUM Platform monorepo.
227
+
228
+ ### Default Mode: Git Tag Pinning
229
+
230
+ By default, `requirements.txt` references a specific git tag of `sum_core`:
231
+
232
+ ```
233
+ sum-core @ git+https://github.com/markashton480/sum-core.git@SUM_CORE_GIT_REF#subdirectory=core
234
+ ```
235
+
236
+ **Before deploying**, replace `SUM_CORE_GIT_REF` with the actual version tag (e.g., `v0.1.0`).
237
+
238
+ ### Monorepo Development Mode
239
+
240
+ If you're developing within the SUM Platform monorepo and want to make changes to `sum_core` alongside your client project:
241
+
242
+ 1. Edit `requirements.txt`:
243
+
244
+ ```bash
245
+ # Comment out the git install line
246
+ # sum-core @ git+https://...
247
+
248
+ # Uncomment the editable install
249
+ -e ../../core
250
+ ```
251
+
252
+ 2. Reinstall dependencies:
253
+ ```bash
254
+ pip install -r requirements.txt
255
+ ```
256
+
257
+ Now changes to `/core/sum_core/` will be immediately reflected in your client project.
258
+
259
+ **Important**: Do not commit the editable install to your client project repository. It's for local development only.
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env python
2
+ """
3
+ Django management command entry point.
4
+
5
+ Replace 'project_name' with your actual project name after copying.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import os
11
+ import sys
12
+
13
+ from dotenv import load_dotenv
14
+
15
+ # Load environment variables from .env file before Django initialization
16
+ load_dotenv()
17
+
18
+
19
+ def main() -> None:
20
+ """Run administrative tasks."""
21
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_name.settings.local")
22
+ try:
23
+ from django.core.management import execute_from_command_line
24
+ except ImportError as exc:
25
+ raise ImportError(
26
+ "Couldn't import Django. Are you sure it's installed and "
27
+ "available on your PYTHONPATH environment variable? Did you "
28
+ "forget to activate a virtual environment?"
29
+ ) from exc
30
+ execute_from_command_line(sys.argv)
31
+
32
+
33
+ if __name__ == "__main__":
34
+ main()
@@ -0,0 +1,5 @@
1
+ """
2
+ Root package for this Django project.
3
+
4
+ Replace 'project_name' with your actual project name after copying.
5
+ """
@@ -0,0 +1,5 @@
1
+ """
2
+ Client home app package.
3
+
4
+ Replace 'project_name' with your actual project name after copying.
5
+ """
@@ -0,0 +1,20 @@
1
+ """
2
+ Django AppConfig for the client home app.
3
+
4
+ Replace 'project_name' with your actual project name after copying.
5
+ Both 'name' and 'label' must be updated.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from django.apps import AppConfig
11
+
12
+
13
+ class HomeConfig(AppConfig):
14
+ """Configuration for the client home app."""
15
+
16
+ default_auto_field = "django.db.models.BigAutoField"
17
+ # Update these after renaming project_name:
18
+ name = "project_name.home"
19
+ label = "project_name_home"
20
+ verbose_name = "Home"