In addition to kartiks77's answer (for those that want to use pyproject.toml) and in line with the question, this also works:
pyproject.toml
#pyproject.toml [tool.pytest.ini_options] norecursedirs = "lib/third"