HackerTrans
TopNewTrendsCommentsPastAskShowJobs

diegojromero

no profile record

Submissions

Ask HN: What's stopping us from having full static validation of Python code?

2 points·by diegojromero·7 ay önce·2 comments

Ask HN: When it's too much observability?

2 points·by diegojromero·10 ay önce·2 comments

comments

diegojromero
·7 ay önce·discuss
Sure, in my workflow I make use of mypy and ruff extensively (but ruff does not allow plugins). So I decided to create several plugins with the intention of improving the developer experience and understanding of the code.

Now, what I am asking is, could we expand this by having static annotations that enforce runtime behaviours before running the code? I'm not advocating for the removal of the tests or some manual testing phase, but in the same vein of type errors being shown in our IDE, could we have static checks like contracts for functions or class invariants?

Full disclaimer: I leveraged AI technologies to create them.
diegojromero
·10 ay önce·discuss
Well, I was so worried about boilerplate that I created a Python decorator for avoiding polluting the code with so much of that (https://github.com/diegojromerolopez/otelize).

About the cost, AFAIK it is not prohibitive.

I will continue working as I was, thanks for your opinion!
diegojromero
·11 ay önce·discuss
Thanks for your comment! It has given me an idea for a project: a simple library that provides a Python decorator that can be used to include basic telemetry for functions in Python code (think spans with the input parameters as attributes): https://github.com/diegojromerolopez/otelize

Feedback welcome!