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 makepieTODO: 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file makepie-0.1.50-py3-none-any.whl.
File metadata
- Download URL: makepie-0.1.50-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
432a3ca4967a25a7003c85741dc3a73821ed1cd199e8d8b88a503a55a9724f21
|
|
| MD5 |
25e51801a266ebaf7e7270b8b7a3bbc8
|
|
| BLAKE2b-256 |
0909f21d62e29009e65afbb9b8cd77960209d89e0a113ba8bc378594e9046bb4
|