libcontext 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,36 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug to help us improve
4
+ title: "[BUG] "
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Description
10
+
11
+ A clear and concise description of the bug.
12
+
13
+ ## Steps to Reproduce
14
+
15
+ 1. Install `...`
16
+ 2. Run `libctx ...`
17
+ 3. See error
18
+
19
+ ## Expected Behaviour
20
+
21
+ What you expected to happen.
22
+
23
+ ## Actual Behaviour
24
+
25
+ What actually happened. Include the full error traceback if applicable.
26
+
27
+ ## Environment
28
+
29
+ - **OS:** (e.g., Windows 11, Ubuntu 22.04, macOS 14)
30
+ - **Python version:** (e.g., 3.11.4)
31
+ - **libcontext version:** (e.g., 0.1.0)
32
+ - **Package being inspected:** (e.g., requests 2.31.0)
33
+
34
+ ## Additional Context
35
+
36
+ Any other context about the problem (screenshots, logs, etc.).
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a new feature or enhancement
4
+ title: "[FEATURE] "
5
+ labels: enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Problem Statement
10
+
11
+ A clear and concise description of the problem this feature would solve.
12
+
13
+ ## Proposed Solution
14
+
15
+ Describe your proposed solution or feature.
16
+
17
+ ## Alternatives Considered
18
+
19
+ Any alternative solutions or features you've considered.
20
+
21
+ ## Additional Context
22
+
23
+ Any other context, mockups, or examples.
@@ -0,0 +1,21 @@
1
+ ## Description
2
+
3
+ Brief description of the changes in this PR.
4
+
5
+ ## Motivation
6
+
7
+ Why is this change needed? Link to related issue(s) if applicable.
8
+
9
+ Closes #
10
+
11
+ ## Changes
12
+
13
+ - Change 1
14
+ - Change 2
15
+
16
+ ## Checklist
17
+
18
+ - [ ] Tests added/updated
19
+ - [ ] All tests pass (`pytest`)
20
+ - [ ] Docstrings added/updated for public API changes
21
+ - [ ] CHANGELOG.md updated (for user-facing changes)
@@ -0,0 +1,99 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }})
15
+ runs-on: ${{ matrix.os }}
16
+
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ os: [ubuntu-latest, windows-latest, macos-latest]
21
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - name: Set up Python ${{ matrix.python-version }}
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: ${{ matrix.python-version }}
30
+
31
+ - name: Install dependencies
32
+ run: |
33
+ python -m pip install --upgrade pip
34
+ pip install -e ".[dev]"
35
+
36
+ - name: Run tests
37
+ run: pytest -v --cov=libcontext --cov-report=xml
38
+
39
+ - name: Upload coverage
40
+ if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
41
+ uses: codecov/codecov-action@v4
42
+ with:
43
+ file: coverage.xml
44
+ fail_ci_if_error: false
45
+
46
+ lint:
47
+ name: Lint
48
+ runs-on: ubuntu-latest
49
+
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+
53
+ - name: Set up Python
54
+ uses: actions/setup-python@v5
55
+ with:
56
+ python-version: "3.12"
57
+
58
+ - name: Install dependencies
59
+ run: |
60
+ python -m pip install --upgrade pip
61
+ pip install -e ".[dev]"
62
+
63
+ - name: Ruff lint
64
+ run: ruff check src/ tests/
65
+
66
+ - name: Ruff format check
67
+ run: ruff format --check src/ tests/
68
+
69
+ - name: Type checking (mypy)
70
+ run: mypy src/libcontext
71
+
72
+ build:
73
+ name: Build package
74
+ runs-on: ubuntu-latest
75
+
76
+ steps:
77
+ - uses: actions/checkout@v4
78
+
79
+ - name: Set up Python
80
+ uses: actions/setup-python@v5
81
+ with:
82
+ python-version: "3.12"
83
+
84
+ - name: Install build tools
85
+ run: |
86
+ python -m pip install --upgrade pip
87
+ pip install build twine
88
+
89
+ - name: Build
90
+ run: python -m build
91
+
92
+ - name: Check package
93
+ run: twine check dist/*
94
+
95
+ - name: Upload artifacts
96
+ uses: actions/upload-artifact@v4
97
+ with:
98
+ name: dist
99
+ path: dist/
@@ -0,0 +1,65 @@
1
+ # Byte-compiled / cached
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
+ *.egg-info/
24
+ *.egg
25
+
26
+ # Virtual environments
27
+ .venv/
28
+ venv/
29
+ ENV/
30
+ env/
31
+
32
+ # uv
33
+ uv.lock
34
+
35
+ # IDE
36
+ .vscode/
37
+ .idea/
38
+ *.swp
39
+ *.swo
40
+ *~
41
+
42
+ # Testing / coverage
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py,cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+
56
+ # mypy
57
+ .mypy_cache/
58
+ dmypy.json
59
+
60
+ # ruff
61
+ .ruff_cache/
62
+
63
+ # OS files
64
+ .DS_Store
65
+ Thumbs.db
@@ -0,0 +1,35 @@
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.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-02-13
11
+
12
+ ### Added
13
+
14
+ - Initial release of libcontext.
15
+ - AST-based static analysis of Python packages (no code execution).
16
+ - CLI command `libctx` to generate Markdown context files.
17
+ - Support for inspecting any installed Python package by name.
18
+ - Support for inspecting local package directories by path.
19
+ - Extraction of classes, methods, functions, parameters, type annotations, decorators, and docstrings.
20
+ - Automatic README discovery via `importlib.metadata` and filesystem search.
21
+ - Marker-based injection (`<!-- BEGIN/END LIBCONTEXT -->`) for updating existing files without overwriting.
22
+ - Optional `[tool.libcontext]` configuration in `pyproject.toml` for library authors.
23
+ - Module include/exclude filtering.
24
+ - Private member filtering with `--include-private` override.
25
+ - Multi-package support in a single CLI invocation.
26
+ - Intelligent dunder method filtering (includes useful ones like `__init__`, `__call__`, etc.).
27
+ - Respects `__all__` when defined in modules.
28
+ - Positional-only, keyword-only, `*args`, and `**kwargs` parameter handling.
29
+ - Inner class and decorated class support.
30
+ - README truncation with configurable line limit.
31
+ - Free-form `extra_context` field for library authors.
32
+ - Python API for programmatic usage (`collect_package`, `render_package`).
33
+
34
+ [Unreleased]: https://github.com/Syclaw/libcontext/compare/v0.1.0...HEAD
35
+ [0.1.0]: https://github.com/Syclaw/libcontext/releases/tag/v0.1.0
@@ -0,0 +1,166 @@
1
+ # Contributing to libcontext
2
+
3
+ Thank you for your interest in contributing to **libcontext**! This guide will help you get started.
4
+
5
+ ## Code of Conduct
6
+
7
+ By participating in this project, you agree to maintain a respectful and inclusive environment for everyone. Please be kind, constructive, and professional in all interactions.
8
+
9
+ ## Getting Started
10
+
11
+ ### Prerequisites
12
+
13
+ - [uv](https://docs.astral.sh/uv/) (recommended installer: `pip install uv` or see [installation docs](https://docs.astral.sh/uv/getting-started/installation/))
14
+ - Python 3.9 or later
15
+ - Git
16
+
17
+ ### Setting Up Your Development Environment
18
+
19
+ 1. **Fork the repository** on GitHub.
20
+
21
+ 2. **Clone your fork:**
22
+
23
+ ```bash
24
+ git clone https://github.com/<your-username>/libcontext.git
25
+ cd libcontext
26
+ ```
27
+
28
+ 3. **Install dependencies and set up the project:**
29
+
30
+ ```bash
31
+ uv sync
32
+ ```
33
+
34
+ 4. **Verify tests pass:**
35
+
36
+ ```bash
37
+ uv run pytest
38
+ ```
39
+
40
+ ## Making Changes
41
+
42
+ ### Branching Strategy
43
+
44
+ - Create a feature branch from `main`:
45
+ ```bash
46
+ git checkout -b feature/my-feature
47
+ ```
48
+ - Use descriptive branch names: `feature/...`, `fix/...`, `docs/...`
49
+
50
+ ### Code Style
51
+
52
+ - Follow [PEP 8](https://peps.python.org/pep-0008/) conventions.
53
+ - Use type hints for all public function signatures.
54
+ - Write docstrings in [Google style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) for all public classes, methods, and functions.
55
+ - Keep lines under 88 characters (Black default).
56
+
57
+ ### Writing Tests
58
+
59
+ - All new features and bug fixes must include tests.
60
+ - Tests are located in the `tests/` directory.
61
+ - Run the full test suite before submitting:
62
+ ```bash
63
+ uv run pytest -v
64
+ ```
65
+ - Run tests with coverage to check for gaps:
66
+ ```bash
67
+ uv run pytest --cov=libcontext --cov-report=term-missing
68
+ ```
69
+
70
+ ### Commit Messages
71
+
72
+ Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
73
+
74
+ ```
75
+ type(scope): short description
76
+
77
+ Longer explanation if needed.
78
+ ```
79
+
80
+ **Types:** `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, `ci`
81
+
82
+ **Examples:**
83
+ - `feat(inspector): add support for TypedDict extraction`
84
+ - `fix(renderer): handle empty module docstrings`
85
+ - `docs: update README with new CLI options`
86
+
87
+ ## Submitting a Pull Request
88
+
89
+ 1. **Ensure all tests pass** and your code follows the project style.
90
+ 2. **Push your branch** to your fork:
91
+ ```bash
92
+ git push origin feature/my-feature
93
+ ```
94
+ 3. **Open a Pull Request** against `main` on the upstream repository.
95
+ 4. **Fill out the PR template** with a description of your changes.
96
+ 5. **Wait for review** — a maintainer will review your PR and may request changes.
97
+
98
+ ### Pull Request Checklist
99
+
100
+ - [ ] Tests added/updated for the change
101
+ - [ ] All tests pass (`uv run pytest`)
102
+ - [ ] Docstrings added/updated for public API changes
103
+ - [ ] CHANGELOG.md updated (for user-facing changes)
104
+
105
+ ## Reporting Issues
106
+
107
+ ### Bug Reports
108
+
109
+ When filing a bug report, please include:
110
+
111
+ - Python version (`python --version`)
112
+ - libcontext version (`uv run python -c "import libcontext; print(libcontext.__version__)"`)
113
+ - Operating system
114
+ - Steps to reproduce
115
+ - Expected vs actual behaviour
116
+ - Full error traceback (if applicable)
117
+
118
+ ### Feature Requests
119
+
120
+ Feature requests are welcome! Please describe:
121
+
122
+ - The problem you're trying to solve
123
+ - Your proposed solution (if any)
124
+ - Any alternatives you've considered
125
+
126
+ ## Project Structure
127
+
128
+ ```
129
+ libcontext/
130
+ ├── src/libcontext/
131
+ │ ├── __init__.py # Public API exports
132
+ │ ├── models.py # Data models (dataclasses)
133
+ │ ├── inspector.py # AST-based source code inspection
134
+ │ ├── collector.py # Package discovery and module walking
135
+ │ ├── config.py # [tool.libcontext] configuration reader
136
+ │ ├── renderer.py # Markdown generation
137
+ │ └── cli.py # CLI entry point (click)
138
+ ├── tests/
139
+ │ ├── test_cli.py
140
+ │ ├── test_collector.py
141
+ │ ├── test_config.py
142
+ │ ├── test_inspector.py
143
+ │ └── test_renderer.py
144
+ ├── pyproject.toml
145
+ ├── README.md
146
+ ├── CONTRIBUTING.md
147
+ ├── CHANGELOG.md
148
+ ├── DEPENDENCIES.md
149
+ └── LICENSE
150
+ ```
151
+
152
+ ## Release Process
153
+
154
+ Releases are managed by the project maintainers. The general process is:
155
+
156
+ 1. Update version in `pyproject.toml` and `src/libcontext/__init__.py`
157
+ 2. Update `CHANGELOG.md` with the new version
158
+ 3. Create a git tag: `git tag v0.x.x`
159
+ 4. Push tag: `git push origin v0.x.x`
160
+ 5. Build and publish to PyPI: `uv build && uv publish`
161
+
162
+ ## Questions?
163
+
164
+ If you have questions about contributing, feel free to [open a discussion](https://github.com/Syclaw/libcontext/discussions) or [create an issue](https://github.com/Syclaw/libcontext/issues).
165
+
166
+ Thank you for helping make libcontext better!
@@ -0,0 +1,52 @@
1
+ # Dependencies and Licenses
2
+
3
+ This document lists all dependencies used by **libcontext** and their respective licenses.
4
+
5
+ ## Runtime Dependencies
6
+
7
+ | Package | Version | License | Description |
8
+ |---------|---------|---------|-------------|
9
+ | [click](https://pypi.org/project/click/) | >=8.0 | BSD-3-Clause | Composable command line interface toolkit. |
10
+ | [tomli](https://pypi.org/project/tomli/) | >=1.0 | MIT | A lil' TOML parser. Only required for Python < 3.11 (replaced by `tomllib` in the standard library). |
11
+
12
+ ## Development Dependencies
13
+
14
+ | Package | Version | License | Description |
15
+ |---------|---------|---------|-------------|
16
+ | [pytest](https://pypi.org/project/pytest/) | >=7.0 | MIT | Testing framework. |
17
+ | [pytest-cov](https://pypi.org/project/pytest-cov/) | >=4.0 | MIT | Coverage plugin for pytest. |
18
+ | [ruff](https://pypi.org/project/ruff/) | >=0.4.0 | MIT | Fast Python linter and formatter (replaces flake8, isort, black, pyupgrade). |
19
+ | [mypy](https://pypi.org/project/mypy/) | >=1.10 | MIT | Static type checker for Python. |
20
+
21
+ ## Build Dependencies
22
+
23
+ | Package | Version | License | Description |
24
+ |---------|---------|---------|-------------|
25
+ | [hatchling](https://pypi.org/project/hatchling/) | * | MIT | Build backend (PEP 517). |
26
+
27
+ ## Standard Library Modules Used
28
+
29
+ The following standard library modules are used and require **no additional installation**:
30
+
31
+ - `ast` — Abstract Syntax Trees (core of the inspection engine)
32
+ - `importlib.metadata` — Package metadata access
33
+ - `importlib.util` — Package location discovery
34
+ - `dataclasses` — Data model definitions
35
+ - `pathlib` — Filesystem path handling
36
+ - `logging` — Diagnostic logging
37
+ - `sys` — System-specific parameters
38
+ - `io` — I/O handling (UTF-8 stdout wrapper)
39
+ - `tomllib` — TOML parsing (Python 3.11+, replaces `tomli`)
40
+
41
+ ## License Compatibility
42
+
43
+ All dependencies use permissive open-source licenses (MIT, BSD-3-Clause) that are fully compatible with libcontext's MIT license. There are no copyleft or restrictive license requirements.
44
+
45
+ ## Updating This Document
46
+
47
+ When adding new dependencies, please update this file accordingly. You can verify installed dependency licenses with:
48
+
49
+ ```bash
50
+ pip install pip-licenses
51
+ pip-licenses --packages click tomli pytest pytest-cov hatchling
52
+ ```
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jonathan VARELA
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.