Skip to main content

A pure-Python Makefile interpreter — use make without installing make

Project description

pymake314

A pure-Python Makefile interpreter. Use make without installing make.

pip install pymake314

No dependencies. Works on any OS where Python 3.8+ is available — including environments where you cannot install system packages.


CLI usage

pymake                        # run the default target from ./Makefile
pymake build                  # run a specific target
pymake build test             # run multiple targets in order
pymake -n build               # dry run — print commands, don't execute
pymake -s test                # silent — don't echo commands
pymake -k test                # keep going after errors
pymake -i test                # ignore all errors
pymake -f path/to/Makefile    # use a specific Makefile
pymake -C path/to/dir         # change to directory before doing anything
pymake CC=clang build         # override a variable
pymake -p                     # print parsed variable/rule database and exit

Python API

from pymake import run

rc = run()                                        # default target, ./Makefile
rc = run("build", "test")                         # multiple targets
rc = run("all", makefile="path/to/Makefile")      # custom Makefile path
rc = run("build", variables={"CC": "clang"})      # variable overrides
rc = run("all", dry_run=True)                     # dry run
rc = run("all", silent=True)                      # silent mode
rc = run("all", ignore_errors=True)               # ignore errors
rc = run("all", keep_going=True)                  # keep going after errors

run() returns 0 on success and a non-zero exit code on failure.
It raises FileNotFoundError if the Makefile is missing, and RuntimeError on dependency cycles or missing targets.


Supported Makefile features

Feature Supported
= recursive variables
:= / ::= immediate variables
?= conditional assignment
+= append
!= shell assignment
$(VAR) / ${VAR} expansion
$(VAR:.c=.o) suffix substitution references
$(VAR:%.c=%.o) pattern substitution references
.PHONY targets
Pattern rules (%.o: %.c)
Automatic variables $@ $< $^ $*
@ silent prefix
- ignore-errors prefix
include / -include
Backslash line continuation
Inline # comments
File timestamp (mtime) up-to-date checks
-C directory flag
-n dry run
-s silent mode
-k keep going
-i ignore errors
ifeq / ifdef conditionals 🔜 planned
$(foreach ...) / $(call ...) 🔜 planned
Parallel jobs (-j) 🔜 planned

Why pymake?

Some environments — CI containers, restricted servers, embedded systems, Windows machines — don't have make available and you can't install it. pymake gives you the same workflow (make build, make test, make clean) with nothing but Python.


License

See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymake314-1.0.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymake314-1.0.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file pymake314-1.0.0.tar.gz.

File metadata

  • Download URL: pymake314-1.0.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pymake314-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bad217220fd1172995639c63cd055a90bcbfd4cef66e8a1872a8ea79e4439fb9
MD5 1f323a7adb02b499a09b1f41274cdfbb
BLAKE2b-256 fe5afe5872d4b33e6b96dfd17374b15a552898d4bdf9cad17ca30e909f20fdd5

See more details on using hashes here.

File details

Details for the file pymake314-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pymake314-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pymake314-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdbaac9a9eb8c8e2f34d25a8f8fe873d7791b4ab657ede9528084190d6ccd6b9
MD5 9fb2f8a19441df1aac9a24e0e2e82c85
BLAKE2b-256 45994736690150a64462ac6bcfad9ad4b74042cd30ecff9fe4db2a19e1e0ae72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page