Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Taskfile instead or in addition of Makefile #13

Open
Rjdrenth opened this issue Oct 11, 2023 · 2 comments
Open

Use Taskfile instead or in addition of Makefile #13

Rjdrenth opened this issue Oct 11, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Rjdrenth
Copy link

🚀 Feature Request

You mentioned improving the Makefile for windows support. I'd like to suggest using a Taskfile](https://taskfile.dev/) instead of a Makefile, which provides all the functionality of a Makefile and more. It also allows for distinctive commands based on the OS.
Another great feature is that it can load .env files.

As an example, see the Taskfile I use in my own cookiecutter template: Taskfile

@Rjdrenth Rjdrenth added the enhancement New feature or request label Oct 11, 2023
@Undertone0809
Copy link
Owner

I am glad to hear it. It seems more elegant. I will try to learn about it. Thanks for you suggestion!

@Undertone0809
Copy link
Owner

Undertone0809 commented Nov 5, 2023

There are some problem if we use Taskfile:

  • github actions need install it but makefile default in Ubuntu of github actions.
  • It a new technique, means people need additional learning cost.
  • We can get the same function by using makefile.

I have been research some other solution. The best way to build project may be poetry run xxx. We can use poetry test to test the project and using poetry build to build the project.

All command in poetry means we should not maintain excess files like makefile. So the question is how to run script in poetry. Poetry can only run python script originally, python-poetry/poetry#591 and python-poetry/poetry#241 has talk about it. We can using poe the poet plugin to implement it. A simple example is as follows:

Install poe the poet plugin in poetry

poetry self add poethepoet[poetry_plugin]

Next, write these in pyproject.toml

[tool.poe.tasks]
test = "pytest --cov=poethepoet"                                # command based
mksandwich = { script = "my_package.sandwich:build" }                 # python script based
tunnel = { shell = "ssh -N -L 0.0.0.0:8080:$PROD:8080 $PROD &" }  # shell script based

So we can use the following commands to invoke.

poetry run poe test -v   
poetry run poe tunnel

Add the poetry_command

[tool.poe]
poetry_command = ""

Now we can use poetry test to run test = "pytest --cov=poethepoet".

We can use poe the poet. It can be installed in poetry but it still need learning cost. Makefile seems also a good way to build the project if we make some compatibility in Makefile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants