Readit News logoReadit News
henbruas commented on Uv 0.3 – Unified Python packaging   astral.sh/blog/uv-unified... · Posted by u/mantapoint
claytonjy · 2 years ago
Is there any reason to still use Rye, now? looks like this release adds all the things I would have missed from Rye, but I don't think I use all of Rye's features
henbruas commented on Mistakes in the Design of CSS (2013)   wiki.csswg.org/ideas/mist... · Posted by u/ARCarr
mhitza · 2 years ago
> Note that the Tailwind team strongly anti-recommends @apply and regrets ever putting it in there

Please link to something that supports this claim, because it's not the first time I've seen it made on HN, but only found it on HN

henbruas commented on Python 3.11.0 final   discuss.python.org/t/pyth... · Posted by u/pantalaimon
emptysea · 3 years ago
I think the issues you encountered may be due to the specific libraries. Lots of the pre-typing libraries haven’t adopted static typing, like Django and Celery and then when your project is 95% Django and Celery you’re SOL.

I’m not even sure it’s possible to have Django typed without reworking the ORM, I’m thinking about reverse relations, .annotate(), etc.

Yes, there are type stubs for these libraries but they’re either forced to be more strict, preventing use of dynamism, or opt for being less strict but allowing you to use all the library features, at the cost of safety.

I think in the end, new libraries built with static typing in mind, like Pydantic, FastAPI, and Edgedb, are the answer.

henbruas · 3 years ago
> Yes, there are type stubs for these libraries but they’re either forced to be more strict, preventing use of dynamism, or opt for being less strict but allowing you to use all the library features, at the cost of safety.

There are type stubs for Django that somewhat avoid these compromises: https://github.com/typeddjango/django-stubs

To be able to do this they have to use a Mypy plugin though. And even then it's still far from perfect.

henbruas commented on Python 3.11.0 final   discuss.python.org/t/pyth... · Posted by u/pantalaimon
matsemann · 3 years ago
The problem is that you lose all help from tooling/IDEs. Like in Celery, the definition is "shared_task(*args, *kwargs)". This gives you no indication of what parameters you actually can use. Opening up the code doesn't help, as it's many layers down. The decorated function ends up untyped, but with some new methods on it that again are untyped. But like originalfunction.delay(...) should have the params of the original decorated function. But no, all that is lost. Just pray that the docs are correct.*
henbruas · 3 years ago
While it's of course not ideal, stub files can help with this issue. For example you can get stubs for Celery that make both `shared_task` and `delay` properly typed: https://github.com/sbdchd/celery-types
henbruas commented on No-op statements syntactically valid only since Python X.Y   github.com/jwilk/python-s... · Posted by u/pabs3
jamesfinlayson · 4 years ago
I'd be interested to know regardless - the @0 in the Python 3.9 example has me stumped. Maybe it's a decorator but I don't think so. It doesn't look like matrix multiplication either.
henbruas · 4 years ago
It is indeed a decorator. It's relying on https://peps.python.org/pep-0614/
henbruas commented on Today’s JavaScript, from an outsider’s perspective (2020)   lea.verou.me/2020/05/toda... · Posted by u/ddtaylor
goldenkey · 4 years ago
All he had to do was run `node index.mjs` or `npm run start` to have his index recognized as a module.

Node DOES not read package.json, npm (node package manager) does. Node is not the package manager, so of course changes to package.json won't affect running `node index.js`

However, node recognizes the file extension mjs as a module and will execute it as such. So renaming the extension of the script would work.

Alternatively, if you wish to use the package.json info to launch node, use the package manager through `npm run start`

This isn't rocket science and honestly makes perfect sense.

Package management is basic stuff and Node really doesn't do it any different than Ruby gems or Pip requirements, etc..I think you and your buddy need to have a talk about the assumptions you're making with regard to the actual executable versus the package manager and re- evaluate your understanding from first principles.

henbruas · 4 years ago
The documentation seems VERY clear that the "type" field in package.json DOES affect the node runtime: https://nodejs.org/api/packages.html#type
henbruas commented on Why I Use Nim instead of Python for Data Processing   benjamindlee.com/posts/20... · Posted by u/benjamin-lee
kiidev · 4 years ago
Isn't that going to be even slower, since a 156mb file would probably make gc_lines a very big tuple before summing it?
henbruas · 4 years ago
gc_lines isn't a tuple here, it's a generator expression. It will be lazily evaluated.
henbruas commented on Django 3   docs.djangoproject.com/en... · Posted by u/cstuder
Pandabob · 6 years ago
This looks neat. Does anyone have experience with using type hints and mypy with Django? Any gotchas?
henbruas · 6 years ago
I'm currently experimenting with it, so I don't have a lot to say yet. But you'll want to use this: https://pypi.org/project/django-stubs/

u/henbruas

KarmaCake day18December 2, 2019View Original