feat(distribution): pip-installable package + PyPI publish workflow (closes #54 phase-1)#144
Closed
Wolfvin wants to merge 1 commit into
Closed
feat(distribution): pip-installable package + PyPI publish workflow (closes #54 phase-1)#144Wolfvin wants to merge 1 commit into
Wolfvin wants to merge 1 commit into
Conversation
…loses #54 phase-1) Issue #54 Phase 1 — Python package + PyPI distribution: 1. codelens/ package (codelens/__init__.py, codelens/__main__.py): - Thin wrapper that delegates to scripts/codelens.py - Resolves scripts/ dir at runtime (source checkout or installed) - main() function loads legacy codelens.py via importlib - __version__ = '8.2.0' for programmatic access 2. pyproject.toml updates: - [project.scripts] codelens = codelens:main entry point - [tool.setuptools.packages.find] includes codelens/ + scripts/ subpackages - scripts/codelens.py excluded from py-modules (would shadow package) 3. setup.py: - Explicitly lists top-level .py modules from scripts/ (excluding codelens.py) - Prevents setuptools auto-discovery from creating conflicting 'codelens' module 4. scripts/codelens.py: - Legacy mode (python3 scripts/codelens.py) prints DeprecationWarning - Points users to 'codelens' console command after pip install - Fully backward compatible — legacy mode still works 5. .github/workflows/publish-pypi.yml: - Triggers on tag push (v*.*.*) - Builds sdist + wheel via 'python -m build' - Publishes to PyPI via trusted publishing (OIDC, no token needed) - TestPyCI publish on manual dispatch 6. docs/install.md: - Documents 4 install methods: pip, pipx, python -m, from source - Optional extras table (grammars, rules, watch, lsp, dev, all) - Troubleshooting section 7. Synced docs (README, SKILL.md, SKILL-QUICK.md, graph_model.py): - Command count 68 -> 69, MCP tools 66 -> 67 (from prior PRs) Verified: - 'codelens --command-count' works (69 commands) - 'python -m codelens --command-count' works - 'import codelens; codelens.__version__' works (8.2.0) - 'python3 scripts/codelens.py' works with deprecation warning - 'codelens init/scan' end-to-end works via pip install - Test suite: 1347 passed, 76 skipped, 0 failed (no regressions)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Closed
6 tasks
|
This was referenced Jul 2, 2026
Merged
Owner
Author
Wolfvin
added a commit
that referenced
this pull request
Jul 3, 2026
…ulti-arch (refs #54) Phase 2 of issue #54 — container image distribution for CodeLens. Files added: - Dockerfile (minimal): python:3.11-slim + tree-sitter core + 6 grammars + watchdog + PyYAML. Non-root codelens user (UID 1000). HEALTHCHECK via 'codelens --command-count' (exercises full command-registry import path). ENTRYPOINT is a /usr/local/bin/codelens wrapper -> python3 scripts/codelens.py (forward-compatible: Phase 1 PR #144 will replace with console script). - Dockerfile.maximal: minimal + all Python extras (grammars/watch/rules/lsp/dev) + pre-installed LSP servers (python-lsp-server, ruff-lsp, pyright, typescript-language-server) + Node.js LTS. Enables '--deep' out of the box for Python and JS/TS. Full LSP coverage pending native LSP server issue. - .dockerignore: excludes .git, tests, benchmarks, vscode-codelens, __pycache__, .codelens runtime state, build artifacts to keep build context lean. - .github/workflows/docker-publish.yml: multi-arch (linux/amd64 + linux/arm64) buildx pipeline. Matrix builds minimal + maximal. Pushes to GHCR (ghcr.io/wolfvin/codelens) with tags: :latest, :sha-<short>, :v<x.y.z>, :maximal-latest. GHA cache per variant. Smoke-test step on minimal. Triggers: push to main (Dockerfile/scripts changes), tags v*, workflow_dispatch. - docs/installation/docker.md: usage guide — quick start, image variants, persistence volume, shell alias, --deep LSP mode, MCP server, health check, multi-arch, local build, tagging strategy, troubleshooting. Acceptance criterion met: docker run --rm -v "$(pwd):/workspace" ghcr.io/wolfvin/codelens scan /workspace Test baseline: 1398 passed, 76 skipped, 1 failed (pre-existing test_codelensignore failure, unrelated to this change — only new files added, no Python modifications). Docker build not tested locally (docker not in sandbox); CI workflow will validate on push. Phase 1 (PR #144 pip-installable) not yet merged — Dockerfile built on current main (entry point python3 scripts/codelens.py). When Phase 1 merges, update Dockerfile to 'pip install .' + drop wrapper script. Noted in Dockerfile header. Findings: - pyproject.toml lines 77-79 confirm no console-script entry point exists yet (Phase 1 will add [project.scripts] codelens = ...). Wrapper script bridges this gap so the acceptance-criterion command works today. - No --version flag on codelens CLI; used --command-count for HEALTHCHECK (deeper check — verifies command registry + grammar imports load).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Closes #54 (Phase 1 only — Python package + PyPI)
What
Implements Phase 1 of issue #54: makes CodeLens pip-installable and adds a PyPI publish workflow.
Changes
New:
codelens/packagecodelens/__init__.py— thin wrapper that delegates toscripts/codelens.pycodelens/__main__.py— enablespython -m codelensscripts/dir at runtime (works in source checkout AND installed package)main()function loads legacycodelens.pyvia importlib__version__ = "8.2.0"for programmatic accesspyproject.toml[project.scripts] codelens = "codelens:main"— console entry point[tool.setuptools.packages.find]includes bothcodelens/andscripts/subpackages (commands, formatters, parsers, plugins)scripts/codelens.pyexcluded from auto-discovery (would shadow the package)setup.py(new).pymodules fromscripts/(excludingcodelens.py)codelensmodulescripts/codelens.pypython3 scripts/codelens.py) now prints aDeprecationWarningpointing to thecodelensconsole command.github/workflows/publish-pypi.yml(new)v*.*.*)python -m buildworkflow_dispatchdocs/install.md(new)pip install,pipx install,python -m codelens, from sourcegrammars,rules,watch,lsp,dev,all)Synced docs
README.md,SKILL.md,SKILL-QUICK.md,scripts/graph_model.py— command count 68→69, MCP tools 66→67 (from prior PRs, needed for consistent package metadata before PyPI publish)Verification
All 4 install methods tested and working:
End-to-end scan via pip install:
Test suite: 1347 passed, 76 skipped, 0 failed (no regressions)
Acceptance criteria status
pip install codelensworks on Python 3.8+ (tested 3.12)python3 scripts/codelens.pystill works (with deprecation warning)publish-pypi.yamlon tag pushNot in this PR (future phases)
docker run ghcr.io/wolfvin/codelens)codelens upgrade)Test plan
codelensconsole command works afterpip install -e .python -m codelensworksimport codelensreturns correct__version__python3 scripts/codelens.pyworks with deprecation warningcodelens init+codelens scanend-to-end worksSetup required before first PyPI publish
Wolfvin/CodeLensPublish to PyPIpypipypienvironment in GitHub repo settings (Settings → Environments)git tag v8.3.0 && git push --tags