It is currently Thu Mar 28, 2024 10:08 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
Offline
 Post subject: Python 3 libraries for Go and GTP?
Post #1 Posted: Tue Apr 20, 2021 2:52 pm 
Lives with ko
User avatar

Posts: 205
Liked others: 49
Was liked: 36
Rank: EGF 2k
KGS: MKyle
My level of expertise is poor in both but I quite enjoy messing around with go and python.

I want to be able to interact with bots and have found some great code for handling the GTP commands in projects such as:
goreviewpartner
Gomill
twogtp

But I have some Python 3 code that I'd quite like to use without worrying about compatibility.
Are there any libraries or projects written in Python 3 which manage GTP commands?
Or is there a good reason why these projects use Python 2?

Are there any other cool projects I should be aware of?

Top
 Profile  
 
Offline
 Post subject: Re: Python 3 libraries for Go and GTP?
Post #2 Posted: Wed Apr 21, 2021 7:46 am 
Gosei
User avatar

Posts: 1348
Liked others: 202
Was liked: 203
twogtp was written in 2007, Python 3 appeared later. but why do goreviewpartner and Gomill use Python 2, this is interesting, can ask the authors?

Top
 Profile  
 
Offline
 Post subject: Re: Python 3 libraries for Go and GTP?
Post #3 Posted: Wed Apr 21, 2021 1:15 pm 
Gosei
User avatar

Posts: 1348
Liked others: 202
Was liked: 203
maybe it's interesting https://github.com/aigagror/GymGo

Top
 Profile  
 
Offline
 Post subject: Re: Python 3 libraries for Go and GTP?
Post #4 Posted: Thu Apr 22, 2021 3:15 am 
Lives with ko
User avatar

Posts: 205
Liked others: 49
Was liked: 36
Rank: EGF 2k
KGS: MKyle
Thanks :)

And wrote:
twogtp was written in 2007, Python 3 appeared later. but why do goreviewpartner and Gomill use Python 2, this is interesting, can ask the authors?


That is a solid excuse for twogtp at least.
Looks like grp was based on Gomill to some extent?
Interesting that SGFmill seems to have branched of Gomill and uses python 3 but looses the GTP handling stuff. That suggests that there are some issues with the gomill GTP code playing nicely with python 3. I've actually been trying to update it myself but it doesn't take long for me to run into issues.

And wrote:
maybe it's interesting https://github.com/aigagror/GymGo


Yes. This looks quite nice. A bit cleaner than the board state representations in other python code maybe.

I was encouraged to notice that Katrain is all python. Then slightly dissapointed to learn that it doesn't use GTP.

Top
 Profile  
 
Offline
 Post subject: Re: Python 3 libraries for Go and GTP?
Post #5 Posted: Thu Apr 22, 2021 9:44 am 
Gosei
User avatar

Posts: 1348
Liked others: 202
Was liked: 203
differences between os.popen2 and subprocess.Popen, solution in go_assistant program (Russian)
https://www.sql.ru/forum/1254184/python ... cess-popen
https://github.com/zztrilobit/go_assist ... r/goban.py

Top
 Profile  
 
Offline
 Post subject: Re: Python 3 libraries for Go and GTP?
Post #6 Posted: Thu Apr 22, 2021 10:36 am 
Gosei
User avatar

Posts: 1348
Liked others: 202
Was liked: 203
frisbee-twogtp (python3) https://github.com/jmoudrik/frisbee-two ... -twogtp.py

Top
 Profile  
 
Offline
 Post subject: Re: Python 3 libraries for Go and GTP?
Post #7 Posted: Thu Apr 22, 2021 8:25 pm 
Dies in gote

Posts: 25
Liked others: 0
Was liked: 3
I wrote a go game logic library in C++ with a Python wrapper. It should be faster than most pure-Python implementations. It works in Python 3 only:

https://github.com/macfergus/baduk

The documentation is somewhat lacking, sorry. But if you want to try to use I can make an effort to improve the docs.

Probably less useful, but I've also written some GTP driving code as part of a different project; I didn't intend it to be a standalone GTP library, but here it is for completeness:

https://github.com/macfergus/badukai/tr ... adukai/gtp

also Python 3 only

Quote:
but why do goreviewpartner and Gomill use Python 2, this is interesting, can ask the authors?


In my experience, the transition from Python 2 to Python 3 took a looooong time. Basically, you couldn't upgrade your project until every single library you depend on upgraded. As recently as 2014 I worked at a company that was still starting new projects in Python 2, due to single key dependency.

Top
 Profile  
 
Offline
 Post subject: Re: Python 3 libraries for Go and GTP?
Post #8 Posted: Fri Apr 23, 2021 4:02 am 
Lives with ko
User avatar

Posts: 205
Liked others: 49
Was liked: 36
Rank: EGF 2k
KGS: MKyle
And wrote:
differences between os.popen2 and subprocess.Popen, solution in go_assistant program (Russian)
https://www.sql.ru/forum/1254184/python ... cess-popen
https://github.com/zztrilobit/go_assist ... r/goban.py


I have no Russian skills but from the code and some Google translating, I think I can find the right things to look into.
The versions of popen and subprocesses seem critical.

And wrote:


Excellent! Exactly the kind of thing I was hoping for.

kferg wrote:
I wrote a go game logic library in C++ with a Python wrapper. It should be faster than most pure-Python implementations. It works in Python 3 only:

https://github.com/macfergus/baduk

The documentation is somewhat lacking, sorry. But if you want to try to use I can make an effort to improve the docs.

Probably less useful, but I've also written some GTP driving code as part of a different project; I didn't intend it to be a standalone GTP library, but here it is for completeness:

https://github.com/macfergus/badukai/tr ... adukai/gtp

also Python 3 only


Excellent. These tools look really nice. I will try them out now.

Docs aren't critically important IMO because the code is really clear and concise. I think I could roughly follow everything in each repo within a couple of minutes.
Docs might help more people find it though which seems like a good thing.

kferg wrote:
In my experience, the transition from Python 2 to Python 3 took a looooong time. Basically, you couldn't upgrade your project until every single library you depend on upgraded. As recently as 2014 I worked at a company that was still starting new projects in Python 2, due to single key dependency.


That's understandable, especially for larger scale projects.
I find it a bit unusual for these small go projects though as they seem to have so few dependencies.

Thanks both. That's so much more useful stuff than I expected

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group