{"id":1466,"library":"dotenv","title":"Python Dotenv (DEPRECATED `dotenv` package)","description":"This entry refers to the original `dotenv` package (pedroburon/dotenv, version 0.9.9), a deprecated and unmaintained library for loading environment variables from `.env` files. Most users intending to manage `.env` files in Python should instead use the actively maintained `python-dotenv` library. This package is no longer developed and lacks features, bug fixes, and security updates present in its modern alternatives. Its status is deprecated.","status":"deprecated","version":"0.9.9","language":"en","source_language":"en","source_url":"https://github.com/pedroburon/dotenv","tags":["dotenv","environment variables","deprecated","env"],"install":[{"cmd":"pip install dotenv","lang":"bash","label":"Installing the DEPRECATED dotenv"}],"dependencies":[],"imports":[{"note":"While this import path works for the deprecated 'dotenv' package, most users intending to load .env files should install and use the 'python-dotenv' package, which shares the same primary import structure but provides superior functionality and maintenance.","symbol":"load_dotenv","correct":"from dotenv import load_dotenv"}],"quickstart":{"code":"# It is strongly recommended to use 'python-dotenv' instead of 'dotenv'.\n# First, uninstall the deprecated package if you have it:\n# pip uninstall dotenv\n\n# Then, install the recommended 'python-dotenv' package:\n# pip install python-dotenv\n\n# Example using 'python-dotenv':\nfrom dotenv import load_dotenv\nimport os\n\n# Create a dummy .env file for demonstration\nwith open('.env', 'w') as f:\n    f.write('MY_VAR=\"Hello from python-dotenv!\"\\n')\n    f.write('ANOTHER_VAR=123\\n')\n\n# Load environment variables from .env\nload_dotenv()\n\n# Access the variables\nmy_var = os.getenv('MY_VAR')\nanother_var = os.getenv('ANOTHER_VAR')\n\nprint(f\"MY_VAR: {my_var}\")\nprint(f\"ANOTHER_VAR: {another_var}\")\n\n# Clean up the dummy .env file\nos.remove('.env')","lang":"python","description":"This quickstart demonstrates the recommended way to load environment variables using the `python-dotenv` library. It explicitly advises against installing the deprecated `dotenv` package and provides a functional example for `python-dotenv`."},"warnings":[{"fix":"Migrate to `python-dotenv` (theskumar/python-dotenv). Uninstall `dotenv` (`pip uninstall dotenv`) and then install `python-dotenv` (`pip install python-dotenv`).","message":"The `dotenv` package (pedroburon/dotenv, version 0.9.9) is DEPRECATED and has not been maintained since 2017. It should not be used in new projects and existing projects should migrate.","severity":"breaking","affected_versions":"<=0.9.9"},{"fix":"Always use `pip install python-dotenv` to ensure you get the actively maintained and feature-rich library.","message":"Most users intending to load environment variables from `.env` files are actually looking for the `python-dotenv` package, not `dotenv`. The `pip install dotenv` command installs the deprecated version.","severity":"gotcha","affected_versions":"all"},{"fix":"Refer to the `python-dotenv` documentation for the complete feature set and proper usage. Do not rely on `dotenv` for robust `.env` parsing.","message":"Despite sharing similar API calls like `load_dotenv()`, the deprecated `dotenv` package lacks critical features (e.g., handling variable expansion), bug fixes, and security updates present in `python-dotenv`.","severity":"gotcha","affected_versions":"all"},{"fix":"Immediately switch to `python-dotenv` to benefit from ongoing maintenance, security patches, and active community support.","message":"Security vulnerabilities and unpatched bugs may exist in the unmaintained `dotenv` package, making its use risky, especially in production environments.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}