Skip to main content

Import order detection

Project description

A script to detect that the import order matches Mozilla WebDev Python guidelines. Usage: [filename] [filename..]

Filename can be a glob. Or multiple filenames. For example: apps/*.py mkt/*.py

Baked will also accept files being piped to it, for example:

git diff-index HEAD^ --name-only | baked

Baked loads a confg file as JSON. It will look in the following places for the file:

  • the current directory for .baked
  • the users profile directory for .baked

For an example see:

The config file contains:

  • order: the list of orders of import blocks. This allows you to group your imports into categories.
  • fallback: if a category is not found for lib, what should it fall back to, for most this will be local.
  • from_order: a dictionary of sections with a boolean value for each section. If the value is false, then baked will not care that an import came before from. Default is true for each category.
  • modules: a dictionary of categories and a list of modules. This allows baked to put each module in the category.

If you’d like to exclude an import from baked add the comment #NOQA.


With one exception, we ignore that imports should be ordered CONSTANT, Class, var. Just sort by alpha, case insensitive. That’s easier for everyone to parse.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for baked, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size baked-0.1.4.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page