METADATA 12 KB

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