Skip to content

About

VS Code extension — inline update hints and one-click upgrades for requirements.txt and pyproject.toml, with major-version warnings

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

91 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Dependencies Updater

Smart version management for Python requirements.txt and pyproject.toml files with one-click updates and breaking change detection.

Marketplace Version Downloads License: MIT CI

✨ Features

  • 🔍 Smart Version Detection - Automatically detects requirements.txt and pyproject.toml files and displays version information
  • 🎯 Risk Analysis - Distinguishes between safe updates (patch/minor) and risky updates (major versions)
  • 🖱️ One-Click Updates - Click on version hints to update to the latest version instantly
  • 🧠 Constraint-Aware Suggestions - Suggestions respect each dependency's own specifier (==, >=, ~=, ==1.2.* wildcards, environment markers)
  • 💬 Hover Details - Hover a dependency to see its PyPI summary and latest version
  • ⚠️ Safety Confirmation - Shows confirmation dialogs for major version updates to prevent breaking changes
  • 📊 Status Bar Display - Real-time display of updatable package count
  • 🌍 Multi-language Support - Supports Chinese, English, Japanese, Korean, and more languages
  • 💾 Smart Caching - Reduces network requests and improves response speed
  • 📦 Modern Python Projects - Full support for pyproject.toml with [project] dependencies and [project.optional-dependencies]

🚀 Installation

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "Python Dependencies Updater"
  4. Click Install

Or install from command line:

code --install-extension cookabc.python-dependencies-updater

🚀 Usage

requirements.txt Files

  1. Open any requirements.txt file
  2. The extension automatically shows status for each dependency:
    • ✓ Up to date - Package is already latest version
    • ↗ Update to X.X.X - Safe update available (click to update)
    • ⚠️ Update to X.X.X Major - Major version update (use caution)

pyproject.toml Files

  1. Open any pyproject.toml file with [project] dependencies
  2. The extension supports both:
    • Main dependencies in [project] section
    • Optional dependencies in [project.optional-dependencies] sections
  3. Shows the same version information and update capabilities

Batch Updates

  • Click the status bar update notification
  • Or use Command Palette: Ctrl+Shift+P → "Update All Packages"
  • Automatically separates safe updates from risky major version updates

⚙️ Configuration

Setting Default Description
pyDepsHint.enabled true Enable/disable the extension
pyDepsHint.showPrerelease false Include pre-release versions
pyDepsHint.cacheTTLMinutes 60 Cache TTL in minutes
pyDepsHint.supportPyProject true Enable/disable pyproject.toml support
pyDepsHint.registryUrl https://pypi.org Custom registry exposing the PyPI JSON API

🏗️ Project Structure

src/
├── core/           # Core business logic
│   ├── cache.ts           # Cache management
│   ├── parser.ts          # Dependency parsing (requirements.txt)
│   ├── pyprojectParser.ts # pyproject.toml parsing
│   ├── unifiedParser.ts   # Unified parser for both formats
│   ├── versionAnalyzer.ts # Version risk analysis
│   └── versionResolver.ts # Version resolution
├── providers/      # Service providers
│   ├── codeLensProvider.ts # CodeLens provider
│   ├── pypiClient.ts      # PyPI API client
│   └── versionService.ts  # Version service
├── utils/          # Utility functions
│   ├── configuration.ts   # Configuration management
│   ├── i18n.ts           # Internationalization
│   └── statusBar.ts      # Status bar management
├── types/          # Type definitions
│   └── index.ts
└── extension.ts    # Extension entry point

🛠️ Development

# Install dependencies
npm install

# Compile
npm run compile

# Run tests
npm test

# Package extension
npx vsce package

🆕 pyproject.toml Support

Starting from v1.1.0, this extension now supports modern Python project files! It can parse and update dependencies in pyproject.toml files, supporting:

Supported Sections

  • [project] - Main dependencies
  • [project.optional-dependencies] - Optional dependency groups

Example pyproject.toml

[project]
name = "my-project"
version = "1.0.0"
dependencies = [
    "fastapi==0.116.1",
    "sqlalchemy==2.0.43",
    "pydantic==2.11.7",
]

[project.optional-dependencies]
dev = [
    "pytest>=7.0.0",
    "black>=23.0.0",
]

The extension will automatically detect pyproject.toml files and provide the same smart version checking and update capabilities as for requirements.txt files.

Scope notes: only PEP 621 tables ([project] / [project.optional-dependencies]) are parsed — Poetry's [tool.poetry.dependencies] is not supported yet. Both multi-line and single-line dependency arrays work; each dependency is updated in place without touching its neighbours on the same line.

🚀 Publishing

Automated: pushing a version tag runs tests, publishes to both marketplaces and attaches the VSIX to a GitHub Release. Publishing uses OIDC trusted publishing — register the repository + workflow once on each marketplace (no token stored as a secret); VSCE_PAT / OVSX_PAT secrets still work as a fallback:

git tag v<package.json version> && git push origin v<package.json version>

Manual local publish (reads .env with VSCE_PAT / OVSX_PAT):

# Publish to both VS Code Marketplace and OpenVSX
./publish.sh all

# Publish to VS Code Marketplace only
./publish.sh vsx

# Publish to OpenVSX only
./publish.sh ovsx

Prerequisites: Azure DevOps Personal Access Token with Marketplace permissions. See VS Code Publishing Docs for setup details.

�📄 License

MIT

About

VS Code extension — inline update hints and one-click upgrades for requirements.txt and pyproject.toml, with major-version warnings

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages