DAI-Lab / cookiecutter-pypackage

DAI Lab's adaptation of cookiecutter-pypackage
BSD 3-Clause "New" or "Revised" License
1 stars 5 forks source link

Resort Makefile targets #16

Open csala opened 5 years ago

csala commented 5 years ago

Current Makefile has the targets ordered in a way that is difficult to read and understand.

I suggest resorting them following these two guidelines:

group all the targets by concepts

Put all the targets related to clean, install, lint, test, docs and release grouped by what they relate to.

This makes much easier to understand which variations of each command exist.

For example, current help command shows:

install              install the package to the active Python's site-packages
install-test         install the package and test dependencies
test                 run tests quickly with the default Python
lint                 check style with flake8 and isort
install-develop      install the package in editable mode and dependencies for development
test-all             run tests on every Python version with tox
fix-lint             fix lint issues using autoflake, autopep8, and isort
coverage             check code coverage quickly with the default Python
docs                 generate Sphinx HTML documentation, including API docs
view-docs            view docs in browser
serve-docs           compile the docs watching for changes

Here, commands like install-develp or coverage might be skipped, as they are separated from what they relate to.

So, instead of that, I'd rather order them like this, which shows them all grouped:

install              install the package to the active Python's site-packages
install-test         install the package and test dependencies
install-develop      install the package in editable mode and dependencies for development
test                 run tests quickly with the default Python
test-all             run tests on every Python version with tox
coverage             check code coverage quickly with the default Python
lint                 check style with flake8 and isort
fix-lint             fix lint issues using autoflake, autopep8, and isort
docs                 generate Sphinx HTML documentation, including API docs
view-docs            view docs in browser
serve-docs           compile the docs watching for changes

So all the install, test, lint and docs commands are grouped together.

Things that are used by others go first

This is not that important, but I'd always sort the groups so that individual commands show before the composed ones.

For example, instead of starting the clean group with the composed clean command, I would put it at the end, so it's clearer that this is just a call to all the others:

clean-build          remove build artifacts
clean-pyc            remove Python file artifacts
clean-docs           remove previously built docs
clean-coverage       remove coverage artifacts
clean-test           remove test artifacts
clean                remove all build, test, coverage, docs and Python artifacts
csala commented 4 years ago

Any thoughts on this @micahjsmith ?

I really think that resorting the targets as suggested would make it much easier for the user to both see what options there are when executing make help and to find and understand related things when reading the Makefile contents directly.