latence 0.1.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 (108) hide show
  1. latence-0.1.0/.env.example +15 -0
  2. latence-0.1.0/.github/workflows/publish.yml +33 -0
  3. latence-0.1.0/.github/workflows/test.yml +84 -0
  4. latence-0.1.0/.gitignore +141 -0
  5. latence-0.1.0/.pre-commit-config.yaml +34 -0
  6. latence-0.1.0/CONTRIBUTING.md +13 -0
  7. latence-0.1.0/GITHUB_SETUP.md +156 -0
  8. latence-0.1.0/LICENSE +21 -0
  9. latence-0.1.0/Makefile +87 -0
  10. latence-0.1.0/PKG-INFO +502 -0
  11. latence-0.1.0/README.md +469 -0
  12. latence-0.1.0/SDK_TUTORIAL.md +1835 -0
  13. latence-0.1.0/docs/README.md +84 -0
  14. latence-0.1.0/docs/chunking.md +148 -0
  15. latence-0.1.0/docs/colbert.md +41 -0
  16. latence-0.1.0/docs/colpali.md +47 -0
  17. latence-0.1.0/docs/compression.md +94 -0
  18. latence-0.1.0/docs/dataset_intelligence.md +272 -0
  19. latence-0.1.0/docs/document_intelligence.md +135 -0
  20. latence-0.1.0/docs/embed.md +98 -0
  21. latence-0.1.0/docs/embedding.md +34 -0
  22. latence-0.1.0/docs/enrichment.md +321 -0
  23. latence-0.1.0/docs/extraction.md +91 -0
  24. latence-0.1.0/docs/ontology.md +96 -0
  25. latence-0.1.0/docs/pipelines.md +325 -0
  26. latence-0.1.0/docs/redaction.md +87 -0
  27. latence-0.1.0/examples/pipeline.yml +214 -0
  28. latence-0.1.0/notebooks/_test_utils.py +475 -0
  29. latence-0.1.0/notebooks/compress_documents.ipynb +223 -0
  30. latence-0.1.0/notebooks/cost-efficiency_simulator.ipynb +254 -0
  31. latence-0.1.0/notebooks/diverse_file_processing.ipynb +353 -0
  32. latence-0.1.0/notebooks/embed_anything.ipynb +212 -0
  33. latence-0.1.0/notebooks/end-to-end.ipynb +571 -0
  34. latence-0.1.0/notebooks/extract_and_redact_pii.ipynb +231 -0
  35. latence-0.1.0/notebooks/extract_from_docs.ipynb +218 -0
  36. latence-0.1.0/notebooks/knowledge_graph_builder.ipynb +529 -0
  37. latence-0.1.0/pyproject.toml +69 -0
  38. latence-0.1.0/src/latence/__init__.py +199 -0
  39. latence-0.1.0/src/latence/_base.py +368 -0
  40. latence-0.1.0/src/latence/_client.py +284 -0
  41. latence-0.1.0/src/latence/_constants.py +36 -0
  42. latence-0.1.0/src/latence/_deprecation.py +58 -0
  43. latence-0.1.0/src/latence/_exceptions.py +341 -0
  44. latence-0.1.0/src/latence/_logging.py +91 -0
  45. latence-0.1.0/src/latence/_models/__init__.py +149 -0
  46. latence-0.1.0/src/latence/_models/chunking.py +53 -0
  47. latence-0.1.0/src/latence/_models/colbert.py +74 -0
  48. latence-0.1.0/src/latence/_models/colpali.py +70 -0
  49. latence-0.1.0/src/latence/_models/common.py +81 -0
  50. latence-0.1.0/src/latence/_models/compression.py +31 -0
  51. latence-0.1.0/src/latence/_models/dataset_intelligence_service.py +74 -0
  52. latence-0.1.0/src/latence/_models/document_intelligence.py +221 -0
  53. latence-0.1.0/src/latence/_models/embed.py +137 -0
  54. latence-0.1.0/src/latence/_models/embedding.py +97 -0
  55. latence-0.1.0/src/latence/_models/enrichment.py +271 -0
  56. latence-0.1.0/src/latence/_models/extraction.py +39 -0
  57. latence-0.1.0/src/latence/_models/jobs.py +73 -0
  58. latence-0.1.0/src/latence/_models/ontology.py +103 -0
  59. latence-0.1.0/src/latence/_models/pipeline.py +229 -0
  60. latence-0.1.0/src/latence/_models/redaction.py +39 -0
  61. latence-0.1.0/src/latence/_pipeline/__init__.py +55 -0
  62. latence-0.1.0/src/latence/_pipeline/builder.py +621 -0
  63. latence-0.1.0/src/latence/_pipeline/config_loader.py +192 -0
  64. latence-0.1.0/src/latence/_pipeline/data_package.py +1265 -0
  65. latence-0.1.0/src/latence/_pipeline/job.py +438 -0
  66. latence-0.1.0/src/latence/_pipeline/spec.py +358 -0
  67. latence-0.1.0/src/latence/_pipeline/validator.py +342 -0
  68. latence-0.1.0/src/latence/_retry.py +261 -0
  69. latence-0.1.0/src/latence/_utils.py +209 -0
  70. latence-0.1.0/src/latence/_version.py +3 -0
  71. latence-0.1.0/src/latence/pipelines/PIPELINE_SPEC.md +171 -0
  72. latence-0.1.0/src/latence/pipelines/__init__.py +12 -0
  73. latence-0.1.0/src/latence/py.typed +0 -0
  74. latence-0.1.0/src/latence/resources/__init__.py +60 -0
  75. latence-0.1.0/src/latence/resources/_base.py +147 -0
  76. latence-0.1.0/src/latence/resources/chunking.py +206 -0
  77. latence-0.1.0/src/latence/resources/colbert.py +156 -0
  78. latence-0.1.0/src/latence/resources/colpali.py +188 -0
  79. latence-0.1.0/src/latence/resources/compression.py +354 -0
  80. latence-0.1.0/src/latence/resources/credits.py +53 -0
  81. latence-0.1.0/src/latence/resources/dataset_intelligence_service.py +399 -0
  82. latence-0.1.0/src/latence/resources/document_intelligence.py +593 -0
  83. latence-0.1.0/src/latence/resources/embed.py +579 -0
  84. latence-0.1.0/src/latence/resources/embedding.py +146 -0
  85. latence-0.1.0/src/latence/resources/enrichment.py +350 -0
  86. latence-0.1.0/src/latence/resources/experimental.py +255 -0
  87. latence-0.1.0/src/latence/resources/extraction.py +200 -0
  88. latence-0.1.0/src/latence/resources/jobs.py +451 -0
  89. latence-0.1.0/src/latence/resources/ontology.py +196 -0
  90. latence-0.1.0/src/latence/resources/pipeline.py +1326 -0
  91. latence-0.1.0/src/latence/resources/redaction.py +197 -0
  92. latence-0.1.0/src/latence/types/__init__.py +89 -0
  93. latence-0.1.0/tests/__init__.py +1 -0
  94. latence-0.1.0/tests/fixtures/sample.pdf +112 -0
  95. latence-0.1.0/tests/integration/__init__.py +3 -0
  96. latence-0.1.0/tests/integration/test_api_smoke.py +305 -0
  97. latence-0.1.0/tests/integration/test_di_e2e.py +401 -0
  98. latence-0.1.0/tests/integration/test_parity_check.py +206 -0
  99. latence-0.1.0/tests/integration/test_pipeline_e2e.py +676 -0
  100. latence-0.1.0/tests/test_builder_validation.py +162 -0
  101. latence-0.1.0/tests/test_chunking.py +195 -0
  102. latence-0.1.0/tests/test_data_package.py +326 -0
  103. latence-0.1.0/tests/test_dataset_intelligence.py +409 -0
  104. latence-0.1.0/tests/test_enrichment.py +265 -0
  105. latence-0.1.0/tests/test_models.py +388 -0
  106. latence-0.1.0/tests/test_pipeline.py +766 -0
  107. latence-0.1.0/tests/test_refinery.py +938 -0
  108. latence-0.1.0/tests/test_sdk_parity.py +115 -0
@@ -0,0 +1,15 @@
1
+ # Latence Python SDK Environment Variables
2
+ # Copy to .env or export these in your shell
3
+
4
+ # API Key (required for all API calls)
5
+ LATENCE_API_KEY=la_your_api_key_here
6
+
7
+ # Base URL (optional - defaults to production)
8
+ # For staging/development:
9
+ # LATENCE_BASE_URL=https://staging.api.latence.ai
10
+ # For production (default):
11
+ # LATENCE_BASE_URL=https://api.latence.ai
12
+
13
+ # Logging level (optional - defaults to WARNING)
14
+ # Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
15
+ # LATENCE_LOG_LEVEL=DEBUG
@@ -0,0 +1,33 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment:
11
+ name: pypi
12
+ url: https://pypi.org/p/latence
13
+ permissions:
14
+ id-token: write # Required for trusted publishing
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: '3.12'
23
+
24
+ - name: Install build dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install build
28
+
29
+ - name: Build package
30
+ run: python -m build
31
+
32
+ - name: Publish to PyPI
33
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,84 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Set up Python 3.12
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.12"
19
+
20
+ - name: Install dependencies
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+ pip install -e ".[dev]"
24
+
25
+ - name: Check formatting
26
+ run: ruff format --check src/latence tests/
27
+
28
+ - name: Run linter
29
+ run: ruff check src/latence tests/
30
+
31
+ - name: Run type checking
32
+ run: mypy src/latence
33
+
34
+ test:
35
+ runs-on: ubuntu-latest
36
+ strategy:
37
+ matrix:
38
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
39
+
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+
43
+ - name: Set up Python ${{ matrix.python-version }}
44
+ uses: actions/setup-python@v5
45
+ with:
46
+ python-version: ${{ matrix.python-version }}
47
+
48
+ - name: Install dependencies
49
+ run: |
50
+ python -m pip install --upgrade pip
51
+ pip install -e ".[dev]"
52
+
53
+ - name: Run unit tests with coverage
54
+ run: pytest tests/ --ignore=tests/integration -v --cov=latence --cov-report=xml --cov-report=term-missing
55
+
56
+ - name: Upload coverage to Codecov
57
+ if: matrix.python-version == '3.12'
58
+ uses: codecov/codecov-action@v4
59
+ with:
60
+ file: ./coverage.xml
61
+ fail_ci_if_error: false
62
+
63
+ integration:
64
+ runs-on: ubuntu-latest
65
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
66
+ needs: [lint, test]
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+
70
+ - name: Set up Python 3.12
71
+ uses: actions/setup-python@v5
72
+ with:
73
+ python-version: "3.12"
74
+
75
+ - name: Install dependencies
76
+ run: |
77
+ python -m pip install --upgrade pip
78
+ pip install -e ".[dev]"
79
+
80
+ - name: Run integration tests
81
+ env:
82
+ LATENCE_BASE_URL: ${{ secrets.STAGING_API_URL }}
83
+ LATENCE_API_KEY: ${{ secrets.STAGING_API_KEY }}
84
+ run: pytest tests/integration/ -v --tb=short
@@ -0,0 +1,141 @@
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
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ *.py,cover
49
+ .hypothesis/
50
+ .pytest_cache/
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
+ target/
74
+
75
+ # Jupyter Notebook
76
+ .ipynb_checkpoints
77
+
78
+ # IPython
79
+ profile_default/
80
+ ipython_config.py
81
+
82
+ # pyenv
83
+ .python-version
84
+
85
+ # pipenv
86
+ Pipfile.lock
87
+
88
+ # PEP 582
89
+ __pypackages__/
90
+
91
+ # Celery stuff
92
+ celerybeat-schedule
93
+ celerybeat.pid
94
+
95
+ # SageMath parsed files
96
+ *.sage.py
97
+
98
+ # Environments
99
+ .env
100
+ .venv
101
+ env/
102
+ venv/
103
+ ENV/
104
+ env.bak/
105
+ venv.bak/
106
+
107
+ # Spyder project settings
108
+ .spyderproject
109
+ .spyproject
110
+
111
+ # Rope project settings
112
+ .ropeproject
113
+
114
+ # mkdocs documentation
115
+ /site
116
+
117
+ # mypy
118
+ .mypy_cache/
119
+ .dmypy.json
120
+ dmypy.json
121
+
122
+ # Pyre type checker
123
+ .pyre/
124
+
125
+ # IDEs
126
+ .vscode/
127
+ .idea/
128
+ *.swp
129
+ *.swo
130
+ *~
131
+
132
+ # OS
133
+ .DS_Store
134
+ Thumbs.db
135
+
136
+ # Project specific
137
+ .dev.vars
138
+
139
+ # Notebooks: archived old notebooks and test data
140
+ notebooks/_archive/
141
+ notebooks/data/
@@ -0,0 +1,34 @@
1
+ # Pre-commit hooks for latence-python
2
+ # Install with: pre-commit install
3
+ # Run manually: pre-commit run --all-files
4
+
5
+ repos:
6
+ - repo: https://github.com/pre-commit/pre-commit-hooks
7
+ rev: v4.5.0
8
+ hooks:
9
+ - id: trailing-whitespace
10
+ - id: end-of-file-fixer
11
+ - id: check-yaml
12
+ - id: check-added-large-files
13
+ args: ['--maxkb=500']
14
+ - id: check-merge-conflict
15
+
16
+ - repo: https://github.com/astral-sh/ruff-pre-commit
17
+ rev: v0.3.0
18
+ hooks:
19
+ # Run the formatter
20
+ - id: ruff-format
21
+ args: [--config, pyproject.toml]
22
+ # Run the linter
23
+ - id: ruff
24
+ args: [--fix, --config, pyproject.toml]
25
+
26
+ - repo: local
27
+ hooks:
28
+ - id: mypy
29
+ name: mypy
30
+ entry: mypy src/latence --config-file pyproject.toml
31
+ language: system
32
+ types: [python]
33
+ pass_filenames: false
34
+ always_run: true
@@ -0,0 +1,13 @@
1
+ # Contributing to Latence AI Python SDK
2
+
3
+ Thank you for your interest in Latence AI.
4
+
5
+ At this stage, the SDK is maintained by a solo founder and **we are not accepting external contributions** (issues, pull requests, or feature requests via GitHub).
6
+
7
+ ## What you can do
8
+
9
+ - **Fork** the repository for your own use under the terms of the [license](LICENSE).
10
+ - **Report bugs or request features** by emailing [support@latence.ai](mailto:support@latence.ai).
11
+ - **Share feedback** — beta users can reach us directly at [admin@latence.ai](mailto:admin@latence.ai).
12
+
13
+ We appreciate your understanding and look forward to opening contributions in the future.
@@ -0,0 +1,156 @@
1
+ # GitHub Repository Setup Instructions
2
+
3
+ ## 1. Create Private Repository on GitHub
4
+
5
+ Go to https://github.com/new and create a new repository:
6
+
7
+ - **Repository name**: `latence-python` (or `python-sdk`)
8
+ - **Description**: Official Python SDK for Latence AI API Gateway
9
+ - **Visibility**: ✅ **Private** (for now)
10
+ - **Initialize**: ❌ Do NOT initialize with README, .gitignore, or license (we already have these)
11
+
12
+ ## 2. Push Local Repository
13
+
14
+ After creating the repository, run these commands:
15
+
16
+ ```bash
17
+ cd /workspace/latence-python
18
+
19
+ # Add remote (replace with your actual GitHub URL)
20
+ git remote add origin https://github.com/latenceai/latence-python.git
21
+
22
+ # Push to GitHub
23
+ git push -u origin main
24
+ ```
25
+
26
+ ## 3. Configure Repository Settings
27
+
28
+ ### Branch Protection
29
+ Go to: **Settings → Branches → Add rule**
30
+
31
+ - Branch name pattern: `main`
32
+ - ✅ Require pull request reviews before merging
33
+ - ✅ Require status checks to pass before merging
34
+ - Select: `test`
35
+
36
+ ### PyPI Trusted Publishing (OIDC)
37
+
38
+ The publish workflow uses **Trusted Publishing** (OIDC), so no API token secret is needed.
39
+ Before your first release, configure a **pending trusted publisher** on PyPI:
40
+
41
+ 1. Go to https://pypi.org/manage/account/publishing/
42
+ 2. Fill in:
43
+ - **PyPI project name**: `latence`
44
+ - **Owner**: `latenceai`
45
+ - **Repository**: `latence-python`
46
+ - **Workflow name**: `publish.yml`
47
+ - **Environment name**: `pypi`
48
+ 3. Click **Add**
49
+
50
+ Then create a GitHub Environment named `pypi` in the repository:
51
+
52
+ 1. Go to: **Settings → Environments → New environment**
53
+ 2. Name it `pypi`
54
+ 3. Optionally enable **Required reviewers** for manual approval on each release
55
+
56
+ ### Secrets (for integration tests)
57
+ Go to: **Settings → Secrets and variables → Actions**
58
+
59
+ - `STAGING_API_URL` - Base URL for the staging API gateway
60
+ - `STAGING_API_KEY` - API key for staging integration tests
61
+
62
+ ### Topics
63
+ Go to: **Settings → General → Topics**
64
+
65
+ Add topics for discoverability:
66
+ - `python`
67
+ - `sdk`
68
+ - `api-client`
69
+ - `latence`
70
+ - `embeddings`
71
+ - `nlp`
72
+ - `document-processing`
73
+
74
+ ## 4. Make Repository Public (When Ready)
75
+
76
+ Once everything is perfect and you're ready to release:
77
+
78
+ 1. Go to: **Settings → General → Danger Zone**
79
+ 2. Click "Change repository visibility"
80
+ 3. Select "Make public"
81
+ 4. Confirm
82
+
83
+ ## 5. Create First Release
84
+
85
+ Go to: **Releases → Create a new release**
86
+
87
+ - **Tag**: `v0.1.0`
88
+ - **Title**: `v0.1.0 - Initial Release`
89
+ - **Description**: Copy from README highlights
90
+ - Publish release → This will automatically trigger PyPI publishing workflow
91
+
92
+ ## Repository Structure
93
+
94
+ ```
95
+ latenceai/latence-python/
96
+ ├── .github/
97
+ │ └── workflows/
98
+ │ ├── test.yml # CI tests
99
+ │ └── publish.yml # PyPI publishing
100
+ ├── src/latence/ # Package source
101
+ ├── tests/ # Test suite
102
+ ├── notebooks/ # Tutorial notebooks
103
+ ├── README.md # Main documentation
104
+ ├── pyproject.toml # Package configuration
105
+ ├── LICENSE # MIT License
106
+ ├── CONTRIBUTING.md # Contribution guide
107
+ └── .gitignore # Git ignore rules
108
+ ```
109
+
110
+ ## Quick Commands Reference
111
+
112
+ ```bash
113
+ # Clone repository (after creating on GitHub)
114
+ git clone https://github.com/latenceai/latence-python.git
115
+
116
+ # Install in development mode
117
+ cd latence-python
118
+ python -m venv venv
119
+ source venv/bin/activate
120
+ pip install -e ".[dev]"
121
+
122
+ # Run tests
123
+ pytest tests/ -v
124
+
125
+ # Check types
126
+ mypy src/latence
127
+
128
+ # Build package
129
+ python -m build
130
+
131
+ # Install from local build
132
+ pip install dist/latence-0.1.0-py3-none-any.whl
133
+ ```
134
+
135
+ ## PyPI Package Name
136
+
137
+ The package will be published as **`latence`** on PyPI:
138
+
139
+ ```bash
140
+ pip install latence
141
+ ```
142
+
143
+ ```python
144
+ from latence import Latence
145
+
146
+ client = Latence(api_key="your_api_key")
147
+ ```
148
+
149
+ ## Note
150
+
151
+ Keep the repository **private** until:
152
+ - ✅ All features tested and verified
153
+ - ✅ Documentation complete
154
+ - ✅ README polished
155
+ - ✅ Example notebooks working
156
+ - ✅ First version ready for public release
latence-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Latence AI
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.
latence-0.1.0/Makefile ADDED
@@ -0,0 +1,87 @@
1
+ # Makefile for latence-python SDK
2
+ # Usage: make <target>
3
+
4
+ .PHONY: install dev test test-cov test-integration lint format check clean build publish-test
5
+
6
+ # Install package in editable mode
7
+ install:
8
+ pip install -e .
9
+
10
+ # Install with dev dependencies and pre-commit hooks
11
+ dev:
12
+ pip install -e ".[dev]"
13
+ pip install pre-commit pytest-cov
14
+ pre-commit install
15
+ @echo ""
16
+ @echo "Development environment ready!"
17
+ @echo "Pre-commit hooks installed."
18
+
19
+ # Run tests
20
+ test:
21
+ pytest tests/ -v
22
+
23
+ # Run tests with coverage
24
+ test-cov:
25
+ pytest tests/ -v --cov=latence --cov-report=term-missing --cov-report=html
26
+ @echo ""
27
+ @echo "Coverage report generated at htmlcov/index.html"
28
+
29
+ # Run integration tests against staging API
30
+ test-integration:
31
+ @echo "Running integration tests against staging..."
32
+ LATENCE_BASE_URL=https://staging.api.latence.ai pytest tests/integration/ -v
33
+
34
+ # Run linter and type checker
35
+ lint:
36
+ ruff check src/latence tests/
37
+ mypy src/latence
38
+
39
+ # Format code
40
+ format:
41
+ ruff format src/latence tests/
42
+ ruff check --fix src/latence tests/
43
+
44
+ # Run all checks (lint + test) - use before pushing
45
+ check: lint test
46
+ @echo ""
47
+ @echo "All checks passed!"
48
+
49
+ # Clean build artifacts
50
+ clean:
51
+ rm -rf build/
52
+ rm -rf dist/
53
+ rm -rf *.egg-info/
54
+ rm -rf src/*.egg-info/
55
+ rm -rf .pytest_cache/
56
+ rm -rf .mypy_cache/
57
+ rm -rf .ruff_cache/
58
+ rm -rf htmlcov/
59
+ rm -rf .coverage
60
+ find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
61
+
62
+ # Build package
63
+ build: clean
64
+ pip install build
65
+ python -m build
66
+
67
+ # Publish to Test PyPI (for testing releases)
68
+ publish-test: build
69
+ pip install twine
70
+ twine upload --repository testpypi dist/*
71
+ @echo ""
72
+ @echo "Published to Test PyPI!"
73
+ @echo "Install with: pip install --index-url https://test.pypi.org/simple/ latence"
74
+
75
+ # Show help
76
+ help:
77
+ @echo "Available targets:"
78
+ @echo " make dev - Install dev dependencies and pre-commit hooks"
79
+ @echo " make test - Run tests"
80
+ @echo " make test-cov - Run tests with coverage report"
81
+ @echo " make test-integration - Run integration tests against staging"
82
+ @echo " make lint - Run linter and type checker"
83
+ @echo " make format - Format code with ruff"
84
+ @echo " make check - Run all checks (lint + test)"
85
+ @echo " make clean - Remove build artifacts"
86
+ @echo " make build - Build package"
87
+ @echo " make publish-test - Publish to Test PyPI"