Client Libraries
Multiple client libraries are available for interacting with various Spacetime APIs and data models. Currently, client libraries are available in Go and Python.
Python
Requirements
- Python 3+
- A venv is strongly recommended, especially in areas where multiple versions of the APIs may be installed alongside eachother on one system.
Installation
The Spacetime client libraries are available through an Aalyria-provided package index: https://us-central1-python.pkg.dev/a5a-spacetime-artifacts/py-packages/simple.
They can be installed with pip
using the --extra-package-index
flag.
Install all Spacetime api packages with latest versions:
pip install spacetime-api --extra-index-url https://us-central1-python.pkg.dev/a5a-spacetime-artifacts/py-packages/simple
Install an individual api package.
pip install spacetime-common --extra-index-url https://us-central1-python.pkg.dev/a5a-spacetime-artifacts/py-packages/simple
Note: spacetime-api
is a Python metapackage with all individual libraries listed as requirements, and no concrete libraries present. Each release version corresponds to the version of each individual library that it depends on. Installing the spacetime-api
metapackage version x.y.z
will install version x.y.z
of all individual Spacetime api libraries.
Usage Example
import nmts.v1.proto.nmts_pb2 as nmts
import nmts.v1.proto.ek.physical.platform_pb2 as platform_pb2
import nmts.v1.proto.types.geophys.geodesy_pb2 as geodesy_pb2
import nmts.v1.proto.types.geophys.motion_pb2 as motion_pb2
from google.protobuf import text_format
entities = []
# Platform
platform = nmts.Entity()
platform.id = "user-terminal-1-platform"
# Create the geodetic coordinates
geodetic = geodesy_pb2.GeodeticWgs84()
geodetic.longitude_deg = -91.142578
geodetic.latitude_deg = -0.877259
geodetic.height_wgs84_m = 0
# Create the motion description with geodetic entry
motion_desc = motion_pb2.MotionDescription()
motion_desc.geodetic_wgs84.CopyFrom(geodetic)
# Create the motion with the entry
motion = motion_pb2.Motion()
motion.entry.append(motion_desc)
# Create the platform
platform_obj = platform_pb2.Platform()
platform_obj.name = "user-terminal-1"
platform_obj.category_tag = "UserTerminal"
platform_obj.motion.CopyFrom(motion)
platform.ek_platform.CopyFrom(platform_obj)
entities.append(platform)
"""Write the entities and relationships to a textproto file."""
fragment = nmts.Fragment()
fragment.entity.extend(entities)
txtProto = text_format.MessageToString(fragment, as_utf8=True)
print(txtProto)
Go
Requirements
- Go 1.19+
Installation
The Spacetime Go libraries are available through an Aalyria-provided Go module proxy. You’ll need to configure your Go environment to use the custom proxy for outernetcouncil.org
modules:
export GOPROXY=https://us-central1-go.pkg.dev/a5a-spacetime-artifacts/go-modules,https://proxy.golang.org,direct
export GONOSUMDB=outernetcouncil.org/*
Coming Soon: Direct access to these modules without proxy configuration will be available in an upcoming release.
Available Modules
The following Go modules are available for import:
aalyria.com/spacetime/common
aalyria.com/spacetime/federation
aalyria.com/spacetime/federation/interconnect
aalyria.com/spacetime/model
aalyria.com/spacetime/nbi
aalyria.com/spacetime/nbi/resources
aalyria.com/spacetime/provisioning
aalyria.com/spacetime/scheduling
aalyria.com/spacetime/solver
aalyria.com/spacetime/telemetry
aalyria.com/spacetime/types
outernetcouncil.org/nmts
outernetcouncil.org/nmts/v2
You can add these modules to your Go project using:
go get aalyria.com/spacetime/common
go get outernetcouncil.org/nmts/v1
# Add other modules as needed
Usage Example
package main
import (
"fmt"
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto"
nmtsproto "outernetcouncil.org/nmts/v1/proto"
"outernetcouncil.org/nmts/v1/proto/ek/physical"
"outernetcouncil.org/nmts/v1/proto/types/geophys"
)
func main() {
var entities []*nmtsproto.Entity
// Create platform entity
platformEntity := &nmtsproto.Entity{
Id: "user-terminal-1-platform",
}
// Create geodetic coordinates
geodetic := &geophys.GeodeticWgs84{
LongitudeDeg: proto.Float64(-91.142578),
LatitudeDeg: proto.Float64(-0.877259),
HeightWgs84M: proto.Float64(0),
}
// Create motion description
motionDesc := &geophys.MotionDescription_GeodeticWgs84{
GeodeticWgs84: geodetic,
}
// Create motion with entry
motionObj := &geophys.Motion{
Entry: []*geophys.MotionDescription{
{Type: motionDesc},
},
}
// Create platform
platformObj := &nmtsproto.Entity_EkPlatform{
EkPlatform: &physical.Platform{
Name: "user-terminal-1",
CategoryTag: "UserTerminal",
Motion: motionObj,
}}
platformEntity.Kind = platformObj
entities = append(entities, platformEntity)
// Create fragment with entities
fragment := &nmtsproto.Fragment{
Entity: entities,
}
fmt.Println(prototext.Format(fragment))
}