project

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package project turns the paths a user names — files, directories and glob patterns — into the model files to load, in a deterministic order.

Index

Constants

View Source
const Stdin = "-"

Stdin is the path that names standard input, by the convention that a lone "-" is read from the stream rather than from a file of that name. A file really called "-" is named as "./-".

View Source
const StdinName = "<stdin>"

StdinName is what a model read from standard input is called in diagnostics.

Variables

This section is empty.

Functions

func Dependencies

func Dependencies(files []string, known func(name string) bool) []string

Dependencies returns the model files, beside or below the named ones, that declare a root namespace an import of the named files begins with and none of them declares, then the files those imports lead to in turn. known reports the names another source declares — the standard library's root packages — so an import of one is not searched for. A named file that cannot be read or is standard input contributes nothing; the loader reports the former. The result is ordered as it was found and holds no file already named.

func DependenciesOf added in v0.10.0

func DependenciesOf(sources []Source, known func(name string) bool) []string

DependenciesOf is Dependencies over sources already read, so a notebook's cells, or a file converted from another notation, are searched from as the model text they load as. Standard input contributes nothing.

func Expand

func Expand(inputs []string) ([]string, error)

Expand turns the paths named on a command line (or at a %load prompt) into the sources to load: a directory contributes every model file and notebook under it, a pattern contributes the model files and notebooks among its matches, and any other path is taken as named. Files come back in a deterministic order — the inputs in the order given, each directory walk and each pattern match sorted by path — and duplicates are dropped, so naming a file twice loads it once.

func IsLoadable added in v0.10.0

func IsLoadable(path string) bool

IsLoadable reports whether path names a source a load reads: a model file or a notebook, whose code cells are the model.

func IsModelFile

func IsModelFile(path string) bool

IsModelFile reports whether path names a SysML or KerML model file.

func IsStdin

func IsStdin(path string) bool

IsStdin reports whether path names standard input.

func ModelFiles

func ModelFiles(dir string) ([]string, error)

ModelFiles walks dir and returns every .sysml/.kerml file and .ipynb notebook under it, sorted by path. Hidden directories are skipped, so a repository's .git or a build cache under a dot-directory contributes nothing. Symlinked directories are walked — a project may keep a shared library as a link — each at most once, so a cycle terminates.

func ReadFile

func ReadFile(path string) (string, []byte, error)

ReadFile returns the contents of the model at path together with the name it is reported under, reading standard input when path names it.

Types

type Source added in v0.10.0

type Source struct {
	Path    string
	Content []byte
}

Source is a loaded source as the dependency search sees it: the path it was read from, which locates the directories searched, and its model text. The cells of a notebook are Sources sharing the notebook's path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL