bundles

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ManifestFilename = "manifest.json"

ManifestFilename is the well-known manifest.json filename contained within deployment bundles.

View Source
const PythonRequirementsFilename = "requirements.txt"

PythonRequirementsFilename is the well-known filename for the Python pip package dependency list.

Variables

This section is empty.

Functions

func NewBundler

func NewBundler(path util.AbsolutePath, manifest *Manifest, filePatterns []string, log logging.Logger) (*bundler, error)

NewBundler creates a bundler that will archive the directory specified by `path`, or the containing directory if `path` is a file. The provided manifest should contain the metadata for the app, such as the entrypoint, Python version, R package dependencies, etc. The bundler will fill in the `files` section and include the manifest.json in the bundler.

Types

type Bundler

type Bundler interface {
	CreateManifest() (*Manifest, error)
	CreateBundle(archive io.Writer) (*Manifest, error)
}

type Environment

type Environment struct {
	Image    string `json:"image"`    // The image to use during content build/execution
	Prebuilt bool   `json:"prebuilt"` // Determines whether Connect should skip the build phase for this content.
}

type Jupyter

type Jupyter struct {
	HideAllInput    bool `json:"hide_all_input"`    // Hide code cells when rendering
	HideTaggedInput bool `json:"hide_tagged_input"` // Hide the input of cells tagged with "hide_input"
}

type Manifest

type Manifest struct {
	Version     int             `json:"version"`                             // Manifest version (always 1)
	Locale      string          `json:"locale,omitempty"`                    // User's locale. Currently unused.
	Platform    string          `json:"platform,omitempty" name:"r-version"` // Client R version
	Metadata    Metadata        `json:"metadata"`                            // Properties about this deployment. Ignored by shinyapps.io
	Python      *Python         `json:"python,omitempty"`                    // If non-null, specifies the Python version and dependencies
	Jupyter     *Jupyter        `json:"jupyter,omitempty"`                   // If non-null, specifies the Jupyter options
	Quarto      *Quarto         `json:"quarto,omitempty"`                    // If non-null, specifies the Quarto version and engines
	Environment *Environment    `json:"environment,omitempty"`               // Information about the execution environment
	Packages    PackageMap      `json:"packages"`                            // Map of R package name to package details
	Files       ManifestFileMap `json:"files"`                               // List of file paths contained in the bundle
}

Manifest contains details about a specific deployment specified in the manifest.json file.

The manifest describes the type of content (its dependencies, how its environment can be recreated (if needed) and how it is served/executed).

func NewManifest

func NewManifest() *Manifest

func NewManifestFromConfig

func NewManifestFromConfig(cfg *config.Config) *Manifest

func ReadManifest

func ReadManifest(r io.Reader) (*Manifest, error)

ReadManifest reads and parses the manifest.

func ReadManifestFile

func ReadManifestFile(path util.Path) (*Manifest, error)

ReadManifest reads and parses the manifest file stored at path.

func (*Manifest) AddFile

func (manifest *Manifest) AddFile(path string, fileMD5 []byte)

func (*Manifest) Clone

func (manifest *Manifest) Clone() (*Manifest, error)

func (*Manifest) GetFilenames

func (manifest *Manifest) GetFilenames() []string

func (*Manifest) ToJSON

func (manifest *Manifest) ToJSON() ([]byte, error)

func (*Manifest) WriteManifest

func (m *Manifest) WriteManifest(w io.Writer) error

WriteManifest writes the manifest in JSON format.

func (*Manifest) WriteManifestFile

func (m *Manifest) WriteManifestFile(path util.Path) error

WriteManifestFile writes the manifest to a file.

type ManifestFile

type ManifestFile struct {
	Checksum string `json:"checksum"`
}

func NewManifestFile

func NewManifestFile() ManifestFile

type ManifestFileMap

type ManifestFileMap map[string]ManifestFile

func NewManifestFileMap

func NewManifestFileMap() ManifestFileMap

type Metadata

type Metadata struct {
	AppMode         connect.AppMode `json:"appmode"`                    // Selects the runtime for this content.
	ContentCategory string          `json:"content_category,omitempty"` // A refinement of the AppMode used by plots and sites
	Entrypoint      string          `json:"entrypoint,omitempty"`       // The main file being deployed.
	PrimaryRmd      string          `json:"primary_rmd,omitempty"`      // The rendering target for Rmd deployments.
	PrimaryHtml     string          `json:"primary_html,omitempty"`     // The default document for static deployments.
	HasParameters   bool            `json:"has_parameters,omitempty"`   // True if this is content allows parameter customization.
}

Metadata contains details about this deployment (type, etc).

type Package

type Package struct {
	Source      string     `json:",omitempty"`  // Symbolic name describing where this package originated. e.g. "CRAN".
	Repository  string     `json:",omitempty"`  // URL to the source repository
	Description dcf.Record `json:"description"` // A collection of key:value fields from the DESCRIPTION file

}

Package describes a single R package.

type PackageMap

type PackageMap map[string]Package

type Python

type Python struct {
	Version        string               `json:"version"` // The Python version
	PackageManager PythonPackageManager `json:"package_manager"`
}

type PythonPackageManager

type PythonPackageManager struct {
	Name        string `json:"name"`
	Version     string `json:"version,omitempty"` // Package manager version
	PackageFile string `json:"package_file"`      // Filename listing dependencies; usually "requirements.txt"
}

type Quarto

type Quarto struct {
	Version string   `json:"version"`
	Engines []string `json:"engines"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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