Skip to content

Bug: Ruff check runs on entire directory for monorepo #3

@cobycloud

Description

@cobycloud

As a user, I want to be able to execute linting recursively, on a per package directory basis.

For example:

If we have the following toml

[tool.poetry]
name = "swarmauri-monorepo"
version = "0.6.1.dev13"
description = "Monorepo for multiple interdependent Swarmauri Python packages"
authors = ["Jacob Stewart <[email protected]>"]
# Disables packaging mode
package-mode = false

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
pydantic = "^2.0"
ipython = "^8.28.0"

# Path dependencies (editable installs by default)
###
# Foundational 
###
swarmauri_core = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/core" }
swarmauri_base = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/base" }
swarmauri_standard = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_standard"}
swarmauri = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/swarmauri" }

###
# Extra First Class Citizens
###
swarmauri_vectorstore_doc2vec = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_vectorstore_doc2vec"}
swarmauri_embedding_doc2vec = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_embedding_doc2vec"}
swarmauri_embedding_tfidf = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_embedding_tfidf"}
swarmauri_embedding_nmf = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_embedding_nmf"}
swarmauri-tool-matplotlib = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_tool_matplotlib"}
swarmauri_parser_keywordextractor = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_parser_keywordextractor"}
swarmauri_parser_beautifulsoupelement = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_parser_beautifulsoupelement"}
swarmauri_vectorstore_tfidf = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_vectorstore_tfidf"}
swarmauri_distance_minkowski = { git = "https://github.com/swarmauri/swarmauri-sdk.git", branch = "mono/dev", subdirectory = "pkgs/standards/swarmauri_distance_minkowski"}

We will find that within the toml, we do not mention the package located under swarmauri_toolkit_jupytertoolkit.JupyterToolkit.

Upon executing the following command:

 cd pkgs
  soliloquy prepare --directory . --recursive \
    --bump "patch" \
    --commit-msg "chore: auto increment packages" \
    --lint-fix

We find that the lint_ops executes the following:
ruff check /home/runner/work/swarmauri-sdk/swarmauri-sdk/pkgs --fix

Here is the full output for this scenario:

[lint_ops] Running: ruff check /home/runner/work/swarmauri-sdk/swarmauri-sdk/pkgs --fix
[lint_ops] Ruff linting failed with exit code 1.
community/swarmauri_toolkit_jupytertoolkit/tests/i9n/test_i9n__init__.py:15:58: F401 `swarmauri_toolkit_jupytertoolkit.JupyterToolkit` imported but unused; consider using `importlib.util.find_spec` to test for availability
   |
13 |         """Ensures that the __init__.py loads correctly."""
14 |         try:
15 |             from swarmauri_toolkit_jupytertoolkit import JupyterToolkit
   |                                                          ^^^^^^^^^^^^^^ F401
16 |         except ImportError:
17 |             pytest.fail("Failed to import JupyterToolkit")
   |
   = help: Remove unused import: `swarmauri_toolkit_jupytertoolkit.JupyterToolkit`
Found 38 errors (37 fixed, 1 remaining).

We want to iteratively go through each of the packages located on the mono (that we find to have git paths) and run the ruff checks in the packages' directory, such that the ruff checks only run on the files mentioned in the monorepo pyproject.toml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions