spin-sdk 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spin_sdk/__init__.py +0 -0
- spin_sdk/componentize-py.toml +2 -0
- spin_sdk/wit/__init__.py +12 -0
- spin_sdk/wit/deps/cli/command.wit +7 -0
- spin_sdk/wit/deps/cli/environment.wit +18 -0
- spin_sdk/wit/deps/cli/exit.wit +4 -0
- spin_sdk/wit/deps/cli/imports.wit +20 -0
- spin_sdk/wit/deps/cli/run.wit +4 -0
- spin_sdk/wit/deps/cli/stdio.wit +17 -0
- spin_sdk/wit/deps/cli/terminal.wit +47 -0
- spin_sdk/wit/deps/clocks/monotonic-clock.wit +45 -0
- spin_sdk/wit/deps/clocks/wall-clock.wit +42 -0
- spin_sdk/wit/deps/clocks/world.wit +6 -0
- spin_sdk/wit/deps/filesystem/preopens.wit +8 -0
- spin_sdk/wit/deps/filesystem/types.wit +634 -0
- spin_sdk/wit/deps/filesystem/world.wit +6 -0
- spin_sdk/wit/deps/http/handler.wit +43 -0
- spin_sdk/wit/deps/http/proxy.wit +32 -0
- spin_sdk/wit/deps/http/types.wit +570 -0
- spin_sdk/wit/deps/io/error.wit +34 -0
- spin_sdk/wit/deps/io/poll.wit +41 -0
- spin_sdk/wit/deps/io/streams.wit +251 -0
- spin_sdk/wit/deps/io/world.wit +6 -0
- spin_sdk/wit/deps/random/insecure-seed.wit +25 -0
- spin_sdk/wit/deps/random/insecure.wit +22 -0
- spin_sdk/wit/deps/random/random.wit +26 -0
- spin_sdk/wit/deps/random/world.wit +7 -0
- spin_sdk/wit/deps/sockets/instance-network.wit +9 -0
- spin_sdk/wit/deps/sockets/ip-name-lookup.wit +51 -0
- spin_sdk/wit/deps/sockets/network.wit +147 -0
- spin_sdk/wit/deps/sockets/tcp-create-socket.wit +26 -0
- spin_sdk/wit/deps/sockets/tcp.wit +321 -0
- spin_sdk/wit/deps/sockets/udp-create-socket.wit +26 -0
- spin_sdk/wit/deps/sockets/udp.wit +277 -0
- spin_sdk/wit/deps/sockets/world.wit +11 -0
- spin_sdk/wit/exports/__init__.py +35 -0
- spin_sdk/wit/exports/inbound_redis.py +22 -0
- spin_sdk/wit/exports/incoming_handler.py +13 -0
- spin_sdk/wit/imports/__init__.py +0 -0
- spin_sdk/wit/imports/error.py +51 -0
- spin_sdk/wit/imports/key_value.py +90 -0
- spin_sdk/wit/imports/llm.py +87 -0
- spin_sdk/wit/imports/monotonic_clock.py +53 -0
- spin_sdk/wit/imports/mysql.py +40 -0
- spin_sdk/wit/imports/outgoing_handler.py +29 -0
- spin_sdk/wit/imports/poll.py +66 -0
- spin_sdk/wit/imports/postgres.py +40 -0
- spin_sdk/wit/imports/rdbms_types.py +227 -0
- spin_sdk/wit/imports/redis.py +149 -0
- spin_sdk/wit/imports/sqlite.py +111 -0
- spin_sdk/wit/imports/streams.py +288 -0
- spin_sdk/wit/imports/types.py +1002 -0
- spin_sdk/wit/imports/variables.py +42 -0
- spin_sdk/wit/inbound-redis.wit +8 -0
- spin_sdk/wit/key-value.wit +47 -0
- spin_sdk/wit/llm.wit +70 -0
- spin_sdk/wit/mysql.wit +15 -0
- spin_sdk/wit/postgres.wit +15 -0
- spin_sdk/wit/rdbms-types.wit +80 -0
- spin_sdk/wit/redis.wit +70 -0
- spin_sdk/wit/spin.wit +27 -0
- spin_sdk/wit/sqlite.wit +50 -0
- spin_sdk/wit/types.py +24 -0
- spin_sdk/wit/variables.wit +18 -0
- spin_sdk-0.0.1.dist-info/LICENSE +217 -0
- spin_sdk-0.0.1.dist-info/METADATA +258 -0
- spin_sdk-0.0.1.dist-info/RECORD +69 -0
- spin_sdk-0.0.1.dist-info/WHEEL +5 -0
- spin_sdk-0.0.1.dist-info/top_level.txt +1 -0
spin_sdk/__init__.py
ADDED
|
File without changes
|
spin_sdk/wit/__init__.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import TypeVar, Generic, Union, Optional, Union, Protocol, Tuple, List, Any
|
|
2
|
+
from enum import Flag, Enum, auto
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from abc import abstractmethod
|
|
5
|
+
import weakref
|
|
6
|
+
|
|
7
|
+
from .types import Result, Ok, Err, Some
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SpinAll(Protocol):
|
|
12
|
+
pass
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface environment {
|
|
2
|
+
/// Get the POSIX-style environment variables.
|
|
3
|
+
///
|
|
4
|
+
/// Each environment variable is provided as a pair of string variable names
|
|
5
|
+
/// and string value.
|
|
6
|
+
///
|
|
7
|
+
/// Morally, these are a value import, but until value imports are available
|
|
8
|
+
/// in the component model, this import function should return the same
|
|
9
|
+
/// values each time it is called.
|
|
10
|
+
get-environment: func() -> list<tuple<string, string>>;
|
|
11
|
+
|
|
12
|
+
/// Get the POSIX-style arguments to the program.
|
|
13
|
+
get-arguments: func() -> list<string>;
|
|
14
|
+
|
|
15
|
+
/// Return a path that programs should use as their initial current working
|
|
16
|
+
/// directory, interpreting `.` as shorthand for this.
|
|
17
|
+
initial-cwd: func() -> option<string>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package wasi:cli@0.2.0-rc-2023-12-05;
|
|
2
|
+
|
|
3
|
+
world imports {
|
|
4
|
+
include wasi:clocks/imports@0.2.0-rc-2023-11-10;
|
|
5
|
+
include wasi:filesystem/imports@0.2.0-rc-2023-11-10;
|
|
6
|
+
include wasi:sockets/imports@0.2.0-rc-2023-11-10;
|
|
7
|
+
include wasi:random/imports@0.2.0-rc-2023-11-10;
|
|
8
|
+
include wasi:io/imports@0.2.0-rc-2023-11-10;
|
|
9
|
+
|
|
10
|
+
import environment;
|
|
11
|
+
import exit;
|
|
12
|
+
import stdin;
|
|
13
|
+
import stdout;
|
|
14
|
+
import stderr;
|
|
15
|
+
import terminal-input;
|
|
16
|
+
import terminal-output;
|
|
17
|
+
import terminal-stdin;
|
|
18
|
+
import terminal-stdout;
|
|
19
|
+
import terminal-stderr;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface stdin {
|
|
2
|
+
use wasi:io/streams@0.2.0-rc-2023-11-10.{input-stream};
|
|
3
|
+
|
|
4
|
+
get-stdin: func() -> input-stream;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface stdout {
|
|
8
|
+
use wasi:io/streams@0.2.0-rc-2023-11-10.{output-stream};
|
|
9
|
+
|
|
10
|
+
get-stdout: func() -> output-stream;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface stderr {
|
|
14
|
+
use wasi:io/streams@0.2.0-rc-2023-11-10.{output-stream};
|
|
15
|
+
|
|
16
|
+
get-stderr: func() -> output-stream;
|
|
17
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
interface terminal-input {
|
|
2
|
+
/// The input side of a terminal.
|
|
3
|
+
resource terminal-input;
|
|
4
|
+
|
|
5
|
+
// In the future, this may include functions for disabling echoing,
|
|
6
|
+
// disabling input buffering so that keyboard events are sent through
|
|
7
|
+
// immediately, querying supported features, and so on.
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface terminal-output {
|
|
11
|
+
/// The output side of a terminal.
|
|
12
|
+
resource terminal-output;
|
|
13
|
+
|
|
14
|
+
// In the future, this may include functions for querying the terminal
|
|
15
|
+
// size, being notified of terminal size changes, querying supported
|
|
16
|
+
// features, and so on.
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/// An interface providing an optional `terminal-input` for stdin as a
|
|
20
|
+
/// link-time authority.
|
|
21
|
+
interface terminal-stdin {
|
|
22
|
+
use terminal-input.{terminal-input};
|
|
23
|
+
|
|
24
|
+
/// If stdin is connected to a terminal, return a `terminal-input` handle
|
|
25
|
+
/// allowing further interaction with it.
|
|
26
|
+
get-terminal-stdin: func() -> option<terminal-input>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/// An interface providing an optional `terminal-output` for stdout as a
|
|
30
|
+
/// link-time authority.
|
|
31
|
+
interface terminal-stdout {
|
|
32
|
+
use terminal-output.{terminal-output};
|
|
33
|
+
|
|
34
|
+
/// If stdout is connected to a terminal, return a `terminal-output` handle
|
|
35
|
+
/// allowing further interaction with it.
|
|
36
|
+
get-terminal-stdout: func() -> option<terminal-output>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/// An interface providing an optional `terminal-output` for stderr as a
|
|
40
|
+
/// link-time authority.
|
|
41
|
+
interface terminal-stderr {
|
|
42
|
+
use terminal-output.{terminal-output};
|
|
43
|
+
|
|
44
|
+
/// If stderr is connected to a terminal, return a `terminal-output` handle
|
|
45
|
+
/// allowing further interaction with it.
|
|
46
|
+
get-terminal-stderr: func() -> option<terminal-output>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
package wasi:clocks@0.2.0-rc-2023-11-10;
|
|
2
|
+
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
|
|
3
|
+
/// time.
|
|
4
|
+
///
|
|
5
|
+
/// It is intended to be portable at least between Unix-family platforms and
|
|
6
|
+
/// Windows.
|
|
7
|
+
///
|
|
8
|
+
/// A monotonic clock is a clock which has an unspecified initial value, and
|
|
9
|
+
/// successive reads of the clock will produce non-decreasing values.
|
|
10
|
+
///
|
|
11
|
+
/// It is intended for measuring elapsed time.
|
|
12
|
+
interface monotonic-clock {
|
|
13
|
+
use wasi:io/poll@0.2.0-rc-2023-11-10.{pollable};
|
|
14
|
+
|
|
15
|
+
/// An instant in time, in nanoseconds. An instant is relative to an
|
|
16
|
+
/// unspecified initial value, and can only be compared to instances from
|
|
17
|
+
/// the same monotonic-clock.
|
|
18
|
+
type instant = u64;
|
|
19
|
+
|
|
20
|
+
/// A duration of time, in nanoseconds.
|
|
21
|
+
type duration = u64;
|
|
22
|
+
|
|
23
|
+
/// Read the current value of the clock.
|
|
24
|
+
///
|
|
25
|
+
/// The clock is monotonic, therefore calling this function repeatedly will
|
|
26
|
+
/// produce a sequence of non-decreasing values.
|
|
27
|
+
now: func() -> instant;
|
|
28
|
+
|
|
29
|
+
/// Query the resolution of the clock. Returns the duration of time
|
|
30
|
+
/// corresponding to a clock tick.
|
|
31
|
+
resolution: func() -> duration;
|
|
32
|
+
|
|
33
|
+
/// Create a `pollable` which will resolve once the specified instant
|
|
34
|
+
/// occured.
|
|
35
|
+
subscribe-instant: func(
|
|
36
|
+
when: instant,
|
|
37
|
+
) -> pollable;
|
|
38
|
+
|
|
39
|
+
/// Create a `pollable` which will resolve once the given duration has
|
|
40
|
+
/// elapsed, starting at the time at which this function was called.
|
|
41
|
+
/// occured.
|
|
42
|
+
subscribe-duration: func(
|
|
43
|
+
when: duration,
|
|
44
|
+
) -> pollable;
|
|
45
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
package wasi:clocks@0.2.0-rc-2023-11-10;
|
|
2
|
+
/// WASI Wall Clock is a clock API intended to let users query the current
|
|
3
|
+
/// time. The name "wall" makes an analogy to a "clock on the wall", which
|
|
4
|
+
/// is not necessarily monotonic as it may be reset.
|
|
5
|
+
///
|
|
6
|
+
/// It is intended to be portable at least between Unix-family platforms and
|
|
7
|
+
/// Windows.
|
|
8
|
+
///
|
|
9
|
+
/// A wall clock is a clock which measures the date and time according to
|
|
10
|
+
/// some external reference.
|
|
11
|
+
///
|
|
12
|
+
/// External references may be reset, so this clock is not necessarily
|
|
13
|
+
/// monotonic, making it unsuitable for measuring elapsed time.
|
|
14
|
+
///
|
|
15
|
+
/// It is intended for reporting the current date and time for humans.
|
|
16
|
+
interface wall-clock {
|
|
17
|
+
/// A time and date in seconds plus nanoseconds.
|
|
18
|
+
record datetime {
|
|
19
|
+
seconds: u64,
|
|
20
|
+
nanoseconds: u32,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// Read the current value of the clock.
|
|
24
|
+
///
|
|
25
|
+
/// This clock is not monotonic, therefore calling this function repeatedly
|
|
26
|
+
/// will not necessarily produce a sequence of non-decreasing values.
|
|
27
|
+
///
|
|
28
|
+
/// The returned timestamps represent the number of seconds since
|
|
29
|
+
/// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
|
|
30
|
+
/// also known as [Unix Time].
|
|
31
|
+
///
|
|
32
|
+
/// The nanoseconds field of the output is always less than 1000000000.
|
|
33
|
+
///
|
|
34
|
+
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
|
|
35
|
+
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
|
|
36
|
+
now: func() -> datetime;
|
|
37
|
+
|
|
38
|
+
/// Query the resolution of the clock.
|
|
39
|
+
///
|
|
40
|
+
/// The nanoseconds field of the output is always less than 1000000000.
|
|
41
|
+
resolution: func() -> datetime;
|
|
42
|
+
}
|