genai-otel-instrument 0.1.1.dev0__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.
Potentially problematic release.
This version of genai-otel-instrument might be problematic. Click here for more details.
- genai_otel_instrument-0.1.1.dev0/.claude/settings.local.json +10 -0
- genai_otel_instrument-0.1.1.dev0/.github/workflows/README.md +203 -0
- genai_otel_instrument-0.1.1.dev0/.github/workflows/pre-release-check.yml +128 -0
- genai_otel_instrument-0.1.1.dev0/.github/workflows/publish.yml +77 -0
- genai_otel_instrument-0.1.1.dev0/.github/workflows/test.yml +135 -0
- genai_otel_instrument-0.1.1.dev0/.gitignore +365 -0
- genai_otel_instrument-0.1.1.dev0/.idea/.gitignore +3 -0
- genai_otel_instrument-0.1.1.dev0/.idea/genai_otel_instrument.iml +8 -0
- genai_otel_instrument-0.1.1.dev0/.idea/inspectionProfiles/Project_Default.xml +61 -0
- genai_otel_instrument-0.1.1.dev0/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- genai_otel_instrument-0.1.1.dev0/.idea/misc.xml +4 -0
- genai_otel_instrument-0.1.1.dev0/.idea/modules.xml +8 -0
- genai_otel_instrument-0.1.1.dev0/.idea/vcs.xml +6 -0
- genai_otel_instrument-0.1.1.dev0/.pylintrc +44 -0
- genai_otel_instrument-0.1.1.dev0/CHANGELOG.md +255 -0
- genai_otel_instrument-0.1.1.dev0/Contributing.md +195 -0
- genai_otel_instrument-0.1.1.dev0/LICENSE +201 -0
- genai_otel_instrument-0.1.1.dev0/MANIFEST.in +11 -0
- genai_otel_instrument-0.1.1.dev0/OTEL_SEMANTIC_COMPATIBILITY.md +213 -0
- genai_otel_instrument-0.1.1.dev0/OTEL_SEMANTIC_GAP_ANALYSIS_AND_IMPLEMENTATION_PLAN.md +1499 -0
- genai_otel_instrument-0.1.1.dev0/PKG-INFO +463 -0
- genai_otel_instrument-0.1.1.dev0/PRE_RELEASE_CHECKLIST.md +157 -0
- genai_otel_instrument-0.1.1.dev0/README.md +283 -0
- genai_otel_instrument-0.1.1.dev0/TEST_COVERAGE_CHECKLIST.md +89 -0
- genai_otel_instrument-0.1.1.dev0/TROUBLESHOOTING.md +365 -0
- genai_otel_instrument-0.1.1.dev0/baseline_tests.txt +64 -0
- genai_otel_instrument-0.1.1.dev0/combine_code.sh +16 -0
- genai_otel_instrument-0.1.1.dev0/combined_code_all.txt +0 -0
- genai_otel_instrument-0.1.1.dev0/example_usage.py +218 -0
- genai_otel_instrument-0.1.1.dev0/examples/README.md +234 -0
- genai_otel_instrument-0.1.1.dev0/examples/anthropic/.env.example +15 -0
- genai_otel_instrument-0.1.1.dev0/examples/anthropic/README.md +41 -0
- genai_otel_instrument-0.1.1.dev0/examples/anthropic/example.py +27 -0
- genai_otel_instrument-0.1.1.dev0/examples/aws_bedrock/.env.example +17 -0
- genai_otel_instrument-0.1.1.dev0/examples/aws_bedrock/README.md +41 -0
- genai_otel_instrument-0.1.1.dev0/examples/aws_bedrock/example.py +37 -0
- genai_otel_instrument-0.1.1.dev0/examples/azure_openai/.env.example +16 -0
- genai_otel_instrument-0.1.1.dev0/examples/azure_openai/README.md +41 -0
- genai_otel_instrument-0.1.1.dev0/examples/azure_openai/example.py +29 -0
- genai_otel_instrument-0.1.1.dev0/examples/cohere/.env.example +6 -0
- genai_otel_instrument-0.1.1.dev0/examples/cohere/README.md +13 -0
- genai_otel_instrument-0.1.1.dev0/examples/cohere/example.py +19 -0
- genai_otel_instrument-0.1.1.dev0/examples/demo/.env.example +5 -0
- genai_otel_instrument-0.1.1.dev0/examples/demo/Dockerfile +15 -0
- genai_otel_instrument-0.1.1.dev0/examples/demo/README.md +148 -0
- genai_otel_instrument-0.1.1.dev0/examples/demo/app.py +101 -0
- genai_otel_instrument-0.1.1.dev0/examples/demo/docker-compose.yml +39 -0
- genai_otel_instrument-0.1.1.dev0/examples/demo/requirements.txt +5 -0
- genai_otel_instrument-0.1.1.dev0/examples/google_ai/.env.example +15 -0
- genai_otel_instrument-0.1.1.dev0/examples/google_ai/README.md +41 -0
- genai_otel_instrument-0.1.1.dev0/examples/google_ai/example.py +25 -0
- genai_otel_instrument-0.1.1.dev0/examples/groq/.env.example +5 -0
- genai_otel_instrument-0.1.1.dev0/examples/groq/README.md +7 -0
- genai_otel_instrument-0.1.1.dev0/examples/groq/example.py +15 -0
- genai_otel_instrument-0.1.1.dev0/examples/huggingface/.env.example +3 -0
- genai_otel_instrument-0.1.1.dev0/examples/huggingface/README.md +6 -0
- genai_otel_instrument-0.1.1.dev0/examples/huggingface/example.py +10 -0
- genai_otel_instrument-0.1.1.dev0/examples/langchain/.env.example +15 -0
- genai_otel_instrument-0.1.1.dev0/examples/langchain/README.md +41 -0
- genai_otel_instrument-0.1.1.dev0/examples/langchain/example.py +30 -0
- genai_otel_instrument-0.1.1.dev0/examples/litellm/example.py +21 -0
- genai_otel_instrument-0.1.1.dev0/examples/llamaindex/.env.example +4 -0
- genai_otel_instrument-0.1.1.dev0/examples/llamaindex/README.md +7 -0
- genai_otel_instrument-0.1.1.dev0/examples/llamaindex/example.py +15 -0
- genai_otel_instrument-0.1.1.dev0/examples/mistralai/.env.example +4 -0
- genai_otel_instrument-0.1.1.dev0/examples/mistralai/README.md +6 -0
- genai_otel_instrument-0.1.1.dev0/examples/mistralai/example.py +15 -0
- genai_otel_instrument-0.1.1.dev0/examples/ollama/.env.example +3 -0
- genai_otel_instrument-0.1.1.dev0/examples/ollama/README.md +6 -0
- genai_otel_instrument-0.1.1.dev0/examples/ollama/example.py +9 -0
- genai_otel_instrument-0.1.1.dev0/examples/openai/.env.example +20 -0
- genai_otel_instrument-0.1.1.dev0/examples/openai/README.md +41 -0
- genai_otel_instrument-0.1.1.dev0/examples/openai/example.py +29 -0
- genai_otel_instrument-0.1.1.dev0/examples/replicate/.env.example +3 -0
- genai_otel_instrument-0.1.1.dev0/examples/replicate/README.md +6 -0
- genai_otel_instrument-0.1.1.dev0/examples/replicate/example.py +11 -0
- genai_otel_instrument-0.1.1.dev0/examples/smolagents/example.py +17 -0
- genai_otel_instrument-0.1.1.dev0/examples/togetherai/.env.example +3 -0
- genai_otel_instrument-0.1.1.dev0/examples/togetherai/README.md +6 -0
- genai_otel_instrument-0.1.1.dev0/examples/togetherai/example.py +14 -0
- genai_otel_instrument-0.1.1.dev0/examples/vertexai/.env.example +3 -0
- genai_otel_instrument-0.1.1.dev0/examples/vertexai/README.md +6 -0
- genai_otel_instrument-0.1.1.dev0/examples/vertexai/example.py +9 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/__init__.py +129 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/__version__.py +34 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/auto_instrument.py +413 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/cli.py +92 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/config.py +187 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/cost_calculator.py +276 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/exceptions.py +17 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/gpu_metrics.py +240 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/__init__.py +47 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/anthropic_instrumentor.py +134 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/anyscale_instrumentor.py +27 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/aws_bedrock_instrumentor.py +94 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/azure_openai_instrumentor.py +69 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/base.py +528 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/cohere_instrumentor.py +76 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/google_ai_instrumentor.py +87 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/groq_instrumentor.py +106 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/huggingface_instrumentor.py +97 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/langchain_instrumentor.py +75 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/llamaindex_instrumentor.py +36 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/mistralai_instrumentor.py +119 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/ollama_instrumentor.py +83 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/openai_instrumentor.py +241 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/replicate_instrumentor.py +42 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/togetherai_instrumentor.py +42 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/instrumentors/vertexai_instrumentor.py +42 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/llm_pricing.json +589 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/logging_config.py +45 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/mcp_instrumentors/__init__.py +14 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/mcp_instrumentors/api_instrumentor.py +144 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/mcp_instrumentors/base.py +105 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/mcp_instrumentors/database_instrumentor.py +336 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/mcp_instrumentors/kafka_instrumentor.py +31 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/mcp_instrumentors/manager.py +139 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/mcp_instrumentors/redis_instrumentor.py +31 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/mcp_instrumentors/vector_db_instrumentor.py +265 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/metrics.py +148 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel/py.typed +2 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel_instrument.egg-info/PKG-INFO +463 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel_instrument.egg-info/SOURCES.txt +184 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel_instrument.egg-info/dependency_links.txt +1 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel_instrument.egg-info/entry_points.txt +2 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel_instrument.egg-info/requires.txt +176 -0
- genai_otel_instrument-0.1.1.dev0/genai_otel_instrument.egg-info/top_level.txt +1 -0
- genai_otel_instrument-0.1.1.dev0/merge_project.sh +101 -0
- genai_otel_instrument-0.1.1.dev0/openlit/semcov.py +30 -0
- genai_otel_instrument-0.1.1.dev0/phase1_partial_tests.txt +66 -0
- genai_otel_instrument-0.1.1.dev0/pyproject.toml +259 -0
- genai_otel_instrument-0.1.1.dev0/requirements-dev.txt +41 -0
- genai_otel_instrument-0.1.1.dev0/requirements-testing.txt +50 -0
- genai_otel_instrument-0.1.1.dev0/requirements.txt +70 -0
- genai_otel_instrument-0.1.1.dev0/sample.env +116 -0
- genai_otel_instrument-0.1.1.dev0/scripts/fix_all_deps.sh +61 -0
- genai_otel_instrument-0.1.1.dev0/scripts/fix_instrumentors.py +176 -0
- genai_otel_instrument-0.1.1.dev0/scripts/test_installation.py +158 -0
- genai_otel_instrument-0.1.1.dev0/scripts/test_release.sh +206 -0
- genai_otel_instrument-0.1.1.dev0/setup.cfg +4 -0
- genai_otel_instrument-0.1.1.dev0/setup.py +12 -0
- genai_otel_instrument-0.1.1.dev0/simple_test.py +157 -0
- genai_otel_instrument-0.1.1.dev0/test_example_debug.py +56 -0
- genai_otel_instrument-0.1.1.dev0/test_exporter_fix.py +41 -0
- genai_otel_instrument-0.1.1.dev0/test_final.py +41 -0
- genai_otel_instrument-0.1.1.dev0/test_gpu_debug.py +22 -0
- genai_otel_instrument-0.1.1.dev0/test_gpu_metrics.py +13 -0
- genai_otel_instrument-0.1.1.dev0/tests/__init__.py +0 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_anthropic_instrumentor.py +287 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_anyscale_instrumentor.py +43 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_aws_bedrock_instrumentor.py +375 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_azure_openai_instrumentor.py +254 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_base.py +689 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_cohere_instrumentor.py +181 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_google_ai_instrumentor.py +223 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_groq_instrumentor.py +235 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_huggingface_instrumentor.py +220 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_langchain_instrumentor.py +266 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_litellm_instrumentor.py +51 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_llamaindex_instrumentor.py +160 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_mcp_instrumentor.py +59 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_mistralai_instrumentor.py +96 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_ollama_instrumentor.py +188 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_openai_instrumentor.py +497 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_replicate_instrumentor.py +165 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_smolagents_instrumentor.py +61 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_togetherai_instrumentor.py +171 -0
- genai_otel_instrument-0.1.1.dev0/tests/instrumentors/test_vertexai_instrumentor.py +182 -0
- genai_otel_instrument-0.1.1.dev0/tests/mcp_instrumentors/test_api_instrumentor.py +236 -0
- genai_otel_instrument-0.1.1.dev0/tests/mcp_instrumentors/test_database_instrumentor.py +431 -0
- genai_otel_instrument-0.1.1.dev0/tests/mcp_instrumentors/test_kafka_instrumentor.py +75 -0
- genai_otel_instrument-0.1.1.dev0/tests/mcp_instrumentors/test_manager.py +501 -0
- genai_otel_instrument-0.1.1.dev0/tests/mcp_instrumentors/test_mcp_base.py +142 -0
- genai_otel_instrument-0.1.1.dev0/tests/mcp_instrumentors/test_redis_instrumentor.py +106 -0
- genai_otel_instrument-0.1.1.dev0/tests/mcp_instrumentors/test_vector_db_instrumentor.py +507 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_auto_instrument.py +906 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_cli.py +207 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_config.py +88 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_cost_calculator.py +252 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_exceptions.py +50 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_gpu_metrics.py +420 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_init.py +214 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_logging_config.py +331 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_metrics.py +100 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_openai_instrumentor.py +93 -0
- genai_otel_instrument-0.1.1.dev0/tests/test_otel_setup.py +0 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# CI/CD Workflows
|
|
2
|
+
|
|
3
|
+
This directory contains GitHub Actions workflows for automated testing, validation, and publishing.
|
|
4
|
+
|
|
5
|
+
## Workflows
|
|
6
|
+
|
|
7
|
+
### 1. `test.yml` - Continuous Integration Tests
|
|
8
|
+
|
|
9
|
+
**Triggers:**
|
|
10
|
+
- Push to `main` or `develop` branches
|
|
11
|
+
- Pull requests to `main` or `develop` branches
|
|
12
|
+
|
|
13
|
+
**Jobs:**
|
|
14
|
+
|
|
15
|
+
#### `test` job
|
|
16
|
+
- **Matrix:** Runs on Ubuntu, macOS, and Windows with Python 3.8-3.12
|
|
17
|
+
- **Steps:**
|
|
18
|
+
1. Lint with pylint
|
|
19
|
+
2. Check formatting with black
|
|
20
|
+
3. Check import sorting with isort
|
|
21
|
+
4. Type check with mypy
|
|
22
|
+
5. Run pytest with coverage
|
|
23
|
+
6. Upload coverage to Codecov
|
|
24
|
+
|
|
25
|
+
#### `build-and-install-test` job
|
|
26
|
+
- **Matrix:** Runs on Ubuntu and Windows with Python 3.9 and 3.12
|
|
27
|
+
- **Purpose:** Validates that the package can be built and installed correctly
|
|
28
|
+
- **Steps:**
|
|
29
|
+
1. Build the package using `python -m build`
|
|
30
|
+
2. Check package with `twine check`
|
|
31
|
+
3. Install in isolated virtual environment
|
|
32
|
+
4. Test core imports
|
|
33
|
+
5. Verify CLI tool works (`genai-instrument --help`)
|
|
34
|
+
|
|
35
|
+
#### `security` job
|
|
36
|
+
- **Platform:** Ubuntu with Python 3.11
|
|
37
|
+
- **Steps:**
|
|
38
|
+
1. Run safety check for dependency vulnerabilities
|
|
39
|
+
2. Run bandit security scan
|
|
40
|
+
|
|
41
|
+
### 2. `publish.yml` - PyPI Publication
|
|
42
|
+
|
|
43
|
+
**Triggers:**
|
|
44
|
+
- Release published on GitHub
|
|
45
|
+
- Manual workflow dispatch (for testing)
|
|
46
|
+
|
|
47
|
+
**Steps:**
|
|
48
|
+
1. **Test Suite:** Runs full pytest suite to ensure all tests pass
|
|
49
|
+
2. **Code Quality:** Validates formatting and import sorting
|
|
50
|
+
3. **Build:** Creates wheel and sdist packages
|
|
51
|
+
4. **Validation:** Checks package with twine
|
|
52
|
+
5. **Installation Test:** Tests package installation in clean environment
|
|
53
|
+
6. **Publish to Test PyPI:** Uploads to Test PyPI (if release event)
|
|
54
|
+
7. **Publish to PyPI:** Uploads to production PyPI (if release event)
|
|
55
|
+
|
|
56
|
+
**Required Secrets:**
|
|
57
|
+
- `TEST_PYPI_API_TOKEN`: API token for Test PyPI
|
|
58
|
+
- `PYPI_API_TOKEN`: API token for production PyPI
|
|
59
|
+
|
|
60
|
+
### 3. `pre-release-check.yml` - Pre-Release Validation
|
|
61
|
+
|
|
62
|
+
**Triggers:**
|
|
63
|
+
- Manual workflow dispatch
|
|
64
|
+
- Push of version tags (`v*`)
|
|
65
|
+
|
|
66
|
+
**Purpose:** Comprehensive validation before creating a release (mimics `scripts/test_release.sh`)
|
|
67
|
+
|
|
68
|
+
**Matrix:** Runs on Ubuntu, Windows, and macOS with Python 3.9 and 3.12
|
|
69
|
+
|
|
70
|
+
**Steps:**
|
|
71
|
+
1. Display environment information
|
|
72
|
+
2. Install development dependencies
|
|
73
|
+
3. Auto-format code (isort + black)
|
|
74
|
+
4. Run full test suite with coverage
|
|
75
|
+
5. Perform code quality checks
|
|
76
|
+
6. Build package
|
|
77
|
+
7. Validate package with twine
|
|
78
|
+
8. Test installation in isolated environment
|
|
79
|
+
9. Verify CLI functionality
|
|
80
|
+
10. Upload build artifacts (Ubuntu + Python 3.12 only)
|
|
81
|
+
|
|
82
|
+
**Use this workflow:**
|
|
83
|
+
- Before creating a new release
|
|
84
|
+
- To validate your changes work across all platforms
|
|
85
|
+
- As a final check that everything is ready for publication
|
|
86
|
+
|
|
87
|
+
## Usage Examples
|
|
88
|
+
|
|
89
|
+
### Running Pre-Release Validation Manually
|
|
90
|
+
|
|
91
|
+
1. Go to "Actions" tab in GitHub
|
|
92
|
+
2. Select "Pre-Release Validation" workflow
|
|
93
|
+
3. Click "Run workflow"
|
|
94
|
+
4. Select branch and click "Run workflow"
|
|
95
|
+
|
|
96
|
+
This will run all validation checks across all platforms.
|
|
97
|
+
|
|
98
|
+
### Creating a Release
|
|
99
|
+
|
|
100
|
+
1. **Run Pre-Release Validation:**
|
|
101
|
+
```bash
|
|
102
|
+
# Locally, you can use:
|
|
103
|
+
./scripts/test_release.sh
|
|
104
|
+
|
|
105
|
+
# Or trigger the GitHub Action manually
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
2. **Ensure all checks pass**
|
|
109
|
+
|
|
110
|
+
3. **Create and push a version tag:**
|
|
111
|
+
```bash
|
|
112
|
+
git tag v0.2.0
|
|
113
|
+
git push origin v0.2.0
|
|
114
|
+
```
|
|
115
|
+
This triggers the pre-release-check workflow.
|
|
116
|
+
|
|
117
|
+
4. **Create GitHub Release:**
|
|
118
|
+
- Go to "Releases" → "Draft a new release"
|
|
119
|
+
- Select the tag you created
|
|
120
|
+
- Fill in release notes
|
|
121
|
+
- Click "Publish release"
|
|
122
|
+
|
|
123
|
+
This triggers the publish workflow which will:
|
|
124
|
+
- Run tests
|
|
125
|
+
- Build package
|
|
126
|
+
- Publish to Test PyPI
|
|
127
|
+
- Publish to PyPI
|
|
128
|
+
|
|
129
|
+
### Manual Testing Before Release
|
|
130
|
+
|
|
131
|
+
Use the local script for faster iteration:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# From project root
|
|
135
|
+
./scripts/test_release.sh
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
This script provides colored output and validates:
|
|
139
|
+
- Project structure
|
|
140
|
+
- Python environment
|
|
141
|
+
- Code formatting (auto-applies)
|
|
142
|
+
- Full test suite
|
|
143
|
+
- Package build
|
|
144
|
+
- Package validation
|
|
145
|
+
- Installation in isolated environment
|
|
146
|
+
- CLI functionality
|
|
147
|
+
|
|
148
|
+
## Workflow Dependencies
|
|
149
|
+
|
|
150
|
+
All workflows require these tools (automatically installed):
|
|
151
|
+
- `pytest` - Testing framework
|
|
152
|
+
- `pytest-cov` - Coverage plugin
|
|
153
|
+
- `black` - Code formatter
|
|
154
|
+
- `isort` - Import sorter
|
|
155
|
+
- `pylint` - Linter
|
|
156
|
+
- `mypy` - Type checker
|
|
157
|
+
- `build` - Package builder
|
|
158
|
+
- `twine` - Package uploader
|
|
159
|
+
|
|
160
|
+
## Best Practices
|
|
161
|
+
|
|
162
|
+
1. **Before committing:**
|
|
163
|
+
- Run `black genai_otel tests`
|
|
164
|
+
- Run `isort genai_otel tests`
|
|
165
|
+
- Run `pytest tests/`
|
|
166
|
+
|
|
167
|
+
2. **Before creating a PR:**
|
|
168
|
+
- Ensure all CI checks pass
|
|
169
|
+
- Review coverage report
|
|
170
|
+
|
|
171
|
+
3. **Before releasing:**
|
|
172
|
+
- Run `./scripts/test_release.sh` locally
|
|
173
|
+
- Trigger "Pre-Release Validation" workflow
|
|
174
|
+
- Verify all platforms pass
|
|
175
|
+
- Update CHANGELOG.md
|
|
176
|
+
- Update version in `genai_otel/__version__.py`
|
|
177
|
+
|
|
178
|
+
4. **After releasing:**
|
|
179
|
+
- Test installation from PyPI: `pip install genai-otel-instrument`
|
|
180
|
+
- Verify functionality with example code
|
|
181
|
+
- Monitor for any user-reported issues
|
|
182
|
+
|
|
183
|
+
## Troubleshooting
|
|
184
|
+
|
|
185
|
+
### Tests fail only on specific OS
|
|
186
|
+
- Check for platform-specific path handling
|
|
187
|
+
- Review file permission issues (especially on Windows)
|
|
188
|
+
- Check line ending differences (CRLF vs LF)
|
|
189
|
+
|
|
190
|
+
### Package build fails
|
|
191
|
+
- Ensure `pyproject.toml` is valid
|
|
192
|
+
- Check MANIFEST.in includes all necessary files
|
|
193
|
+
- Verify dependencies are correctly specified
|
|
194
|
+
|
|
195
|
+
### Installation test fails
|
|
196
|
+
- Check entry points in `pyproject.toml`
|
|
197
|
+
- Verify all required files are included in the package
|
|
198
|
+
- Test locally with: `pip install dist/*.whl`
|
|
199
|
+
|
|
200
|
+
### CLI tool not found after installation
|
|
201
|
+
- Verify `[project.scripts]` section in `pyproject.toml`
|
|
202
|
+
- Check that console_scripts entry point is correct
|
|
203
|
+
- Test with: `python -m genai_otel.cli`
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
name: Pre-Release Validation
|
|
2
|
+
|
|
3
|
+
# This workflow mimics the manual test_release.sh script
|
|
4
|
+
# Run it before creating a release to validate everything works
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch: # Manual trigger only
|
|
8
|
+
push:
|
|
9
|
+
tags:
|
|
10
|
+
- 'v*' # Trigger on version tags
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
pre-release-validation:
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
19
|
+
python-version: ["3.9", "3.12"]
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Display environment info
|
|
30
|
+
run: |
|
|
31
|
+
echo "=========================================="
|
|
32
|
+
echo "Pre-Release Validation"
|
|
33
|
+
echo "=========================================="
|
|
34
|
+
python --version
|
|
35
|
+
python -c "import sys; print(f'Python path: {sys.executable}')"
|
|
36
|
+
|
|
37
|
+
- name: Install development dependencies
|
|
38
|
+
run: |
|
|
39
|
+
python -m pip install --upgrade pip
|
|
40
|
+
pip install -e ".[dev]"
|
|
41
|
+
|
|
42
|
+
- name: Auto-format code
|
|
43
|
+
run: |
|
|
44
|
+
echo "→ Auto-formatting code with isort and black..."
|
|
45
|
+
isort genai_otel tests
|
|
46
|
+
black genai_otel tests
|
|
47
|
+
echo "✓ Code formatting applied"
|
|
48
|
+
|
|
49
|
+
- name: Run full test suite
|
|
50
|
+
run: |
|
|
51
|
+
echo "→ Running tests..."
|
|
52
|
+
pytest tests/ -v --cov=genai_otel --cov-report=term --cov-report=html --cov-report=term-missing
|
|
53
|
+
echo "✓ All tests passed"
|
|
54
|
+
|
|
55
|
+
- name: Code quality checks
|
|
56
|
+
run: |
|
|
57
|
+
echo "→ Running code quality checks..."
|
|
58
|
+
black --check genai_otel tests --exclude='__version__\.py'
|
|
59
|
+
isort --check-only --skip-glob='*/__version__.py' genai_otel tests
|
|
60
|
+
pylint genai_otel --rcfile=.pylintrc --exit-zero || true
|
|
61
|
+
echo "✓ Code quality checks complete"
|
|
62
|
+
|
|
63
|
+
- name: Build package
|
|
64
|
+
run: |
|
|
65
|
+
echo "→ Building package..."
|
|
66
|
+
pip install build twine
|
|
67
|
+
python -m build
|
|
68
|
+
echo "✓ Package built successfully"
|
|
69
|
+
|
|
70
|
+
- name: Check package with twine
|
|
71
|
+
run: |
|
|
72
|
+
echo "→ Checking package with twine..."
|
|
73
|
+
twine check dist/*
|
|
74
|
+
echo "✓ Package check passed"
|
|
75
|
+
|
|
76
|
+
- name: Test installation in isolated environment
|
|
77
|
+
shell: bash
|
|
78
|
+
run: |
|
|
79
|
+
echo "→ Testing installation in temporary environment..."
|
|
80
|
+
|
|
81
|
+
# Create temporary virtual environment
|
|
82
|
+
python -m venv test_release_env
|
|
83
|
+
|
|
84
|
+
# Activate based on OS
|
|
85
|
+
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
|
86
|
+
source test_release_env/Scripts/activate
|
|
87
|
+
else
|
|
88
|
+
source test_release_env/bin/activate
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Install the built wheel
|
|
92
|
+
pip install dist/*.whl
|
|
93
|
+
|
|
94
|
+
# Test imports
|
|
95
|
+
python -c 'import genai_otel; print(f"Successfully imported genai_otel version: {genai_otel.__version__}")'
|
|
96
|
+
python -c 'from genai_otel.config import OTelConfig; from genai_otel.cost_calculator import CostCalculator; from genai_otel.auto_instrument import setup_auto_instrumentation; print("All core components imported successfully")'
|
|
97
|
+
|
|
98
|
+
# Test CLI tool
|
|
99
|
+
genai-instrument --help > /dev/null 2>&1
|
|
100
|
+
echo "✓ CLI tool works"
|
|
101
|
+
|
|
102
|
+
# Cleanup
|
|
103
|
+
deactivate
|
|
104
|
+
|
|
105
|
+
- name: Upload build artifacts
|
|
106
|
+
uses: actions/upload-artifact@v4
|
|
107
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
108
|
+
with:
|
|
109
|
+
name: dist-packages
|
|
110
|
+
path: dist/
|
|
111
|
+
|
|
112
|
+
- name: Summary
|
|
113
|
+
if: success()
|
|
114
|
+
run: |
|
|
115
|
+
echo ""
|
|
116
|
+
echo "=========================================="
|
|
117
|
+
echo "✓ All Pre-Release Checks Passed!"
|
|
118
|
+
echo "=========================================="
|
|
119
|
+
echo ""
|
|
120
|
+
echo "Release Checklist:"
|
|
121
|
+
echo "✅ All tests passing"
|
|
122
|
+
echo "✅ Code formatting applied"
|
|
123
|
+
echo "✅ Import sorting applied"
|
|
124
|
+
echo "✅ Package builds successfully"
|
|
125
|
+
echo "✅ Installation tested"
|
|
126
|
+
echo "✅ CLI tool works"
|
|
127
|
+
echo ""
|
|
128
|
+
echo "Ready for release! 🚀"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch: # Allow manual triggering for testing
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.11"
|
|
19
|
+
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: |
|
|
22
|
+
python -m pip install --upgrade pip
|
|
23
|
+
pip install build twine
|
|
24
|
+
|
|
25
|
+
# Run full test suite before publishing
|
|
26
|
+
- name: Install dev dependencies and run tests
|
|
27
|
+
run: |
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
pytest tests/ -v --cov=genai_otel --cov-report=term
|
|
30
|
+
echo "✓ All tests passed"
|
|
31
|
+
|
|
32
|
+
# Code quality checks
|
|
33
|
+
- name: Format and lint checks
|
|
34
|
+
run: |
|
|
35
|
+
black --check genai_otel tests --exclude='__version__\.py'
|
|
36
|
+
isort --check-only --skip-glob='*/__version__.py' genai_otel tests
|
|
37
|
+
echo "✓ Code quality checks passed"
|
|
38
|
+
|
|
39
|
+
- name: Build package
|
|
40
|
+
run: python -m build
|
|
41
|
+
|
|
42
|
+
- name: Check package with twine
|
|
43
|
+
run: twine check dist/*
|
|
44
|
+
|
|
45
|
+
# Test installation before publishing
|
|
46
|
+
- name: Test package installation
|
|
47
|
+
run: |
|
|
48
|
+
python -m venv test_env
|
|
49
|
+
source test_env/bin/activate
|
|
50
|
+
pip install dist/*.whl
|
|
51
|
+
|
|
52
|
+
# Test imports
|
|
53
|
+
python -c 'import genai_otel; print(f"Successfully imported genai_otel version: {genai_otel.__version__}")'
|
|
54
|
+
python -c 'from genai_otel.config import OTelConfig; from genai_otel.cost_calculator import CostCalculator; print("All core components imported successfully")'
|
|
55
|
+
|
|
56
|
+
# Test CLI
|
|
57
|
+
genai-instrument --help
|
|
58
|
+
echo "✓ CLI tool works"
|
|
59
|
+
|
|
60
|
+
deactivate
|
|
61
|
+
rm -rf test_env
|
|
62
|
+
|
|
63
|
+
- name: Publish to Test PyPI
|
|
64
|
+
if: github.event_name == 'release'
|
|
65
|
+
env:
|
|
66
|
+
TWINE_USERNAME: __token__
|
|
67
|
+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
68
|
+
run: |
|
|
69
|
+
twine upload --repository testpypi dist/* --skip-existing || echo "Package may already exist on Test PyPI"
|
|
70
|
+
|
|
71
|
+
- name: Publish to PyPI
|
|
72
|
+
if: github.event_name == 'release'
|
|
73
|
+
env:
|
|
74
|
+
TWINE_USERNAME: __token__
|
|
75
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
76
|
+
run: |
|
|
77
|
+
twine upload dist/*
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, develop ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, develop ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
16
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install --upgrade pip
|
|
29
|
+
pip install -e ".[dev]"
|
|
30
|
+
|
|
31
|
+
- name: Lint with pylint
|
|
32
|
+
run: |
|
|
33
|
+
pylint genai_otel --rcfile=.pylintrc || true
|
|
34
|
+
|
|
35
|
+
- name: Check formatting with black
|
|
36
|
+
run: |
|
|
37
|
+
black --check genai_otel tests --exclude='__version__\.py'
|
|
38
|
+
|
|
39
|
+
- name: Check import sorting with isort
|
|
40
|
+
run: |
|
|
41
|
+
isort --check-only --skip-glob='*/__version__.py' genai_otel tests
|
|
42
|
+
|
|
43
|
+
- name: Type check with mypy
|
|
44
|
+
run: |
|
|
45
|
+
mypy genai_otel || true
|
|
46
|
+
|
|
47
|
+
- name: Run tests
|
|
48
|
+
run: |
|
|
49
|
+
pytest tests/ -v --cov=genai_otel --cov-report=xml --cov-report=term
|
|
50
|
+
|
|
51
|
+
- name: Upload coverage to Codecov
|
|
52
|
+
uses: codecov/codecov-action@v3
|
|
53
|
+
with:
|
|
54
|
+
file: ./coverage.xml
|
|
55
|
+
flags: unittests
|
|
56
|
+
name: codecov-umbrella
|
|
57
|
+
fail_ci_if_error: false
|
|
58
|
+
|
|
59
|
+
# New job: Test package build and installation
|
|
60
|
+
build-and-install-test:
|
|
61
|
+
runs-on: ${{ matrix.os }}
|
|
62
|
+
strategy:
|
|
63
|
+
fail-fast: false
|
|
64
|
+
matrix:
|
|
65
|
+
os: [ubuntu-latest, windows-latest]
|
|
66
|
+
python-version: ["3.9", "3.12"]
|
|
67
|
+
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v4
|
|
70
|
+
|
|
71
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
72
|
+
uses: actions/setup-python@v5
|
|
73
|
+
with:
|
|
74
|
+
python-version: ${{ matrix.python-version }}
|
|
75
|
+
|
|
76
|
+
- name: Install build dependencies
|
|
77
|
+
run: |
|
|
78
|
+
python -m pip install --upgrade pip
|
|
79
|
+
pip install build twine
|
|
80
|
+
|
|
81
|
+
- name: Build package
|
|
82
|
+
run: python -m build
|
|
83
|
+
|
|
84
|
+
- name: Check package with twine
|
|
85
|
+
run: twine check dist/*
|
|
86
|
+
|
|
87
|
+
- name: Test installation in isolated environment
|
|
88
|
+
shell: bash
|
|
89
|
+
run: |
|
|
90
|
+
# Create a temporary directory for testing
|
|
91
|
+
python -m venv test_env
|
|
92
|
+
|
|
93
|
+
# Activate virtual environment
|
|
94
|
+
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
|
95
|
+
source test_env/Scripts/activate
|
|
96
|
+
else
|
|
97
|
+
source test_env/bin/activate
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# Install the built wheel
|
|
101
|
+
pip install dist/*.whl
|
|
102
|
+
|
|
103
|
+
# Test imports
|
|
104
|
+
python -c 'import genai_otel; print(f"Successfully imported genai_otel version: {genai_otel.__version__}")'
|
|
105
|
+
python -c 'from genai_otel.config import OTelConfig; from genai_otel.cost_calculator import CostCalculator; from genai_otel.auto_instrument import setup_auto_instrumentation; print("All core components imported successfully")'
|
|
106
|
+
|
|
107
|
+
# Test CLI tool
|
|
108
|
+
genai-instrument --help
|
|
109
|
+
echo "CLI tool works"
|
|
110
|
+
|
|
111
|
+
# Cleanup
|
|
112
|
+
deactivate
|
|
113
|
+
|
|
114
|
+
security:
|
|
115
|
+
runs-on: ubuntu-latest
|
|
116
|
+
steps:
|
|
117
|
+
- uses: actions/checkout@v4
|
|
118
|
+
|
|
119
|
+
- name: Set up Python
|
|
120
|
+
uses: actions/setup-python@v5
|
|
121
|
+
with:
|
|
122
|
+
python-version: "3.11"
|
|
123
|
+
|
|
124
|
+
- name: Install dependencies
|
|
125
|
+
run: |
|
|
126
|
+
python -m pip install --upgrade pip
|
|
127
|
+
pip install safety bandit
|
|
128
|
+
|
|
129
|
+
- name: Run safety check
|
|
130
|
+
run: |
|
|
131
|
+
safety check || true
|
|
132
|
+
|
|
133
|
+
- name: Run bandit security check
|
|
134
|
+
run: |
|
|
135
|
+
bandit -r genai_otel -ll || true
|