Akuli / porcupine

A decent editor written in tkinter
MIT License
160 stars 46 forks source link

Delete toposort dependency #1507

Closed Akuli closed 3 months ago

Akuli commented 3 months ago

Given that xz just happened, I want to minimize Porcupine's dependencies, and I think toposort is the only dependency that can be reasonably removed.

When I added toposort dependency in 2017 (commit c713798b30bad0d3d4812246b07092cb4cfc9c4a), it was because I couldn't figure out how to program it myself. The source code is short, but it looked complicated and I didn't want to copy it. Since then, I have worked with graphs more and the algorithm is now quite obvious to me, so I rewrote it from scratch.

Moosems commented 3 months ago

Why can't platformdirs be removed?

Akuli commented 3 months ago

Good question. It can be removed, but it would require a few hours of Windows hell.

Porcupine only uses user_log_path, user_cache_path and user_config_path. Determining them on 3 different platforms gives 9 different cases. It would be slightly more work than this PR, but maybe worth the effort.

As for the windows hell: In platformdirs source code, they have 3 ways to locate folders (ctypes, registry, environment variables). They dynamically pick whatever works when platformdirs is imported. Environment variables are by far the simplest way, and probably reliable enough for Porcupine, but this needs to be tested in a few different Windows environments to convince me.

Moosems commented 3 months ago

There's a reason I've decided to cut windows support in all my future projects lol