{"id":13298555,"url":"https://github.com/edvardm/demake","last_synced_at":"2025-03-10T09:33:31.122Z","repository":{"id":60793458,"uuid":"544118807","full_name":"edvardm/demake","owner":"edvardm","description":"Helper to translate Makefile rules  to PyInvoke  tasks.py file","archived":false,"fork":false,"pushed_at":"2023-04-16T18:04:50.000Z","size":97,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T01:31:11.516Z","etag":null,"topics":["developer-experience","developer-tools","invoke","productivity","task-automation"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edvardm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-01T17:40:11.000Z","updated_at":"2023-04-12T09:01:31.000Z","dependencies_parsed_at":"2023-01-22T02:15:17.507Z","dependency_job_id":null,"html_url":"https://github.com/edvardm/demake","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edvardm%2Fdemake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edvardm%2Fdemake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edvardm%2Fdemake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edvardm%2Fdemake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edvardm","download_url":"https://codeload.github.com/edvardm/demake/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242823836,"owners_count":20191070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["developer-experience","developer-tools","invoke","productivity","task-automation"],"created_at":"2024-07-29T17:29:47.498Z","updated_at":"2025-03-10T09:33:31.112Z","avatar_url":"https://github.com/edvardm.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Demake\n\nVersion 0.1.6\n\n## Overview\n\nHelper to convert Makefiles to [PyInvoke](https://www.pyinvoke.org/) files,\nsee [sample run below](#sample-run)\n\n## Rationale\n\nMakefiles typically contain rules to build files based on dependencies,\nwhereas [PyInvoke](https://www.pyinvoke.org/) is used for task automation.\nThese are two separate things.\n\n[GNU Make](https://www.gnu.org/software/make/) is a powerful tool, so it is\noften used for task automation as well, mainly because it is already present\nin many development environments, and most people are familiar with the basic\nsyntax. Problem is, Make is not very suitable for complex rules. Error\nhandling, condition logic, passing arbitrary command line arguments etc is not\nwhere it really shines.\n\nIn the end there shouldn't even be battle between Make and task automation\ntools. In fact, in some cases it makes totally sense to have both PyInvoke for\nconvenient task automation, and Make for incremental builds. PyInvoke, like\nmany task automation tools, doesn't offer support for building items\nautomatically based on extension, or running build targets based on file\nmodification time. In such cases, it would be totally reasonable to use\nPyInvoke as main automation tool for developers, and let Make handle\nincremental builds and nothing else.\n\nSure, complex Make tasks can be extracted to shell scripts, but then the same\narguments about awkward programmability would arise as with Make.\n\n## Purpose of Demake\n\nIt helps you by transforming some of the rules in existing `Makefile`s to\n`tasks.py` files used by PyInvoke. It is by no means complete and it is quite\nlikely that you need to modify generated `tasks.py` before it is useful, with\nthe exception of very trivial Makefiles. It should still save you from some\nmanual work, and for me it was a good excuse to something bit more serious\nwith Haskell than just to dabble with `ghci` solving [Project\nEuler](https://projecteuler.net/) problems.\n\n## Install instructions\n\nclone the repository, then do\n\n```bash\nstack build \u0026\u0026 \\\n  stack install \u0026\u0026 \\\n  echo \"installed to $(stack path --local-bin)\"\n```\n\nIf you don't have Stack setup already, I recommend using\n[ghcup](https://www.haskell.org/ghcup/) to install it.\n\n## Sample run\u003ca id=\"sample-run\"\u003e\u003c/a\u003e\n\nWith Makefile contents of\n\n```Makefile\n.PHONY: deps\nTEST_DIR := tests\n\n.PHONY: dev-init\ndev-init: .check-poetry deps quick-test ## prepare project ready for development\n\n.PHONY: .check-poetry\n.check-poetry:\n\t@command -v poetry 2\u003e/dev/null || (echo \"poetry not found, please see https://python-poetry.org/docs/#installation\"; exit 1)\n\n.PHONY: deps\ndeps:  ## install dependencies\n\tpoetry install --no-root\n\n.PHONY: quick-test\nquick-test: opts ?= --durations 3\nquick-test:\n\tpytest $(opts) -m \"not slow\" $(TEST_DIR)\n```\n\nResulting output:\n\n```python\nfrom invoke import task\n\nTEST_DIR = \"tests\"\n\n@task\ndef deps(c):\n    c.run('poetry install --no-root')\n\n\n@task\ndef _check_poetry(c):\n    c.run('command -v poetry 2\u003e/dev/null || (echo \"poetry not found, please see https://python-poetry.org/docs/#installation\"; exit 1)')\n\n\n@task\ndef quick_test(c):\n    c.run(f'pytest {opts} -m \"not slow\" {TEST_DIR}')\n\n\n@task(pre=[_check_poetry, deps, quick_test])\ndef dev_init(c):\n    pass\n```\n\n## Credits\n\nNicolas Mattias for his [Makefile\nlibrary](https://github.com/nmattia/makefile), which I modified a bit to\nsupport parsing of top-level and inline comments\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedvardm%2Fdemake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedvardm%2Fdemake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedvardm%2Fdemake/lists"}