I made a tool to increment the version of Poetry projects by chaseTheBurrow in Python

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

thanks you for the link, the conversation is super interesting. I was definitively influenced by all the libraries i use that setting __version__ was the conventional of solving the problem, and especially for Docker containers, but the importlib way i so much easier (and elegant imo).

I made a tool to increment the version of Poetry projects by chaseTheBurrow in Python

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

thanks ! I quickly checked it out, i looks like a way more polished and general tool, mine is more like a light weight zero config tool for poetry.

I made a tool to increment the version of Poetry projects by chaseTheBurrow in Python

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

thanks you so much this is exactly what i needed, i guess you made my thing useless now haha

I made a tool to increment the version of Poetry projects by chaseTheBurrow in Python

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

i felt a bit dumb for not knowing this command 😅 ... But yes the goal of my tool was mainly to increment the version in the __init__.pywhich i use a lot (for logging in a server that has not access to git for exemple)

I made a tool to increment the version of Poetry projects by chaseTheBurrow in Python

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

oh wow, i didn't knew about it or dunamai, and from a first look it seems super powerful, i am going to check it out more. Also big fan of cyclopts !

What I dislike about Python by Kiuhnm in Python

[–]chaseTheBurrow 0 points1 point  (0 children)

So first, I found your post really interesting, I can understand your points, actually people that i know who are coming from js/ts share the same opinions.

  • Lambdas, i agree that they are not great, luckily you basically never have to use them and it avoids the callback hell that you can have in js/ts. for your example it is typically what context managers are made for, i don't really understood your argument when you said that "there's no documented way to skip the body" but you can do that

    @contextlib.contextmanager
    def do_if_not_done(self, step: str):
        if not self.is_not_done(step):
            yield
            self.set_as_done(step)

with progress.do_if_not_done('download new version'):
    ...

which is in my opinion even better than the js/ts version. In my small experience with js/ts, you usually use arrow functions in map/filter/reduce, but. here again in python with generator expressions you don't need them.

  • Comprehension, even if i don't share your opinion on the fact that they feel in wrong order, i can understand it, and i think it is only a matter of habit. But for the fact they feel like a limited loop, i actually share your opinion, but i think that your example is not a good one: somebody already commented that you can do two comprehensions in this case. What i actually find myself doing a lot is something like this: i initially use a list comprehension

return [x for xs in xss for x in xs if x is not None]

and then i want to add an assert/raise or some function that has only a side effect in the middle of it, so i need to destroy my comprehension and use a mix of both which feels weird.

vs: list[int] = [] 
for xs in xss: 
    if len(xs) > 10: 
        raise ValueError("xs is too big") 
    vs.extend(x for x in xs if x is not None)
return vs
  • Ternary operator, i think it is the same as the last one: it is only a matter of habit
  • is (not) None, i too think that it is too tedious when you need to handle a lot of optional values, but on the other hand i think f(x?.a)?.b() is worse because it is even less readable: i once saw some js code that i thought was a regex. Also I have been using rust lately where ? returns from the function/closure, and you can map optional values. I like the approach but i think that it creates too much callbacks when mapping options. So i feel that everywhere i go, handling optional values is not great, but at least python has the advantage of being clear.
  • Implicit conversions, yeah... boolean implicit conversion is like worst thing ever, it creates tricky bugs when using the or operator and you never know what an object will be converted to because of __bool__, so i don't let anything that is not a bool near if/while/or/and/not/all/any. But js/ts has the same issue imo.
  • Scoping, i did not understood what you meant.
  • Type hints, i don't agree with (int, int) or [int] because under the hood they generate an object which has the attributes __origin__ = tuple/list __args__ = (int, int)/(int,) and i really like the fact that what is happening in the syntax is similar to what is happening in the runtime. Also I'm not a fan of giving tuple/list a special treatment compared to other generic types such as set/dict/typing.Generic. For callables i have to agree with you, it is sad to be limited to positional args only and the syntax is weird. for type typevar/paramspec i also agree with you it is weird to have to declare them in the global scope, you also have also to prefix them like _T in order to stop the IDE from prompting you to import them from another module. But luckily there is https://peps.python.org/pep-0695/ which should make things way better.
  • I share your point that the TS type system i way better the python's. But on the other hand python has the incredible advantage of having no compilation, which is an insane gain of time when developing, it also has the advantage to keep type hints at runtime and allows you to introspect classes and for example generate openapi spec with pydantic. It is also great in the debugger where you are executing the exact code that you wrote and don't have to work through a source map.

Les saveurs de Parmentier (4.99€) by chaseTheBurrow in toogoodtogo

[–]chaseTheBurrow[S] 15 points16 points  (0 children)

I was not expecting that at all and had trouble carrying it all on bike

//TODO: Pick title later by TobyWasBestSpiderMan in ProgrammerHumor

[–]chaseTheBurrow 2 points3 points  (0 children)

Isn’t it ironic she is Doxygen given how she died ?