GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pybpc/f2format: Backport compiler for Python 3.6 formatted string literals (f-string).

BranchesTags
Open more actions menu

Latest commit

 

History

271 Commits
271 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
ci
ci
 
 
docs
docs
 
 
scripts
scripts
 
 
share
share
 
 
test
test
 
 
.coveragerc
.coveragerc
 
 
.editorconfig
.editorconfig
 
 
.env
.env
 
 
.flake8
.flake8
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.readthedocs.yml
.readthedocs.yml
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
Makefile
Makefile
 
 
Pipfile
Pipfile
 
 
README.md
README.md
 
 
TODO.md
TODO.md
 
 
bandit.yml
bandit.yml
 
 
f2format.py
f2format.py
 
 
mypy.ini
mypy.ini
 
 
pyproject.toml
pyproject.toml
 
 
pytest.ini
pytest.ini
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 
tox.ini
tox.ini
 
 
vermin.ini
vermin.ini
 
 

Repository files navigation

NB: f2format is currently under reconstruction. It is highly recommended to directly install from the git repo or the pre-release distributions.


f2format

PyPI - Downloads PyPI - Version PyPI - Python Version

GitHub Actions - Status Codecov - Coverage Documentation Status

Write f-string in Python 3.6 flavour, and let f2format worry about back-port issues 🍺

  Since PEP 498, Python introduced f-string literals in version 3.6. Though released ever since December 23, 2016, Python 3.6 is still not widely used as expected. For those who are now used to f-strings, f2format provides an intelligent, yet imperfect, solution of a backport compiler by converting f-strings to str.format expressions, which guarantees you to always write f-strings in Python 3.6 flavour then compile for compatibility later.

  f2format is inspired and assisted by my good mate @gousaiyang. It functions by tokenising and parsing Python code into multiple abstract syntax trees (AST), through which it shall synthesise and extract expressions from f-string literals, and then reassemble the original string using str.format method. Besides conversion and format specification, f2format also considered and resolved string concatenation. Also, it always tries to maintain the original layout of source code, and accuracy of syntax.

Documentation

  See documentation for usage and more details.

Contribution

  Contributions are very welcome, especially fixing bugs and providing test cases. Note that code must remain valid and reasonable.

See Also

  • pybpc (formerly known as python-babel)
  • poseur
  • walrus
  • relaxedecor
  • vermin

About

Backport compiler for Python 3.6 formatted string literals (f-string).

pybpc.github.io/f2format/

Topics

backportf-stringpybpc

Resources

Readme
MIT license
Activity
Custom properties

Stars

20 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.