Python
Support for Python projects using requirements.txt and pyproject.toml.
Table of contents
- Supported Files
- Registry
- requirements.txt Format
- pyproject.toml Format
- Version Specification
- Special Cases
- Vulnerability Database
- Example Files
- Troubleshooting
Supported Files
| File | Description |
|---|---|
requirements.txt |
pip requirements file |
pyproject.toml |
PEP 517/518 project file |
Registry
PyPI - The Python Package Index
- Base URL:
https://pypi.org/pypi - Rate limit: ~20 requests per second
- Documentation: pypi.org
requirements.txt Format
Basic Syntax
requests==2.31.0
flask>=2.0.0
django>=4.0,<5.0
With Comments
# Web framework
flask>=2.0.0
# HTTP library
requests==2.31.0 # pinned for compatibility
With Extras
requests[security]==2.31.0
celery[redis,auth]>=5.0.0
Editable Installs
-e git+https://github.com/user/repo.git#egg=package
Editable installs show → Git hint.
pyproject.toml Format
PEP 621 (Standard)
[project]
dependencies = [
"requests>=2.31.0",
"flask>=2.0.0",
]
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"black>=23.0.0",
]
Poetry
[tool.poetry.dependencies]
python = "^3.11"
requests = "^2.31.0"
flask = "^2.0.0"
[tool.poetry.dev-dependencies]
pytest = "^7.0.0"
Setuptools (Legacy)
[options]
install_requires =
requests>=2.31.0
flask>=2.0.0
Version Specification
Python uses PEP 440 version specifiers:
| Syntax | Meaning |
|---|---|
==1.0.0 |
Exactly 1.0.0 |
>=1.0.0 |
1.0.0 or higher |
<=1.0.0 |
1.0.0 or lower |
~=1.0.0 |
>=1.0.0, <1.1.0 (compatible) |
>=1.0,<2.0 |
Range |
!=1.0.0 |
Not 1.0.0 |
* |
Any version |
Special Cases
Name Normalization
PyPI normalizes package names per PEP 503:
Flask=flasktyping_extensions=typing-extensions
Dependi handles normalization automatically.
Pre-release Versions
flask>=2.0.0a1
requests>=2.31.0rc1
Pre-release versions (alpha, beta, rc) are tracked separately.
Development Status
Packages marked with classifier Development Status :: 7 - Inactive show as deprecated.
Yanked Versions
Yanked versions on PyPI show ⊘ Yanked hint.
Vulnerability Database
Python vulnerabilities are sourced from:
- PyPA Advisory Database
- GitHub Security Advisories
- Safety DB
Example Files
requirements.txt
# Production dependencies
requests==2.31.0 # ✓
flask>=2.0.0 # -> 3.0.0
django>=4.0,<5.0 # ✓
sqlalchemy>=2.0.0 # ✓
# Development
pytest>=7.0.0 # -> 7.4.0
black>=23.0.0 # ✓
pyproject.toml
[project]
name = "my-project"
version = "1.0.0"
dependencies = [
"requests>=2.31.0", # ✓
"flask>=2.0.0", # -> 3.0.0
"pydantic>=2.0.0", # ✓
]
[project.optional-dependencies]
dev = [
"pytest>=7.0.0", # -> 7.4.0
"ruff>=0.1.0", # ✓
]
Troubleshooting
Package Not Found
- Check package name spelling (remember normalization)
- Verify the package exists on PyPI
- Check network connectivity to pypi.org
Wrong Version Shown
- PyPI may have multiple releases per version
- Clear cache and restart Zed
- Check if package uses non-standard versioning
requirements.txt Not Parsed
- Ensure standard format (no unusual characters)
- Check for BOM or encoding issues
- Remove any complex pip options