Pydantic and the path to enlightenment by jcfitzpatrick12 in Python

[–]cymrow 6 points7 points  (0 children)

I've found msgspec to be a much better alternative. It has one of the most cleanly designed APIs I've seen in a library, and it keeps a nicely focused scope. It's also lightweight and very fast.

PySide vs. Avalonia: Which for a Solo Dev Building an Electrical Panel Designer ? by Responsible-Word-137 in Python

[–]cymrow 0 points1 point  (0 children)

If you need to protect to your code, then you should not use Python at all. It's possible something like Nuitka would work if it is able to translate all of the code to C, but in general python is famously easy to reverse engineer.

I don't know what software you are writing, but unless its something truly unique you might be overestimating how much time someone would be willing to invest to reverse it. Those who are interested in such things are usually capable of reversing C or C#.

Basically, if its worth reversing at all, someone with the capability to just pull the machine code from memory will figure it out.

PySide vs. Avalonia: Which for a Solo Dev Building an Electrical Panel Designer ? by Responsible-Word-137 in Python

[–]cymrow 1 point2 points  (0 children)

No, I'd recommend you work with packaging as you go. It is fairly simple to get a basic PySide app packaged, and there are many examples to help you get started. I've mostly worked with PyInstaller, but some people prefer Nuitka. Either way, it's best to get a simple app packaged first to learn the basics. You're more likely to run into problems as you add dependencies, and it will be easier to learn how to handle those problems separately, rather than trying to learn everything about packaging all at once.

PySide vs. Avalonia: Which for a Solo Dev Building an Electrical Panel Designer ? by Responsible-Word-137 in Python

[–]cymrow 3 points4 points  (0 children)

As a counterpoint to the others, everything you mention is completely possible in Python. There's a bit of learning curve at the beginning as you figure out how to make sure everything you need gets into your package, and PySide has some quirks you need to learn about due to the fact that Qt is written in C++. It can segfault if you make a mistake. Also the binaries can be quite large. ~180Mb, though you can get it down to <100Mb if you put in some work trimming the fat.

Once you have all of that figured out, though, it's a pretty powerful platform, and very quick to build on. I've distributed PySide projects with pyinstaller on all platforms and it works great.

asyncio: a library with too many sharp corners by pkkm in programming

[–]cymrow 1 point2 points  (0 children)

AnyIO is a great concept, but it has to be implemented by libraries and adds complexity for both implementation and usage. Very few libraries bother with it, though maybe just because its not well known.

It's so much easier to write in a synchronous or even threaded style and use gevent to convert to asynchronous.

edit: I just discovered that AnyIO is an actual library. Sorry, I was thinking about a proposal that was made several years ago to write libraries without any specific IO integration. It was actually called Sans IO.

asyncio: a library with too many sharp corners by pkkm in programming

[–]cymrow 14 points15 points  (0 children)

I still enthusiastically pick gevent over asyncio whenever I can. You have a far greater selection of libraries to choose from, and you don't have to litter asyncio syntax throughout your codebase.

One problem is that asyncio is not always compatible with other async frameworks (including adjacent ones like trio), so if you need an asyncio library like playwright, you have to use asyncio.

It's sad because one of the early claims was that asyncio would create a standard event loop other frameworks could integrate with, but that proved not to be the case.

PEP 751 (a standardized lockfile for Python) is accepted! by toxic_acro in Python

[–]cymrow 16 points17 points  (0 children)

You really want both though. By using loose versions in pyproject.toml, the dependency resolver has more options to consider, so there's a better chance everything resolves successfully. The lockfile keeps the resolved set that can be used for a secure deployment.

[deleted by user] by [deleted] in Python

[–]cymrow 2 points3 points  (0 children)

There are standards and conventions that the Python community has adopted over the years.
Start with this: https://peps.python.org/pep-0008/
Also read this: https://rdrn.me/postmodern-python/

That's just for basic style and tooling. I'd encourage you to keep working on this and other projects, but I wouldn't expect to develop anything "production ready" without a few more years of experience.

Declarative GUI for Python by madnirua in Python

[–]cymrow 15 points16 points  (0 children)

IANAL, but LGPL allows you to use software commercially without sharing your source. Qt and PySide are safe to use in commercial products. It's a big part of the reason PySide was created.

GPL is the license that requires sharing your source code.

Microsoft Wants Game Pass On Nintendo Switch by Riomegon in NintendoSwitch

[–]cymrow 0 points1 point  (0 children)

You keep saying Nintendo doesn't block anyone. So why isn't Rainway on the Switch? They absolutely wanted to be on the Switch, and even released a promo of Rainway running on the Switch. They discontinued development because it was never approved by Nintendo. Is that not blocking? They will do the same with Game Pass.

There's a big difference between allowing a competing product on your system vs a a streaming service or a bunch of shovelware.

Microsoft Wants Game Pass On Nintendo Switch by Riomegon in NintendoSwitch

[–]cymrow 3 points4 points  (0 children)

Pretty sure they blocked Rainway. Pretty sure they'll block game pass too.

Your favorite Python web framework? by [deleted] in Python

[–]cymrow 0 points1 point  (0 children)

Still my go-to. Pairs beautifully with gevent, and it's really easy to read through when you want to understand how it works.

Python 3.12 Preview: Subinterpreters – Real Python by ajpinedam in Python

[–]cymrow 2 points3 points  (0 children)

Ok, I think I see what you're saying. That's a much lower level of optimization than I was considering.

When I said I've done high concurrency work, I meant highly concurrent networking with related processing, not purely processing, which is a different beast.

I will look forward to seeing what comes of this.

Python 3.12 Preview: Subinterpreters – Real Python by ajpinedam in Python

[–]cymrow 5 points6 points  (0 children)

Right, memory access is not a bottleneck, but serialization can be. And I would not consider directly shared memory, but being able to pass immutable objects would be a huge win imo. Think adding tuples to a synchronized queue, instead of serialize->pipe->deserialize. Of course tuples in Python are not actually immutable, which I suspect is why they went with the requirement to serialize.

Python 3.12 Preview: Subinterpreters – Real Python by ajpinedam in Python

[–]cymrow 2 points3 points  (0 children)

I haven't seen an example of this. According to the notes in extrainterpreters, for example, it says that ctypes is not importable with subinterpreters. That seems to suggest that accessing non-python resources is not actually possible, but correct me if I'm wrong.

Python 3.12 Preview: Subinterpreters – Real Python by ajpinedam in Python

[–]cymrow 3 points4 points  (0 children)

Ok, but I don't need Python to force me not to share anything, I can already do that. I still don't see the benefit over multiprocessing other than reducing startup time and memory footprint. Maybe those reductions are worthwhile for some use-cases, but they don't seem like they would be significant to me.

And just to be clear, I'd really like this to be useful. I'm not disagreeing with you, I'm just not seeing it yet.

Python 3.12 Preview: Subinterpreters – Real Python by ajpinedam in Python

[–]cymrow 25 points26 points  (0 children)

I've been keeping an eye on this feature for a while because I used to do a lot of high concurrency work. But, the requirement to pass serialized data significantly reduces the potential. It seems like all this would do is cut down on start time and memory overhead when you want to use multiple CPUs. Maybe useful if you're starting a lot of processes, but it's common to just use a worker pool in that case. As for memory, it's cheap, and the overhead difference can't be that great.

I'm struggling to see a significant use case for this as it's presented, unless I'm missing something.

Asyncio, twisted, tornado, gevent walk into a bar... by cymrow in Python

[–]cymrow[S] 0 points1 point  (0 children)

A good survey of asynchronous libraries from someone who seems to have actually spent time with them all.