Removing unused imports via
unused_imports
bundled-in plugin.Grouping all libraries separately via
separate_libs
bundled-in plugin.PEP263 support.
importanize
not honors encoding comment on top of the file on how it reads python source files.Basic plugins via
pluggy
.Added support for
.ini
files configuration style.In addition to
.importanizerc
config can be read fromsetup.cfg
,importanize.ini
,importanize.json
andtox.ini
.Added
--no-auto-pipe
flag in case incorrect auto pipe detection.Added
lines
formatter which formats all imports on individual linesfrom package.subpackage.module.submodule import CONSTANT from package.subpackage.module.submodule import Klass from package.subpackage.module.submodule import bar from package.subpackage.module.submodule import foo from package.subpackage.module.submodule import rainbows
Added
after_imports_normalize_new_lines
configuration.Complete refactor of parsing imports. No more string splitting. Advantage is that comments around imports are now fully supported:
# standalone comment from foo import bar # inline comment
Importanize itself can only run on Python 3 but it can importanize Python 2 files.
mypy
is used to check complete repository.
- Fixed removing first line in files without imports.
- Added
--list
option to list all found imports grouped by same packages as in config.
- Added support for custom line length.
- Fixed (again) importanize hanging when provided relative file path when finding sub-configurations.
- Fixed importanize failing on empty files. Thanks Milind.
- Fixed importanize hanging when provided relative file path when finding sub-configurations. Thanks Milind.
- Fixed sub-configrations. They are searched when organizing individual files now.
- Added support for sub-configurations when
.importanize
is found. - Added support for
add_imports
in configuration.
- Added support to customize number of new lines added after imports
via
after_imports_new_lines
configuration. Useful when using auto formatters such asyapf
.
- Skipping directories which makes skipping subfolders much faster
- Fixed bug which incorrectly skipped files
- Fixed bug which incorrectly removed duplicate leafless imports which had different
as
names
- Added
--ci
flag to validate import organization in files - Added
sitepackages
import group. Thanks Pamela. SeeREADME
for more info - Added pipe handling (e.g.
cat foo.py | importanize
) - Fixed bug which incorrectly sorted imports with aliases (e.g.
import foo as bar
) - Files are not overridden when imports are already organized. Useful in precommit hooks which detect changed files.
- Released as Python wheel
- Fixed a bug where
importanize
did not correctly detect stdlibs on Windows (see #29) - Removed
future
dependency sincesix>=1.9
includes all the used features - Fixed tests to be executable on Windows
- Added multiple formatter options. Can be used using
--formatter
flag or can be set in the configuration file. - Fixes a bug in parsing imports when encountering both
\
and()
(see #26 for example) - Fixes a bug where wildcard leaf imports were combined with other others (see #25 for example)
- Using tokens to parse Python files. As a result this allows to fix how comments are handled (see #21 for example)
- New "exclude" config which allows to skip files
- Presetving origin file new line characters
- Traversing parent paths to find importanize config file
- Multiple imports (e.g.
import a, b
) are normalized instead of exiting - Multiple imports with the same stem are combined into single import statement (see #17 for example)
- Fixed where single line triple-quote docstrings would cause none of the imports to be recognized
- Fixed where import leafs were not properly sorted for mixed case (aka CamelCase)
- Ignoring comment blocks when parsing for imports
- Fixed bug when imports start on a first line, extra lines were being added to the file.
- First release on PyPI.