nestauk / daps_utils

Tools for setting up and running pipelines in a Data Analytics and Production System (DAPS).
0 stars 1 forks source link

`calver-init`: add support for projects that diverge from `project_name/project_name` directory structure #111

Open jooh opened 2 years ago

jooh commented 2 years ago

The pre-commit hook in calver-init currently assumes that the project is named in a standard project/project structure, so for instance the VERSION file lives under, ojd_daps/ojd_daps/VERSION. This breaks if the repo name differs from the module name (e.g. by using kebab case on the repo side), or indeed if you ever decide to check out a repo under a different name for testing, as you might do when developing multiple feature branches in parallel.

I propose handling this by adding a little python script specifically for poetry-based projects, where the project name can be accessed from pyproject.toml. Something similar may be possible for traditional setup.py projects, but it's a little hairier to pull the name field out of that script... Maybe not in the initial PR. The idea for now is to revert to the current directory-based pattern whenever tool.poetry.name isn't set in the toml.

See also https://github.com/nestauk/data-utils/issues/15