Python 3 libraries for Go and GTP?

For discussing go computing, software announcements, etc.
Post Reply
User avatar
MikeKyle
Lives with ko
Posts: 205
Joined: Wed Jul 26, 2017 2:27 am
Rank: EGF 2k
GD Posts: 0
KGS: MKyle
Has thanked: 49 times
Been thanked: 36 times

Python 3 libraries for Go and GTP?

Post by MikeKyle »

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?
And
Gosei
Posts: 1464
Joined: Tue Sep 25, 2018 10:28 am
GD Posts: 0
Has thanked: 212 times
Been thanked: 215 times

Re: Python 3 libraries for Go and GTP?

Post by And »

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?
And
Gosei
Posts: 1464
Joined: Tue Sep 25, 2018 10:28 am
GD Posts: 0
Has thanked: 212 times
Been thanked: 215 times

Re: Python 3 libraries for Go and GTP?

Post by And »

maybe it's interesting https://github.com/aigagror/GymGo
User avatar
MikeKyle
Lives with ko
Posts: 205
Joined: Wed Jul 26, 2017 2:27 am
Rank: EGF 2k
GD Posts: 0
KGS: MKyle
Has thanked: 49 times
Been thanked: 36 times

Re: Python 3 libraries for Go and GTP?

Post by MikeKyle »

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.
And
Gosei
Posts: 1464
Joined: Tue Sep 25, 2018 10:28 am
GD Posts: 0
Has thanked: 212 times
Been thanked: 215 times

Re: Python 3 libraries for Go and GTP?

Post by And »

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
And
Gosei
Posts: 1464
Joined: Tue Sep 25, 2018 10:28 am
GD Posts: 0
Has thanked: 212 times
Been thanked: 215 times

Re: Python 3 libraries for Go and GTP?

Post by And »

kferg
Dies in gote
Posts: 25
Joined: Thu Jan 03, 2019 2:00 pm
GD Posts: 0
Been thanked: 3 times

Re: Python 3 libraries for Go and GTP?

Post by kferg »

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
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.
User avatar
MikeKyle
Lives with ko
Posts: 205
Joined: Wed Jul 26, 2017 2:27 am
Rank: EGF 2k
GD Posts: 0
KGS: MKyle
Has thanked: 49 times
Been thanked: 36 times

Re: Python 3 libraries for Go and GTP?

Post by MikeKyle »

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.
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
Post Reply