django-orbit 0.2.0__tar.gz

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 (40) hide show
  1. django_orbit-0.2.0/CHANGELOG.md +59 -0
  2. django_orbit-0.2.0/CONTRIBUTING.md +205 -0
  3. django_orbit-0.2.0/LICENSE +21 -0
  4. django_orbit-0.2.0/MANIFEST.in +12 -0
  5. django_orbit-0.2.0/PKG-INFO +462 -0
  6. django_orbit-0.2.0/README.md +415 -0
  7. django_orbit-0.2.0/django_orbit.egg-info/PKG-INFO +462 -0
  8. django_orbit-0.2.0/django_orbit.egg-info/SOURCES.txt +38 -0
  9. django_orbit-0.2.0/django_orbit.egg-info/dependency_links.txt +1 -0
  10. django_orbit-0.2.0/django_orbit.egg-info/requires.txt +11 -0
  11. django_orbit-0.2.0/django_orbit.egg-info/top_level.txt +1 -0
  12. django_orbit-0.2.0/orbit/__init__.py +17 -0
  13. django_orbit-0.2.0/orbit/apps.py +44 -0
  14. django_orbit-0.2.0/orbit/conf.py +69 -0
  15. django_orbit-0.2.0/orbit/handlers.py +174 -0
  16. django_orbit-0.2.0/orbit/helpers.py +226 -0
  17. django_orbit-0.2.0/orbit/middleware.py +326 -0
  18. django_orbit-0.2.0/orbit/migrations/0001_initial.py +32 -0
  19. django_orbit-0.2.0/orbit/migrations/0002_alter_orbitentry_type.py +18 -0
  20. django_orbit-0.2.0/orbit/migrations/0003_alter_orbitentry_type.py +34 -0
  21. django_orbit-0.2.0/orbit/migrations/__init__.py +0 -0
  22. django_orbit-0.2.0/orbit/models.py +299 -0
  23. django_orbit-0.2.0/orbit/recorders.py +206 -0
  24. django_orbit-0.2.0/orbit/templates/orbit/base.html +201 -0
  25. django_orbit-0.2.0/orbit/templates/orbit/dashboard.html +387 -0
  26. django_orbit-0.2.0/orbit/templates/orbit/partials/detail.html +239 -0
  27. django_orbit-0.2.0/orbit/templates/orbit/partials/feed.html +236 -0
  28. django_orbit-0.2.0/orbit/templatetags/__init__.py +1 -0
  29. django_orbit-0.2.0/orbit/templatetags/orbit_tags.py +100 -0
  30. django_orbit-0.2.0/orbit/urls.py +29 -0
  31. django_orbit-0.2.0/orbit/utils.py +339 -0
  32. django_orbit-0.2.0/orbit/views.py +225 -0
  33. django_orbit-0.2.0/orbit/watchers.py +556 -0
  34. django_orbit-0.2.0/pyproject.toml +124 -0
  35. django_orbit-0.2.0/setup.cfg +4 -0
  36. django_orbit-0.2.0/setup.py +11 -0
  37. django_orbit-0.2.0/tests/test_core.py +66 -0
  38. django_orbit-0.2.0/tests/test_watchers.py +31 -0
  39. django_orbit-0.2.0/tests/test_watchers_phase1.py +85 -0
  40. django_orbit-0.2.0/tests/test_watchers_phase1_extra.py +85 -0
