future-fstrings
A backport of fstrings to python<3.6
What it is and what it does
future-fstrings is a codec-based backport that allows you to write Python 3.6+ f-string syntax and run it on Python 2.7 and Python 3.4–3.5. You add a special encoding cookie to the top of your file, and the package intercepts the source at import time, rewriting f-strings into equivalent `.format()` calls before the Python interpreter sees them. This works by registering a custom UTF-8 codec on startup that uses tokenize-rt to perform the transformation.
The package also provides a command-line tool (`future-fstrings-show`) to pre-transform source files, useful for distributing code to platforms like micropython that don't support f-strings at all. However, the project is archived and no longer maintained, so it will not adapt to future Python changes or receive security updates.
Use it for:
- Maintain a single f-string codebase that runs on Python 2.7 and early Python 3 versions without duplicating syntax.
- Pre-transform source code before deploying to micropython or other embedded platforms that lack f-string support.
- Gradually migrate legacy Python 2.7 codebases to modern f-string syntax while maintaining backward compatibility during transition.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Enables f-string syntax in Python versions before 3.6 by transparently rewriting f-strings to `.format()` calls at import time via a custom codec.
No. The package is abandoned (last updated 2022-01-15) and targets Python versions that are themselves end-of-life. If you need f-strings on older Python, this was useful historically, but new projects should target Python 3.6+. Existing projects still on unsupported Python versions should prioritize upgrading rather than relying on unmaintained backports.
Install
future-fstrings on PyPI
pip
pip install future-fstringsuv
uv add future-fstringspoetry
poetry add future-fstringsInstalling future-fstrings
Before you install
Installation is straightforward with low friction, but the package is abandoned as of 2022-01-15 with no active maintenance. It was last released on 2019-06-16, so it will not receive updates for new Python versions or security issues.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it safe to adopt from a licensing perspective.
Quickstart
# Install
pip install future-fstrings
# At the top of your .py file, add:
# -*- coding: future_fstrings -*-
# Then write f-strings normally:
thing = 'world'
print(f'hello {thing}')
# Run on Python 2.7 or 3.4–3.5; the codec rewrites it to:
# print('hello {}'.format((thing)))
Requires Python 2.7 or 3.4–3.5 to run with the codec active; Python 3.6+ natively supports f-strings and does not need this package. The encoding cookie must be the first or second line of the file.
Verify before relying
- Whether the codec approach remains reliable on modern Python interpreters beyond the versions it was tested against.
- Compatibility with third-party tools that parse or analyze Python source code (linters, type checkers, etc.).
- Whether Python 2.7 and Python 3.4–3.5 remain viable targets for new projects using this package.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — tokenize-rt |
| Maintenance | abandoned — 2,616 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 749,735/month — #5,160 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: future_fstrings-1.2.0-py2.py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
flake8-use-fstringA flake8 plugin that detects and flags…
permissive · top 15,000 on PyPI
flyntFlynt is a command-line tool that automatically…
permissive · top 15,000 on PyPI
flake8-pep3101A flake8 plugin that detects and flags…
copyleft · top 15,000 on PyPI
shellescapeProvides a `quote()` function that…
permissive · top 5,000 on PyPI
backports.csvProvides Python 3's csv module API for Python…
unclear · top 15,000 on PyPI
tokenize-rtWraps Python's stdlib tokenize module to enable…
permissive · top 5,000 on PyPI
pyupgradeAutomatically rewrites Python source code to…
permissive · top 5,000 on PyPI
typingProvides type hints and annotations for Python…
permissive · top 5,000 on PyPI
traceback2Provides a backport of Python's traceback…
permissive · top 5,000 on PyPI
eval-type-backportEnables newer Python typing syntax (like `X |…
permissive · top 1,000 on PyPI