pmakefile


Namepmakefile JSON
Version 0.4.5 PyPI version JSON
download
home_page
Summary
upload_time2024-02-27 06:44:45
maintainer
docs_urlNone
authorthautwarm
requires_python>=3.7,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pmakefile

## Background

Makefile is a fundamental tool when it comes to building software. As a simple way to organize code compilation,
it's been part of Unix world for over 40 years. However, it's not a perfect tool. Its cross-platform support is not native yet, and learning curves can be steep. This project aims to provide a practical alternative to Makefile subset for most common use cases.

> Software can be reproducible, protable, and maintainable, for regular users and developers, with a simple "P-makefile".

## Usage

See the `example/` directory where we write a single `make` in Python using `pmakefile` and `zig cc` to cross-compile the QuickJS project for Windows, Linux, and macOS (x86_64 and aarch64), which is a huge task and so far not achieved by any other known makefile written for QuickJS. With `pmakefile`, writing `make` promises us excellent portability, static type checking, and simplicity, while depending on only a standard Python distribution.

The `pmakefile` Python module exports some useful functions, see [builtin functions](#useful-helper-functions)

The pmakefile structure can be given as follows:

```python
from pmakefile import *

phony([
    'all', 'clean', ... # phony targets
])

ROOT = Path(__file__).parent.relative_to(os.getcwd())

@recipe('dep1', 'dep2')
def my_recipe():
    """documentation for my_recipe"""

    # some python statements
```

Then you can use it in your favorite shell:

```shell
pmk help
# pmk all
# pmk clean
```

## Useful Helper Functions


- `get_os() -> 'windows' | 'linux' | 'macos'`
- `log(msg: str, level: 'ok' | 'error' | 'info' | 'debug' | 'warn' | 'normal' = 'normal')`
- `shell(command: str | list[str], *, env: dict | None = None, noprint: bool = False)`
- `get_deps()`: get direct dependencies of current target
- `with proft(title: str): ...`: profile the execution time of the code block and report with the given `title` (when the environment variable `PMAKEFILE_PROF` is set)
- `get_dlext() -> str`: get platform-specific dynamic library file extension

## License

MIT License is used for this project. See [LICENSE](LICENSE) for more details.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pmakefile",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "thautwarm",
    "author_email": "twshere@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/4e/63/59f1f2d2864f8147ab9874091645cdf480fec4ea6bb78bdd96d98601ed3e/pmakefile-0.4.5.tar.gz",
    "platform": null,
    "description": "# pmakefile\n\n## Background\n\nMakefile is a fundamental tool when it comes to building software. As a simple way to organize code compilation,\nit's been part of Unix world for over 40 years. However, it's not a perfect tool. Its cross-platform support is not native yet, and learning curves can be steep. This project aims to provide a practical alternative to Makefile subset for most common use cases.\n\n> Software can be reproducible, protable, and maintainable, for regular users and developers, with a simple \"P-makefile\".\n\n## Usage\n\nSee the `example/` directory where we write a single `make` in Python using `pmakefile` and `zig cc` to cross-compile the QuickJS project for Windows, Linux, and macOS (x86_64 and aarch64), which is a huge task and so far not achieved by any other known makefile written for QuickJS. With `pmakefile`, writing `make` promises us excellent portability, static type checking, and simplicity, while depending on only a standard Python distribution.\n\nThe `pmakefile` Python module exports some useful functions, see [builtin functions](#useful-helper-functions)\n\nThe pmakefile structure can be given as follows:\n\n```python\nfrom pmakefile import *\n\nphony([\n    'all', 'clean', ... # phony targets\n])\n\nROOT = Path(__file__).parent.relative_to(os.getcwd())\n\n@recipe('dep1', 'dep2')\ndef my_recipe():\n    \"\"\"documentation for my_recipe\"\"\"\n\n    # some python statements\n```\n\nThen you can use it in your favorite shell:\n\n```shell\npmk help\n# pmk all\n# pmk clean\n```\n\n## Useful Helper Functions\n\n\n- `get_os() -> 'windows' | 'linux' | 'macos'`\n- `log(msg: str, level: 'ok' | 'error' | 'info' | 'debug' | 'warn' | 'normal' = 'normal')`\n- `shell(command: str | list[str], *, env: dict | None = None, noprint: bool = False)`\n- `get_deps()`: get direct dependencies of current target\n- `with proft(title: str): ...`: profile the execution time of the code block and report with the given `title` (when the environment variable `PMAKEFILE_PROF` is set)\n- `get_dlext() -> str`: get platform-specific dynamic library file extension\n\n## License\n\nMIT License is used for this project. See [LICENSE](LICENSE) for more details.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "",
    "version": "0.4.5",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bdeb6f3dd550abf22f8c7d9982047f705e596befe7c0af0b96fdccd095dfd885",
                "md5": "00215e922255ba1dba1ba6737f637b23",
                "sha256": "5f721abd2d96a03959acfb253fc258ecabf2d1fbd03b8171282ac3877a3bb611"
            },
            "downloads": -1,
            "filename": "pmakefile-0.4.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "00215e922255ba1dba1ba6737f637b23",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 7839,
            "upload_time": "2024-02-27T06:44:43",
            "upload_time_iso_8601": "2024-02-27T06:44:43.539160Z",
            "url": "https://files.pythonhosted.org/packages/bd/eb/6f3dd550abf22f8c7d9982047f705e596befe7c0af0b96fdccd095dfd885/pmakefile-0.4.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e6359f1f2d2864f8147ab9874091645cdf480fec4ea6bb78bdd96d98601ed3e",
                "md5": "c2ae1b05ca68b563f7c9523b5071405d",
                "sha256": "9c8ec5132b4605d5d8a2770e529b295ee8a40c898317fa40840661e487288f77"
            },
            "downloads": -1,
            "filename": "pmakefile-0.4.5.tar.gz",
            "has_sig": false,
            "md5_digest": "c2ae1b05ca68b563f7c9523b5071405d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 7136,
            "upload_time": "2024-02-27T06:44:45",
            "upload_time_iso_8601": "2024-02-27T06:44:45.490774Z",
            "url": "https://files.pythonhosted.org/packages/4e/63/59f1f2d2864f8147ab9874091645cdf480fec4ea6bb78bdd96d98601ed3e/pmakefile-0.4.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-27 06:44:45",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pmakefile"
}
        
Elapsed time: 2.51057s