METADATA 11 KB

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