• Stars
    star
    683
  • Rank 66,158 (Top 2 %)
  • Language
    Python
  • Created over 10 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bottom-up approach to refactoring in python

Introduction

Build Status Latest Version Supported Python versions Development Status Wheel Status Download format License Backers on Open Collective Sponsors on Open Collective

RedBaron is a python library and tool powerful enough to be used into IPython solely that intent to make the process of writing code that modify source code as easy and as simple as possible. That include writing custom refactoring, generic refactoring, tools, IDE or directly modifying you source code into IPython with a higher and more powerful abstraction than the advanced texts modification tools that you find in advanced text editors and IDE.

RedBaron guaranteed you that it will only modify your code where you ask him to. To achieve this, it is based on Baron a lossless AST for Python that guarantees the operation ast_to_code(code_to_ast(source_code)) == source_code. (Baron's AST is called an FST, a Full Syntax Tree).

RedBaron API and feel is heavily inspired by BeautifulSoup. It tries to be simple and intuitive and that once you've get the basics principles, you are good without reading the doc for 80% of your operations.

For now, RedBaron can be considered in alpha, the core is quite stable but it is not battle tested yet and is still a bit rough. Feedback and contribution are very welcome.

The public documented API on the other side is guaranteed to be retro-compatible and won't break until 2.0 (if breaking is needed at that point). There might be the only exception that if you directly call specific nodes constructors with FST that this API change, but this is not documented and simply horribly unpracticable, so I'm expecting no one to do that.

Support

RedBaron is support python python 2 and up to python 3.7 grammar.

Roadmap

Current roadmap is as boring as needed:

  • bug fixes
  • new small features (walker pattern, maybe code generation) and performance improvement.

Installation

pip install redbaron[pygments]

Or if you don't want to have syntax highlight in your shell or don't need it:

pip install redbaron

Running tests

pip install pytest
py.test tests

Community

You can reach us on irc.freenode.net#baron or irc.freenode.net##python-code-quality.

Financial support

Baron and RedBaron are a very advanced piece of engineering that requires a lot of time of concentration to work on. Until the end of 2018, the development has been a full volunteer work mostly done by Bram, but now, to reach the next level and bring those projects to the stability and quality you expect, we need your support.

You can join our contributors and sponsors on our transparent OpenCollective, every contribution will count and will be mainly used to work on the projects stability and quality but also on continuing, on the side, the R&D side of those projects.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Contributors

This project exists thanks to all the people who contribute.

Code of Conduct

As a member of PyCQA, RedBaron follows its Code of Conduct.

Links

RedBaron is fully documented, be sure to check the tutorial and documentation.

More Repositories

1

isort

A Python utility / library to sort imports.
Python
6,471
star
2

bandit

Bandit is a tool designed to find common security issues in Python code.
Python
5,900
star
3

pycodestyle

Simple Python style checker in one Python file
Python
4,924
star
4

pylint

It's not just a linter that annoys you!
Python
4,246
star
5

flake8

flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.
Python
3,068
star
6

pyflakes

A simple program which checks Python source files for errors
Python
1,304
star
7

pydocstyle

docstring style checker
Python
1,105
star
8

flake8-bugbear

A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
Python
1,056
star
9

autoflake

Removes unused imports and unused variables as reported by pyflakes
Python
877
star
10

mccabe

McCabe complexity checker for Python
Python
602
star
11

pylint-django

Pylint plugin for improving code analysis for when using Django
Python
556
star
12

docformatter

Formats docstrings to follow PEP 257
Python
528
star
13

pep8-naming

Naming Convention checker for Python
Python
471
star
14

astroid

A common base representation of python source code for pylint and other projects
Python
425
star
15

modernize

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

baron

IDE allow you to refactor code, Baron allows you to write refactoring code.
Python
285
star
17

flake8-import-order

Flake8 plugin that checks import order against various Python Style Guides
Python
277
star
18

eradicate

Removes commented-out code from Python files
Python
199
star
19

doc8

Style checker for sphinx (or other) rst documentation.
Python
158
star
20

flake8-docstrings

Integration of pydocstyle and flake8 for combined linting and reporting
Python
144
star
21

flake8-commas

Flake8 extension for enforcing trailing commas in python
Python
131
star
22

flake8-pyi

A plugin for Flake8 that provides specializations for type hinting stub files
Python
73
star
23

pylint-celery

Pylint plugin for analysing code using Celery
Python
34
star
24

meta

Documentation about how the PyCQA organization works
Python
24
star
25

pylint-plugin-utils

Utilities and helpers for writing Pylint plugins
Python
20
star
26

oeuvre

A repository to collect examples of Python code for testing code-quality tools
Python
11
star
27

flake8-polyfill

Project to make writing plugins across major versions of flake8 easier
Python
11
star
28

flake8-json

JSON formatter for Flake8 output
Python
10
star
29

bandit-action

GitHub Action to run Bandit
9
star
30

infrastructure

Mirror of PyCQA's infrastructure playbooks
6
star
31

mccabe-console-script

Add a console script for the mccabe complexity checker
Python
4
star