METADATA 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. Metadata-Version: 2.1
  2. Name: isort
  3. Version: 5.12.0
  4. Summary: A Python utility / library to sort Python imports.
  5. Home-page: https://pycqa.github.io/isort/
  6. License: MIT
  7. Keywords: Refactor,Lint,Imports,Sort,Clean
  8. Author: Timothy Crosley
  9. Author-email: timothy.crosley@gmail.com
  10. Requires-Python: >=3.8.0
  11. Classifier: Development Status :: 6 - Mature
  12. Classifier: Environment :: Console
  13. Classifier: Intended Audience :: Developers
  14. Classifier: License :: OSI Approved :: MIT License
  15. Classifier: Natural Language :: English
  16. Classifier: Programming Language :: Python
  17. Classifier: Programming Language :: Python :: 3
  18. Classifier: Programming Language :: Python :: 3.8
  19. Classifier: Programming Language :: Python :: 3.9
  20. Classifier: Programming Language :: Python :: 3.10
  21. Classifier: Programming Language :: Python :: 3.11
  22. Classifier: Programming Language :: Python :: 3
  23. Classifier: Programming Language :: Python :: 3 :: Only
  24. Classifier: Programming Language :: Python :: 3.10
  25. Classifier: Programming Language :: Python :: 3.11
  26. Classifier: Programming Language :: Python :: 3.8
  27. Classifier: Programming Language :: Python :: 3.9
  28. Classifier: Programming Language :: Python :: Implementation :: CPython
  29. Classifier: Programming Language :: Python :: Implementation :: PyPy
  30. Classifier: Topic :: Software Development :: Libraries
  31. Classifier: Topic :: Utilities
  32. Provides-Extra: colors
  33. Provides-Extra: pipfile-deprecated-finder
  34. Provides-Extra: plugins
  35. Provides-Extra: requirements-deprecated-finder
  36. Requires-Dist: colorama (>=0.4.3) ; extra == "colors"
  37. Requires-Dist: pip-api ; extra == "requirements-deprecated-finder"
  38. Requires-Dist: pip-shims (>=0.5.2) ; extra == "pipfile-deprecated-finder"
  39. Requires-Dist: pipreqs ; extra == "pipfile-deprecated-finder" or extra == "requirements-deprecated-finder"
  40. Requires-Dist: requirementslib ; extra == "pipfile-deprecated-finder"
  41. Requires-Dist: setuptools ; extra == "plugins"
  42. Project-URL: Changelog, https://github.com/pycqa/isort/blob/main/CHANGELOG.md
  43. Project-URL: Documentation, https://pycqa.github.io/isort/
  44. Project-URL: Repository, https://github.com/pycqa/isort
  45. Description-Content-Type: text/markdown
  46. [![isort - isort your imports, so you don't have to.](https://raw.githubusercontent.com/pycqa/isort/main/art/logo_large.png)](https://pycqa.github.io/isort/)
  47. ------------------------------------------------------------------------
  48. [![PyPI version](https://badge.fury.io/py/isort.svg)](https://badge.fury.io/py/isort)
  49. [![Test Status](https://github.com/pycqa/isort/workflows/Test/badge.svg?branch=develop)](https://github.com/pycqa/isort/actions?query=workflow%3ATest)
  50. [![Lint Status](https://github.com/pycqa/isort/workflows/Lint/badge.svg?branch=develop)](https://github.com/pycqa/isort/actions?query=workflow%3ALint)
  51. [![Code coverage Status](https://codecov.io/gh/pycqa/isort/branch/main/graph/badge.svg)](https://codecov.io/gh/pycqa/isort)
  52. [![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://pypi.org/project/isort/)
  53. [![Join the chat at https://gitter.im/timothycrosley/isort](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/timothycrosley/isort?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
  54. [![Downloads](https://pepy.tech/badge/isort)](https://pepy.tech/project/isort)
  55. [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
  56. [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
  57. [![DeepSource](https://static.deepsource.io/deepsource-badge-light-mini.svg)](https://deepsource.io/gh/pycqa/isort/?ref=repository-badge)
  58. _________________
  59. [Read Latest Documentation](https://pycqa.github.io/isort/) - [Browse GitHub Code Repository](https://github.com/pycqa/isort/)
  60. _________________
  61. isort your imports, so you don't have to.
  62. isort is a Python utility / library to sort imports alphabetically, and
  63. automatically separated into sections and by type. It provides a command line
  64. utility, Python library and [plugins for various
  65. editors](https://github.com/pycqa/isort/wiki/isort-Plugins) to
  66. quickly sort all your imports. It requires Python 3.8+ to run but
  67. supports formatting Python 2 code too.
  68. - [Try isort now from your browser!](https://pycqa.github.io/isort/docs/quick_start/0.-try.html)
  69. - [Using black? See the isort and black compatibility guide.](https://pycqa.github.io/isort/docs/configuration/black_compatibility.html)
  70. - [isort has official support for pre-commit!](https://pycqa.github.io/isort/docs/configuration/pre-commit.html)
  71. ![Example Usage](https://raw.github.com/pycqa/isort/main/example.gif)
  72. Before isort:
  73. ```python
  74. from my_lib import Object
  75. import os
  76. from my_lib import Object3
  77. from my_lib import Object2
  78. import sys
  79. from third_party import lib15, lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8, lib9, lib10, lib11, lib12, lib13, lib14
  80. import sys
  81. from __future__ import absolute_import
  82. from third_party import lib3
  83. print("Hey")
  84. print("yo")
  85. ```
  86. After isort:
  87. ```python
  88. from __future__ import absolute_import
  89. import os
  90. import sys
  91. from third_party import (lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8,
  92. lib9, lib10, lib11, lib12, lib13, lib14, lib15)
  93. from my_lib import Object, Object2, Object3
  94. print("Hey")
  95. print("yo")
  96. ```
  97. ## Installing isort
  98. Installing isort is as simple as:
  99. ```bash
  100. pip install isort
  101. ```
  102. Install isort with requirements.txt support:
  103. ```bash
  104. pip install isort[requirements_deprecated_finder]
  105. ```
  106. Install isort with Pipfile support:
  107. ```bash
  108. pip install isort[pipfile_deprecated_finder]
  109. ```
  110. Install isort with both formats support:
  111. ```bash
  112. pip install isort[requirements_deprecated_finder,pipfile_deprecated_finder]
  113. ```
  114. ## Using isort
  115. **From the command line**:
  116. To run on specific files:
  117. ```bash
  118. isort mypythonfile.py mypythonfile2.py
  119. ```
  120. To apply recursively:
  121. ```bash
  122. isort .
  123. ```
  124. If [globstar](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html)
  125. is enabled, `isort .` is equivalent to:
  126. ```bash
  127. isort **/*.py
  128. ```
  129. To view proposed changes without applying them:
  130. ```bash
  131. isort mypythonfile.py --diff
  132. ```
  133. Finally, to atomically run isort against a project, only applying
  134. changes if they don't introduce syntax errors:
  135. ```bash
  136. isort --atomic .
  137. ```
  138. (Note: this is disabled by default, as it prevents isort from
  139. running against code written using a different version of Python.)
  140. **From within Python**:
  141. ```python
  142. import isort
  143. isort.file("pythonfile.py")
  144. ```
  145. or:
  146. ```python
  147. import isort
  148. sorted_code = isort.code("import b\nimport a\n")
  149. ```
  150. ## Installing isort's for your preferred text editor
  151. Several plugins have been written that enable to use isort from within a
  152. variety of text-editors. You can find a full list of them [on the isort
  153. wiki](https://github.com/pycqa/isort/wiki/isort-Plugins).
  154. Additionally, I will enthusiastically accept pull requests that include
  155. plugins for other text editors and add documentation for them as I am
  156. notified.
  157. ## Multi line output modes
  158. You will notice above the \"multi\_line\_output\" setting. This setting
  159. defines how from imports wrap when they extend past the line\_length
  160. limit and has [12 possible settings](https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html).
  161. ## Indentation
  162. To change the how constant indents appear - simply change the
  163. indent property with the following accepted formats:
  164. - Number of spaces you would like. For example: 4 would cause standard
  165. 4 space indentation.
  166. - Tab
  167. - A verbatim string with quotes around it.
  168. For example:
  169. ```python
  170. " "
  171. ```
  172. is equivalent to 4.
  173. For the import styles that use parentheses, you can control whether or
  174. not to include a trailing comma after the last import with the
  175. `include_trailing_comma` option (defaults to `False`).
  176. ## Intelligently Balanced Multi-line Imports
  177. As of isort 3.1.0 support for balanced multi-line imports has been
  178. added. With this enabled isort will dynamically change the import length
  179. to the one that produces the most balanced grid, while staying below the
  180. maximum import length defined.
  181. Example:
  182. ```python
  183. from __future__ import (absolute_import, division,
  184. print_function, unicode_literals)
  185. ```
  186. Will be produced instead of:
  187. ```python
  188. from __future__ import (absolute_import, division, print_function,
  189. unicode_literals)
  190. ```
  191. To enable this set `balanced_wrapping` to `True` in your config or pass
  192. the `-e` option into the command line utility.
  193. ## Custom Sections and Ordering
  194. isort provides configuration options to change almost every aspect of how
  195. imports are organized, ordered, or grouped together in sections.
  196. [Click here](https://pycqa.github.io/isort/docs/configuration/custom_sections_and_ordering.html) for an overview of all these options.
  197. ## Skip processing of imports (outside of configuration)
  198. To make isort ignore a single import simply add a comment at the end of
  199. the import line containing the text `isort:skip`:
  200. ```python
  201. import module # isort:skip
  202. ```
  203. or:
  204. ```python
  205. from xyz import (abc, # isort:skip
  206. yo,
  207. hey)
  208. ```
  209. To make isort skip an entire file simply add `isort:skip_file` to the
  210. module's doc string:
  211. ```python
  212. """ my_module.py
  213. Best module ever
  214. isort:skip_file
  215. """
  216. import b
  217. import a
  218. ```
  219. ## Adding or removing an import from multiple files
  220. isort can be ran or configured to add / remove imports automatically.
  221. [See a complete guide here.](https://pycqa.github.io/isort/docs/configuration/add_or_remove_imports.html)
  222. ## Using isort to verify code
  223. The `--check-only` option
  224. -------------------------
  225. isort can also be used to verify that code is correctly formatted
  226. by running it with `-c`. Any files that contain incorrectly sorted
  227. and/or formatted imports will be outputted to `stderr`.
  228. ```bash
  229. isort **/*.py -c -v
  230. SUCCESS: /home/timothy/Projects/Open_Source/isort/isort_kate_plugin.py Everything Looks Good!
  231. ERROR: /home/timothy/Projects/Open_Source/isort/isort/isort.py Imports are incorrectly sorted.
  232. ```
  233. One great place this can be used is with a pre-commit git hook, such as
  234. this one by \@acdha:
  235. <https://gist.github.com/acdha/8717683>
  236. This can help to ensure a certain level of code quality throughout a
  237. project.
  238. ## Git hook
  239. isort provides a hook function that can be integrated into your Git
  240. pre-commit script to check Python code before committing.
  241. [More info here.](https://pycqa.github.io/isort/docs/configuration/git_hook.html)
  242. ## Setuptools integration
  243. Upon installation, isort enables a `setuptools` command that checks
  244. Python files declared by your project.
  245. [More info here.](https://pycqa.github.io/isort/docs/configuration/setuptools_integration.html)
  246. ## Spread the word
  247. [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
  248. Place this badge at the top of your repository to let others know your project uses isort.
  249. For README.md:
  250. ```markdown
  251. [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
  252. ```
  253. Or README.rst:
  254. ```rst
  255. .. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336
  256. :target: https://pycqa.github.io/isort/
  257. ```
  258. ## Security contact information
  259. To report a security vulnerability, please use the [Tidelift security
  260. contact](https://tidelift.com/security). Tidelift will coordinate the
  261. fix and disclosure.
  262. ## Why isort?
  263. isort simply stands for import sort. It was originally called
  264. "sortImports" however I got tired of typing the extra characters and
  265. came to the realization camelCase is not pythonic.
  266. I wrote isort because in an organization I used to work in the manager
  267. came in one day and decided all code must have alphabetically sorted
  268. imports. The code base was huge - and he meant for us to do it by hand.
  269. However, being a programmer - I\'m too lazy to spend 8 hours mindlessly
  270. performing a function, but not too lazy to spend 16 hours automating it.
  271. I was given permission to open source sortImports and here we are :)
  272. ------------------------------------------------------------------------
  273. [Get professionally supported isort with the Tidelift
  274. Subscription](https://tidelift.com/subscription/pkg/pypi-isort?utm_source=pypi-isort&utm_medium=referral&utm_campaign=readme)
  275. Professional support for isort is available as part of the [Tidelift
  276. Subscription](https://tidelift.com/subscription/pkg/pypi-isort?utm_source=pypi-isort&utm_medium=referral&utm_campaign=readme).
  277. Tidelift gives software development teams a single source for purchasing
  278. and maintaining their software, with professional grade assurances from
  279. the experts who know it best, while seamlessly integrating with existing
  280. tools.
  281. ------------------------------------------------------------------------
  282. Thanks and I hope you find isort useful!
  283. ~Timothy Crosley