Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace black and isort with ruff formatter #590

Merged
merged 3 commits into from
May 20, 2024
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
10 changes: 4 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ jobs:
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -e .
- name: Ruff Format Check
run: ruff format --check .
- name: Ruff Check
run: ruff check --output-format=github .
- name: Mypy Check
run: mypy ./seedfarmer
- name: Flake8 Check
run: flake8 ./seedfarmer
- name: Black Check
run: black --check ./seedfarmer
- name: Isort Check
run: isort --check ./seedfarmer
- name: PyTest
run: cp test/unit-test/mock_data/seedfarmer.yaml . && pytest
8 changes: 7 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx.ext.autosectionlabel", "sphinx.ext.napoleon", "myst_parser", "autoapi.extension","sphinx_click.ext"]
extensions = [
"sphinx.ext.autosectionlabel",
"sphinx.ext.napoleon",
"myst_parser",
"autoapi.extension",
"sphinx_click.ext",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand Down
57 changes: 27 additions & 30 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
[tool.black]
[tool.ruff]
exclude = [
".eggs",
".git",
".hg",
".mypy_cache",
".ruff_cache",
".tox",
".venv",
".env",
"_build",
"buck-out",
"build",
"dist",
"codeseeder.out",
"seedfarmer.gitmodules"
]
line-length = 120
target-version = ["py37", "py38", "py39", "py310", "py311"]
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| \.env
| _build
| buck-out
| build
| dist
| codeseeder.out
| seedfarmer.gitmodules
)/
'''
target-version = "py38"

[tool.ruff.lint]
select = ["E", "W", "F", "I"]
ignore = []
fixable = ["ALL"]

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 120
src_paths = ["seedfarmer"]
py_version = 37
skip_gitignore = false
[tool.ruff.lint.per-file-ignores]
"docs/*" = ["E402"]
"test/unit-test/mock_data/*" = ["E501"]

[tool.mypy]
python_version = "3.7"
python_version = "3.8"
strict = true
ignore_missing_imports = true
disallow_untyped_decorators = false
Expand Down
4 changes: 1 addition & 3 deletions requirements-dev.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
awscli~=1.31.13
black~=24.3.0
certifi~=2023.7.22
check-manifest~=0.48
flake8~=5.0.4
isort~=5.10.1
mypy~=0.961
myst-parser~=0.18.0
pip-tools~=6.14.0
Expand All @@ -13,6 +10,7 @@ pytest~=7.2.0
pytest-cov~=4.0.0
pytest-mock~=3.10.0
pytest-ordering~=0.6
ruff~=0.4.4
twine~=4.0.1
types-PyYAML~=6.0.8
types-setuptools~=57.4.17
Expand Down
59 changes: 8 additions & 51 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile requirements-dev.in
# pip-compile --output-file=requirements-dev.txt requirements-dev.in
#
alabaster==0.7.13
# via sphinx
Expand All @@ -14,8 +14,6 @@ awscli==1.31.13
# via -r requirements-dev.in
babel==2.14.0
# via sphinx
black==24.3.0
# via -r requirements-dev.in
bleach==6.0.0
# via readme-renderer
boto3==1.33.13
Expand All @@ -42,17 +40,13 @@ charset-normalizer==3.3.2
check-manifest==0.49
# via -r requirements-dev.in
click==8.1.7
# via
# black
# pip-tools
# via pip-tools
colorama==0.4.4
# via awscli
coverage[toml]==7.2.7
# via pytest-cov
cryptography==42.0.4
# via
# moto
# secretstorage
# via moto
docutils==0.16
# via
# awscli
Expand All @@ -61,28 +55,16 @@ docutils==0.16
# readme-renderer
# sphinx
# sphinx-rtd-theme
exceptiongroup==1.2.0
# via pytest
flake8==5.0.4
# via -r requirements-dev.in
idna==3.6
# via requests
imagesize==1.4.1
# via sphinx
importlib-metadata==4.2.0
# via
# keyring
# twine
# via twine
iniconfig==2.0.0
# via pytest
isort==5.10.1
# via -r requirements-dev.in
jaraco-classes==3.2.3
# via keyring
jeepney==0.8.0
# via
# keyring
# secretstorage
jinja2==3.1.3
# via
# moto
Expand All @@ -107,8 +89,6 @@ markupsafe==2.1.5
# jinja2
# moto
# werkzeug
mccabe==0.7.0
# via flake8
mdit-py-plugins==0.3.5
# via myst-parser
mdurl==0.1.2
Expand All @@ -120,38 +100,27 @@ moto[codebuild,iam,s3,secretsmanager,ssm,sts]==4.0.13
mypy==0.991
# via -r requirements-dev.in
mypy-extensions==1.0.0
# via
# black
# mypy
# via mypy
myst-parser==0.18.1
# via -r requirements-dev.in
packaging==23.2
# via
# black
# build
# pyroma
# pytest
# sphinx
pathspec==0.11.2
# via black
pip-tools==6.14.0
# via -r requirements-dev.in
pkginfo==1.9.6
# via twine
platformdirs==4.0.0
# via black
pluggy==1.2.0
# via pytest
pyasn1==0.5.1
# via rsa
pycodestyle==2.9.1
# via flake8
pycparser==2.21
# via cffi
pydot==1.4.2
# via -r requirements-dev.in
pyflakes==2.5.0
# via flake8
pygments==2.17.2
# via
# pyroma
Expand Down Expand Up @@ -208,12 +177,12 @@ rich==13.7.0
# via twine
rsa==4.7.2
# via awscli
ruff==0.4.4
# via -r requirements-dev.in
s3transfer==0.8.2
# via
# awscli
# boto3
secretstorage==3.3.3
# via keyring
six==1.16.0
# via
# bleach
Expand Down Expand Up @@ -242,16 +211,6 @@ sphinxcontrib-qthelp==1.0.3
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
tomli==2.0.1
# via
# black
# build
# check-manifest
# coverage
# mypy
# pip-tools
# pyproject-hooks
# pytest
trove-classifiers==2024.2.22
# via pyroma
twine==4.0.2
Expand All @@ -264,8 +223,6 @@ types-setuptools==57.4.18
# via -r requirements-dev.in
typing-extensions==4.7.1
# via
# astroid
# black
# mypy
# myst-parser
unidecode==1.3.8
Expand Down
3 changes: 2 additions & 1 deletion seedfarmer/commands/_deployment_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ def _exec_deploy(mdo: ModuleDeployObject) -> ModuleDeploymentResponse:
if dep_resp_object.status in ["ERROR", "error", "Error"]:
_logger.error("At least one module failed to deploy...exiting deployment")
print_errored_modules_build_info(
"These modules had errors deploying", deploy_response # type: ignore
"These modules had errors deploying",
deploy_response, # type: ignore
)
raise seedfarmer.errors.ModuleDeploymentError(
error_message="At least one module failed to deploy...exiting deployment"
Expand Down
1 change: 0 additions & 1 deletion seedfarmer/models/manifests/_module_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class ModuleManifest(CamelModel):
_local_path: Optional[str] = PrivateAttr(default=None)

def __init__(self, **kwargs: Any) -> None:

from seedfarmer.utils import batch_replace_env

kwargs = batch_replace_env(payload=kwargs)
Expand Down
3 changes: 2 additions & 1 deletion seedfarmer/output_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ def print_modules_build_info(
console.print(f"[bold {color}]{description}", crop=False)
for r_obj in modules_data:
console.print(
f" [cyan]{r_obj.deployment}-{r_obj.group}-{r_obj.module} status: {r_obj.status}", crop=False # type: ignore
f" [cyan]{r_obj.deployment}-{r_obj.group}-{r_obj.module} status: {r_obj.status}", # type: ignore
crop=False,
)
(
console.print(f" {r_obj.codeseeder_metadata.build_url}", crop=False) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion test/unit-test/_test_cli_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _test_command(
exit_code: int,
expected_output: Optional[str] = None,
return_result: Optional[bool] = False,
skip_eval:Optional[bool] = False,
skip_eval: Optional[bool] = False,
):
runner = CliRunner()
command_output = runner.invoke(sub_command, options)
Expand Down
Loading