Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Makefile #80

Merged
merged 2 commits into from Jan 19, 2020
Merged

Add Makefile #80

merged 2 commits into from Jan 19, 2020

Conversation

CodeMouse92
Copy link
Contributor

Addresses #38

Here's a few notes:

First, this assumes UNIX-based environment; Makefiles are seldom appropriate for Windows. This should work on any UNIX-like system (Mac/Linux/BSD) with Python 3.6 or later installed. On Ubuntu, you may need to install python3-venv, but actually running the Makefile will indirectly prompt the user to install that anyhow. ;)

Second, I'm doing everything in the context of a virtual environment. There's seldom, if ever, a reason not to do this stuff outside of one! The Makefile sets up the venv, installs the necessary packages, and then performs the appropriate tasks.

The virtual environment is never actually activated; its binaries are called directly, and they know to only use the venv. It's a neat little trick.

Third, I expanded the .gitignore, mainly to prevent virtual environments from getting committed, but secondarily to untrack my own development tools. Hopefully that file is better organized now.

I see no reason why the Actions cannot be adjusted to use the Makefile for almost everything now, but I recommend the primary maintainer be the one to make those adjustments. I'm not overly familiar with Actions yet.

Makefile targets:

  • make: Runs clean dist.
  • make help: List all (most) targets.
  • make lint: Run flake8 linters.
  • make format: Run black
  • make test: Run tests, bootstrapping with Ward from PyPI
  • make prep: Gets the code ready to send as a pull request: lint format test tidy
  • make build: Alias for dist.
  • make dist: First runs lint format test, and then builds using setup.py. This creates dist/.
  • make tidy: Cleans up all cache, .pyc, and egg files. (I adore pycleanup!)
  • make clean: Removes the build/, dist/, and make-venv/ directories. Does not call tidy, because I don't want clean to require the virtual environment.

The make-venv target is not listed because I don't like the name; it is only there so that the virtual environment is not recreated if it already exists.

@darrenburns
Copy link
Owner

This is fantastic, and a really well written PR. Thanks! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants