All Projects → mattnite → Gyro

mattnite / Gyro

Licence: mit
A zig package manager with an index, build runner, and build dependencies

Projects that are alternatives of or similar to Gyro

Zigmod
A package manager for the Zig programming language.
Stars: ✭ 81 (-35.71%)
Mutual labels:  package-manager
Raven
Raven is a Package Manager for Chez Scheme
Stars: ✭ 107 (-15.08%)
Mutual labels:  package-manager
Npackd
Package manager for Microsoft Windows: Wiki, bug tracker, mirror of the default repositories
Stars: ✭ 118 (-6.35%)
Mutual labels:  package-manager
Instawow
World of Warcraft add-on manager CLI and GUI
Stars: ✭ 98 (-22.22%)
Mutual labels:  package-manager
Pacui
Bash script providing advanced Pacman and Yay/Pikaur/Aurman/Pakku/Trizen/Pacaur/Pamac-cli functionality in a simple UI
Stars: ✭ 103 (-18.25%)
Mutual labels:  package-manager
Scarf
An experimental prototype of a package manager and packaging ecosystem. Currently being rebuilt.
Stars: ✭ 108 (-14.29%)
Mutual labels:  package-manager
Akku
Language package manager for Scheme. (Bug reports to: https://gitlab.com/akkuscm/akku)
Stars: ✭ 82 (-34.92%)
Mutual labels:  package-manager
Baget
A lightweight NuGet and symbol server
Stars: ✭ 1,861 (+1376.98%)
Mutual labels:  package-manager
Conda.jl
Conda managing Julia binary dependencies
Stars: ✭ 105 (-16.67%)
Mutual labels:  package-manager
Bpkg
Lightweight bash package manager
Stars: ✭ 1,601 (+1170.63%)
Mutual labels:  package-manager
Dotnet Unpkg
Pure .NET front-end HTML package management using unpkg.com as a source
Stars: ✭ 103 (-18.25%)
Mutual labels:  package-manager
Ruckzuck
software package manager for windows
Stars: ✭ 103 (-18.25%)
Mutual labels:  package-manager
Pkgverse
📦🔭🌠 Create your own universe of packages à la tidyverse
Stars: ✭ 108 (-14.29%)
Mutual labels:  package-manager
Apk Tools
[MIRROR] Alpine package manager
Stars: ✭ 92 (-26.98%)
Mutual labels:  package-manager
Haxelib
The Haxe library manager
Stars: ✭ 119 (-5.56%)
Mutual labels:  package-manager
Pypi Server
Tornado based server like pypi.python.org. With caching from pypi.
Stars: ✭ 83 (-34.13%)
Mutual labels:  package-manager
Yarn
The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
Stars: ✭ 40,325 (+31903.97%)
Mutual labels:  package-manager
Pnpm
Fast, disk space efficient package manager -- 快速的,节省磁盘空间的包管理工具
Stars: ✭ 14,219 (+11184.92%)
Mutual labels:  package-manager
Mint
A package manager that installs and runs executable Swift packages
Stars: ✭ 1,750 (+1288.89%)
Mutual labels:  package-manager
Alire
Command-line tool from the Alire project and supporting library
Stars: ✭ 108 (-14.29%)
Mutual labels:  package-manager

gyro: a zig package manager

A gyroscope is a device used for measuring or maintaining orientation

Linux windows macOS



Table of Contents

Introduction

Gyro is an unofficial package manager for the Zig programming language. It improves a developer's life by giving them a package experience similar to cargo. Dependencies are declared in a gyro.zzz file in the root of your project, and are exposed to you programmatically in the build.zig file by importing @import("gyro").pkgs. In short, all that's needed on your part is how you want to add packages to different objects you're building:

const Builder = @import("std").build.Builder;
const pkgs = @import("gyro").pkgs;

pub fn build(b: *Builder) void {
    const exe = b.addExecutable("main", "src/main.zig");
    pkgs.addAllTo(exe);
    exe.install();
}

To make the job of finding suitable packages to use in your project easier, gyro is paired with a package index located at astrolabe.pm. A simple gyro add Hejsil/mecha will add the latest version of mecha (parser combinator library) as a dependency. To build your project all that's needed is gyro build and gyro will fetch anything that hasn't been downloaded.

If you want code that's not in the package index don't fret because I have you covered, if it's in a github repository, then all you have to do is gyro add --github <user>/<repo> (or -g instead of --github), and if it's located elsewhere gyro supports downloading tar.gz archives over https (see "How To" section).

Installation

In order to install gyro, all you need to do is extract one of the release tarballs for your system and add the single static binary to your PATH.

Building

If you'd like to build from source, the only thing you need is the zig compiler:

git clone https://github.com/mattnite/gyro.git --recursive
zig build -Dbootstrap

The -Dbootstrap is required because gyro uses git submodules to do the initial build. After that one can build gyro with gyro, this will pull packages from the package index instead of using git submodules.

gyro build

(Note: you might need to move the original gyro binary from the zig-cache first). This command wraps zig build, so you can pass arguements like you normally would, like gyro build test to run your unit tests.

Consuming packages

To find potential zig packages you'd like to use:

  • astrolabe.pm, the default package index
  • zpm, a site that lists cool zig projects and where to find them
  • search github for #zig and #zig-package tags

If you want to use code from a package from astrolabe, then all you need to do is gyro add <package name>, else if you want to use a Github repository as a dependency then all that's required is gyro add <user>/<repo>.

Packages are exposed to your build.zig file through a struct in @import("gyro"), and you can simply add them using a addAllTo() function, and then @import() in your code.

Assume there is a hello_world package available to on the index, we'd add it to our project like so:

gyro add hello_world

build.zig:

const Builder = @import("std").build.Builder;
const pkgs = @import("gyro").pkgs;

pub fn build(b: *Builder) void {
    const exe = b.addExecutable("main", "src/main.zig");
    pkgs.addAllTo(exe);
    exe.install();
}

main.zig:

const hw = @import("hello_world");

pub fn main() !void {
    try hw.greet();
}

If you want to "link" a specific package to an object, the packages you depend on are accessed like pkgs.<package name> so in the example above you could instead do exe.addPackage(pkgs.hello_world).

Build dependencies

It's also possible to use packaged code in your build.zig, since this would only run at build time and most likely not required in your application or library these are kept separate from your regular dependencies in your project file.

When you want to add a dependency as a build dep, all you need to do is add --build-dep to the gyro invocation. For example, let's assume I need to do some parsing with a package called mecha:

gyro add --build-dep mecha

and in my build.zig:

const Builder = @import("std").build.Builder;
const pkgs = @import("gyro").pkgs;
const mecha = @import("mecha");

pub fn build(b: *Builder) void {
    const exe = b.addExecutable("main", "src/main.zig");
    pkgs.addAllTo(exe);
    exe.install();
}

Producing packages

The easiest way for an existing project to adopt gyro is to start by running gyro init <user>/<repo> to grab metadata from their Github project. From there the package maintainer to finish the init process by defining a few more things:

  • the root file, it is src/main.zig by default
  • file globs describing which files are actually part of the package. It is encouraged to include the license and readme, as well as testing code.
  • any other packages if the repo exports multiple repos (and their corresponding root files of course)
  • dependencies (see previous section).

A note on projects and dependencies

A project may export multiple packages, each with their own root file. For the sake of simplicity all packages in a project share the same dependencies.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].