algorithm-visualizer icon indicating copy to clipboard operation
algorithm-visualizer copied to clipboard

Add Python Tracer

Open MarkKoz opened this issue 6 years ago • 18 comments

Hi, I'm interested in working on a Python tracer. It seems pretty straight forward: write the tracer, add a Dockerfile to the backend, and port the algorithms to Python (though this seems like it can be saved for later given neither C++ nor Java have any algorithms yet). Would this be a welcomed contribution?

MarkKoz avatar May 31 '19 11:05 MarkKoz

Of course it is a welcomed contribution, and I would appreciate it. Let me know if you need any support.

64json avatar May 31 '19 15:05 64json

Great to hear. I will start working on it probably next week (currently in the middle of some other work). It seems best for the repo to be created under your organisation, right?

MarkKoz avatar May 31 '19 18:05 MarkKoz

Awesome, I just created tracers.py repository. Feel free to send a pull request to it!

64json avatar Jun 02 '19 16:06 64json

@MarkKoz Is there any news on this ?

srkn avatar Jul 17 '19 08:07 srkn

@MarkKoz Is there any news on this ?

I have been busy recently and I assume so is @MarkKoz, but I will continue working on it whenever I get some free time (hopefully within 2 weeks).

64json avatar Jul 17 '19 09:07 64json

I'll try to get back on it within a similar time frame. I'd like to get it to a working state as it's crude and completely untested right now.

MarkKoz avatar Jul 17 '19 11:07 MarkKoz

Update: started working on unit tests. Not the most fun to write but it's getting there. Will open a draft PR once I've finished at least one batch of tests. Has already revealed some errors in the code to me which I've patched up along with the circular import error.

MarkKoz avatar Jul 24 '19 00:07 MarkKoz

Sounds great, I'll also start to work on deploying the library to Python Package Index and creating AWS Lambda function to compile codes soon.

64json avatar Jul 24 '19 13:07 64json

@MarkKoz @parkjs814 , May I ask do we have a tracer for python yet? wondering where can I find more info on this. Thanks.

phuang07 avatar May 06 '20 23:05 phuang07

It exists here https://github.com/algorithm-visualizer/tracers.py but is not really functional yet. Progress has stalled. I had a PR open which hasn't been merged yet and I moved onto other things. Sorry for that, I should have been more pushy to get it merged. At this point, I imagine some things are out of date compared to the other tracers. I will try to revisit the project next month. Of course, anyone else is welcome to contribute too.

MarkKoz avatar May 07 '20 02:05 MarkKoz

My huge apologies to @MarkKoz that I still haven't had much spare time to work on integrating your work into the project. What should be done is to create a extractor.py repository, which would be an AWS Lambda function to compile/run user-submitted code with tracers.py library.

I would appreciate if someone experienced in Python and AWS Lambda can contribute to it. If anyone interested, I can give more details.

64json avatar May 07 '20 04:05 64json

@parkjs814 @MarkKoz I would have time after next week. Would you pass along more details and I will take a look at it. Thanks for putting everything together.

phuang07 avatar May 07 '20 12:05 phuang07

@phuang07 Thanks for your interest! Let me explain how Algorithm Visualizer supports Java first, since supporting Python would almost exactly resemble it.

  1. git push to tracers.java triggers Travis CI to:

    1. publish a new version of the visualization library to the JitPack repository.
  2. After the publication, it triggers another Travis CI on extractor.java to:

    1. download the newest version of the visualization library from JitPack, and
    2. build/deploy the AWS Lambda function.
  3. When the AWS Lambda function receives a request having user-submitted code as payload, it compiles/runs it and sends back the extracted visualization.json.

Looking into the following files would be helpful to understand the concept:

  • Travis CI setup on tracers.java: https://github.com/algorithm-visualizer/tracers.java/blob/master/.travis.yml
  • Travis CI setup on extractor.java: https://github.com/algorithm-visualizer/extractor.java/blob/master/.travis.yml
  • AWS Lambda function: https://github.com/algorithm-visualizer/extractor.java/blob/master/src/main/java/org/algorithm_visualizer/Extractor.java

For now, you can forget about 1-i and 2-i. (This is because I am thinking of NOT publishing the visualization library to an external repository at all and only using it within the AWS Lambda function, hence merging tracers.* into extractor.* eventually.)

Here are the steps needed to be done when you work on the extractor.py repository:

  1. Manually install the visualization library (by copying the content of tracers.py probably?), so that the AWS Lambda function can compile/run user-submitted code with it. This step would replace 1-i and 2-i.
  2. Rewrite Extractor.java in Python.
  3. Adjust .travis.yml for Python.

Let me know if you have any questions!

64json avatar May 08 '20 06:05 64json

Great. Will look into this.

phuang07 avatar May 21 '20 22:05 phuang07

I am also interested in adding python to algorithm-visualizer. Is it possible to simplify the development by using some tool like Brython or transcrypt that can run python directly in the browser, no aws needed? The only problem I expect here is the code editor support for source maps.

krsch avatar Sep 23 '21 17:09 krsch

I am also interested in adding python to algorithm-visualizer. Is it possible to simplify the development by using some tool like Brython or transcrypt that can run python directly in the browser, no aws needed? The only problem I expect here is the code editor support for source maps.

Now you could try http://pyscript.net ...

villares avatar Jun 20 '22 17:06 villares

[自动回复]您的邮件已收到,会尽快给您答复。

lxzzz avatar Jun 20 '22 17:06 lxzzz

你的邮件已收到

bookerdong avatar Jun 20 '22 17:06 bookerdong