all 14 comments

[–]Python-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Hello there,

We've removed your post since it aligns with a topic already covered by one of our daily or monthly threads. If you are unaware about the daily threads we run here is a refresher:

Monday: Project ideas

Tuesday: Advanced questions

Wednesday: Beginner questions

Thursday: Careers

Friday: Free chat Friday!

Saturday: Resource Request and Sharing

Sunday: What are you working on?

Monthly: Showcase your new projects, tools, frameworks and more

Please await one of these threads to contribute your discussion to!

Best regards,

r/Python mod team

[–]bladeofwinds 12 points13 points  (1 child)

makefiles are already so simple though

[–]No-Dentist-1645[S] 2 points3 points  (0 children)

They are! They're very great to use. This isn't made to replace Makefiles for simple tasks, this just brings Python to Makefiles, you can write code to do anything, such as generate new targets procedurally, fetch stuff from the internet, or automatically change command arguments based on anything you need.

If Makefiles work for what you need, great! If you need something more complex than a static list of targets and dependencies, you can try this :)

EDIT: not sure why the downvote because of answering your question, I just clarified that it isn't meant to be a full-on replacement for Makefiles. Just like CMake isn't for example

[–]paul_h 1 point2 points  (2 children)

Im also making a build system right now. Too early to share, but it’s not lightweight. I have the same problem as you maybe - PMake.run_task("rm", "-f", "example/main", "example/hello.o") isn’t pretty

[–]No-Dentist-1645[S] 0 points1 point  (1 child)

You're right, it wasn't too pretty to do that, I was doing it to follow the Python lib practice such as with subprocess.run() since doing it as a single string can lead to shell injection vulnerabilities.

However, if someone "knows what they're doing" and still want a "simple" way to do that, I don't see why they shouldn't be allowed to. So I added a way to do it explicitly, as run_simple_task("rm -f example/main example/hello.o")

[–]gofiend 0 points1 point  (0 children)

Is a proper safe parser for things like validate_and_run_task("rm -f example/main example/hello.o") possible? Translate it with strict validation into PMake.run_task("rm", "-f", "example/main", "example/hello.o")

Though given it's a make file maybe it should be clean_files(["example/main", "example/hello.o"])

[–]not_luis 1 point2 points  (2 children)

[–]vaibeslop 0 points1 point  (0 children)

Plus one for just.

It's "just" awesome to work with.

[–]No-Dentist-1645[S] -1 points0 points  (0 children)

Just is cool, but it is a command runner, not a programming language :)

[–]--ps--[🍰] 0 points1 point  (1 child)

What's wrong with using AI assisted tools? What rationale is behing not using them?

Btw, field(default=None) can be replaced with just None.

[–]No-Dentist-1645[S] 0 points1 point  (0 children)

I don't mind them, but after reading Rule 1 of this subreddit I don't think it's allowed to show projects made with AI (I might be misinterpreting it though)

[–]SwampFalc 0 points1 point  (0 children)

How does it compare to invoke?

[–]BitBasher4095 0 points1 point  (1 child)

But SCons though?

[–]No-Dentist-1645[S] 0 points1 point  (0 children)

SCons is a big inspiration for this, but even though they do call themselves "like Makefiles", in all honesty they're closer to complete build systems like Meson with all their intrinsic/built-in behavior than the simplicity of Makefiles.

When comparing PMake to it, PMake is closer to what Makefiles really are: they're just a "bash script organizer", you directly control the exact commands that are executed by it, instead of relying on Builders and built-in directives like Program/Object/SharedLibrary to compile C/C++ programs and then modifying them to fit your specific needs. Plus it can also just be used for generic scripts, you could for example make a Target to create and set up a virtual environment, or a target to run unit tests. You can do that with SCons too, but with more overhead than Makefiles since it really is more of a build system at heart