Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Requirements Auto SortNew to Visual Studio Code? Get it now.
Requirements Auto Sort

Requirements Auto Sort

WillemSeethaler

|
73 installs
| (0) | Free
An auto sorter for the requirements.txt file on save.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Requirements Auto Sort README

Version License Tests Status

Table of Contents

  • Features
  • Installation
  • Usage
  • Examples
  • Configuration Settings
  • Release Notes
  • License
  • Support

Requirements Auto Sort is a Visual Studio Code extension that automatically sorts the contents of requirements.txt files. The extension can be triggered either by saving the file or by manually running a command from the Command Palette.

Features

  • Automatic Sorting on Save: Sorts your requirements.txt file alphabetically every time you save it.
  • Comment Retention: Keeps comments associated with the relevant requirement and places them above the requirement.
  • Manual Sorting Command: Use the Sort Requirements command from the Command Palette to sort manually.

Installation

From the VS Code Marketplace

  • Open Visual Studio Code.
  • Navigate to the Extensions view by clicking on the Extensions icon in the Activity Bar or pressing Ctrl+Shift+X (Cmd+Shift+X on macOS).
  • Search for Requirements Auto Sort.
  • Click Install.

From Source

  • Clone the repository
git clone https://github.com/WCS19/RequirementsAutoSort.git
  • Navigate to the extension directory
cd RequirementsAutoSort
  • Install dependencies
npm install
  • Open the project in VS Code
code .
  • Press F5 to launch the extension in a new Extension Development Host window.

Usage

Automatic Sorting on Save

  • Simply save your requirements.txt file, and the extension will automatically sort its contents alphabetically, preserving associated comments.

Manual Sorting Command

  • Open the requirements.txt file you wish to sort.
  • Open the Command Palette by pressing Ctrl+Shift+P (Cmd+Shift+P on macOS).
  • Type Sort Requirements and select the Sort Requirements command.
  • The file will be sorted, and a success notification will appear.

Configuration Settings

  • Still In Development

Examples

Example Before Sorting

flask==1.1.1
# Comment about pandas
pandas==1.2.0
# Comment about numpy
numpy==1.19.3

Example After Sorting

# Comment about numpy
numpy==1.19.3
# Comment about pandas
pandas==1.2.0
flask==1.1.1
  • GIF examples coming soon

Requirements

This extension requires:

  • Visual Studio Code: Version 1.96.0 or higher.
  • A valid requirements.txt file in your workspace.
  • Note: The file must be named exactly "requirements.txt". This extension was developed and tested on VS Code version 1.96.2. Compatibility with earlier versions has not been verified.

Release Notes

Please refer to the CHANGELOG file for detailed release notes.

Version 0.1.0

  • Initial release of Requirements Auto Sort.

Version 0.2.0

  • Release Date: 2024-12-31

Upcoming Features

  • Future releases will introduce customizable sorting options, enabling users to select ascending or descending order and tailor how comments, package pairs, duplicates, and other elements are managed.

License

This project is licensed under the MIT License

Support

If you encounter any issues or have questions, please open an issue on the GitHub Issues page.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft