contextmg 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.
@@ -0,0 +1,144 @@
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
+ # IDE settings
126
+ .vscode/
127
+ .idea/
128
+ *.swp
129
+ *.swo
130
+ *~
131
+ .DS_Store
132
+
133
+ # Project specific
134
+ .containerization-assist/
135
+ *.bak
136
+ *.tmp
137
+
138
+ # Virtual environments
139
+ .venv*/
140
+ venv*/
141
+
142
+ # OS specific
143
+ .DS_Store
144
+ Thumbs.db
@@ -0,0 +1,266 @@
1
+ # Contributing to ContextForge
2
+
3
+ Thank you for your interest in contributing to ContextForge! We believe that collaborative development leads to better software for everyone. This document provides guidelines and instructions for contributing to the project.
4
+
5
+ ## Code of Conduct
6
+
7
+ By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors. We are committed to providing a welcoming space for people of all backgrounds and experience levels.
8
+
9
+ ## How to Contribute
10
+
11
+ ### Reporting Bugs
12
+
13
+ Before creating bug reports, please check the issue list to avoid duplicates. When you create a bug report, include:
14
+
15
+ - **Clear description**: What is the bug and what did you expect to happen?
16
+ - **Steps to reproduce**: Provide specific steps to reproduce the issue
17
+ - **Python version**: Include the Python version you're using
18
+ - **Dependencies**: List relevant library versions (langchain-core, tiktoken, etc.)
19
+ - **Error messages**: Include full traceback if applicable
20
+ - **Code sample**: Provide a minimal code example that triggers the bug
21
+
22
+ ### Suggesting Features
23
+
24
+ Feature suggestions are welcome! When proposing a feature:
25
+
26
+ - **Use clear, descriptive language**: Explain the use case and benefits
27
+ - **Provide context**: How does this feature fit into ContextForge's mission?
28
+ - **Include examples**: Show how the feature would be used
29
+ - **Consider alternatives**: Have you thought of other ways to solve this?
30
+
31
+ ### Pull Requests
32
+
33
+ We accept pull requests from community members. To submit a PR:
34
+
35
+ 1. **Fork the repository** and create a feature branch
36
+ ```bash
37
+ git checkout -b feature/your-feature-name
38
+ ```
39
+
40
+ 2. **Make your changes** following our code standards (see below)
41
+
42
+ 3. **Write or update tests** for your changes
43
+ ```bash
44
+ pytest -v
45
+ ```
46
+
47
+ 4. **Run code formatting** to ensure consistency
48
+ ```bash
49
+ black src/ tests/
50
+ ```
51
+
52
+ 5. **Commit with clear messages**
53
+ ```bash
54
+ git commit -m "Add feature: clear description of changes"
55
+ ```
56
+
57
+ 6. **Push to your fork** and open a pull request
58
+ ```bash
59
+ git push origin feature/your-feature-name
60
+ ```
61
+
62
+ ## Development Setup
63
+
64
+ ### Prerequisites
65
+
66
+ - Python 3.10 or higher
67
+ - Git
68
+ - Virtual environment tool (venv, conda, etc.)
69
+
70
+ ### Local Development Environment
71
+
72
+ ```bash
73
+ # Clone the repository
74
+ git clone https://github.com/yourusername/contextforge.git
75
+ cd contextforge
76
+
77
+ # Create and activate virtual environment
78
+ python -m venv .venv
79
+ source .venv/bin/activate # On Windows: .venv\Scripts\Activate.ps1
80
+
81
+ # Upgrade pip
82
+ pip install --upgrade pip setuptools wheel
83
+
84
+ # Install in development mode with all dependencies
85
+ pip install -e ".[dev]"
86
+ ```
87
+
88
+ ### Running Tests
89
+
90
+ ```bash
91
+ # Run all tests
92
+ pytest -v
93
+
94
+ # Run tests with coverage report
95
+ pytest --cov=contextforge tests/
96
+
97
+ # Run specific test class
98
+ pytest tests/test_engine.py::TestAutomatedContextEngine -v
99
+
100
+ # Run tests matching a pattern
101
+ pytest -k "token_budget" -v
102
+ ```
103
+
104
+ ### Code Formatting
105
+
106
+ We use Black for code formatting to maintain consistency:
107
+
108
+ ```bash
109
+ # Format all Python files
110
+ black src/ tests/
111
+
112
+ # Check formatting without changes
113
+ black --check src/ tests/
114
+ ```
115
+
116
+ ## Code Standards
117
+
118
+ ### Style Guidelines
119
+
120
+ - **Line length**: Maximum 88 characters (Black default)
121
+ - **Imports**: Group and sort using isort conventions
122
+ - **Type hints**: Use type hints for all function signatures
123
+ - **Docstrings**: Follow Google-style docstring format
124
+
125
+ ### Example Function Structure
126
+
127
+ ```python
128
+ def my_function(param1: str, param2: int) -> Dict[str, Any]:
129
+ """
130
+ Brief one-line description of the function.
131
+
132
+ Longer detailed description explaining the purpose, behavior,
133
+ and any important details about how the function works.
134
+
135
+ Args:
136
+ param1: Description of param1 and its expected format.
137
+ param2: Description of param2 and its constraints.
138
+
139
+ Returns:
140
+ Description of the return value and its structure.
141
+
142
+ Raises:
143
+ ValueError: Description of when this exception is raised.
144
+ TypeError: Description of when this exception is raised.
145
+ """
146
+ # Implementation
147
+ pass
148
+ ```
149
+
150
+ ### Docstring Standards
151
+
152
+ - Use triple-quoted strings (""")
153
+ - Include parameter and return value documentation
154
+ - Document exceptions that can be raised
155
+ - Provide usage examples for complex functions
156
+ - Keep descriptions concise but complete
157
+
158
+ ## Testing Standards
159
+
160
+ ### Test Coverage Requirements
161
+
162
+ - New code must have corresponding unit tests
163
+ - Tests should cover both success and error paths
164
+ - Edge cases and boundary conditions should be tested
165
+ - Aim for >80% code coverage
166
+
167
+ ### Test Organization
168
+
169
+ ```python
170
+ class TestComponentName:
171
+ """Test suite for ComponentName class."""
172
+
173
+ def test_basic_functionality(self):
174
+ """Test the primary use case."""
175
+ # Arrange
176
+ # Act
177
+ # Assert
178
+ pass
179
+
180
+ def test_error_handling(self):
181
+ """Test error conditions."""
182
+ with pytest.raises(ValueError):
183
+ # Code that should raise
184
+ pass
185
+ ```
186
+
187
+ ## Documentation
188
+
189
+ ### Updating README
190
+
191
+ If your changes affect usage, please update the README.md with:
192
+ - New API endpoints or functions
193
+ - New configuration options
194
+ - Updated examples
195
+ - New sections if introducing major features
196
+
197
+ ### API Documentation
198
+
199
+ Keep docstrings updated in the code:
200
+ - Update docstrings when changing parameters
201
+ - Add examples to complex functions
202
+ - Document edge cases and limitations
203
+
204
+ ## Commit Messages
205
+
206
+ Write clear, descriptive commit messages:
207
+
208
+ ```
209
+ # Good
210
+ commit -m "Add token budget enforcement in AdaptiveContextPool
211
+
212
+ - Validate token budget before rendering
213
+ - Apply word-level compression if budget exceeded
214
+ - Add comprehensive error messages for debugging"
215
+
216
+ # Avoid
217
+ commit -m "Fix bug"
218
+ commit -m "Update stuff"
219
+ ```
220
+
221
+ ### Commit Message Format
222
+
223
+ - First line: Short summary (50 chars max)
224
+ - Blank line
225
+ - Detailed explanation (wrap at 72 chars)
226
+ - Reference related issues: "Fixes #123"
227
+
228
+ ## Release Process
229
+
230
+ The maintainers follow semantic versioning (MAJOR.MINOR.PATCH):
231
+
232
+ - **MAJOR**: Breaking changes
233
+ - **MINOR**: New features (backward compatible)
234
+ - **PATCH**: Bug fixes (backward compatible)
235
+
236
+ ## Code Review Process
237
+
238
+ When you submit a PR:
239
+
240
+ 1. **Automated checks run**: Tests, formatting, coverage
241
+ 2. **Code review**: Maintainers review for quality and consistency
242
+ 3. **Feedback**: Comments and suggestions for improvement
243
+ 4. **Revisions**: You address feedback with new commits
244
+ 5. **Approval**: Once approved, PR is merged
245
+
246
+ ## Areas We're Looking For Help
247
+
248
+ - **Bug fixes**: See open issues labeled "bug"
249
+ - **Documentation**: Improve examples, tutorials, API docs
250
+ - **Performance**: Optimize hot paths, profile memory usage
251
+ - **Testing**: Increase test coverage and add edge cases
252
+ - **Features**: Implement features from the roadmap
253
+
254
+ ## Questions?
255
+
256
+ - Open an issue for questions
257
+ - Check existing issues and discussions first
258
+ - Ask on GitHub Discussions
259
+
260
+ ## License
261
+
262
+ By contributing to ContextForge, you agree that your contributions will be licensed under the MIT License.
263
+
264
+ ---
265
+
266
+ Thank you for helping make ContextForge better! 🚀
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ContextForge 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.