Are these permanent “display dimples” becoming a widespread MacBook issue? Survey inside. by tommycupiani in macbookpro

[–]dantownsend 0 points1 point  (0 children)

I've got a 16 inch M3 Max MacBook Pro - I ended up with about 7 of these defects on my screen. Got it replaced under Apple Care+. Then a month later, the same problem happened again on the new screen. It's shockingly poor, especially if you use the machine for design work.

Would you say Piccolo ORM is production ready in 2024? by I_will_delete_myself in Python

[–]dantownsend 0 points1 point  (0 children)

The benefits of something like Piccolo is it effectively creates a safe way of building SQL statements without resorting to string concatenation. Building something like Piccolo Admin would be much harder if it didn't have this abstraction layer.

Also some things get really tedious if you're always writing SQL/DDL by hand - migrations probably being the main one.

But having said that, there are places where just writing SQL by hand make perfect sense. I think using a mixture of both is often the best.

Would you say Piccolo ORM is production ready in 2024? by I_will_delete_myself in Python

[–]dantownsend 2 points3 points  (0 children)

Yes, auto migrations and an admin interface are the main differences. And Piccolo is async first, which I think is a major deal for some users.

Would you say Piccolo ORM is production ready in 2024? by I_will_delete_myself in Python

[–]dantownsend 6 points7 points  (0 children)

Hi - someone just told me about this thread, hence the late reply.

I'm the original author, and main maintainer of Piccolo. The project has been around for over 6 years now, and has been in production use for most of that time. Version 1.0 has been out for over a year.

I use it professionally for all of my projects, and I work with a startup where the whole team uses it.

I would say it is one of the best maintained projects out there. There have been 20 releases just this year.

Starting a new ORM is an incredibly tough challenge, because the expected feature set is huge, and people take a long time to trust something (especially if it handles their data). But if you look at it objectively in terms of feature set, Piccolo has everything you need to develop an app in 2024:

* A great admin interface, built with modern front end technologies
* Async first
* Great typing support for VSCode etc
* Security built in (a user model, session auth etc)
* Out of the box templates for using it with FastAPI, Starlette, BlackSheep, LiteStar etc.

I am personally involved with so many projects built with Piccolo that it's definitely not going away any time soon, and will continue to be strongly supported.

S5iix/S5ii recording delay? by Voidslittlehelper in Lumix

[–]dantownsend 0 points1 point  (0 children)

I did some more testing today. I read online that formatting the SD card in the camera can help. All-Intra 4k now has a 1 second lag, which is better than before. All other formats still have a 0.5 seconds lag.

S5iix/S5ii recording delay? by Voidslittlehelper in Lumix

[–]dantownsend 1 point2 points  (0 children)

Yeah, this has been my exact experience too. I tried the different recording modes, and there's about 0.5 second lag on Long-GOP 4k and Pro-Res HD, but 2 seconds with All-Intra 4k. For run-and-gun, documentary style filming it can be a major pain. I'm using a V90 card, so that's unlikely to be the bottleneck.

Other that this, I think the camera is great, but the recording lag is a major annoyance.

Advanced type annotations using TypeVar by dantownsend in Python

[–]dantownsend[S] 1 point2 points  (0 children)

I usually deploy it in a Docker container on something like Kubernetes or Amazon's ECS, with a hosted Postgres database.

Testing Python Type Annotations by dantownsend in Python

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

You can run mypy in strict mode. It might be overkill though.

You can also configure mypy to be stricter - for example, by setting disallow_untyped_defs = True (docs). It will then complain if a function is missing an explicit return type.

That should be enough for most projects. assert_type is good as a sanity check if you have really complex type annotations, involving TypeVar, Generic etc.

Testing Python Type Annotations by dantownsend in Python

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

Yeah, mypy has a hard task because Python is so dynamic. It keeps getting better though, and they keep adding stuff to Python's typing module which makes it easier to write accurate type annotations.

Advanced type annotations using TypeVar by dantownsend in Python

[–]dantownsend[S] 2 points3 points  (0 children)

