diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e1b81befda..ed283fffc3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -16,8 +16,6 @@ RUN curl -sSL https://install.python-poetry.org | python3 - \ && echo "fpath+=~/.zfunc\nautoload -Uz compinit && compinit" >> /home/vscode/.zshrc COPY pyproject.toml poetry.lock ./ -# we do not want the packages defined for this install, comment out the line. -RUN sed -i 's/^[^#]*packages/#&/' pyproject.toml RUN poetry config virtualenvs.create false \ - && poetry install --no-interaction --all-extras \ + && poetry install --no-root --no-interaction --all-extras \ && rm -rf /root/.cache/pypoetry \ No newline at end of file diff --git a/.devcontainer/post-install.sh b/.devcontainer/post-install.sh index ef655e7585..359914cd9d 100644 --- a/.devcontainer/post-install.sh +++ b/.devcontainer/post-install.sh @@ -9,4 +9,7 @@ python -m pip install --upgrade pip pip3 install -r demo/requirements.txt -r demo/requirements.behave.txt # install black for formatting -pip3 install black \ No newline at end of file +pip3 install black + +# install a version of aries-cloudagent so the pytests can pick up a version +pip3 install aries-cloudagent \ No newline at end of file diff --git a/.vscode-sample/launch.json b/.vscode-sample/launch.json index f3af717a1b..2eae0a1f9f 100644 --- a/.vscode-sample/launch.json +++ b/.vscode-sample/launch.json @@ -16,34 +16,37 @@ ] }, { - "name": "flake8 - aries_cloudagent", + "name": "ruff - aries_cloudagent", "type": "python", "request": "launch", - "module": "flake8", + "module": "ruff", "console": "integratedTerminal", + "sudo": true, "justMyCode": true, "cwd": "${workspaceFolder}/aries_cloudagent", - "args": [ - "--max-line-length=90", - "--exclude=*/tests/**", - "--extend-ignore=D202,W503", - "--per-file-ignores=*/__init__.py:D104" - ], + "args": ["check", "."], }, { - "name": "flake8 - current file", + "name": "ruff fix - aries_cloudagent", "type": "python", "request": "launch", - "module": "flake8", + "module": "ruff", "console": "integratedTerminal", + "sudo": true, "justMyCode": true, - "args": [ - "--max-line-length=90", - "--exclude=*/tests/**", - "--extend-ignore=D202,W503", - "--per-file-ignores=*/__init__.py:D104", - "${file}" - ], + "cwd": "${workspaceFolder}/aries_cloudagent", + "args": ["check", ".", "--fix"], + }, + { + "name": "ruff - current file", + "type": "python", + "request": "launch", + "module": "ruff", + "console": "integratedTerminal", + "sudo": true, + "justMyCode": true, + "cwd": "${workspaceFolder}/aries_cloudagent", + "args": ["check", ".", "${file}"], }, { "name": "black (check) - aries_cloudagent", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 51d59a2c0b..c428e49f90 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ Contributions are made pursuant to the Developer's Certificate of Origin, availa A configuration for [pre-commit](https://pre-commit.com/) is included in this repository. This is an optional tool to help contributors commit code that follows the formatting requirements enforced by the CI pipeline. Additionally, it can be used to help contributors write descriptive commit messages that can be parsed by changelog generators. -On each commit, pre-commit hooks will run that verify the committed code complies with flake8 and is formatted with black. To install the flake8 and black checks: +On each commit, pre-commit hooks will run that verify the committed code complies with ruff and is formatted with black. To install the ruff and black checks: ``` $ pre-commit install diff --git a/DevReadMe.md b/DevReadMe.md index db1262054a..3a50a02b2e 100644 --- a/DevReadMe.md +++ b/DevReadMe.md @@ -211,7 +211,7 @@ The `manage` script is described in detail [here](https://github.com/hyperledger ## Development Workflow -We use [Flake8](http://flake8.pycqa.org/en/latest/) to enforce a coding style guide. +We use [Ruff](https://github.com/astral-sh/ruff) to enforce a coding style guide. We use [Black](https://black.readthedocs.io/en/stable/) to automatically format code. diff --git a/devcontainer.md b/devcontainer.md index 2d9d42ca78..48f86386e7 100644 --- a/devcontainer.md +++ b/devcontainer.md @@ -75,7 +75,7 @@ In VS Code, open a Terminal, you should be able to run the following commands: ``` python -m aries_cloudagent -v cd aries_cloudagent -flake8 --max-line-length=90 --exclude=*/tests/** --extend-ignore=D202,W503 --per-file-ignores=*/__init__.py:D104 +ruff check . black . --check ```