GithubHelp home page GithubHelp logo

00mjk / modernize Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pycqa/modernize

0.0 0.0 0.0 380 KB

Modernizes Python code for eventual Python 3 migration. Built on top of fissix (a fork of lib2to3)

Home Page: https://modernize.readthedocs.org/

License: Other

Python 100.00%

modernize's Introduction

Python           _              _        
   _ __  ___  __| |___ _ _ _ _ (_)______ 
  | '  \/ _ \/ _` / -_) '_| ' \| |_ / -_)
  |_|_|_\___/\__,_\___|_| |_||_|_/__\___|

Coveralls

Read the Docs

GitHub Actions

PyPI

Modernize is a Python program that reads Python 2 source code and applies a series of fixers to transform it into source code that is valid on both Python 3 and Python 2.7.

This allows you to run your test suite on Python 2.7 and Python 3 so you can gradually port your code to being fully Python 3 compatible without slowing down development of your Python 2 project.

The python -m modernize command works like python -m fissix, see fissix. Here's how you'd rewrite a single file:

python -m modernize -w example.py

It does not guarantee, but it attempts to spit out a codebase compatible with Python 2.6+ or Python 3. The code that it generates has a runtime dependency on six, unless the --no-six option is used. Version 1.9.0 or later of six is recommended. Some of the fixers output code that is not compatible with Python 2.5 or lower.

Once your project is ready to run in production on Python 3 it's recommended to drop Python 2.7 support using pyupgrade

Documentation: modernize.readthedocs.io.

See the LICENSE file for the license of modernize. Using this tool does not affect licensing of the modernized code.

This library is a very thin wrapper around fissix, a fork of lib2to3.

modernize's People

Contributors

takluyver avatar graingert avatar brettcannon avatar daira avatar mitsuhiko avatar techtonik avatar loewis avatar martindemello avatar asottile avatar martinfalatic avatar shaib avatar squirrel532 avatar jeremyh avatar cclauss avatar speidy avatar pre-commit-ci[bot] avatar timgates42 avatar temoto avatar devosnw avatar untitaker avatar jayvdb avatar amyreese avatar jeffwidman avatar jwilk avatar garyvdm avatar davidmuller avatar dasich avatar bfroehle avatar avdn avatar alasdairnicol avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.