usort-1.1.3


توضیحات

Safe, minimal import sorting
ویژگی مقدار
سیستم عامل -
نام فایل usort-1.1.3
نام usort
نسخه کتابخانه 1.1.3
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Meta
ایمیل نویسنده Tim Hatch <thatch@fb.com>, Amethyst Reese <amethyst@fb.com>
آدرس صفحه اصلی -
آدرس اینترنتی https://pypi.org/project/usort/
مجوز MIT License Copyright (c) Meta Platforms, Inc. and affiliates. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# μsort **Safe, minimal import sorting for Python projects.** [![documentation](https://readthedocs.org/projects/usort/badge/?version=stable)](https://usort.readthedocs.io/en/stable/?badge=stable) [![version](https://img.shields.io/pypi/v/usort.svg)](https://pypi.org/project/usort) [![changelog](https://img.shields.io/badge/change-log-blue.svg)](https://usort.readthedocs.io/en/latest/changelog.html) [![license](https://img.shields.io/pypi/l/usort.svg)](https://github.com/facebook/usort/blob/main/LICENSE) μsort is a safe, minimal import sorter. Its primary goal is to make no "dangerous" changes to code. This is achieved by detecting distinct "blocks" of imports that are the most likely to be safely interchangeable, and only reordering imports within these blocks without altering formatting. Code style is left as an exercise for linters and formatters. Within a block, µsort will follow common Python conventions for grouping imports based on source (standard library, third-party, first-party, or relative), and then sorting lexicographically within each group. This will commonly look like: ```py import re from pathlib import Path from typing import Iterable from unittest.mock import call, Mock, patch import aiohttp from aiosqlite import connect import foo from bar import bar from .main import main ``` Blocks are inferred from a number of real world conditions, including any intermediate statements between imports: ```py import warnings warnings.filterwarnings(...) import re import sys ``` In this case, µsort detects two blocks–separated by the call to `filterwarnings()`, and will only sort imports inside of each block. Running µsort on this code will generate no changes, because each block is already sorted. Imports can be excluded from blocks using the `#usort:skip` directive, or with `#isort:skip` for compatibility with existing codebases. µsort will leave these imports unchanged, and treat them as block separators. See the [User Guide][] for more details about how blocks are detected, and how sorting is performed. ## Install µsort requires Python 3.10 or newer to run. Install µsort with: ```shell-session $ pip install usort ``` ## Usage To format one or more files or directories in-place: ```shell-session $ usort format <path> [<path> ...] ``` To generate a diff of changes without modifying files: ```shell-session $ usort diff <path> ``` To just validate that files are formatted correctly, like during CI: ```shell-session $ usort check <path> ``` ### pre-commit µsort provides a [pre-commit](https://pre-commit.com/) hook. To enforce sorted imports before every commit, add the following to your `.pre-commit-config.yaml` file: ```yaml - repo: https://github.com/facebook/usort rev: v1.0.7 hooks: - id: usort ``` ## License μsort is MIT licensed, as found in the [LICENSE][] file. [LICENSE]: https://github.com/facebook/usort/tree/main/LICENSE [User Guide]: https://usort.readthedocs.io/en/stable/guide.html


نیازمندی

مقدار نام
- attrs>=21.2.0
- click>=7.0.0
- libcst>=0.3.7
- moreorless>=0.3.0
- stdlibs>=2021.4.1
ython_versio tomli;
- trailrunner<2.0,>=1.0
xtr black==25.9.0;
xtr click==8.1.8;
xtr coverage==7.11.0;
xtr flake8==7.3.0;
xtr hatch==1.15.1;
xtr mypy==1.18.2;
xtr pessimist==0.9.3;
xtr ufmt==2.8.0;
xtr volatile==2.1.0;
xtr sphinx-mdinclude==0.6.2;
xtr sphinx==7.4.7;


زبان مورد نیاز

مقدار نام
>=3.10 Python


نحوه نصب


نصب پکیج whl usort-1.1.3:

    pip install usort-1.1.3.whl


نصب پکیج tar.gz usort-1.1.3:

    pip install usort-1.1.3.tar.gz