Skip to content

Commit

Permalink
Replace asottile/reorder-python-imports with isort
Browse files Browse the repository at this point in the history
black >=24 is incompatible with it since it adds a whitespace between
an initial docstring and the import section, which
reorder-python-imports does not like. This is something that is not
likely to be fixed. For reference:

asottile/reorder-python-imports#366
psf/black#4175

This substitution causes some reordering since isort separates
first-party imports from third-party ones by default. We're still
keeping the one line per import format to reduce merge conflicts.
  • Loading branch information
lkubb committed Apr 28, 2024
1 parent 9f5223c commit 5972381
Show file tree
Hide file tree
Showing 68 changed files with 116 additions and 49 deletions.
8 changes: 4 additions & 4 deletions data/salt_python_support.yaml
Expand Up @@ -2,28 +2,28 @@
3003:
min:
- 3
- 7
- 8
max:
- 3
- 9
3004:
min:
- 3
- 7
- 8
max:
- 3
- 10
3005:
min:
- 3
- 7
- 8
max:
- 3
- 10
3006:
min:
- 3
- 7
- 8
max:
- 3
- 10
Expand Down
10 changes: 5 additions & 5 deletions project/.pre-commit-config.yaml.j2
Expand Up @@ -65,14 +65,14 @@ repos:
]
exclude: src/{{ package_namespace_path }}{{ package_name }}/version.py

- repo: https://github.com/asottile/reorder_python_imports
rev: v3.12.2
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: reorder-python-imports
- id: isort
args: [
--py{{ python_requires[:2] | join("") }}-plus,
--py {{ python_requires[:2] | join("") }},
]
exclude: src/{{ package_namespace_path }}{{ package_name }}/version.py
exclude: src/{{ package_namespace_path }}{{ package_name }}/(__init__|version).py

- repo: https://github.com/psf/black
rev: 24.2.0
Expand Down
1 change: 0 additions & 1 deletion project/.pre-commit-hooks/make-autodocs.py.j2
Expand Up @@ -3,7 +3,6 @@ import os.path
import subprocess
from pathlib import Path


repo_path = Path(subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode().strip())
src_dir = repo_path / "src" / {% if package_namespace -%} "{{ package_namespace }}" / {% endif -%} "{{ package_name }}"
doc_dir = repo_path / "docs"
Expand Down
2 changes: 1 addition & 1 deletion project/docs/index.rst.j2
Expand Up @@ -16,7 +16,7 @@
:maxdepth: 2
:caption: Provided Modules
:hidden:
{% for loader in loaders %}
{% for loader in loaders %}
ref/{{ loader.rstrip("s") + ("" if loader in singular_loader_dirs else "s") }}/index
{%- endfor %}

Expand Down
80 changes: 43 additions & 37 deletions project/pyproject.toml.j2
Expand Up @@ -110,44 +110,50 @@ build_dir = "build/sphinx"
[tool.black]
line-length = 100

[tool.isort]
force_single_line = true
skip = ["src/{{ package_namespace_path }}{{ package_name }}/__init__.py"]
profile = "black"
line_length = 100

[tool.towncrier]
package = "{{ package_namespace_pkg }}{{ package_name }}"
filename = "CHANGELOG.md"
template = "changelog/.template.jinja"
directory = "changelog/"
start_string = "# Changelog\n"
underlines = ["", "", ""]
title_format = "## {version} ({project_date})"
package = "{{ package_namespace_pkg }}{{ package_name }}"
filename = "CHANGELOG.md"
template = "changelog/.template.jinja"
directory = "changelog/"
start_string = "# Changelog\n"
underlines = ["", "", ""]
title_format = "## {version} ({project_date})"
{%- if tracker_url %}
issue_format = "[#{issue}]({{ tracker_url }}/{issue})"
issue_format = "[#{issue}]({{ tracker_url }}/{issue})"
{%- endif %}

[[tool.towncrier.type]]
directory = "removed"
name = "Removed"
showcontent = true

[[tool.towncrier.type]]
directory = "deprecated"
name = "Deprecated"
showcontent = true

[[tool.towncrier.type]]
directory = "changed"
name = "Changed"
showcontent = true

[[tool.towncrier.type]]
directory = "fixed"
name = "Fixed"
showcontent = true

[[tool.towncrier.type]]
directory = "added"
name = "Added"
showcontent = true

[[tool.towncrier.type]]
directory = "security"
name = "Security"
showcontent = true
[[tool.towncrier.type]]
directory = "removed"
name = "Removed"
showcontent = true

[[tool.towncrier.type]]
directory = "deprecated"
name = "Deprecated"
showcontent = true

[[tool.towncrier.type]]
directory = "changed"
name = "Changed"
showcontent = true

[[tool.towncrier.type]]
directory = "fixed"
name = "Fixed"
showcontent = true

[[tool.towncrier.type]]
directory = "added"
name = "Added"
showcontent = true

[[tool.towncrier.type]]
directory = "security"
name = "Security"
showcontent = true
@@ -1,6 +1,7 @@
"""
Salt auth module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt beacon module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt cache module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt cloud module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt engine module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt executor module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt fileserver module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt grain module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt log_handler module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt matcher module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt metaproxy module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt execution module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt netapi module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt output module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt pillar module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt pkgdb module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt pkgfile module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt proxy module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt queue module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt renderer module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt returner module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt roster module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt runner module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt SDB module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt serializer module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt state module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt thorium module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt token module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt top module
"""

import logging

log = logging.getLogger(__name__)
Expand Down
@@ -1,6 +1,7 @@
"""
Salt wheel module
"""

import logging

log = logging.getLogger(__name__)
Expand Down

0 comments on commit 5972381

Please sign in to comment.