Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Usage: ./cli.py [OPTIONS] COMMAND [ARGS]...
│ coverage Run and show coverage. │
│ fix-code-style Fix code style of all manageprojects source code files via darker │
│ format-file Format and check the given python source code file with │
│ darker/isort/pyupgrade/autopep8/mypy etc.
│ darker/autoflake/isort/pyupgrade/autopep8/mypy etc. │
│ install Run pip-sync and install 'manageprojects' via pip as editable. │
│ mypy Run Mypy (configured in pyproject.toml) │
│ publish Build and upload this project to PyPi │
Expand Down Expand Up @@ -260,7 +260,8 @@ You can use `format-file` as "Action on save" or manual action in your IDE to fi
```
Usage: ./cli.py format-file [OPTIONS] FILE_PATH

Format and check the given python source code file with darker/isort/pyupgrade/autopep8/mypy etc.
Format and check the given python source code file with
darker/autoflake/isort/pyupgrade/autopep8/mypy etc.
The optional fallback values will be only used, if we can't get them from the project meta files
like ".editorconfig" and "pyproject.toml"

Expand Down
2 changes: 1 addition & 1 deletion manageprojects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Manage Python / Django projects
"""

__version__ = '0.9.10'
__version__ = '0.10.0'
__author__ = 'Jens Diemer <[email protected]>'
2 changes: 1 addition & 1 deletion manageprojects/cli/cli_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def format_file(
file_path: Path,
):
"""
Format and check the given python source code file with darker/isort/pyupgrade/autopep8/mypy etc.
Format and check the given python source code file with darker/autoflake/isort/pyupgrade/autopep8/mypy etc.

The optional fallback values will be only used, if we can't get them from the project meta files
like ".editorconfig" and "pyproject.toml"
Expand Down
10 changes: 10 additions & 0 deletions manageprojects/format_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ def run_pyupgrade(tools_executor, file_path, config):
)


def run_autoflake(tools_executor, file_path, config):
# TODO: Remove if isort can do the job: https://github.com/PyCQA/isort/issues/1105
tools_executor.verbose_check_output(
'autoflake',
'--in-place',
file_path,
)


def run_darker(tools_executor, file_path, config, darker_prefixes):
if darker_prefixes:
# darker/black will not fix e.g.:
Expand Down Expand Up @@ -262,6 +271,7 @@ def format_one_file(
print('\n')

run_pyupgrade(tools_executor, file_path, config)
run_autoflake(tools_executor, file_path, config)

if config.main_branch_name:
run_darker(tools_executor, file_path, config, darker_prefixes)
Expand Down
2 changes: 2 additions & 0 deletions manageprojects/tests/test_format_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def test_format_one_file(self):
'--py39-plus',
'manageprojects/tests/test_format_file.py',
],
['.../autoflake', '--in-place', 'manageprojects/tests/test_format_file.py'],
[
'.../autopep8',
'--ignore-local-config',
Expand Down Expand Up @@ -233,6 +234,7 @@ def test_format_one_file(self):
'--py39-plus',
'manageprojects/tests/test_format_file.py',
],
['.../autoflake', '--in-place', 'manageprojects/tests/test_format_file.py'],
[
'.../autopep8', # <<< Instead of Darker!
'--ignore-local-config',
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dev = [
"autopep8", # https://github.com/hhatto/autopep8
"pyupgrade", # https://github.com/asottile/pyupgrade
"flake8", # https://github.com/pycqa/flake8
"autoflake", # https://github.com/PyCQA/autoflake
"pyflakes", # https://github.com/PyCQA/pyflakes
"codespell", # https://github.com/codespell-project/codespell
"EditorConfig", # https://github.com/editorconfig/editorconfig-core-py
Expand Down
220 changes: 113 additions & 107 deletions requirements.dev.txt

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ binaryornot==0.4.4 \
--hash=sha256:359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061 \
--hash=sha256:b8b71173c917bddcd2c16070412e369c3ed7f0528926f70cac18a6c97fd563e4
# via cookiecutter
bx-py-utils==76 \
--hash=sha256:c9fcedc76daa9782b0a0c535d0d803061f61117f95957862ef58253f3c35fc0e \
--hash=sha256:f15c64731cd9df0ca9a7bd3993fc0bf4faeb25fc30157348eb9735bf0989a210
bx-py-utils==80 \
--hash=sha256:34c4f5e4e1199014a83139aa4285a85f84274a982f9a9a8eae056fd9848a42f7 \
--hash=sha256:59f3d641c516fdf75d47ea86cd84fe6405d07fc7761074dcbbb967b6962dcc09
# via manageprojects (pyproject.toml)
certifi==2022.12.7 \
--hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \
--hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18
certifi==2023.5.7 \
--hash=sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7 \
--hash=sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716
# via requests
chardet==5.1.0 \
--hash=sha256:0d62712b956bc154f85fb0a266e2a3c5913c2967e00348701b32411d6def31e5 \
Expand Down Expand Up @@ -186,9 +186,9 @@ mdurl==0.1.2 \
--hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \
--hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba
# via markdown-it-py
pygments==2.15.0 \
--hash=sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094 \
--hash=sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500
pygments==2.15.1 \
--hash=sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c \
--hash=sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1
# via rich
python-dateutil==2.8.2 \
--hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \
Expand Down Expand Up @@ -240,13 +240,13 @@ pyyaml==6.0 \
--hash=sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174 \
--hash=sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5
# via cookiecutter
requests==2.28.2 \
--hash=sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa \
--hash=sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf
requests==2.30.0 \
--hash=sha256:10e94cc4f3121ee6da529d358cdaeaff2f1c409cd377dbc72b825852f2f7e294 \
--hash=sha256:239d7d4458afcb28a692cdd298d87542235f4ca8d36d03a15bfc128a6559a2f4
# via cookiecutter
rich==13.3.3 \
--hash=sha256:540c7d6d26a1178e8e8b37e9ba44573a3cd1464ff6348b99ee7061b95d1c6333 \
--hash=sha256:dc84400a9d842b3a9c5ff74addd8eb798d155f36c1c91303888e0a66850d2a15
rich==13.3.5 \
--hash=sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c \
--hash=sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704
# via
# manageprojects (pyproject.toml)
# rich-click
Expand All @@ -262,11 +262,11 @@ text-unidecode==1.3 \
--hash=sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8 \
--hash=sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93
# via python-slugify
tomlkit==0.11.7 \
--hash=sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c \
--hash=sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d
tomlkit==0.11.8 \
--hash=sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171 \
--hash=sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3
# via manageprojects (pyproject.toml)
urllib3==1.26.15 \
--hash=sha256:8a388717b9476f934a21484e8c8e61875ab60644d29b9b39e11e4b9dc1c6b305 \
--hash=sha256:aa751d169e23c7479ce47a0cb0da579e3ede798f994f5816a74e4f4500dcea42
urllib3==2.0.2 \
--hash=sha256:61717a1095d7e155cdb737ac7bb2f4324a858a1e2e6466f6d03ff630ca68d3cc \
--hash=sha256:d055c2f9d38dc53c808f6fdc8eab7360b6fdbbde02340ed25cfbcd817c62469e
# via requests