Change8

v1.2.2

Breaking Changes
📦 python-dotenvView on GitHub →
3 breaking2 features🐛 2 fixes🔧 3 symbols

Summary

This release introduces support for Python 3.14 and updates the behavior of key setting/unsetting functions regarding symlinks and file modes, resulting in breaking changes for symlink following and file mode preservation.

⚠️ Breaking Changes

  • The behavior of `dotenv.set_key` and `dotenv.unset_key` regarding symlinks has changed; they no longer follow symlinks by default. To restore the previous behavior of following symlinks, use `follow_symlinks=True`.
  • The CLI commands `set` and `unset` no longer follow symlinks in some situations where they previously did.
  • The file mode of modified .env files is no longer unconditionally reset to `0o600` by `dotenv.set_key`, `dotenv.unset_key`, or the CLI commands `set`/`unset`. The original file mode is now preserved, unless the file is being created or is not a regular file, in which case mode `0o600` is used.

Migration Steps

  1. If you relied on `dotenv.set_key` or `dotenv.unset_key` following symlinks, update calls to include `follow_symlinks=True`.
  2. Review usage of `dotenv run` to ensure flag forwarding behavior is as expected.

✨ New Features

  • Added support for Python 3.14, including the free-threaded (3.14t) build.
  • The `dotenv run` command now forwards flags directly to the specified command.

🐛 Bug Fixes

  • Improved `set_key` and `unset_key` behavior when interacting with symlinks.
  • Corrected the license specifier and added missing Python 3.14 classifiers in package metadata.

Affected Symbols