<#21700 Pants doesn't detect sources roots unless ...
# github-notifications
c
#21700 Pants doesn't detect sources roots unless root_pattern=["/"] Issue created by mnowotnik Describe the bug On MacOS root_pattern needs to be set to ["/"]. Any other value causes "No source root found for '.'" error. Pants version 2.23.0 OS MacOS Additional info /src/foo_lib/BUILD
Copy code
python_sources(
    name="foo_lib",
    sources=["foo.py"],  # Include only source files
)

python_tests(
    name="foo_lib_tests",
    dependencies=[":foo_lib"],  # Test depends on the library
    sources=["test_foo.py"],    # Include only test files
)
/pants.toml [GLOBAL] pants_version = "2.23.0" backend_packages = [ "pants.backend.python", "pants.backend.docker", "pants.backend.shell", "pants.backend.experimental.python.lint.ruff.check" ] [python] interpreter_constraints = [">=3.7"] [source] root_patterns = ["/src"] /BUILD
Copy code
shell_sources(
    name="0",
)
python_sources(
    name="root",
)
image Works without an issue if
root_patterns = ["/"]
. pantsbuild/pants