Skip to content

Commit 9281622

Browse files
committed
all: move modules to stdlib
1 parent c398aac commit 9281622

File tree

7 files changed

+15
-13
lines changed

7 files changed

+15
-13
lines changed

examples/embedding/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

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

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

2828
// See type Context interface and related docs
2929
ctx := py.NewContext(py.DefaultContextOpts())
30-
31-
// This drives modules being able to perform cleanup and release resources
30+
31+
// This drives modules being able to perform cleanup and release resources
3232
defer ctx.Close()
3333

3434
var err error

examples/multi-context/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

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

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

132-
// This drives modules being able to perform cleanup and release resources
132+
// This drives modules being able to perform cleanup and release resources
133133
w.ctx.Close()
134134
}()
135135
}

main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ import (
1414
"runtime"
1515
"runtime/pprof"
1616

17-
_ "github.com/go-python/gpython/modules"
1817
"github.com/go-python/gpython/py"
1918
"github.com/go-python/gpython/repl"
2019
"github.com/go-python/gpython/repl/cli"
20+
21+
_ "github.com/go-python/gpython/stdlib"
2122
)
2223

2324
// Globals

pytest/pytest.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import (
1111
"strings"
1212
"testing"
1313

14-
_ "github.com/go-python/gpython/modules"
15-
1614
"github.com/go-python/gpython/compile"
1715
"github.com/go-python/gpython/py"
16+
17+
_ "github.com/go-python/gpython/stdlib"
1818
)
1919

2020
var gContext = py.NewContext(py.DefaultContextOpts())

repl/repl_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
// import required modules
9-
_ "github.com/go-python/gpython/modules"
9+
_ "github.com/go-python/gpython/stdlib"
1010
)
1111

1212
type replTest struct {

repl/web/main.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ import (
1313
"log"
1414
"runtime"
1515

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

1819
// import required modules
19-
_ "github.com/go-python/gpython/modules"
20-
21-
"github.com/go-python/gpython/repl"
20+
_ "github.com/go-python/gpython/stdlib"
2221
)
2322

2423
// Implement the replUI interface

modules/runtime.go renamed to stdlib/stdlib.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
package modules
5+
// Package stdlib provides the bootstrap code to wire in all the stdlib
6+
// (python) modules into a gpython context and VM.
7+
package stdlib
68

79
import (
810
"bytes"

0 commit comments

Comments
 (0)