coherent-oss / system

4 stars 0 forks source link

Develop a system for zero-config project management #1

Open jaraco opened 5 months ago

jaraco commented 5 months ago
jaraco commented 5 months ago

One challenge I've identified is installing from GitHub source or other source directory. If a project doesn't have a pyproject.toml, pip has no idea about how to build it:

 @ pip-run git+https://github.com/jaraco/tempora@experiment/coherent
ERROR: git+https://github.com/jaraco/tempora@experiment/coherent does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
Traceback (most recent call last):
  File "/opt/homebrew/bin/pip-run", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/pip_run/__init__.py", line 13, in run
    with deps.load(*deps.not_installed(pip_args)) as home:
  File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/pip_run/deps.py", line 100, in load
    subprocess.check_call(cmd, env=env)
  File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('/opt/homebrew/opt/python@3.12/bin/python3.12', '-m', 'pip', 'install', '-t', PosixPath('/var/folders/f2/2plv6q2n7l932m2x004jlw340000gn/T/pip-run-hky8fqrm'), 'git+https://github.com/jaraco/tempora@experiment/coherent')' returned non-zero exit status 1.

We could require each project to have the minimal pyproject.toml, but that becomes a shared artifact that needs to be managed across projects. Is there another way that a tool like pip or uv could infer those settings? Or get them from environment variables?

jaraco commented 4 months ago

Another issue these projects will face - how to manage development environment defaults, such as setting the recommended defaults for ruff?

Perhaps the system should follow the same principle as skeleton did for .gitignore - that is, it should be defined somewhere at a system level or environment level.

Or maybe there should be a parent repo that contains the relevant projects and that repo should contain the ruff defaults. Something like:

py / coherent / build

Where py is coherent-oss/python and would contain the settings for all Python projects such as ruff best practices (and could contain projects outside coherent-oss). coherent is coherent-oss/coherent (?) and would contain settings or concerns specific to projects using the coherent namespace. And build is coherent-oss/coherent.build.

jaraco commented 4 months ago

Ugh. It appears as if ruff only allows for discovering settings from one file. That file can explicitly include other files, but there's no support for composition (like git's global/user/local hierarchy). I think what this means is that anything that runs linting (including an editor that's autosaving, a pre-commit hook, a check at test time, or a manually-invoked formatting/lint operation) will have to be aware of the common config in order to honor it.

jaraco commented 4 months ago

(moved to coherent-oss/coherent.test#1)

jaraco commented 3 months ago

Thusfar, the builder is working for all of the coherent projects (coherent.build, coherent.test, and coherent.cli at the time of this writing). It's also working for tempora in the experimental branch. Therefore, I'm declaring "prove the builder" done.