Skip to content

Commit 8640d95

Browse files
committed
In the beginning was the Word
0 parents  commit 8640d95

File tree

17 files changed

+1967
-0
lines changed

17 files changed

+1967
-0
lines changed

.github_bak/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
time: "08:00"
8+
labels:
9+
- "dependencies"
10+
- package-ecosystem: "github-actions"
11+
directory: "/"
12+
schedule:
13+
interval: "daily"
14+
time: "08:00"
15+
labels:
16+
- "dependencies"

.github_bak/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: build
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version: stable
18+
- name: test
19+
run: |
20+
go test -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./...
21+
- uses: codecov/codecov-action@v4
22+
if: matrix.os == 'ubuntu-latest'
23+
with:
24+
token: ${{ secrets.CODECOV_TOKEN }}
25+
file: ./coverage.txt

.github_bak/workflows/lint.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version: stable
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v6
20+
with:
21+
skip-go-installation: true

.github_bak/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
packages: write
12+
13+
jobs:
14+
goreleaser:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version: stable
23+
- uses: goreleaser/goreleaser-action@v5
24+
with:
25+
version: latest
26+
args: release --clean
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage.txt
2+
dist/
3+
.ari.history

.golangci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
linters:
2+
enable:
3+
- thelper
4+
- gofumpt
5+
- tparallel
6+
- unconvert
7+
- unparam
8+
- wastedassign

.goreleaser.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
gomod:
8+
proxy: true
9+
10+
builds:
11+
- env: ["CGO_ENABLED=0"]
12+
mod_timestamp: "{{ .CommitTimestamp }}"
13+
flags: ["-trimpath"]
14+
targets: ["go_first_class"]
15+
16+
changelog:
17+
sort: asc
18+
use: github
19+
filters:
20+
exclude:
21+
- "^docs:"
22+
- "^test:"
23+
- "^chore"
24+
- Merge pull request
25+
- Merge remote-tracking branch
26+
- Merge branch
27+
- go mod tidy
28+
groups:
29+
- title: "New Features"
30+
regexp: "^.*feat[(\\w)]*:+.*$"
31+
order: 0
32+
- title: "Bug fixes"
33+
regexp: "^.*fix[(\\w)]*:+.*$"
34+
order: 10
35+
- title: Other work
36+
order: 999
37+
38+
release:
39+
footer: |
40+
41+
---
42+
43+
_Released with [GoReleaser](https://goreleaser.com)!_

LICENSE

Whitespace-only changes.

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# ari
2+
3+
**A**rray **R**elational **I**nteractive programming environment.
4+
5+
## Background
6+
7+
I stumbled into a fairly flexible, powerful setup using Julia and DuckDB to do data analysis.
8+
9+
Details:
10+
11+
- Julia as primary programming language
12+
- Julia Pluto Notebooks as primary programming environment
13+
- Notebook One: Data ETL
14+
- HTTP: Calling HTTP APIs to fetch JSON data (GitHub, Shortcut)
15+
- CSV: Transforming fetched JSON data into CSV
16+
- SQL: (Out of band) Defining SQL tables using SQL schema
17+
- SQL: (Out of band) Importing CSV into DuckDB using a schema defined in a SQL file
18+
- Notebook Two: Data Analyses
19+
- SQL: DuckDB tables as source of truth
20+
- Julia: Wrote trivial utility fn to transform arbitrary SQL query results into Julia DataFrames
21+
- `DataFrame(DBInterface.execute(conn, sql))`
22+
- Renders as a well-formatted table in the notebook interface
23+
- Array-language-like story for interacting with the DataFrame
24+
- Fully dynamic: type information from the database schema used to dynamically populate the DataFrame with data of appropriate types.
25+
- Julia: Mustache package for templating functions to build a LaTeX report to house all analyses
26+
- Julia: Plots package for generating plots as PDF to insert into final LaTeX report
27+
- Julia: Statistics, StatsBase packages both for aggregates and data to plot, pull from DataFrames
28+
- Julia: Executed external `latexmk` using Julia's `run` to build LaTeX report
29+
30+
Why move away from this slick setup?
31+
32+
- Concision and expressive power of array languages.
33+
- A lot of my code was SQL in Julia.
34+
35+
Ari currently embeds the Goal array programming language. What gaps from my Julia+DuckDB experience need to be filled to use Goal where I used Julia?
36+
37+
- Notebook programming environment
38+
- Cell dependencies and automatic re-run
39+
- Nice-to-have
40+
- Autocomplete
41+
- Required
42+
- Built-in language/library help documentation
43+
- Required
44+
- Rich rendering
45+
- Tables: Required
46+
- Graphics: Nice-to-have
47+
- HTTP Client
48+
- Nice-to-have (can rely on shelling out to `curl` to start).
49+
- SQL
50+
- Query results as Goal tables/dictionaries/arrays
51+
- Required
52+
- Plots
53+
- Declarative plot definition producing one of PNG/PDF or HTML/JS output
54+
- Required
55+
- q tutorials simply leverage JS bridge + Highcharts
56+
- Julia Plots package has pluggable backends:
57+
- GR (cross-platform, has C bindings)
58+
- Plotly (JS)
59+
- gnuplot (command-line utility)
60+
- HDF5 file format
61+
- See GNU Octave plotting
62+
- See [Gonum](https://github.com/gonum)
63+
64+
Goal already has a number of features that mean we don't need to fill these gaps to start (more flexible options may be considered in the future):
65+
66+
- Powerful string API
67+
- JSON support
68+
- CSV support

cmd/goal.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package cmd
2+
3+
import (
4+
"sort"
5+
6+
"codeberg.org/anaseto/goal"
7+
)
8+
9+
var goalKeywordsFromCtx []string
10+
11+
func goalKeywords(ctx *goal.Context) []string {
12+
if goalKeywordsFromCtx == nil {
13+
goalKeywordsFromCtx = ctx.Keywords(nil)
14+
sort.Strings(goalKeywordsFromCtx)
15+
}
16+
return goalKeywordsFromCtx
17+
}
18+
19+
var goalNonAsciis = map[string]string{
20+
"eachleft": "`", // this is ASCII, but for completeness and less surprise
21+
"eachright": "´",
22+
"rshift": "»",
23+
"shift": "«",
24+
"firsts": "¿",
25+
}

0 commit comments

Comments
 (0)