Open drew-512 opened 2 years ago
Also with (6), I'd like to invite discussion and ideas around what that suggested repo layout for outside ("3rd party") gpython modules. For example, a side project I'm commissioned on is an exciting particle physics project that I've packaged into a gpython module (so it can be more easily consumed by non-developer types). I am interested in using its public release (date TBD) to also model suggestion for others on how to publish their gpython module.
So, perhaps the template looks like:
github.com/{{publisher}}/gpython-{{module-family-name}}/
go.mod (1.15 or later)
go.sum
README.md
module-foo/
README.md
module.gpython.go
...
module-bar/
README.md
module.gpython.go
...
...
I invite any feedback or suggestions from you github and Go and Python warriors out there. 🗡️
the work plan SGTM.
as for the pyfmt
work, I am a bit worried that there might be some impedance mismatch: pyfmt
seems to have been written to bring the .format
facilities to Go, which may not be completely the same than implementing the .format
facilities in Go for Python. also, the main dev seem to have moved one and we may not get fixes upstream.
the licenses being compatible (BSD-3), it may well be just as efficient to adopt the initial files in our tree (with proper mentions of the original work), or start "from scratch".
as for the modules reorganization, why not. (in Go spirit, the directory holding them would be named module
instead of modules
, but that just me nitpicking).
seamlessly integrating 3rd-party modules into a "stock" gpython
executable might prove a bit complicated, considering the state of the stdlib plugin
package (and its lack of cross-platform support).
this probably means people will need to compile their own gpython
executable, with the 3rd-party modules they want (well, except if it's a pure python one, and not an extension one written in {C,G}Python)
as for the
pyfmt
work, I am a bit worried that there might be some impedance mismatch:pyfmt
seems to have been written to bring the.format
facilities to Go, which may not be completely the same than implementing the.format
facilities in Go for Python. also, the main dev seem to have moved one and we may not get fixes upstream. the licenses being compatible (BSD-3), it may well be just as efficient to adopt the initial files in our tree (with proper mentions of the original work), or start "from scratch".
Great points! That evaluation probably saves me a lot of time and process. I will do a deeper evaluation when I get to that point in the worklist. My basic goal was to provide support for the most basic forms of .format()
, where a 20% implementation gets us 80% coverage sort of thing -- so newcomers trying out gpython aren't immediately met with an error when they excitedly try "{} {}".format("hello", "world")
or whatever.
as for the modules reorganization, why not. (in Go spirit, the directory holding them would be named
module
instead ofmodules
, but that just me nitpicking).
Ok, great. Lmk if you have a preference on me doing that sooner or later, otherwise, I'll stick with (7) so we can build momentum towards that (and will be a nice reward). I def think the repo will look and feel tighter and cleaner with that simple reorg.
seamlessly integrating 3rd-party modules into a "stock"
gpython
executable might prove a bit complicated, considering the state of the stdlibplugin
package (and its lack of cross-platform support). this probably means people will need to compile their owngpython
executable, with the 3rd-party modules they want (well, except if it's a pure python one, and not an extension one written in {C,G}Python)
Ha, I wasn't even thinking about dylib support, and more just focused on people in the mindset to offer their Go package (e.g. a particle physics computation framework) in the form of a cli build target that allows consumers to easily use the framework through Python scripts (as you described). This is really how I see gpython is offering a lot of value to Go projects. So, in sum, my vision is that gpython makes it easy to do this and the examples model and reflect this (e.g. examples/embedding
).
Hi @sbinet and all, I hope you've been having a prosperous summer and may blessings be with everyone.
In the coming several weeks, I'll be knocking out golden tests for the multi-context example along with some of the remaining items above.
With that done, I think we'll be at a great point to:
Below is my upcoming worklist I plan to take on in the coming weeks/months:
py.ContextOpts
and implement (Issue 143)py.utils
, including funcs that usereflect
to auto-populate Go structs from a givenpy.Object
exit()
(Issue 140)pytest/pytest.go
so the same boilerplate doesn't have to appear for each goldenmain_test.go
etcexamples/multi-context
into a golden test.real
,imag
,conjugate
properties topy.Int
,py.Float
,py.BigInt
,py.Bool
plus tests (Issue 73)modules
dir. In a future wheregpython
gets traction as an embedded interpreter and more and more modules appear, it makes sense to me that they show up the modules dir, not the project root dir. This is basically just a bunch of dirs moving and a fewimport
lines changing. I would be happy to do this first or as soon as makes sense (since something like this is better done sooner than later). I think this is also very helpful (self-documenting) for newcomers to understand the project structure and organization.py.ModuleImpl
foros
, offering support for a few commonly used functions -- e.g.os.system()
py.ContextOpts
that correspond to newpy.Method
flags which are checked when apy.Module
is populated during an initialpy.Context
module import (instantiation)..format
using pyfmt (Issue 116)pyfmt
so I don't start investing time into that and then we don't want to add that as a dependency. We can cross this bridge as it comes, but I wanted to express the value here and thatpyfmt
is a natural fit with gpython!Also please lmk what order I should do these in if that's something that matters to people. Otherwise, I listed them in the order that makes the most sense to me.
@sbinet @ncw, please lmk how the PRs should show up. By default, I'll do a separate PR for each numbered item (citing the Issue # in the PR)
Drew