• Stars
    star
    129
  • Rank 279,362 (Top 6 %)
  • Language
    Rust
  • License
    BSD 3-Clause "New...
  • Created over 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Project templates in rust

project init (pi)

Build Status Windows build status

pi is a command-line utility to initialize projects. It is written in rust.

It is intended to provide something like cookiecutter, but faster.

Reasons to use pi:

  • You want to automate the process of starting a new project, for all your projects.
  • You want project initialization that's quick

Reasons to use pi over cookiecutter:

  • Templates are smaller. Define files you need in a .toml.
  • Fast. pi is 30x faster than cookiecutter when rendering the sample vim plugin template.
  • pi uses mustache, a logic-less language, for templates.
  • pi can initialize a darcs, pijul, mercurial, or git repository inside your projects
  • pi provides opinionated templates for many languages
  • pi is extensible in Rust

Reasons to not use pi over cookiecutter:

  • cookiecutter uses jinja templates, which are far more sophisticated.
  • pi is newer and presumably more buggy
  • cookiecutter is extensible in Python

Benchmarks (with Haskell's bench):

Tool Language Time (vim example plugin) Time (rust library)
pi init rust 10.10 ms 8.809 ms
pi new rust 6.672 ms 8.653 ms
cookiecutter python 317.1 ms 316.9 ms

Installation

Script

Enter the following in a command prompt:

curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git vmchale/project-init

Binary releases

The easiest way for most users is simply to download the prebuilt binaries. You can find binaries for various platforms on the release page.

Cargo

First, install cargo. Then:

 $ cargo install project_init

You will need to use the nightly release for this to work; if in doubt run

rustup run nightly cargo install project_init

Use

pi reads from $HOME/.pi_templates/ and your current directory. So, if you place a template in the $HOME/.pi_templates/idris/, you can initialize a project anywhere with

 $ pi init idris treesod

There is a repo containing pi templates here.

You can also use pi with built-in templates, viz.

 $ pi new haskell really-good-project
Finished initializing project in really-good-project/

Or to fetch a template from github:

 $ pi git vmchale/haskell-ats ambitious-insane-project

Examples

Configuration

Global configuration is via the $HOME/.pi.toml file. The following is an example:

license = "BSD3"         # set default license to BSD3 
version_control = "git"  # initialize new repositories with git
version = "0.1.0"        # start new projects at version 0.1.0

[author]
name = "Vanessa McHale"
email = "[email protected]"
github_username = "vmchale"

# put any custom keys you want under a [[user]] table
[[user]]
website = "https://vmchale.com"

Project-specific config lives in $PROJECT_NAME/template.toml. The following is an example for a vim plugin:

license = "BSD3"        # overrides global value if set
with_readme = true      # add README.md

[files]
files = ["syntax/{{ project }}.vim","plugin/{{ project }}.vim","doc/{{ project }}.txt"] # blank files
directories = ["doc","syntax","plugin"]
templates = ["vimball.txt"] # files to be processed

[config]
version = "0.1.0"
version_control = "darcs"

# put any custom keys you want below [[user]]
[[user]]
vim_org_username = "vmchale"

This will generate the following directory structure:

vim-plugin
├── LICENSE
├── README.md
├── doc
│  └── vim-plugin.txt
├── plugin
│  └── vim-plugin.vim
├── syntax
│  └── vim-plugin.vim
└── vimball.txt

For a more in-depth example, see here. This is a template based off the recursion schemes generator.

Templates

pi uses mustache for templating, via the rustache crate.

You can find examples and help on the mustache page, or you can my look at the example repo.

More Repositories

1

tin-summer

Find build artifacts that are taking up disk space
Rust
306
star
2

polyglot

Tool to count lines of source code.
ATS
234
star
3

command-line-tweeter

Tweets in from a pipe
Haskell
71
star
4

dhall-vim

Syntax highlighting for Dhall
Vim Script
67
star
5

jacinda

Functional, expression-oriented data processing language
Haskell
66
star
6

cpkg

A build tool/package manager for C, configured with Dhall
Dhall
65
star
7

recursion_schemes

Recursion schemes for Idris
Idris
60
star
8

kempe

Kempe is a compiled stack-based language
Haskell
56
star
9

github-actions-dhall

Dhall helpers for github actions
Dhall
55
star
10

madlang

Madlang is a language for generative literature
Haskell
52
star
11

atspkg

Build tool for ATS.
Haskell
41
star
12

apple

Apple array system
Haskell
37
star
13

permutations

Provides a type-safe way of working with permutations in Idris
Idris
30
star
14

dickinson

Text generation language
Haskell
28
star
15

tomlcheck

A syntax checker for TOML files
Haskell
28
star
16

vim-twitter

Tweet from inside vim!
Vim Script
27
star
17

libmeme

A library for inserting clap emoji into strings
Haskell
25
star
18

hs-ats

Home of the fast-arithmetic library for number theory in ATS and Haskell.
ATS
22
star
19

tw-rs

Command-Line Interface Tweeter, for rust
Rust
19
star
20

rure

Haskell bindings to Rust's regex library
Haskell
17
star
21

coronavirus

covid-19 data in J
J
16
star
22

EMD

Earth mover's distance on Nvidia GPUS
Haskell
14
star
23

doggo-command-line

Compliment your dog
Rust
13
star
24

just-vim

Syntax highlighting for Justfiles
Vim Script
13
star
25

phash

Perceptual hashing command-line tool
Haskell
13
star
26

linear

Linear lenses in Blodwen
Idris
13
star
27

ion-vim

Syntax highlighting for the ion shell
Vim Script
13
star
28

libarchive

Haskell bindings to libarchive
C
12
star
29

recursion-schemata

Generate fake recursion schemes
Haskell
12
star
30

pybqn

BQN↔NumPy bridge
C
12
star
31

edit-distance

Levenshtein edit distance, packaged for ATS
ATS
11
star
32

ats-format

ATS source code formatter
Haskell
11
star
33

j-hs

Call J from Haskell
Haskell
11
star
34

shake-dhall

Facilities for using Shake + dhall
Haskell
10
star
35

cpp-build

Use the C pre-processor on Rust projects
Rust
10
star
36

ghc-cross

aarch64 and armv7 cross-compilers
9
star
37

morphism-zoo

Some examples of recursion schemes, with benchmarks
Haskell
9
star
38

ipkg-vim

Syntax highlighting for Idris package files
Vim Script
9
star
39

ats-stats

Demonstration of GPU-accelerated statistical functions in ATS
ATS
9
star
40

kullback-liebler

Kullback-Liebler divergence in Futhark
Futhark
8
star
41

language-xats

Language library for manipulating ATS3 in Haskell.
Haskell
8
star
42

recursion

Recursion schemes in ATS
ATS
8
star
43

spherical

Library for spherical geometry in Haskell
Haskell
8
star
44

ats-benchmarks

Benchmarks of ATS compared to Rust and Haskell
Haskell
8
star
45

ats-concurrency

Concurrency primitives for ATS
ATS
8
star
46

hlint-lib

Library containing some standard HLint helpers
Dhall
7
star
47

pi-templates

Templates for pi
Haskell
7
star
48

perceptual-hash

Perceptual Hash in J
J
7
star
49

monads

Monads for viewtypes in ATS
ATS
7
star
50

hgis

Haskell as a GIS
Haskell
6
star
51

archive-backpack

Demonstration of backpack to enable substitution of tar/libarchive functionality
Haskell
6
star
52

pointfree

Wrapper of pointfree command-line tool for Haskell
Vim Script
6
star
53

hask-replace

Command-line tool to rename modules in Haskell projects
Rust
6
star
54

cabal-project-vim

Syntax highlighting for `cabal.project` files.
Vim Script
6
star
55

miso

Miso project template for GHCJS 8.6
Haskell
5
star
56

tokei-vim

Vim plugin for of tokei
Vim Script
5
star
57

linkedin-madlibs

Source for linkedin article generator
Haskell
5
star
58

brainheck

Brainh*ck intrepreter in haskell.
Brainfuck
5
star
59

haskell-ats

Template project for mixing Haskell and ATS
Haskell
5
star
60

ghci-syntax

Syntax highlighting for ghci configuration files
Vim Script
5
star
61

egison-vim

Vim syntax highlighting for Egison
Vim Script
4
star
62

avif

libavif bindings for Haskell
Haskell
4
star
63

img-fut

Image manipulation in Futhark
Futhark
4
star
64

QR-writer

Haskell library for writing QR codes to file
Haskell
4
star
65

crc32

CRC32 implementation in ATS
ATS
4
star
66

hackage-fetch

Fetch every single package on Hackage, using Python + shell madness
Haskell
4
star
67

markov-bot

Make a twitter bot from any corpus of text you desire
Python
4
star
68

viminit

Python script to initialize a vim project
Python
4
star
69

tibetan-utils

Utils for tibetan numerals in Haskell
Haskell
4
star
70

elliptic-fourier

Elliptic Fourier series in J
J
4
star
71

xmonad-vanessa

Xmonad configuration
Haskell
4
star
72

recursion-schemes-benchmarks

Benchmarks of Fibonacci functions built with recursion schemes vs. pattern matching.
Haskell
3
star
73

composition

Composition extras for Idris
Idris
3
star
74

ats-codecount

Code counter experiment in ATS
ATS
3
star
75

sql-qq

Syntax highlighting for quasi-quotes within Haskell.
Vim Script
3
star
76

madlang-miso

Frontend project template with madlang
Haskell
3
star
77

illiterate

Preprocessor for literate programming
Shell
3
star
78

hot-takes

Programming opinion generator
Haskell
3
star
79

either

Port of Data.Either for ATS
ATS
3
star
80

q-bench

benchmarks of q(-sql)
R
3
star
81

oeis

OEIS functions in Haskell
Haskell
3
star
82

cli-setup

Helper scripts to install manpages alongside a command-line tool.
Rust
3
star
83

dir-traverse

Recursive directory traversals in Haskell
Haskell
2
star
84

phash-fut

Perceptual hash in Futhark
Python
2
star
85

elm-composition

Port of Haskell's composition library to Elm
Elm
2
star
86

pathological-bytestrings

Facilities for testing with ByteStrings
Haskell
2
star
87

lzlib

lzlib bindings for Haskell
Haskell
2
star
88

debug-dump

Like Debug.Trace, but allows writing to files
Haskell
2
star
89

ats-wc

Demonstration of packaing for ATS + faster/safer version of coreutils
ATS
2
star
90

basic-recursion

Basic recursion schemes in Blodwen
2
star
91

comonad

Comonads for Idris
Idris
2
star
92

NonEmpty

NonEmpty type for Dhall
Dhall
2
star
93

haskal

How to write Haskal good
Haskell
2
star
94

librarian

Tools to manage a home library
Haskell
2
star
95

tibetan-typing

An Elm app that teaches typing for Tibetan and Dzongkha.
Elm
2
star
96

ats-storable

ATS storable instance
Haskell
1
star
97

ppp

Permutations in PureScript
PureScript
1
star
98

specats

Bare-bones unit testing library for ATS
ATS
1
star
99

safe-bytecount

Safe bytecount demo in ATS
ATS
1
star
100

matrix-benchmarks

Matrix benchmarks for J/Python
J
1
star