Automate your Python project lifecycle: scaffolding, dependencies, virtual environments, execution, and deployment preparation.
- Automated setup: Detects
pyproject.tomlorrequirements.txtand manages.venvautomatically. - Smart Execution: Runs servers (Uvicorn), scripts, and tests inside the environment without activation headaches.
- Project Hygiene: Built-in formatters, pre-commit hooks, and deep cleaning tools.
- Production Ready: Generates Dockerfiles, Lockfiles, and audits security.
| Feature | Command |
|---|---|
| Initialize Project | pyclit --template <type> |
| Setup Environment | pyclit -v |
| Run Server | pyclit --run UVICORN |
| Run Tests | pyclit --run PYTEST |
| Run Scripts (Proxy) | pyclit --runp main.py |
| Format Code | pyclit --style |
| Install Hooks | pyclit --hooks |
| Clean Artifacts | pyclit --clean |
| Dockerize | pyclit --dockerize |
| Audit Health | pyclit --health |
# 1. Create a new FastAPI project
pyclit --template fastapi
# 2. Setup venv and install dependencies
pyclit -v -toml
# 3. Format verify code style
pyclit --style
# 4. Run tests
pyclit --run PYTEST
# 5. Start the server with Ngrok tunnel
pyclit --run UVICORN -ngrokIsolate the tool from your system python:
pipx install .pip install -e .Verify:
pyclit --helpNote on Windows: The tool automatically handles Scripts/python.exe vs bin/python differences.
Project Detection
pyclit scans for pyproject.toml (Type: TOML) or requirements.txt (Type: REQ) to determine how to install dependencies (supporting Poetry, uv, and pip).
Virtual Environments
By default, pyclit operates on a .venv directory in your project root. It invokes the python executable inside .venv directly, so you never need to run source .venv/bin/activate.
Python Resolution
Flag -version attempts to resolve the best Python version using pyenv and [project] requires-python metadata.
Non-Destructive
Most operations check before overwriting. Use --dry-run to preview actions.
-v: Ensure.venvexists.-req: Force install fromrequirements.txt.-toml: Force install frompyproject.toml(tries Poetry -> uv -> pip).-version: Resolve generic Python version via pyenv.
--run UVICORN: Starts Uvicorn. Auto-detectsapp = FastAPI().- usage:
pyclit --run UVICORN -ip 0.0.0.0 -port 8080
- usage:
--run PYTEST: Runs pytest in venv.- usage:
pyclit --run PYTEST -- -v -k mytest(pass args after--)
- usage:
--run <script.py>: Runs a python script using venv python.--run "<command>": Runs a shell command string with venv in PATH.--runp <target>: Proxy Run. Runs a command/script without checking install state. ideal for quick tasks likepyclit --runp pip list.-ngrok: Exposes UVICORN port via ngrok (requiresngrokin PATH).
--style/--format: Runs formatters. Prefersruffif available, falls back toblack+isort.--hooks: Installspre-commithooks for the repo.
--clean/--nuke: Removes__pycache__,.pytest_cache,dist,build, etc.--rebuild-venv: When paired with--clean, deletes and recreates.venv.
--template <type>: Generates project structure. Types:fastapi,data,cli.pyclitauto-generates a robust.gitignorewhen templating.
--dockerize: Creates an optimizedDockerfile.--lock: Generatesrequirements.lockusingpip-tools(hash-checking) orpip freeze.--health: Checks for Python version mismatches and known vulnerabilities (viapip-auditorsafety).
Initialize environment and install dependencies:
pyclit -v -req
pyclit --run main.pyDetects TOML, installs, and runs server:
pyclit -v -toml --run UVICORNRun all tests with verbose output:
pyclit --run PYTEST -- -vNuclear option to clean caches and reinstall environment:
pyclit --clean --rebuild-venv --yesGenerate lockfile and Dockerfile:
pyclit -v --lock
pyclit --dockerizepyenvnot found: Ensurepyenvis in your PATH if using-version.- Ngrok error: You need
ngrokinstalled and authenticated. - Entrypoint not detected:
pyclitlooks forapp = FastAPI()in common paths. If not found, use--run "uvicorn my.app:app ...". - Permissions: On Windows, ensure you are not locking files in
.venvwhen running--clean.
pyclit is a wrapper, not a replacement. It delegates to best-in-class tools (pip, uv, ruff, docker) rather than reinventing them. It prioritizes "working by default" over complex configuration.
# Run internal tests
python -m unittest discover tests