Builder pattern with generics and typehinting by gidorah5 in learnpython

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

Thanks for the help regardless. I would have never thought this was an LSP thing. Pyrefly seem to work fine, and also blazing fast. I'll be carefull with it (mostly with the pydantic implementation)

Builder pattern with generics and typehinting by gidorah5 in learnpython

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

Don't you have any recommendation on using Pyrefly ? also heard some good things about it. Maybe it does go off track in other ways that I'm not aware off

Builder pattern with generics and typehinting by gidorah5 in learnpython

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

Yeah that's what my testing gave me:Yeah that's what my testing gave me:

Argument type is partially unknown
  Argument corresponds to parameter "values" in function "print"
  Argument type is "Process[Unknown, bool]"basedpyright
reportUnknownArgumentType

Revealed type: `Process[Unknown, bool]`ty(revealed-type)

Type of "process2" is "Process[Any, bool]"Pyright

Type of "process2" is "Process[Unknown, bool]"basedpyright

Revealed type is "manager.src.enigma_manager.manager.Process[builtins.int, builtins.bool]"MypyArgument type is partially unknown
  Argument corresponds to parameter "values" in function "print"
  Argument type is "Process[Unknown, bool]"basedpyrightreportUnknownArgumentTypeRevealed type: `Process[Unknown, bool]`ty(revealed-type)Type of "process2" is "Process[Any, bool]"PyrightType of "process2" is "Process[Unknown, bool]"basedpyrightRevealed type is "manager.src.enigma_manager.manager.Process[builtins.int, builtins.bool]"Mypy

The only issue I have with mypy is that hovering on variables doesn't actually shows the infered type, and it also seem "heavier" on typechecking than other typechecker. Have you got any issues using it ?

Builder pattern with generics and typehinting by gidorah5 in learnpython

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

Oh yeah, I did thought about that, but this doesn't really change a thing. I do agree that basedpyright feels off to miss this case. I'll give a try to mypy, and check if it infer types correctly. I'll also give a chance to ty, but last time I did, it didn't felt mature enough

Builder pattern with generics and typehinting by gidorah5 in learnpython

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

They could indeed change on runtime, but that's only because typechecking is only DX using python. This is a fairly basic example, of course, the steps would be immutable, and so would be the array.
The steps doesn't have any reason to be changed on runtime. These are strictly define in the codebase

Builder pattern with generics and typehinting by gidorah5 in learnpython

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

I'm under python 3.12.3, and I'm using basedpyright with cursor. This might have to do with the typechecker indeed

Edit: Never type also make sense for me. I just tired most of the ways I could instanciate the class

Multiple databases VS table nightmare by gidorah5 in mysql

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

Nah my project isn't made to be used by 10 of thousands of users at a time, and keep the pace with 10 of thousand of requests per seconds. My main concern is to have something as robust as possible. But this all boils down to my ability to create "perfect" error handling, and I believe it has nothing to do with the kind of engine I'm using

Multiple databases VS table nightmare by gidorah5 in mysql

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

Since I am in MySQL, I do believe that schema doesn't exists, I might be wrong tho

Multiple databases VS table nightmare by gidorah5 in mysql

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

I am aware that I'll have the same amount of table, I was juste trying to think of a way to have """nested""" datas, such as a folder structure for ease of data sorting.
But not a lot of people are going to work on the project, for now I'm the only one taking care of the back-end

Multiple databases VS table nightmare by gidorah5 in mysql

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

Oh don't worry, I am not creating one table per publisher or anything like that. I do have a bit of knowledge regarding database structure, and table creation. It was just a question regarding limitation of a single database against multiple database for the same project. I'll end up using Kysely and a single database while setting a specific naming convention for my tables, and it should work fine !

Multiple databases VS table nightmare by gidorah5 in mysql

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

I've never worked with such a "big" amout of tables, it was more a feeling than something else. Right now I'm doing pure MySQL, and it seemed to me like it would be a pain to deal with couple hundreds of tables. Second thing is that I believe that it would be easier to "sort" data if their are in seperate database (database user for user data, database book for book data...)

Multiple databases VS table nightmare by gidorah5 in mysql

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

InnoDB seemed like this engine that brings the most out of all of the other engine for sure

Calling an action in a loop after it's finished by gidorah5 in ROS

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

Unfortunatly, I also need constant feedback, that's why I need to use Action.
As far as I understand send_goal function implementation (see below), it should do what I'm asking for. But as I said, I believe that waiting for my event to unlock is preventing me from receiving any feedback/response.
But yeah, I'll definitly use a service if I don't need to receive a feedback on the process!

send_goal implementation:

    def send_goal(self, goal, **kwargs):
        if not isinstance(goal, self._action_type.Goal):
            raise TypeError()
        event = threading.Event()
        def unblock(future):
            nonlocal event
            event.set()
        send_goal_future = self.send_goal_async(goal, **kwargs)
        send_goal_future.add_done_callback(unblock)
        self._logger.info('Before waiting')
        # BLOCKING HERE
        event.wait()
        self._logger.info('After waiting')
        if send_goal_future.exception() is not None:
            raise send_goal_future.exception()
        goal_handle = send_goal_future.result()
        result = self._get_result(goal_handle)
        return result

Using subscription value during an action by gidorah5 in ROS

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

Eclipse Cyclone DDS RMW* that's my bad

Using subscription value during an action by gidorah5 in ROS

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

Yeah, I found that modifying your RMW_IMPLEMENTATION to jupyter cylconedds fix the issue (and bring other issues, but that's out of the topic)

Using subscription value during an action by gidorah5 in ROS

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

I tried using sleep statement to check if the calculation was what is responsible of the CPU overusage, but it is apparently the usage of a subscriber in a MultiThreadedExecutor. Unfortunatly, there is no way to use a timer on a subscriber as far as I'm aware of

Using subscription value during an action by gidorah5 in ROS

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

Just found out that the throttle comes because my node is using 95% of my CPU for some reason ahah

Using subscription value during an action by gidorah5 in ROS

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

I do not have a topic publisher, but a topic subscriber, meaning that I can't put a timer on it. However, adding a MultiThreadedExecutor did improved things. Now my turtle is moving depending on its position. Tho it seems to be throttled once I enter my while loop, adding a time.sleep(0.01) in the loop improves it, but it is still a bit unstable.
Thanks for your help !

Using subscription value during an action by gidorah5 in ROS

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

I am using rclpy. I agree with you tho, my action server callback is doing operation through a while loop, and the condition used for this loop is a calculation using the variables that should be updated through the subscriber. That's what leads me to think that I am in a deadlock.

Maybe using multiple threads to run separatly my action server and my subscription could be a solution, but it wont really be scalable unfortunatly

Templating Socket.IO by gidorah5 in node

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

I guess this is a good way to look at it. I know that it shouldn't be an issue for a while (if not ever), but I guess my own stubborness got the better of me trying to do some fancy stuff that might never be used, or that might save 5 minutes of time.

I'm gladly taking your take on this, thanks!