• Stars
    star
    251
  • Rank 161,862 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 11 years ago
  • Updated over 6 years ago

Reviews

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

Repository Details

A simple program which checks Python source files for errors.

frosted

PyPI version PyPi downloads Build Status License Bitdeli Badge

Frosted is a fork of pyflakes (originally created by Phil Frost) that aims at more open contribution from the outside public, a smaller more maintainable code base, and a better Python checker for all. It currently cleanly supports Python 2.6 - 3.4 using pies (https://github.com/timothycrosley/pies) to achieve this without ugly hacks and/or py2to3.

IMPORTANT NOTE: FROSTED IS DEPRECATED! LONG LIVE FLAKE8

Frosted was born because pyflakes went for a period of around a year without a maintainer. At some point a maintainer reappeared and the original project continued the mantel of quickly checking code. At this point the best bet, if you are looking for a project to check your code quality is to use the newest version of PyFlakes or Flake8 (https://github.com/PyCQA/flake8) - which itself uses pyflakes in addition to some other great public tools.

Installing Frosted

Installing Frosted is as simple as:

pip install frosted --upgrade

or if you prefer

easy_install frosted

Using Frosted

from the command line:

frosted mypythonfile.py mypythonfile2.py

or recursively:

frosted -r .

which is equivalent to

frosted **/*.py

or to read from stdin:

frosted -

from within Python:

import frosted

frosted.api.check_path("pythonfile.py")

Discussing improvements and getting help

Using any of the following methods will result in a quick resolution to any issue you may have with Frosted or a quick response to any implementation detail you wish to discuss.

  • Mailing List - best place to discuss large architectural changes or changes that effect that may effect Python code-quality projects beyond Frosted.
  • Github issues - best place to report bugs, ask for concretely defined features, and even ask for general help.
  • [email protected] - feel free to email me any questions or concerns you have that you don't think would benefit from community wide involvement.

What makes Frosted better then pyflakes?

The following improvements have already been implemented into Frosted

  • Several improvements and fixes that have stayed open (and ignored) on mainline pyflakes have been integrated.
  • Lots of code has been re-factored and simplified, Frosted aims to be faster and leaner then pyflakes ever was.
  • Frosted adds the ability to configure which files you want to check, and which errors you don't care about. Which, in my opinion, is a must have feature.
  • Frosted implements the .editorconfig standard for configuration. This means you only need one configuration file for isort, frosted, and all the code editors anybody working with your project may be using.
  • Frosted uses a more logical, self-documenting, and standard terminal interface. With pyflakes the default action without any arguments is to do nothing (waiting for stdin) with Frosted you get an error and help.
  • Frosted switched from Java style unittests to the more Pythonic py.test (I admit this is highly subjective).
  • The number one reason frosted is better is because of you! Or rather, the Python community at large. I will quickly respond to any pull requests, recommendations, or bug reports that come my way.
  • Frosting. Duh.

And it will only get better from here on out!

Configuring Frosted

If you find the default frosted settings do not work well for your project, frosted provides several ways to adjust the behavior.

To configure frosted for a single user create a ~/.frosted.cfg file:

[settings]
skip=file3.py,file4.py
ignore_frosted_errors=E101,E205,E300
run_doctests=True
  • skip - A comma delimited list of file or directory names to skip. The name must exactly match the entire path, the name of the file, or one of it's parent directories for it to be skipped.
  • ignore_frosted_errors - A comma delimited list of Frosted error codes to ignore. You can see a definition of all error codes in the next section.

Additionally, you can specify project level configuration simply by placing a .frosted.cfg file at the root of your project. frosted will look up to 25 directories up, from the one it is ran, to find a project specific configuration.

You can then override any of these settings by using command line arguments, or by passing in kwargs into any of the exposed api checking methods.

Beyond that, frosted supports setup.cfg based configuration. All you need to do is add a [frosted] section to your project's setup.cfg file with any desired settings.

Finally, frosted supports editorconfig files using the standard syntax defined here: http://editorconfig.org/

Meaning You can place any standard frosted configuration parameters within a .editorconfig file under the *.py section and they will be honored.

Frosted Error Codes

Frosted recognizes the following errors when present within your code. You can use the 'ignore_frosted_errors' setting to specify any errors you want Frosted to ignore. If you specify the series error code (ex: E100) all errors in that series will be ignored.

I100 Series - General Information

  • I101: Generic

E100 Series - Import Errors

  • E101: UnusedImport
    • Note that it is common practice to import something and not use it for the purpose of exposing it as an API, or using it in an exec statment below. Frosted tries to circumvent most of this by ignoring this error by default in init.py
  • E102: ImportShadowedByLoopVar
  • E103: ImportStarUsed

E200 Series - Function / Method Definition and Calling Errors

  • E201: MultipleValuesForArgument
  • E202: TooFewArguments
  • E203: TooManyArguments
  • E204: UnexpectedArgument
  • E205: NeedKwOnlyArgument
  • E206: DuplicateArgument
  • E207: LateFutureImport
  • E208: ReturnWithArgsInsideGenerator

E300 Series - Variable / Definition Usage Errors

  • E301: RedefinedWhileUnused
  • E302: RedefinedInListComp
  • E303: UndefinedName
  • E304: UndefinedExport
  • E305: UndefinedLocal
  • E306: Redefined
  • E307: UnusedVariable

E400 Series - Syntax Errors

  • E401: DoctestSyntaxError
  • E402: PythonSyntaxError

W100 Series - Exception Warning

  • W101: BareExcept
    • Note that one common case where a bare except is okay, and should be ignored is when handling the rollback of database transactions. In this or simular cases the warning can safely be ignored.

W200 Series - Handling Warning

  • W201: FileSkipped

When deciding whether or not to include an error for reporting, Frosted uses the 99% approach as a yard stick. If it is agreed that 99% of the time (or more) that a pattern occurs it's an error, Frosted will report on it, if not it will not be added to the Frosted project.

Frosted Code API

Frosted exposes a simple API for checking Python code from withing other Python applications or plugins.

  • frosted.api.check (codeString, filename, reporter=modReporter.Default, **setting_overrides) Check the Python source given by codeString for unfrosted flakes.
  • frosted.api.check_path (filename, reporter=modReporter.Default, **setting_overrides) Check the given path, printing out any warnings detected.
  • frosted.check_recursive (paths, reporter=modReporter.Default, **setting_overrides) Recursively check all source files defined in paths.

Additionally, you can use the command line tool in an API fashion, by passing '-' in as the filename and then sending file content to stdin.

Text Editor Integration

Integration with text editors and tools is a priority for the project. As such, any pull request that adds integration support or links to a third-party project that does will be enthusiastically accepted.

Current list of known supported text-editors:

Contributing to Frosted

Our preferred contributions come in the form of pull requests and issue reports. That said, we will not deny monetary contributions. If you desire to do this using flattr etc, please make sure you flattr @bitglue as he is the original creator of pyflakes and without his contribution Frosted would not be possible.

Why did you fork pyflakes?

Pyflakes was a great project, and introduced a great approach for quickly checking for Python coding errors. I am very grateful to the original creators. However, I feel over the last year it has become stagnant, without a clear vision and someone willing to take true ownership of the project. While I know it is in no way intentional, critical failures have stayed open, despite perfectly complete and valid pull-requests open, without so much as an acknowledgement from the maintainer. As I genuinely believe open source projects need constant improvement (releasing early and often), I decided to start this project and look for as much input as possible from the Python community. I'm hoping together we can build an even more awesome code checker!

Note: the maintainer of pyflakes has been added as a contributer to frosted.

Why Frosted?

Frosted is a homage to the original pyflakes creator Phil Frost.


Thanks and I hope you enjoy the new Frosted pyflakes!

~Timothy Crosley

More Repositories

1

streamdeck-ui

A Linux compatible UI for the Elgato Stream Deck.
Python
1,137
star
2

portray

Your Project with Great Documentation.
Python
860
star
3

jiphy

Your client side done in a jiphy. Python to JavaScript 2-way converter.
Python
583
star
4

hypothesis-auto

An extensions for Hypothesis that provides fully automatic testing for type hinted functions
Python
344
star
5

concentration

Stay focused on work when you want, and goof off when you don't.
Python
328
star
6

deprecated.pies

The simplest (and tastiest) way to write one program that runs on both Python 2 and Python 3.
Python
148
star
7

quickpython

A retro interactive coding environment powered by Python and nostalgia
Python
109
star
8

pdocs

A simple program and library to auto generate API documentation for Python modules.
Python
74
star
9

connectable

A very simple implementation of QTs signal / slot pattern in Python
Python
61
star
10

examples

Tests and Documentation Done by Example.
Python
24
star
11

thedom

A python framework to generate html and JavaScript from reusable and combine-able widgets.
Python
23
star
12

GuiBuilder

Click and Drop Editor For WebElements
Python
23
star
13

preconvert

A Library to enable preconversion of any Python type into one that is easily serializable
Python
17
star
14

cookiecutter-python

A cookie cutter template for modern Python projects using Python3.6+, poetry, mypy, py.test, and linters.
Shell
16
star
15

WebBot

WebBot is a collection of several tools that enables building Python web applications the same way native ones are built. As a result, the WebBot framework encourages reuse, concise code, rapid development, and happy developers.
Python
14
star
16

blog

Personal Blog
Python
7
star
17

DynamicForm

Ajax Abstraction Library for Python
Python
6
star
18

Html2Shpaml

Converts html to the more condensed and DRY sphaml format
Python
5
star
19

sigy

A library to enable reusing and composing Python function signatures.
Python
4
star
20

linux_environment

My common environment across all linux computers
Shell
4
star
21

CleanHTML

A Very Forgiving HTML/XML Cleaner
Python
4
star
22

RestClient

A Simple RestClient for Python - Works With AppEngine
Python
3
star
23

instantly

A Python Tool To Create and Expend Project Templates
Python
3
star
24

python3-project-template

Basic cookiecutter template for new Python3 projects
Python
3
star
25

website_change_alert

A simpe script to send a text when a website changes.
Python
3
star
26

camera_name_normalizer

Camera Name Normalization
Python
3
star
27

blox

Build it with Python
Python
3
star
28

preconvert_numpy

Preconverts common numpy types to their serializable (jsonifiable, msgpackable, etc...) form. A plugin for the preconvert Python library.
Python
2
star
29

simple_ci

An extremely simple ci server built with hug
Python
2
star
30

RedisStore

RedisStore enables interacting with Redis keys from within python as if they where native object types.
Python
2
star
31

dpy

A tool that automatically generates quality documentation for Python projects.
Python
2
star
32

todo_list

A remotely available todo list
Python
2
star
33

black_isort

A guaranteed black compatible import sorter with minimal settings.
Python
2
star
34

signature

An expiremental framework for composing Python function signature
Shell
1
star
35

webbot_example_postboard

Code for post board example shown in screen-cast http://www.youtube.com/watch?v=0L8TsmrZPLg
Python
1
star
36

sprints_kit

Evolving kit for leading open source sprints
1
star
37

intrigue_icon_set

A set of 100% free and original icons - with a unique minimalistic look
Perl
1
star
38

webelements_site

The code that powers the WebElements homepage
Python
1
star
39

mde

CLI Markdown Editor
Python
1
star
40

mac_environment

Personal MacOS environment setup instructions
Shell
1
star