⚡
usefultools.dev
req

requirements.txt Generator – From Python Imports

NOUVEAU

requirements.txt generator: paste Python code and get the PyPI packages it imports, with cv2→opencv-python style renames, stdlib filtered and optional version pins.

Fonctionne à 100 % dans votre navigateur — vos données ne sont jamais envoyées ni stockées sur nos serveurs.

Cet outil n'est pas encore entièrement traduit : une partie du texte est encore en anglais. L'outil lui-même fonctionne de la même façon dans toutes les langues.

requirements.txt (8 packages)

beautifulsoup4
numpy
opencv-python
pandas
Pillow
python-dotenv
PyYAML
scikit-learn
Imports found (10) · 1 relative import ignored
ImportTypePackageNote
os stdlib—standard library
json stdlib—standard library
numpy PyPInumpyknown package
pandas PyPIpandasknown package
cv2 renamedopencv-pythonimport cv2
PIL renamedPillowimport PIL
sklearn.model_selection renamedscikit-learnimport sklearn
yaml renamedPyYAMLimport yaml
bs4 renamedbeautifulsoup4import bs4
dotenv renamedpython-dotenvimport dotenv

Standard library list: Python 3.12. Names are matched by a built-in table, not by querying PyPI — check unknown names before installing.

⚡

Exemples rapides

Des entrées typiques et les résultats produits par cet outil.

Renamed
import cv2
opencv-python
Renamed
from PIL import Image
Pillow
Renamed
from sklearn import svm
scikit-learn
stdlib
import os, json
(standard library, skipped)
Pin
import numpy + pin numpy>=1.26
numpy>=1.26
📖

Présentation

This requirements.txt generator reads the import statements in your Python code and turns them into a list of PyPI packages you can install with pip install -r requirements.txt. It knows that many packages are imported under a different name than they are installed with: cv2 comes from opencv-python, PIL from Pillow, sklearn from scikit-learn, yaml from PyYAML, bs4 from beautifulsoup4, dotenv from python-dotenv and a few hundred more, including namespace packages such as google.cloud.storage.

Modules from the Python 3.12 standard library are filtered out, relative imports (from . import x) are ignored, and you can list your own package names to skip. Modules removed in 3.12, like distutils, are flagged with a replacement. Paste version pins such as requests==2.32.3 to apply them to the output, then copy or download the file.

The lookup uses a built-in table and runs entirely in your browser; your code is not uploaded and PyPI is not queried.

Pourquoi utiliser cet outil ?

  • Fixes the classic cv2 vs opencv-python mistake
  • Python 3.12 standard library filtered automatically
  • Keeps your own modules out of the file
  • Applies your version pins in one step
  • Download a ready requirements.txt
⭐

Fonctionnalités

🔁

Import-to-PyPI map

Hundreds of import names mapped to their real distribution names, including google.* and azure.* namespaces.

📚

Stdlib aware

The full Python 3.12 standard library module list is excluded, and removed modules are flagged.

🧭

Real import parsing

Handles import a, b as c, from x.y import z, try/except imports, semicolons and importlib.import_module("x").

📌

Version pins

Paste ==, >=, ~= or != pins and they replace the bare package names.

🏷️

Import table

Every import is listed as renamed, PyPI, stdlib, removed or local with a note.

⬇️

Copy or download

Get a sorted requirements.txt, optionally commented with the import it came from.

🛠️

Mode d'emploi

1

Paste your code

Paste a script, a module or just its import lines into the code box.

2

Skip local modules

List your own package names under Your own modules to skip.

3

Add pins if needed

Type version pins, one per line, to lock versions.

4

Copy or download

Press Copy or Download to save requirements.txt.

🤔

Questions fréquentes