PythonMake


NamePythonMake JSON
Version 0.0.16 PyPI version JSON
download
home_pagehttps://github.com/haryle/PyMake
SummaryA simple CLI wrapper
upload_time2023-09-19 01:29:16
maintainer
docs_urlNone
authorhoangson
requires_python>=3.10
licenseMIT
keywords cli commands
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyMake

## Installing PyMake:

```commandline
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: 

```yaml
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:

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


## To run a target:

```commandline
pymake run <target> <arguments>
```

# Quick start:

## A `Hello World` example:

```yaml
# PyMake.yaml
hello:
    cmd:
        - echo "Hello World"
```
The make file defines the target `hello`. Executing `hello` requires running the command `echo "Hello World"`

```bash
pymake run hello
```

## Add and Commit example
```yaml
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: 
```commandline
pymake run commit "feat: add a new target in PyMake.yaml" --pathspec PyMake.yaml
```

### To add all files
```commandline
pymake run commit "feat: update current repository"
```

### To do a dryrun 
This checks which files are to be committed but does not actually commit. 

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

## Push upstream
```commandline
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. 
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/haryle/PyMake",
    "name": "PythonMake",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "cli,commands",
    "author": "hoangson",
    "author_email": "lehoangsonsg@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/21/78/77d2635b0c78f9cd6bd72e34798feae0841934209580e975d64a971eb59a/pythonmake-0.0.16.tar.gz",
    "platform": null,
    "description": "# PyMake\n\n## Installing PyMake:\n\n```commandline\npip install PythonMake\n```\n\n## What this program is about:\n\nPyMake is a wrapper that allows you to run multiple commands/scripts with variables that can be provided through CLI.\n\nTo run PyMake, you will need to create a `PyMake.yaml` file and define a make target recipe. The general structure of \na `PyMake.yaml` is: \n\n```yaml\ntarget:\n    var:\n      basic: [var1, var2, var3]\n      option: {opt1: flag1, opt2:flag2, opt3:flag3}\n      sequence: [list1, list2]\n    env: {ENV1: \"value1\", ENV2: \"value2\"}\n    cmd:\n      - command1\n      - command2\n```\n`var` element defines all variables in the namespace local to `target`. The variables\ncan be used to interpolate environment variables or command referencing them via the syntax `$(var)`. \n\n`basic` variables are variables that take exactly one value. `basic` variables can take on default (single) values. A \n`null` value means that the variables must be defined at run time. `basic` variables can be parsed as positional arguments\nor by using keyword argument: `--<varname> value`.\n\n`option` variables take no value but is used to activate the corresponding \noption in `cmd`. The default value provided for each `option` variable specifies how the corresponding option will be\nraised in `cmd`. If an `option` variable is not set at `pymake run`, it will not be triggered in the referencing commands.\n`option` variables can be activated using `--<varname>`.\n\n`sequence` variables are variables that take on at least one value. `sequence` variables can also take on default values,\nand a `null` default value means that the variable must be provided at `pymake run`. `sequence` variable can only be defined\nusing `--<varname> value1 value2 ...`.\n\n`env` element defines all environment variables. Environment variables will be defined in the shell used to execute the commands.\nEnvironment variables can be set using `key: value` pairs, where value is a hard-coded value, or is a reference to a `var`\nvariable in this format: `key: $(var)`. Note that a reference is not restricted to a single variable. The following definition\nis valid:\n\n```yaml\nenv:\n    url: \"http://$(hostname):$(port)\"\n```\n\n\n## To run a target:\n\n```commandline\npymake run <target> <arguments>\n```\n\n# Quick start:\n\n## A `Hello World` example:\n\n```yaml\n# PyMake.yaml\nhello:\n    cmd:\n        - echo \"Hello World\"\n```\nThe make file defines the target `hello`. Executing `hello` requires running the command `echo \"Hello World\"`\n\n```bash\npymake run hello\n```\n\n## Add and Commit example\n```yaml\ncommit:\n    var:\n        basic:\n            message: null\n        option:\n            interactive: \"-i\"\n            verbose: \"-v\"\n            dryrun: \"--dry-run\"\n        sequence:\n            pathspec: .\n    cmd:\n      - git add -A $(verbose) $(interactive) $(pathspec)\n      - git commit $(verbose) $(dryrun) --message \"$(message)\"\n```\nAcknowledging that you can do pretty much the same thing with every IDE, I just want to show how PyMake can simplify\nthis add to commit git workflow. Note that here you have to add in the quotation marks yourself. \n\n### To add a specific file: \n```commandline\npymake run commit \"feat: add a new target in PyMake.yaml\" --pathspec PyMake.yaml\n```\n\n### To add all files\n```commandline\npymake run commit \"feat: update current repository\"\n```\n\n### To do a dryrun \nThis checks which files are to be committed but does not actually commit. \n\n```commandline\npymake run commit \"feat: do a dry run\" --dryrun\n```\n\n## Push upstream\n```commandline\npush_remote:\n    var:\n        basic:\n            name: feat-dev\n            main: main\n    cmd:\n        - git checkout -B $(name)\n        - git push -u origin $(name)\n        - git checkout $(main)\n        - git branch -d $(name)\n```\n\nIf you set your main branch to be protected, the general workflow of going on the website, creating a new branch, checking out \nto the branch can be a bit mundane. Additionally, you might have accidentally updated your local main, which means you now need \nto do all the crazy stashing and popping that are too much to remember, try the procedure described here. This will checkout \nlocally to a new branch, create a remote branch with a matching name, then checkout to main and delete the new branch. Now \nyou just need to create a PR on the website and forget all the mundane git stuffs. ",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple CLI wrapper",
    "version": "0.0.16",
    "project_urls": {
        "Homepage": "https://github.com/haryle/PyMake",
        "Repository": "https://github.com/haryle/PyMake"
    },
    "split_keywords": [
        "cli",
        "commands"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e5406a695bea4d5250437eb3318f4697b8902ff9709990b6dde89ac8a3c44459",
                "md5": "4de69a8241b0a9a4b615c0e071db01b5",
                "sha256": "0649db7b8e1207766349d04a5e4342a912add1a692612eec06634cc1bb2157df"
            },
            "downloads": -1,
            "filename": "pythonmake-0.0.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4de69a8241b0a9a4b615c0e071db01b5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 16271,
            "upload_time": "2023-09-19T01:29:14",
            "upload_time_iso_8601": "2023-09-19T01:29:14.461474Z",
            "url": "https://files.pythonhosted.org/packages/e5/40/6a695bea4d5250437eb3318f4697b8902ff9709990b6dde89ac8a3c44459/pythonmake-0.0.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "217877d2635b0c78f9cd6bd72e34798feae0841934209580e975d64a971eb59a",
                "md5": "debd7d929af5ab9411f75f94f6100ab9",
                "sha256": "16b964086c6f7dbf7e476cda4f49972cbda96d70667b9fd8ac0a78eba8edfd03"
            },
            "downloads": -1,
            "filename": "pythonmake-0.0.16.tar.gz",
            "has_sig": false,
            "md5_digest": "debd7d929af5ab9411f75f94f6100ab9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 11370,
            "upload_time": "2023-09-19T01:29:16",
            "upload_time_iso_8601": "2023-09-19T01:29:16.934627Z",
            "url": "https://files.pythonhosted.org/packages/21/78/77d2635b0c78f9cd6bd72e34798feae0841934209580e975d64a971eb59a/pythonmake-0.0.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-19 01:29:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "haryle",
    "github_project": "PyMake",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pythonmake"
}
        
Elapsed time: 0.11886s