auditflowlog 0.0.1__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.
@@ -0,0 +1,147 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ cover/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+ db.sqlite3
60
+ db.sqlite3-journal
61
+
62
+ # Flask stuff:
63
+ instance/
64
+ .webassets-cache
65
+
66
+ # Scrapy stuff:
67
+ .scrapy
68
+
69
+ # Sphinx documentation
70
+ docs/_build/
71
+
72
+ # PyBuilder
73
+ .pybuilder/
74
+ target/
75
+
76
+ # Jupyter Notebook
77
+ .ipynb_checkpoints
78
+
79
+ # IPython
80
+ profile_default/
81
+ ipython_config.py
82
+
83
+ # pyenv
84
+ .python-version
85
+
86
+ # pipenv
87
+ Pipfile.lock
88
+
89
+ # poetry
90
+ poetry.lock
91
+
92
+ # pdm
93
+ .pdm.toml
94
+
95
+ # PEP 582
96
+ __pypackages__/
97
+
98
+ # Celery stuff
99
+ celerybeat-schedule
100
+ celerybeat.pid
101
+
102
+ # SageMath parsed files
103
+ *.sage.py
104
+
105
+ # Environments
106
+ .env
107
+ .venv
108
+ env/
109
+ venv/
110
+ ENV/
111
+ env.bak/
112
+ venv.bak/
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+
132
+ # pytype static type analyzer
133
+ .pytype/
134
+
135
+ # Cython debug symbols
136
+ cython_debug/
137
+
138
+ # IDE
139
+ .vscode/
140
+ .idea/
141
+ *.swp
142
+ *.swo
143
+ *~
144
+
145
+ # OS
146
+ .DS_Store
147
+ Thumbs.db
@@ -0,0 +1,324 @@
1
+ # Building and Publishing AuditFlow SDK
2
+
3
+ ## Prerequisites
4
+
5
+ - Python 3.9+
6
+ - pip
7
+ - PyPI account (for publishing)
8
+
9
+ ## Local Development Setup
10
+
11
+ ```bash
12
+ # Clone the repository
13
+ cd auditflowlog-py
14
+
15
+ # Create virtual environment (optional but recommended)
16
+ python -m venv venv
17
+ source venv/bin/activate # On Windows: venv\Scripts\activate
18
+
19
+ # Install dependencies
20
+ python -m pip install -r requirements.txt
21
+
22
+ # Install package in editable mode
23
+ python -m pip install -e .
24
+
25
+ # Run tests
26
+ python tests/test_models.py
27
+ ```
28
+
29
+ ## Building the Package
30
+
31
+ ### 1. Install Build Tools
32
+
33
+ ```bash
34
+ python -m pip install build twine
35
+ ```
36
+
37
+ ### 2. Build Distribution Files
38
+
39
+ ```bash
40
+ python -m build
41
+ ```
42
+
43
+ This creates two files in `dist/`:
44
+ - `auditflowlog-0.0.1-py3-none-any.whl` - Wheel distribution (binary)
45
+ - `auditflowlog-0.0.1.tar.gz` - Source distribution
46
+
47
+ ### 3. Verify the Build
48
+
49
+ ```bash
50
+ # List contents
51
+ ls dist/
52
+
53
+ # Check wheel contents
54
+ unzip -l dist/auditflowlog-0.0.1-py3-none-any.whl
55
+
56
+ # Verify package metadata
57
+ python -m twine check dist/*
58
+ ```
59
+
60
+ ## Testing the Built Package
61
+
62
+ ### Test in a Clean Environment
63
+
64
+ ```bash
65
+ # Create new virtual environment
66
+ python -m venv test_env
67
+ source test_env/bin/activate # On Windows: test_env\Scripts\activate
68
+
69
+ # Install from wheel
70
+ pip install dist/auditflowlog-0.0.1-py3-none-any.whl
71
+
72
+ # Test import
73
+ python -c "from auditflowlog import AuditFlowClient, LogLevel; print('✓ Import successful')"
74
+
75
+ # Run an example
76
+ python examples/direct_client_example.py
77
+
78
+ # Deactivate and clean up
79
+ deactivate
80
+ rm -rf test_env
81
+ ```
82
+
83
+ ## Publishing to PyPI
84
+
85
+ ### 1. Check Package Name Availability
86
+
87
+ Visit https://pypi.org/project/auditflowlog/ to check if the name is available.
88
+
89
+ If taken, update `pyproject.toml`:
90
+ ```toml
91
+ [project]
92
+ name = "auditflowlog-client" # or another unique name
93
+ ```
94
+
95
+ ### 2. Create PyPI Account
96
+
97
+ 1. Go to https://pypi.org/account/register/
98
+ 2. Verify email
99
+ 3. Enable 2FA (recommended)
100
+
101
+ ### 3. Generate API Token
102
+
103
+ 1. Go to https://pypi.org/manage/account/token/
104
+ 2. Create token with scope: "Entire account" (first time) or "Project: auditflowlog" (after first upload)
105
+ 3. Copy the token (starts with `pypi-`)
106
+
107
+ ### 4. Configure Credentials
108
+
109
+ **Option A: Use .pypirc file (recommended)**
110
+
111
+ Create `~/.pypirc`:
112
+ ```ini
113
+ [pypi]
114
+ username = __token__
115
+ password = pypi-AgEIcHlwaS5vcmcC... # Your actual token
116
+ ```
117
+
118
+ **Option B: Use environment variable**
119
+
120
+ ```bash
121
+ export TWINE_USERNAME=__token__
122
+ export TWINE_PASSWORD=pypi-AgEIcHlwaS5vcmcC...
123
+ ```
124
+
125
+ ### 5. Upload to PyPI
126
+
127
+ ```bash
128
+ # Upload to PyPI
129
+ python -m twine upload dist/*
130
+
131
+ # You'll see:
132
+ # Uploading distributions to https://upload.pypi.org/legacy/
133
+ # Uploading auditflowlog-0.0.1-py3-none-any.whl
134
+ # Uploading auditflowlog-0.0.1.tar.gz
135
+ ```
136
+
137
+ ### 6. Verify on PyPI
138
+
139
+ Visit https://pypi.org/project/auditflowlog/ to see your package!
140
+
141
+ ## Publishing to Test PyPI (Recommended First)
142
+
143
+ Test on TestPyPI before publishing to real PyPI:
144
+
145
+ ### 1. Create TestPyPI Account
146
+
147
+ https://test.pypi.org/account/register/
148
+
149
+ ### 2. Generate TestPyPI Token
150
+
151
+ https://test.pypi.org/manage/account/token/
152
+
153
+ ### 3. Upload to TestPyPI
154
+
155
+ ```bash
156
+ python -m twine upload --repository testpypi dist/*
157
+ ```
158
+
159
+ ### 4. Test Installation
160
+
161
+ ```bash
162
+ pip install --index-url https://test.pypi.org/simple/ auditflowlog
163
+ ```
164
+
165
+ ### 5. If Successful, Upload to Real PyPI
166
+
167
+ ```bash
168
+ python -m twine upload dist/*
169
+ ```
170
+
171
+ ## Version Management
172
+
173
+ ### Update Version Number
174
+
175
+ Edit `pyproject.toml`:
176
+ ```toml
177
+ [project]
178
+ version = "0.2.0" # Bump version
179
+ ```
180
+
181
+ Also update:
182
+ - `src/auditflowlog/__init__.py` - `__version__`
183
+ - `CHANGELOG.md` - Add new version entry
184
+
185
+ ### Semantic Versioning
186
+
187
+ Follow semver (https://semver.org/):
188
+
189
+ - **MAJOR** (1.0.0): Breaking changes
190
+ - **MINOR** (0.2.0): New features, backward compatible
191
+ - **PATCH** (0.1.1): Bug fixes, backward compatible
192
+
193
+ Examples:
194
+ - `0.0.1` → `0.1.1`: Bug fix
195
+ - `0.1.1` → `0.2.0`: New feature (streaming support)
196
+ - `0.2.0` → `1.0.0`: Stable release, API guarantee
197
+
198
+ ## Release Checklist
199
+
200
+ Before publishing a new version:
201
+
202
+ - [ ] Update version in `pyproject.toml`
203
+ - [ ] Update `__version__` in `src/auditflowlog/__init__.py`
204
+ - [ ] Update `CHANGELOG.md` with changes
205
+ - [ ] Run all tests: `python tests/test_models.py`
206
+ - [ ] Test all examples work
207
+ - [ ] Update documentation if needed
208
+ - [ ] Clean dist folder: `rm -rf dist/`
209
+ - [ ] Build: `python -m build`
210
+ - [ ] Check build: `python -m twine check dist/*`
211
+ - [ ] Test install in clean environment
212
+ - [ ] Upload to TestPyPI first
213
+ - [ ] Test TestPyPI install works
214
+ - [ ] Upload to PyPI
215
+ - [ ] Create git tag: `git tag v0.0.1`
216
+ - [ ] Push tag: `git push origin v0.0.1`
217
+ - [ ] Create GitHub release with changelog
218
+
219
+ ## CI/CD (Future)
220
+
221
+ ### GitHub Actions Workflow
222
+
223
+ Create `.github/workflows/publish.yml`:
224
+
225
+ ```yaml
226
+ name: Publish to PyPI
227
+
228
+ on:
229
+ release:
230
+ types: [published]
231
+
232
+ jobs:
233
+ build-and-publish:
234
+ runs-on: ubuntu-latest
235
+ steps:
236
+ - uses: actions/checkout@v3
237
+
238
+ - name: Set up Python
239
+ uses: actions/setup-python@v4
240
+ with:
241
+ python-version: '3.11'
242
+
243
+ - name: Install dependencies
244
+ run: |
245
+ pip install build twine
246
+
247
+ - name: Build
248
+ run: python -m build
249
+
250
+ - name: Publish to PyPI
251
+ env:
252
+ TWINE_USERNAME: __token__
253
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
254
+ run: twine upload dist/*
255
+ ```
256
+
257
+ Add `PYPI_API_TOKEN` to GitHub secrets.
258
+
259
+ ## Troubleshooting
260
+
261
+ ### "Package already exists"
262
+
263
+ You've already uploaded this version. Bump version number and rebuild.
264
+
265
+ ### "Invalid authentication"
266
+
267
+ Check your API token is correct and properly formatted in `.pypirc`.
268
+
269
+ ### "Filename already used"
270
+
271
+ PyPI doesn't allow re-uploading same filename. Bump version and rebuild.
272
+
273
+ ### Import errors after install
274
+
275
+ Make sure `pyproject.toml` has correct package path:
276
+ ```toml
277
+ [tool.hatchling.build.targets.wheel]
278
+ packages = ["src/auditflowlog"]
279
+ ```
280
+
281
+ ## Distribution Channels
282
+
283
+ Once published to PyPI, users can install via:
284
+
285
+ ```bash
286
+ # Standard install
287
+ pip install auditflowlog
288
+
289
+ # With extras
290
+ pip install auditflowlog[loguru]
291
+ pip install auditflowlog[streaming]
292
+ pip install auditflowlog[all]
293
+
294
+ # Specific version
295
+ pip install auditflowlog==0.0.1
296
+
297
+ # Upgrade
298
+ pip install --upgrade auditflowlog
299
+ ```
300
+
301
+ ## Post-Publication
302
+
303
+ After publishing:
304
+
305
+ 1. **Announce** on social media, forums, community
306
+ 2. **Monitor** GitHub issues for bug reports
307
+ 3. **Update** documentation if users find gaps
308
+ 4. **Plan** next version based on feedback
309
+ 5. **Maintain** changelog for transparency
310
+
311
+ ## Support After Release
312
+
313
+ - Respond to GitHub issues promptly
314
+ - Fix critical bugs quickly (patch release)
315
+ - Consider user feature requests for minor releases
316
+ - Maintain backward compatibility until 1.0.0
317
+ - Document breaking changes clearly in CHANGELOG
318
+
319
+ ## Resources
320
+
321
+ - [Python Packaging Guide](https://packaging.python.org/)
322
+ - [PyPI Help](https://pypi.org/help/)
323
+ - [Semantic Versioning](https://semver.org/)
324
+ - [Keep a Changelog](https://keepachangelog.com/)
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ All notable changes to the AuditFlow Python SDK 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
+ ## [0.0.1] - 2026-07-18
9
+
10
+ ### Added
11
+
12
+ #### Core Client
13
+ - `AuditFlowClient` - Synchronous HTTP client for log ingestion
14
+ - `AsyncAuditFlowClient` - Asynchronous HTTP client for log ingestion
15
+ - Context manager support for both sync and async clients
16
+ - Batch log sending capability
17
+ - Proper error handling with custom exceptions
18
+
19
+ #### Logging Framework Integrations
20
+ - `AuditFlowSink` - Loguru sink for automatic log forwarding
21
+ - `StdlibHandler` - Standard library logging handler
22
+ - Automatic metadata extraction from log records
23
+ - Exception tracking in metadata
24
+
25
+ #### Real-time Streaming
26
+ - `LogStream` - Async WebSocket client for real-time log streaming
27
+ - `SyncLogStream` - Synchronous wrapper for blocking usage
28
+ - Flexible filtering by bucket, level, time range, and metadata
29
+ - Auto-reconnect on connection loss
30
+ - Both callback-based and async iterator APIs
31
+
32
+ #### Models and Types
33
+ - `LogLevel` enum (DEBUG, INFO, WARNING, ERROR, CRITICAL)
34
+ - `LogEntry` dataclass for structured log representation
35
+ - `LogFilter` dataclass for query/stream filtering
36
+ - Full type hints throughout the codebase
37
+
38
+ #### Exceptions
39
+ - `AuditFlowError` - Base exception class
40
+ - `AuthenticationError` - Invalid API key
41
+ - `RateLimitError` - Rate limit exceeded
42
+ - `ConnectionError` - WebSocket connection failed
43
+ - `StreamError` - Streaming error
44
+
45
+ #### Documentation
46
+ - Comprehensive README with examples
47
+ - Getting Started guide
48
+ - Architecture documentation
49
+ - 5 complete working examples:
50
+ - Loguru integration
51
+ - Standard library logging
52
+ - Direct client usage
53
+ - Async client usage
54
+ - Real-time streaming
55
+
56
+ #### Package Configuration
57
+ - Optional dependencies for loguru and websockets
58
+ - Proper package metadata and classifiers
59
+ - MIT license
60
+
61
+ ### Dependencies
62
+ - httpx >= 0.27.2 (required)
63
+ - loguru >= 0.7.0 (optional, for loguru integration)
64
+ - websockets >= 12.0 (optional, for streaming)
65
+
66
+ ## [Unreleased]
67
+
68
+ ### Planned Features
69
+ - Buffered sending with automatic batch flushing
70
+ - Circuit breaker pattern for backend failures
71
+ - Local file fallback when backend is unavailable
72
+ - Log compression for large batches
73
+ - Built-in metrics and telemetry
74
+ - Sampling support for high-volume scenarios
75
+ - structlog integration
76
+ - Django/Flask/FastAPI middleware integrations