Providing a way to specify how to run tests (and docs?)

Agreed. Maybe we can start with some common practices and/or heuristics. For example in my projects:

  1. I do this by adding a source-includes key in the [tools.pdm] section of my pyproject.toml file. I include my top level docs/, test/ directories, and top-level tox.ini and conftest.py files.
  2. I don’t use a test extra, but have a testing key in my [tool.pdm.dev-dependencies] section of my pyproject.toml file.
  3. $ tox - this is the one implicit part you’d have to heuristically detect.

So pretty much, if you see a tox.ini file, just run tox and that will do everything necessary. I guess nox would have a similar heuristic. I really like this set up.

The only minor glitch is that both tox and pdm have to be installed for everything to work. Installing pdm isn’t a problem though because I include that in the deps key for each of my tox environments. The tricky bit here is that you can either have tox drive pdm, or pdm drive tox. I’ve experimented with both and prefer the former. So if you get one of my sdists, all you need to do is run tox and it should all Just work.