Skip to main content

An attempt to replace/improve GNU/make with a python package

Project description

Makepie

An attempt to replace/improve GNU/make with a python package

Warning: This package is FAR from production ready, use at your own risk

Note: Makepie is (not yet) a substitution for a build system, it's a way to easily create targets accessible via cli that have complex behavior with the goal to manage projects

Why choose Makepie instead of make

  • Cross platform thanks to python
  • Support for args and kwargs in target call: allow for easy code reuse, smaller/cleaner make
  • No need to learn a new language (if you already know python)
  • Little to zero overhead
  • Syntax similar to make: easy to migrate
  • User as access to all python features (asyncio, multiprocessing...) which can make the build process faster and cleaner

Basic example

from src.makepie import *
makepie_load()

cc = "clang"
ccFlags = "main.cpp -o main.o"

@cache(cache_files=["main.o"], dependencies=["**/*.cpp", "**/*.hpp"])
def build():
	new_version = "0.1"
	log("Building "+new_version+"...")
	sh(f"{cc} {ccFlags}")
	return new_version

def test(ver):
	log("Testing "+ver+"...")
	success = sh("...")
	return success

def upload(ver):
	log("Uploading "+ver+"...")

@default()
def deploy():
	ver = build()
	
	if not test(ver):
		log.error("tests failed, aborting")
		return 1

	upload(ver)
	return 0

Inside your cli launch a deploy with just: makepie

To see more example go to the examples directory, or look at the make.py of this project for a concrete use case

Install

Install package: python3 -m pip install makepie

Then you can just call makepie if ~/.local/bin is in your system PATH

Command shortcut

Make an alias if you want a shortcut to launch makepie:

  • Linux: alias makepie="python3 -Bm makepie"
  • Windows: doskey makepie=python3 -Bm makepie TODO: test on windows

If you want the alias to be permanent put it in your .bashrc, or other corresponding file depending on your shell/operating system

Documentation

The documentation doesn't exist yet so I recommend looking at the source code, there isn't a lot.

Configuration

Makepie can be configured by passing kwargs in makepie_load(), for example: makepie_load(DEBUG=True)

  • CONFIG_NAME: description (example)
  • DEBUG: quick way to troubleshoot bugs (True)
  • ENV_FILE: path to the env file, each of it's value will be loaded in env (".env")
  • MAKEPIELOG_LEVEL: level of the makepie logs (logging.INFO)
  • MAKEPIELOG_FORMAT: format of the makepie logs ("%(message)s")
  • LOG_LEVEL: level of the user log (logging.INFO)
  • LOG_FORMAT: format of the user log ("%(message)s")
  • PRINT_STREAM_NAME: printing stream names (stdout/stderr) when a shell command send output
  • MAX_READ_SIZE: TODO
  • POLL_INTERVAL: TODO

Troubleshoot

Use the DEBUG or MAKEPIELOG_LEVEL config, if the error comes from makepie itself please file an issue.

Contributing

See Contributing.md

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

makepie-0.1.34-py3-none-any.whl (14.4 kB view hashes)

Uploaded Python 3

Supported by

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