Skip to main content

PyMake

Installing PyMake:

pip install PythonMake

What this program is about:

PyMake is a wrapper that allows you to run multiple commands/scripts with variables that can be provided through CLI.

To run PyMake, you will need to create a PyMake.yaml file and define a make target recipe. The general structure of a PyMake.yaml is:

target:
    var:
      basic: [var1, var2, var3]
      option: {opt1: flag1, opt2:flag2, opt3:flag3}
      sequence: [list1, list2]
    env: {ENV1: "value1", ENV2: "value2"}
    cmd:
      - command1
      - command2

var element defines all variables in the namespace local to target. The variables can be used to interpolate environment variables or command referencing them via the syntax $(var).

basic variables are variables that take exactly one value. basic variables can take on default (single) values. A null value means that the variables must be defined at run time. basic variables can be parsed as positional arguments or by using keyword argument: --<varname> value.

option variables take no value but is used to activate the corresponding option in cmd. The default value provided for each option variable specifies how the corresponding option will be raised in cmd. If an option variable is not set at pymake run, it will not be triggered in the referencing commands. option variables can be activated using --<varname>.

sequence variables are variables that take on at least one value. sequence variables can also take on default values, and a null default value means that the variable must be provided at pymake run. sequence variable can only be defined using --<varname> value1 value2 ....

env element defines all environment variables. Environment variables will be defined in the shell used to execute the commands. Environment variables can be set using key: value pairs, where value is a hard-coded value, or is a reference to a var variable in this format: key: $(var). Note that a reference is not restricted to a single variable. The following definition is valid:

env:
    url: "http://$(hostname):$(port)"

To run a target:

pymake run <target> <arguments>

Quick start:

A Hello World example:

# PyMake.yaml
hello:
    cmd:
        - echo "Hello World"

The make file defines the target hello. Executing hello requires running the command echo "Hello World"

pymake run hello

Add and Commit example

commit:
    var:
        basic:
            message: null
        option:
            interactive: "-i"
            verbose: "-v"
            dryrun: "--dry-run"
        sequence:
            pathspec: .
    cmd:
      - git add -A $(verbose) $(interactive) $(pathspec)
      - git commit $(verbose) $(dryrun) --message "$(message)"

Acknowledging that you can do pretty much the same thing with every IDE, I just want to show how PyMake can simplify this add to commit git workflow. Note that here you have to add in the quotation marks yourself.

To add a specific file:

pymake run commit "feat: add a new target in PyMake.yaml" --pathspec PyMake.yaml

To add all files

pymake run commit "feat: update current repository"

To do a dryrun

This checks which files are to be committed but does not actually commit.

pymake run commit "feat: do a dry run" --dryrun

Push upstream

push_remote:
    var:
        basic:
            name: feat-dev
            main: main
    cmd:
        - git checkout -B $(name)
        - git push -u origin $(name)
        - git checkout $(main)
        - git branch -d $(name)

If you set your main branch to be protected, the general workflow of going on the website, creating a new branch, checking out to the branch can be a bit mundane. Additionally, you might have accidentally updated your local main, which means you now need to do all the crazy stashing and popping that are too much to remember, try the procedure described here. This will checkout locally to a new branch, create a remote branch with a matching name, then checkout to main and delete the new branch. Now you just need to create a PR on the website and forget all the mundane git stuffs.

Metadata

Release files for PythonMake 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PythonMake 0.0.16
File Size Uploaded Provenance Actions
pythonmake-0.0.16.tar.gz 11.4 kB Without provenance Details for pythonmake-0.0.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PythonMake 0.0.16
File Interpreter ABI Platform Actions
pythonmake-0.0.16-py3-none-any.whl Python 3 none any Details for pythonmake-0.0.16-py3-none-any.whl

Total release size: 27.6 kB

Release files / pythonmake-0.0.16.tar.gz

Download URL pythonmake-0.0.16.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
16b964086c6f7dbf7e476cda4f49972cbda96d70667b9fd8ac0a78eba8edfd03
BLAKE2b-256 checksum
How to use checksums
217877d2635b0c78f9cd6bd72e34798feae0841934209580e975d64a971eb59a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.5 Linux/5.15.0-83-generic

Release files / pythonmake-0.0.16-py3-none-any.whl

Download URL pythonmake-0.0.16-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0649db7b8e1207766349d04a5e4342a912add1a692612eec06634cc1bb2157df
BLAKE2b-256 checksum
How to use checksums
e5406a695bea4d5250437eb3318f4697b8902ff9709990b6dde89ac8a3c44459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.5 Linux/5.15.0-83-generic

Security for PythonMake 0.0.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page