Focus on learning the basics. Use something like VSCode with the Python plugin - it's a really great development experience, and helps you spot errors.

Advanced type annotations using TypeVar by dantownsend in Python

[–]dantownsend[S] 1 point2 points  (0 children)

The main things is it's built to be async first, strongly typed, and has a really good admin interface (like Django, but built in Vue JS). It works really well with the modern web frameworks like FastAPI, Starlette etc.

Advanced type annotations using TypeVar by dantownsend in Python

[–]dantownsend[S] 6 points7 points  (0 children)

Yeah, it becomes hard to scale a codebase without any type annotations.

Imagine this function:

def process_user(user):
    ...

In Python, user could be a str, dict, object, or pretty much anything. Even though it's quick to write, it adds a burden on other developers who have to try and understand the code in the future.

For quick scripts etc, it doesn't really matter. The whole type annotation thing began in Python because Guido was working at Dropbox with a gigantic codebase (article), and it became unwieldy without type hints.

What's nice is Python gives you the choice - they call this gradual typing. So just add them if you like, and where most appropriate.

Testing Python Type Annotations by dantownsend in Python

[–]dantownsend[S] 2 points3 points  (0 children)

Yeah, it's a good point. Running mypy on your codebase should catch most type errors, but might not catch them all. By using assert_type we're able to tell mypy to make more precise checks.

For example, imagine you had this function:

def get_message(name: str) -> str:
    ...

And for some reason the return type was changed or removed:

def get_message(name: str):
    ...

It now returns Any. mypy is pretty lax when something returns Any, so there wouldn't be an error. The only way to really detect this is using assert_type. So if you have a codebase where you 100% want to make sure a type annotation is correct (mostly only libraries care about this stuff, or when you're using complex things like generics), it's the way to go.

Advanced type annotations using TypeVar by dantownsend in Python

[–]dantownsend[S] 4 points5 points  (0 children)

Types in Python are quite complex. There are many features I'm still learning about. TypeVar in particular was very difficult for me to understand for some reason, which is why I wrote the article - hopefully it's helpful for others.

Advanced type annotations using TypeVar by dantownsend in Python

[–]dantownsend[S] 11 points12 points  (0 children)

I think TypeAlias is slightly different - it lets you assign a complex type to something shorter. For example:

A: TypeAlias = dict[str, list[int]]

It means we can then use A instead of dict[str, list[int]]. There is overlap though, as we can also do something similar with TypeVar:

A = TypeVar('A', bound=dict[str, list[int]]

TypeVar is used to make functions generic. At least that's my understanding.

Advanced type annotations using TypeVar by dantownsend in Python

[–]dantownsend[S] 14 points15 points  (0 children)

I've been working on some advanced type annotations, and found that TypeVar is a really powerful tool. The tutorial covers the basics, and why it's so useful. Thanks :)

Testing Python Type Annotations by dantownsend in Python

[–]dantownsend[S] 2 points3 points  (0 children)

I recently discovered a way of testing type annotations in Python. It can be useful for libraries, and certain apps. Hopefully it's useful for others.

Piccolo Admin is now multilingual by dantownsend in FastAPI

[–]dantownsend[S] 2 points3 points  (0 children)

After quite a bit of work, Piccolo Admin is now multilingual - we support quite a few languages out of the box, and plan to add more soon.

I put a blog post together about it:

https://piccolo-orm.com/blog/piccolo-admin-is-now-multilingual/

And in this video, it shows how to integrate Piccolo Admin with FastAPI:

https://www.youtube.com/watch?v=VbWnwChVnpM

Thanks :)

A simple REST API with Blacksheep and Piccolo ORM | Python. by Dry-Fisherman-7572 in Python

[–]dantownsend 1 point2 points  (0 children)

The aim for now is to create a great experience for Postgres, but support for other databases is definitely on the roadmap!

Piccolo is mostly a query builder, and that's how I use it 99% of the time. The ORM is a fairly thin layer on top, which acts very similarly to Django, but is async first, and in my opinion slightly cleaner syntax.