A beginner-friendly CLI that checks whether a directory looks like a Python project and suggests what to do next.
Project description
pyenv-doctor
pyenv-doctor is a minimal Python command-line tool for beginners.
It scans a directory, checks whether it looks like a Python project, and tells you whether the current Python interpreter is running inside a virtual environment.
What It Checks
This MVP checks for these common Python project files:
requirements.txtpyproject.tomlsetup.pysetup.cfgPipfilepoetry.lockuv.lockenvironment.yml.python-version
If at least one of them exists, the tool prints:
Conclusion: this looks like a Python project
It also checks whether the current Python is running in a virtual environment. After the scan, it prints a short list of beginner-friendly suggestions based on the result.
Supported common cases:
venvvirtualenvConda
Why Virtual Environments Are Useful
Virtual environments help keep project dependencies isolated. This makes it easier to avoid version conflicts between different Python projects on the same machine.
Project Structure
pyenv-doctor/
|-- .gitignore
|-- .github/
| |-- workflows/
| | |-- ci.yml
| | `-- publish.yml
|-- pyproject.toml
|-- README.md
|-- requirements.txt
|-- LICENSE
|-- main.py
`-- tests/
`-- test_main.py
Installation
1. Make sure Python 3.11 or newer is available
python --version
2. Install from PyPI
The PyPI package name is:
python-project-doctor-cli
Install it with:
python -m pip install python-project-doctor-cli
The installed command name is still:
pyenv-doctor
3. Install locally from source
Clone the repository, enter the project directory, and install it locally:
python -m pip install .
For local development, you can also use editable install:
python -m pip install -e .
Run
Run the installed CLI command:
pyenv-doctor
pyenv-doctor .
pyenv-doctor C:\my-project
pyenv-doctor . --json
Run the tool from source:
python main.py
python main.py C:\my-project
python main.py C:\my-project --json
Windows note for virtual environment detection
If you want to verify virtual environment detection on Windows, activate the virtual environment first and then run:
python main.py
This is recommended because py -3.14 main.py may use the system interpreter instead of the currently activated virtual environment.
Run Tests
Run the test suite with:
python -m unittest discover -s tests -v
Exit Codes
0: the scan completed successfully- non-zero: the scan failed because the path was invalid or the arguments were invalid
JSON Output
Use --json to get machine-readable output:
pyenv-doctor . --json
python main.py . --json
The JSON output includes:
scanned_directoryfound_fileslooks_like_python_projectvirtual_environment_detectederrorsuggestions
Example Output
Example 1: Python project detected, virtual environment detected
Scanned directory: C:\demo\my-project
Project file detection:
- requirements.txt: not found
- pyproject.toml: found
- setup.py: not found
- setup.cfg: not found
- Pipfile: not found
- poetry.lock: found
- uv.lock: not found
- environment.yml: not found
- .python-version: not found
Conclusion: this looks like a Python project
Reason: detected pyproject.toml, poetry.lock
Virtual environment detection:
Virtual environment: detected
Suggestions:
- Open pyproject.toml to check how this project should be installed or run.
- If this project uses Poetry, review pyproject.toml and try poetry install.
Example 2: No project markers, no virtual environment
Scanned directory: C:\demo\empty-folder
Project file detection:
- requirements.txt: not found
- pyproject.toml: not found
- setup.py: not found
- setup.cfg: not found
- Pipfile: not found
- poetry.lock: not found
- uv.lock: not found
- environment.yml: not found
- .python-version: not found
Conclusion: no clear Python project markers were found
Details: common Python project files were not found in this directory.
Virtual environment detection:
Virtual environment: not detected
Recommendation: use venv or Conda for an isolated Python environment
Suggestions:
- Verify that you are scanning the project root directory.
Example 3: Invalid path
Error: path does not exist: C:\does-not-exist
Suggestions:
- Check the path spelling and try again.
Example 4: JSON output
{
"scanned_directory": "C:\\demo\\my-project",
"found_files": [
"Pipfile",
".python-version"
],
"looks_like_python_project": true,
"virtual_environment_detected": false,
"error": null,
"suggestions": [
"Open Pipfile to review the project's dependencies and environment settings.",
"Check .python-version to see which Python version this project expects."
]
}
Publishing
This repository includes a GitHub Actions workflow for trusted publishing to PyPI when a GitHub release is published.
To use it, first add this repository as a trusted publisher in your PyPI project settings. Then create a GitHub release to trigger the publish workflow.
Roadmap
- Improve test coverage
- Improve detection rules for different Python workflows
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_project_doctor_cli-0.1.0.tar.gz.
File metadata
- Download URL: python_project_doctor_cli-0.1.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15e3e8f8f8fc9d6e214d398e5379eba06474ede68b266d299e334703fa7976fb
|
|
| MD5 |
149141a34f7fc194ba7c6a686a935226
|
|
| BLAKE2b-256 |
b4ee2e6b1723e4a78073714154c7964fa66022b8d92b7ae627ae0a5a7ed23f94
|
Provenance
The following attestation bundles were made for python_project_doctor_cli-0.1.0.tar.gz:
Publisher:
publish.yml on x1958075990h-pixel/pyenv-doctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_project_doctor_cli-0.1.0.tar.gz -
Subject digest:
15e3e8f8f8fc9d6e214d398e5379eba06474ede68b266d299e334703fa7976fb - Sigstore transparency entry: 1192022226
- Sigstore integration time:
-
Permalink:
x1958075990h-pixel/pyenv-doctor@457e4b87cc3c8a7345a668f2177f0424b7827712 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/x1958075990h-pixel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@457e4b87cc3c8a7345a668f2177f0424b7827712 -
Trigger Event:
release
-
Statement type:
File details
Details for the file python_project_doctor_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: python_project_doctor_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0aa6479638febd07b955e771a17395d5897ea460e30d6a1a184a677f0900463
|
|
| MD5 |
693addf08cf3b73c36fdce8f38342720
|
|
| BLAKE2b-256 |
5b546872975939237846ab0e9fe73576550a0d59c7d5d21c2552bb491908e214
|
Provenance
The following attestation bundles were made for python_project_doctor_cli-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on x1958075990h-pixel/pyenv-doctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_project_doctor_cli-0.1.0-py3-none-any.whl -
Subject digest:
c0aa6479638febd07b955e771a17395d5897ea460e30d6a1a184a677f0900463 - Sigstore transparency entry: 1192022228
- Sigstore integration time:
-
Permalink:
x1958075990h-pixel/pyenv-doctor@457e4b87cc3c8a7345a668f2177f0424b7827712 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/x1958075990h-pixel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@457e4b87cc3c8a7345a668f2177f0424b7827712 -
Trigger Event:
release
-
Statement type: