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

Changes in sub pyproject.toml do not cause a cache bust #12721

Closed
fellhorn opened this issue Aug 6, 2024 · 1 comment · Fixed by #12727
Closed

Changes in sub pyproject.toml do not cause a cache bust #12721

fellhorn opened this issue Aug 6, 2024 · 1 comment · Fixed by #12727
Labels
cache Related to Ruff cache

Comments

@fellhorn
Copy link

fellhorn commented Aug 6, 2024

When modifying a pyproject.toml in a subfolder ruff does correctly handle this as a cache bust. The same modification of the root level pyproject.toml causes a cache bust.

The setup can be recreated with this script:

#!/bin/bash

# Create root pyproject.toml
cat << EOF > pyproject.toml
[tool.ruff.lint]
select = []
EOF

# Create lib directory and its pyproject.toml
mkdir lib
cat << EOF > lib/pyproject.toml
[tool.ruff.lint]
select = []
EOF

# Create a Python file with a hello world function
# It violates ANN rules
cat << EOF > lib/hello.py
def hello_world():
    print("Hello, World!")
EOF

# Run ruff check
echo "Running initial ruff check:"
ruff check

# Modify lib/pyproject.toml
cat << EOF > lib/pyproject.toml
[tool.ruff.lint]
select = ["ANN"]
EOF

# Run ruff check again - it works due to a cache hit
echo "Running ruff check after modification:"
ruff check

# Ruff check without cache will fail
echo "Running ruff check without cache"
ruff check --no-cache

Output:

Running initial ruff check:
All checks passed!
Running ruff check after modification:
All checks passed!
Running ruff check without cache
lib/hello.py:1:5: ANN201 Missing return type annotation for public function `hello_world`
  |
1 | def hello_world():
  |     ^^^^^^^^^^^ ANN201
2 |     print("Hello, World!")
  |
  = help: Add return type annotation: `None`

Found 1 error.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).

Tested with ruff 0.5.6.

Searched for different combinations of these keywords and have not found an existing issue: cache pyproject.toml subfolder --no-cache subproject

@AlexWaygood AlexWaygood changed the title Chnages in sub pyproject.toml do not cause a cache bust Changes in sub pyproject.toml do not cause a cache bust Aug 6, 2024
@AlexWaygood AlexWaygood added the cache Related to Ruff cache label Aug 6, 2024
@dhruvmanila
Copy link
Member

#12264 might be related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cache Related to Ruff cache
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants