Skip to content

all: move modules to stdlib #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ cover.out
/dist

# tests
builtin/testfile
examples/embedding/embedding
stdlib/builtin/testfile
examples/embedding/embedding
6 changes: 3 additions & 3 deletions examples/embedding/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// This initializes gpython for runtime execution and is essential.
// It defines forward-declared symbols and registers native built-in modules, such as sys and time.
_ "github.com/go-python/gpython/modules"
_ "github.com/go-python/gpython/stdlib"

// Commonly consumed gpython
"github.com/go-python/gpython/py"
Expand All @@ -27,8 +27,8 @@ func runWithFile(pyFile string) error {

// See type Context interface and related docs
ctx := py.NewContext(py.DefaultContextOpts())
// This drives modules being able to perform cleanup and release resources

// This drives modules being able to perform cleanup and release resources
defer ctx.Close()

var err error
Expand Down
4 changes: 2 additions & 2 deletions examples/multi-context/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// This initializes gpython for runtime execution and is critical.
// It defines forward-declared symbols and registers native built-in modules, such as sys and time.
_ "github.com/go-python/gpython/modules"
_ "github.com/go-python/gpython/stdlib"

// This is the primary import for gpython.
// It contains all symbols needed to fully compile and run python.
Expand Down Expand Up @@ -129,7 +129,7 @@ func RunMultiPi(numWorkers, numTimes int) time.Duration {
}
workersRunning.Done()

// This drives modules being able to perform cleanup and release resources
// This drives modules being able to perform cleanup and release resources
w.ctx.Close()
}()
}
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import (
"runtime"
"runtime/pprof"

_ "github.com/go-python/gpython/modules"
"github.com/go-python/gpython/py"
"github.com/go-python/gpython/repl"
"github.com/go-python/gpython/repl/cli"

_ "github.com/go-python/gpython/stdlib"
)

// Globals
Expand Down
4 changes: 2 additions & 2 deletions pytest/pytest.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"strings"
"testing"

_ "github.com/go-python/gpython/modules"

"github.com/go-python/gpython/compile"
"github.com/go-python/gpython/py"

_ "github.com/go-python/gpython/stdlib"
)

var gContext = py.NewContext(py.DefaultContextOpts())
Expand Down
2 changes: 1 addition & 1 deletion repl/repl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

// import required modules
_ "github.com/go-python/gpython/modules"
_ "github.com/go-python/gpython/stdlib"
)

type replTest struct {
Expand Down
5 changes: 2 additions & 3 deletions repl/web/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import (
"log"
"runtime"

"github.com/go-python/gpython/repl"
"github.com/gopherjs/gopherwasm/js" // gopherjs to wasm converter shim

// import required modules
_ "github.com/go-python/gpython/modules"

"github.com/go-python/gpython/repl"
_ "github.com/go-python/gpython/stdlib"
)

// Implement the replUI interface
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 7 additions & 5 deletions modules/runtime.go → stdlib/stdlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package modules
// Package stdlib provides the bootstrap code to wire in all the stdlib
// (python) modules into a gpython context and VM.
package stdlib

import (
"bytes"
Expand All @@ -16,10 +18,10 @@ import (
"github.com/go-python/gpython/py"
"github.com/go-python/gpython/vm"

_ "github.com/go-python/gpython/builtin"
_ "github.com/go-python/gpython/math"
_ "github.com/go-python/gpython/sys"
_ "github.com/go-python/gpython/time"
_ "github.com/go-python/gpython/stdlib/builtin"
_ "github.com/go-python/gpython/stdlib/math"
_ "github.com/go-python/gpython/stdlib/sys"
_ "github.com/go-python/gpython/stdlib/time"
)

func init() {
Expand Down
File renamed without changes.
File renamed without changes.