@@ -0,0 +1,59 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2025-12-16
11
+
12
+ ### Added
13
+ - **New Watchers**:
14
+ - `Commands`: Track management commands execution
15
+ - `Cache`: Monitor cache operations (get, set, delete)
16
+ - `Models`: Track model signals (save, delete) and lifecycle
17
+ - `HTTP Client`: Capture outgoing HTTP requests (httpx, requests)
18
+ - **Helpers**:
19
+ - `dump()`: Helper for manual variable inspection (Laravel Telescope style)
20
+ - `log()`: Helper for direct logging to Orbit
21
+ - **Dashboard**:
22
+ - Complete pagination system (25 entries/page)
23
+ - New entry types support with distinct icons and colors
24
+ - "Dumps" section in sidebar
25
+ - **Configuration**:
26
+ - Added `RECORD_*` settings for new watchers
27
+ - Added `RECORD_DUMPS`
28
+
29
+ ### Fixed
30
+ - Fixed HTMX processing for dynamic content loading
31
+ - Fixed pagination state persistence during auto-refresh
32
+ - Sidebar ordering (alphabetical)
33
+ - "Load More" button issues on long lists
34
+ - Accurate cache hit/miss detection using sentinel object
35
+
36
+ ## [0.1.0] - 2024-12-01
37
+
38
+ ### Added
39
+ - Initial release of Django Orbit
40
+ - `OrbitEntry` model for storing telemetry data
41
+ - `OrbitMiddleware` for capturing HTTP requests/responses
42
+ - SQL query recording with duplicate and slow query detection
43
+ - `OrbitLogHandler` for Python logging integration
44
+ - Exception tracking with full traceback capture
45
+ - Modern dashboard UI with space theme
46
+ - HTMX-powered live feed with 3-second polling
47
+ - Alpine.js reactive slide-over detail panel
48
+ - Entry grouping via `family_hash`
49
+ - Configurable ignore paths
50
+ - Sensitive data sanitization
51
+ - Automatic cleanup of old entries
52
+
53
+ ### Technical
54
+ - Django 4.0+ support
55
+ - Python 3.9+ support
56
+ - Tailwind CSS via CDN (no build step required)
57
+ - HTMX for partial page updates
58
+ - Alpine.js for reactive UI components
59
+ - Lucide icons
@@ -0,0 +1,205 @@
1
+ # Contributing to Django Orbit
2
+
3
+ Thank you for your interest in contributing to Django Orbit! This document provides guidelines and information for contributors.
4
+
5
+ ## Development Setup
6
+
7
+ ### Prerequisites
8
+
9
+ - Python 3.9 or higher
10
+ - Django 4.0 or higher
11
+ - Git
12
+
13
+ ### Setting Up Your Development Environment
14
+
15
+ 1. **Fork and clone the repository**
16
+
17
+ ```bash
18
+ git clone https://github.com/astro-stack/django-orbit.git
19
+ cd django-orbit
20
+ ```
21
+
22
+ 2. **Create a virtual environment**
23
+
24
+ ```bash
25
+ python -m venv venv
26
+ source venv/bin/activate # On Windows: venv\Scripts\activate
27
+ ```
28
+
29
+ 3. **Install development dependencies**
30
+
31
+ ```bash
32
+ pip install -e ".[dev]"
33
+ ```
34
+
35
+ 4. **Run the test suite**
36
+
37
+ ```bash
38
+ pytest
39
+ ```
40
+
41
+ ## Code Style
42
+
43
+ We use several tools to maintain code quality:
44
+
45
+ - **Black** for code formatting
46
+ - **isort** for import sorting
47
+ - **Flake8** for linting
48
+ - **mypy** for type checking
49
+
50
+ Run all formatters and linters:
51
+
52
+ ```bash
53
+ black orbit tests
54
+ isort orbit tests
55
+ flake8 orbit tests
56
+ mypy orbit
57
+ ```
58
+
59
+ ## Making Changes
60
+
61
+ ### Branch Naming
62
+
63
+ Use descriptive branch names:
64
+
65
+ - `feature/add-redis-storage`
66
+ - `fix/sql-recorder-crash`
67
+ - `docs/update-installation-guide`
68
+
69
+ ### Commit Messages
70
+
71
+ Follow the [Conventional Commits](https://www.conventionalcommits.org/) format:
72
+
73
+ ```
74
+ type(scope): description
75
+
76
+ [optional body]
77
+
78
+ [optional footer]
79
+ ```
80
+
81
+ Types:
82
+ - `feat`: New feature
83
+ - `fix`: Bug fix
84
+ - `docs`: Documentation changes
85
+ - `style`: Code style changes (formatting, etc.)
86
+ - `refactor`: Code refactoring
87
+ - `test`: Adding or updating tests
88
+ - `chore`: Maintenance tasks
89
+
90
+ ### Pull Request Process
91
+
92
+ 1. Create a new branch from `main`
93
+ 2. Make your changes
94
+ 3. Add or update tests as needed
95
+ 4. Ensure all tests pass
96
+ 5. Update documentation if necessary
97
+ 6. Open a pull request with a clear description
98
+
99
+ ## Testing
100
+
101
+ ### Running Tests
102
+
103
+ ```bash
104
+ # Run all tests
105
+ pytest
106
+
107
+ # Run with coverage
108
+ pytest --cov=orbit --cov-report=html
109
+
110
+ # Run specific test file
111
+ pytest tests/test_middleware.py
112
+
113
+ # Run with verbose output
114
+ pytest -v
115
+ ```
116
+
117
+ ### Writing Tests
118
+
119
+ - Place tests in the `tests/` directory
120
+ - Use pytest fixtures for common setup
121
+ - Test both success and error cases
122
+ - Mock external dependencies
123
+
124
+ Example test:
125
+
126
+ ```python
127
+ import pytest
128
+ from django.test import RequestFactory
129
+ from orbit.middleware import OrbitMiddleware
130
+ from orbit.models import OrbitEntry
131
+
132
+ @pytest.mark.django_db
133
+ def test_middleware_captures_request():
134
+ factory = RequestFactory()
135
+ request = factory.get('/api/users/')
136
+
137
+ middleware = OrbitMiddleware(lambda r: HttpResponse('OK'))
138
+ response = middleware(request)
139
+
140
+ assert response.status_code == 200
141
+ assert OrbitEntry.objects.filter(type='request').exists()
142
+ ```
143
+
144
+ ## Architecture Overview
145
+
146
+ ### Key Components
147
+
148
+ 1. **Models** (`models.py`)
149
+ - `OrbitEntry`: Central storage for all telemetry data
150
+
151
+ 2. **Middleware** (`middleware.py`)
152
+ - `OrbitMiddleware`: Orchestrates request/response capture
153
+
154
+ 3. **Recorders** (`recorders.py`)
155
+ - SQL query interception using `connection.execute_wrapper`
156
+
157
+ 4. **Handlers** (`handlers.py`)
158
+ - `OrbitLogHandler`: Python logging integration
159
+
160
+ 5. **Views** (`views.py`)
161
+ - Dashboard and HTMX partial views
162
+
163
+ ### Data Flow
164
+
165
+ ```
166
+ Request → OrbitMiddleware → Your App → Response
167
+ ↓ ↓
168
+ SQL Recorder Log Handler
169
+ ↓ ↓
170
+ OrbitEntry ← ← ← ← ←
171
+ ```
172
+
173
+ ## Documentation
174
+
175
+ ### Updating Documentation
176
+
177
+ - Keep the README.md up to date with new features
178
+ - Update the CHANGELOG.md following Keep a Changelog format
179
+ - Add docstrings to all public functions and classes
180
+
181
+ ### Building Documentation
182
+
183
+ Currently, documentation is maintained in Markdown files. A full documentation site may be added in the future.
184
+
185
+ ## Release Process
186
+
187
+ 1. Update version in `pyproject.toml`
188
+ 2. Update `CHANGELOG.md`
189
+ 3. Create a git tag: `git tag v0.1.0`
190
+ 4. Push tags: `git push --tags`
191
+ 5. Build and publish to PyPI
192
+
193
+ ## Getting Help
194
+
195
+ - Open an issue for bugs or feature requests
196
+ - Use discussions for questions and ideas
197
+ - Join our community chat (link TBD)
198
+
199
+ ## Code of Conduct
200
+
201
+ Please be respectful and inclusive in all interactions. We follow the [Contributor Covenant](https://www.contributor-covenant.org/) code of conduct.
202
+
203
+ ## License
204
+
205
+ By contributing to Django Orbit, you agree that your contributions will be licensed under the MIT License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Django Orbit Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,12 @@
1
+ include LICENSE
2
+ include README.md
3
+ include CHANGELOG.md
4
+ include CONTRIBUTING.md
5
+
6
+ recursive-include orbit/templates *
7
+ recursive-include orbit/static *
8
+ recursive-include orbit/migrations *.py
9
+
10
+ global-exclude __pycache__
11
+ global-exclude *.py[cod]
12
+ global-exclude .DS_Store