Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,8 @@

from __future__ import annotations

import platform
import shutil
import sys
from collections.abc import Awaitable, Callable
from pathlib import Path
Expand DownExpand Up@@ -38,9 +40,22 @@ async def check_for_latest_version(package_name: str) -> str | None:


def print_env_info() -> None:
"""Print environment info then exit. Full implementation in #30."""
print(f"create-python-app-core {__version__}")
print(f"Python {sys.version}")
"""Print OS/Python/uv tooling versions for bug reports."""
uv = shutil.which("uv")
git = shutil.which("git")
print(f"create-python-app-core: {__version__}")
print(f"Python: {sys.version.split()[0]} ({sys.executable})")
print(f"Platform: {platform.platform()}")
print(f"uv: {uv or 'not found'}")
print(f"git: {git or 'not found'}")
if uv:
import subprocess

try:
out = subprocess.check_output(["uv", "--version"], text=True).strip()
print(f"uv version: {out}")
except OSError:
pass
raise SystemExit(0)


Expand Down
11 changes: 11 additions & 0 deletions packages/create-python-app-core/tests/test_env_info.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
import pytest
from create_python_app_core.api import print_env_info


def test_print_env_info_exits(capsys: pytest.CaptureFixture[str]) -> None:
with pytest.raises(SystemExit) as ei:
print_env_info()
assert ei.value.code == 0
out = capsys.readouterr().out
assert "Python:" in out
assert "Platform:" in out