UV#61
Conversation
zagy
left a comment
There was a problem hiding this comment.
The documentation is a lot and it is very redundant. It doesn't help this way.
Also I stopped review at "fix_whitespace.py". There is o much noise here that It's really hard to review.
The commits need to be squashed to a useful amount.
Functionality itself seems to be there and working (in my tests) alas the repo is almost unmaintainable currently.
| def main(): | ||
| # 1. Ensure correct Python version | ||
| ensure_best_python(base) | ||
|
|
||
| # 2. Clear PYTHONPATH for isolation | ||
| os.environ.pop("PYTHONPATH", None) | ||
|
|
||
| # 3. Dispatch to run or meta commands | ||
| appenv = AppEnv(base, original_cwd) | ||
| if application_name == "appenv": | ||
| appenv.meta(remaining) | ||
| else: | ||
| appenv.run(application_name, remaining) | ||
| ``` |
There was a problem hiding this comment.
I don't think this is very useful here. It will get out of date.
There was a problem hiding this comment.
I don't understand this file apart from being an AI code generation artefact.
9f683b0 to
9f744c2
Compare
8024e92 to
fed46a5
Compare
| ### PR Checklist | ||
|
|
||
| - [ ] Tests pass: `uv run pytest` | ||
| - [ ] Linting passes: `uv run ruff check .` | ||
| - [ ] Formatting correct: `uv run ruff format --check .` | ||
| - [ ] Type checking passes: `uv run ty check .` | ||
| - [ ] Documentation updated (if applicable) | ||
|
|
There was a problem hiding this comment.
This doesn't make sense here. If there was a checklist put it into the proper github template.
There was a problem hiding this comment.
Uhm, is this used anywhere? We usually use pre-commit to achieve this.
|
|
||
| # You can set these variables from the command line. | ||
| SPHINXOPTS ?= | ||
| SPHINXBUILD ?= sphinx-build |
There was a problem hiding this comment.
this would need to be installed somehow … don't we have UV now?
5d42002 to
3750be2
Compare
Replace setup.py/setup.cfg/pytest.ini/tox.ini/requirements.txt with pyproject.toml + uv.lock. Add new CLI commands: migrate, version, uv. Improve init to merge into existing pyproject.toml and support --path/uvx. Deprecate 'run' subcommand in favor of uv run and symlink dispatch. Fix symlink handling: helpful errors when binary not found, warn on non-symlink .venv, clean up dangling current symlinks after migration. Add Sphinx documentation with Furo theme, MyST parser, and autoapi: user guide (commands, installation, workflows), developer guide (architecture, contributing), and .readthedocs.yaml. Restructure test suite with pytest markers (unit/integration/slow), new test modules (test_main, test_migrate, test_uv_bin, test_cli, test_subprocess), and .pyi type stubs for all test modules. Consolidate CI workflows (lint.yml into main.yml), remove bootstrap scripts, update example from requirements.txt to pyproject.toml. Quality audit: ruff green, ty green, tests green, e2e orange (B+ 87/100).
migrate now replaces ./appenv when the running version differs from the on-disk version, keeping projects in sync. Prints old -> new version on update. init retains existing behavior (no overwrite).
init now prints a warning when ./appenv exists with a different version than the running appenv, suggesting migrate to update. Refactored _ensure_appenv_script: update=True replaces, update=False warns on version mismatch. Added docs and test.
targets.wheel.packages = ['src'] conflicted with sources = ['src'], causing uv tool install to produce a broken wheel where the appenv module was not importable at top level.
Scripts without __version__ are definitively older than the running appenv. migrate now replaces them (shows 'unknown -> X.Y.Z'), init warns about them. Previously these were silently skipped.
Logs local vs running version and skip/update/warn decision when APPENV_VERBOSE is set.
…E501 - Remove type annotations from _extract_version, _uv_sync (kept in .pyi stub) - Use cast() for extras variable to satisfy ty without runtime annotation - Fix E501 line-too-long in test_migrate.py by splitting f-string - Fix hatch build config for single-file module (targets.wheel.packages)
Six decisions: duplicate-logging fix, stale-venv recreate, ensure-best-python logging, error message improvement, gitignore setup, TDD test strategy.
- fix(logging): clear handlers in setup_logging to prevent duplicates - feat(venv): add stale-venv Python version compatibility check - feat(logging): add debug logging to ensure_best_python version selection - fix(error): restructure no-Python-found error message with constraint label - feat(gitignore): add ensure_gitignore function, call from init/migrate - test: add 16 spec validation tests in tests/impl_spec/ Plus docs updates and test assertion fixes for new error format.
When installed as a package (uvx, pip, uv run), appenv runs inside a venv. The re-exec mechanism breaks these installations because it re-executes with a system Python that doesn't have appenv installed.
Tests run inside tox venvs so sys.prefix != sys.base_prefix. Mock both to simulate standalone script mode. Add test for the venv skip behavior itself.
Extract shared fixtures into conftest.py, add comprehensive E2E command tests and mock HTTP server for GitHub release download path. Enable parallel coverage with subprocess patching in pyproject.toml.
- installation.md: condensce two-sentence paragraph into one (Art. 1) - workflows.md: remove redundant prose under migrate console block (Art. 1) - commands.md: add working directory note for uvx appenv migrate (Art. 5)
- dev/index.md: replace duplicated exit codes with cross-reference to commands.md; consolidate symlink dispatch explanations; trim sync modes - user/commands.md: remove implementation details from prepare command; add --prerelease allow hint to uvx sections for migrate and self-update - user/installation.md: rewrite uvx section in README style (what just happened, directory layout); add --prerelease allow - user/workflows.md: replace self-update duplication with cross-reference; trim migrate and python selection sections; add --prerelease allow to new project workflow
Top-level --help now explains the mental model: appenv lives as a single script in the project, 'init' creates it there. 'init' supports non-interactive use with --binary, --dep (repeatable), --name, --python-version. When no TTY is detected and required flags are missing, prints a clear error with usage example. ensure_pyproject error now mentions 'uvx appenv' vs local ./appenv confusion explicitly. Tests: autouse _fake_tty fixture ensures interactive init works in test environment.
- Replace {doc} with {ref} for section-anchor references (not supported by {doc})
- Add explicit labels (exit-codes, migrate, self-update) in commands.md
- Remove empty toctree from dev/index.md (navigation no longer shows empty arrow)
- Add uv link and system-safety note to docs/index.md
--binary, --dep, --name, --python-version were added in ab233ed but the docs only described the interactive wizard. Now covers both modes, the options table, and the no-TTY error behavior.
Commands reference: replace 'Nothing to do' section with before/after example showing additive dependency merge and pre-filled prompts. Document Python <3.11 fallback behavior. Dev guide: add 'Conditional tomllib' to design philosophy bullet list.
Three tests documenting expected behavior from docs/user/commands.md: - test_init_existing_project_reads_values_with_tomllib: interactive mode reads current values, pre-fills prompts, appends deps - test_init_existing_project_noninteractive_additive_with_tomllib: --dep appends to existing dependencies instead of replacing - test_init_existing_project_no_tomllib_refuses: without tomllib, init still refuses (current behavior preserved) All fail — implementation of conditional tomllib import in init() pending.
When pyproject.toml already has a [project] section and appenv runs on Python 3.11+, init now reads current values via tomllib and pre-fills its prompts. Dependencies are additive — new entries get appended. Non-interactive mode (--dep) also appends to existing dependencies. On Python 3.9-3.10 (no tomllib), init still refuses with the existing Nothing to do message. - Conditional tomllib import (try/except, stdlib only) - Pyproject.read_existing_project() parses [project] via tomllib - Pyproject._replace_project_section() replaces instead of appending - init() pre-fills interactive prompts with current values - 3 tests promoted from xfail to passing
Non-interactive init only requires --binary when pyproject.toml already has dependencies. --dep adds to existing ones, or can be omitted entirely.
When pyproject.toml already has dependencies, --binary alone should suffice for non-interactive init. Currently fails because has_all_required still demands --dep.
When pyproject.toml already has dependencies (Python 3.11+ / tomllib), --binary is enough for non-interactive mode. Existing deps are preserved as-is; --dep is optional and adds on top. - Adjusted has_all_required to check for existing deps - Handle args.deps=None gracefully in merge logic - Promoted test from xfail to regular
The init help string was truncated at 50 chars in `appenv --help`, showing only "Interactive wizard — creates pyproject.toml, sy..." with no hint about non-interactive mode. Now reads: "Create project — interactive, or --binary/--dep." README: mention non-interactive use and add CI example section. Test: verify help text fits in 50 chars and mentions both modes.
docs/index.md: Removed "Project Structure" (repo tree) and "Conventions" sections. Conventions were partly redundant with Core Concepts, partly folded into a single requirement line. Index is now a clean landing page: intro → Core Concepts → requirements → Getting Started. docs/dev/index.md: Added repository layout tree to Development Setup section where it belongs — developers need it, users don't.
No description provided.