Spaces:
Runtime error
Runtime error
Archie Wood
commited on
Commit
•
13df045
1
Parent(s):
b535509
everything except the duckdb
Browse files- .evidence/customization/custom-formatting.json +4 -0
- .github/workflows/release.yml +98 -0
- .gitignore +10 -0
- .npmrc +3 -0
- .vscode/extensions.json +5 -0
- Dockerfile +34 -0
- README.md +1 -1
- evidence.plugins.yaml +20 -0
- package-lock.json +0 -0
- package.json +37 -0
- pages/index.md +56 -0
- sources/needful_things/connection.yaml +5 -0
- sources/needful_things/orders.sql +1 -0
.evidence/customization/custom-formatting.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": "1.0",
|
3 |
+
"customFormats": []
|
4 |
+
}
|
.github/workflows/release.yml
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This installs the dependencies, zips the files, uploads the artifact, and creates a GitHub release.
|
2 |
+
# This appears to work for Windows, but in macOS it has permissions issues. Linux not tested.
|
3 |
+
name: Package and Release
|
4 |
+
|
5 |
+
on:
|
6 |
+
push:
|
7 |
+
tags:
|
8 |
+
- '*'
|
9 |
+
|
10 |
+
jobs:
|
11 |
+
build:
|
12 |
+
runs-on: ${{ matrix.os }}
|
13 |
+
strategy:
|
14 |
+
matrix:
|
15 |
+
include:
|
16 |
+
# MacOS
|
17 |
+
- os: macos-latest
|
18 |
+
arch: x86_64
|
19 |
+
node: 18
|
20 |
+
- os: macos-latest
|
21 |
+
arch: arm64
|
22 |
+
node: 18
|
23 |
+
- os: macos-latest
|
24 |
+
arch: x86_64
|
25 |
+
node: 20
|
26 |
+
- os: macos-latest
|
27 |
+
arch: arm64
|
28 |
+
node: 20
|
29 |
+
# Ubuntu
|
30 |
+
- os: ubuntu-latest
|
31 |
+
arch: x86_64
|
32 |
+
node: 18
|
33 |
+
- os: ubuntu-latest
|
34 |
+
arch: arm64
|
35 |
+
node: 18
|
36 |
+
- os: ubuntu-latest
|
37 |
+
arch: x86_64
|
38 |
+
node: 20
|
39 |
+
- os: ubuntu-latest
|
40 |
+
arch: arm64
|
41 |
+
node: 20
|
42 |
+
# Windows
|
43 |
+
- os: windows-latest
|
44 |
+
arch: x86_64
|
45 |
+
node: 18
|
46 |
+
- os: windows-latest
|
47 |
+
arch: x86_64
|
48 |
+
node: 20
|
49 |
+
steps:
|
50 |
+
- name: Checkout code
|
51 |
+
uses: actions/checkout@v2
|
52 |
+
|
53 |
+
- name: Set up Node.js ${{ matrix.node }}
|
54 |
+
uses: actions/setup-node@v2
|
55 |
+
with:
|
56 |
+
node-version: ${{ matrix.node }}
|
57 |
+
|
58 |
+
- name: Install dependencies
|
59 |
+
run: npm install
|
60 |
+
|
61 |
+
- name: Zip files (Windows)
|
62 |
+
if: runner.os == 'Windows'
|
63 |
+
run: powershell.exe -Command "Compress-Archive -Path . -DestinationPath evidence-${{ matrix.os }}-${{ matrix.arch }}-node${{ matrix.node }}.zip -Force"
|
64 |
+
|
65 |
+
- name: Zip files (Unix)
|
66 |
+
if: runner.os != 'Windows'
|
67 |
+
run: zip -r evidence-${{ matrix.os }}-${{ matrix.arch }}-node${{ matrix.node }}.zip . -x "*.git*"
|
68 |
+
|
69 |
+
- name: Upload artifact
|
70 |
+
uses: actions/upload-artifact@v2
|
71 |
+
with:
|
72 |
+
name: evidence-${{ matrix.os }}-${{ matrix.arch }}-node${{ matrix.node }}
|
73 |
+
path: evidence-${{ matrix.os }}-${{ matrix.arch }}-node${{ matrix.node }}.zip
|
74 |
+
|
75 |
+
release:
|
76 |
+
runs-on: ubuntu-latest
|
77 |
+
needs: build
|
78 |
+
steps:
|
79 |
+
- name: Checkout code
|
80 |
+
uses: actions/checkout@v2
|
81 |
+
|
82 |
+
- name: Download all artifacts
|
83 |
+
uses: actions/download-artifact@v2
|
84 |
+
with:
|
85 |
+
path: .
|
86 |
+
|
87 |
+
- name: Create or Update GitHub Release
|
88 |
+
uses: ncipollo/release-action@v1
|
89 |
+
with:
|
90 |
+
artifacts: '**/evidence-*.zip'
|
91 |
+
token: ${{ secrets.GH_ACTIONS_RELEASE_TOKEN }}
|
92 |
+
tag: ${{ github.ref }}
|
93 |
+
name: Release ${{ github.ref_name }}
|
94 |
+
body: |
|
95 |
+
Release for ${{ github.ref_name }} with artifacts.
|
96 |
+
draft: false
|
97 |
+
prerelease: false
|
98 |
+
allowUpdates: true
|
.gitignore
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.evidence/template
|
2 |
+
.svelte-kit
|
3 |
+
build
|
4 |
+
node_modules
|
5 |
+
.DS_Store
|
6 |
+
static/data
|
7 |
+
*.options.yaml
|
8 |
+
.vscode/settings.json
|
9 |
+
.env
|
10 |
+
.evidence/meta
|
.npmrc
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
loglevel=error
|
2 |
+
audit=false
|
3 |
+
fund=false
|
.vscode/extensions.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"recommendations": [
|
3 |
+
"evidence.evidence-vscode"
|
4 |
+
]
|
5 |
+
}
|
Dockerfile
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM ubuntu:22.04
|
2 |
+
|
3 |
+
# Install Node.js 20 - https://github.com/nodesource/distributions?tab=readme-ov-file#installation-instructions-deb
|
4 |
+
# And python3
|
5 |
+
RUN apt update \
|
6 |
+
&& apt install -y curl python3 python3-pip \
|
7 |
+
&& rm -rf /var/lib/apt/lists/*
|
8 |
+
|
9 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh \
|
10 |
+
&& bash nodesource_setup.sh \
|
11 |
+
&& apt update \
|
12 |
+
&& apt install -y nodejs \
|
13 |
+
&& rm -rf /var/lib/apt/lists/* \
|
14 |
+
&& rm nodesource_setup.sh
|
15 |
+
|
16 |
+
RUN pip install --upgrade "huggingface_hub[cli]"
|
17 |
+
|
18 |
+
# Build the app
|
19 |
+
WORKDIR /tmp/app
|
20 |
+
RUN npm install && npm run sources && npm run build
|
21 |
+
|
22 |
+
# The site space name must be passed as an environment variable
|
23 |
+
# https://huggingface.co/docs/hub/spaces-sdks-docker#buildtime
|
24 |
+
ARG STATIC_SPACE
|
25 |
+
# The Hugging Face token must be passed as a secret (https://huggingface.co/docs/hub/spaces-sdks-docker#buildtime)
|
26 |
+
# 1. get README.md from the site space
|
27 |
+
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
28 |
+
huggingface-cli download --token=$(cat /run/secrets/HF_TOKEN) --repo-type=space --local-dir=/tmp/app/dist $STATIC_SPACE README.md && rm -rf /tmp/app/dist/.cache
|
29 |
+
# 2. upload the new build to the site space, including README.md
|
30 |
+
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
31 |
+
huggingface-cli upload --token=$(cat /run/secrets/HF_TOKEN) --repo-type=space $STATIC_SPACE /tmp/app/dist . --delete "*"
|
32 |
+
|
33 |
+
# Halt execution because the code space is not meant to run.
|
34 |
+
RUN exit 1
|
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title: Template
|
3 |
emoji: 🏢
|
4 |
colorFrom: purple
|
5 |
colorTo: yellow
|
|
|
1 |
---
|
2 |
+
title: Evidence Template
|
3 |
emoji: 🏢
|
4 |
colorFrom: purple
|
5 |
colorTo: yellow
|
evidence.plugins.yaml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
components:
|
3 |
+
# This loads all of evidence's core charts and UI components
|
4 |
+
# You probably don't want to edit this dependency unless you know what you are doing
|
5 |
+
"@evidence-dev/core-components": {}
|
6 |
+
|
7 |
+
datasources:
|
8 |
+
# You can add additional datasources here by adding npm packages.
|
9 |
+
# Make to also add them to `package.json`.
|
10 |
+
"@evidence-dev/bigquery": { }
|
11 |
+
"@evidence-dev/csv": { }
|
12 |
+
"@evidence-dev/databricks": { }
|
13 |
+
"@evidence-dev/duckdb": { }
|
14 |
+
"@evidence-dev/mssql": { }
|
15 |
+
"@evidence-dev/mysql": { }
|
16 |
+
"@evidence-dev/postgres": { }
|
17 |
+
"@evidence-dev/snowflake": { }
|
18 |
+
"@evidence-dev/sqlite": { }
|
19 |
+
"@evidence-dev/trino": { }
|
20 |
+
"@evidence-dev/motherduck": { }
|
package-lock.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
package.json
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "my-evidence-project",
|
3 |
+
"version": "0.0.1",
|
4 |
+
"scripts": {
|
5 |
+
"build": "evidence build",
|
6 |
+
"build:strict": "evidence build:strict",
|
7 |
+
"dev": "evidence dev --open /",
|
8 |
+
"test": "evidence build",
|
9 |
+
"sources": "evidence sources",
|
10 |
+
"preview": "evidence preview"
|
11 |
+
},
|
12 |
+
"engines": {
|
13 |
+
"npm": ">=7.0.0",
|
14 |
+
"node": ">=18.0.0"
|
15 |
+
},
|
16 |
+
"type": "module",
|
17 |
+
"dependencies": {
|
18 |
+
"@evidence-dev/bigquery": "^2.0.7",
|
19 |
+
"@evidence-dev/core-components": "^4.7.2",
|
20 |
+
"@evidence-dev/csv": "^1.0.12",
|
21 |
+
"@evidence-dev/databricks": "^1.0.7",
|
22 |
+
"@evidence-dev/duckdb": "^1.0.11",
|
23 |
+
"@evidence-dev/evidence": "^39.1.2",
|
24 |
+
"@evidence-dev/motherduck": "^1.0.2",
|
25 |
+
"@evidence-dev/mssql": "^1.0.9",
|
26 |
+
"@evidence-dev/mysql": "^1.1.3",
|
27 |
+
"@evidence-dev/postgres": "^1.0.6",
|
28 |
+
"@evidence-dev/snowflake": "^1.1.0",
|
29 |
+
"@evidence-dev/sqlite": "^2.0.6",
|
30 |
+
"@evidence-dev/trino": "^1.0.8"
|
31 |
+
},
|
32 |
+
"overrides": {
|
33 |
+
"jsonwebtoken": "9.0.0",
|
34 |
+
"trim@<0.0.3": ">0.0.3",
|
35 |
+
"sqlite3": "5.1.5"
|
36 |
+
}
|
37 |
+
}
|
pages/index.md
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Welcome to Evidence
|
3 |
+
---
|
4 |
+
|
5 |
+
<Details title='How to edit this page'>
|
6 |
+
|
7 |
+
This page can be found in your project at `/pages/index.md`. Make a change to the markdown file and save it to see the change take effect in your browser.
|
8 |
+
</Details>
|
9 |
+
|
10 |
+
```sql categories
|
11 |
+
select
|
12 |
+
category
|
13 |
+
from needful_things.orders
|
14 |
+
group by category
|
15 |
+
```
|
16 |
+
|
17 |
+
<Dropdown data={categories} name=category value=category>
|
18 |
+
<DropdownOption value="%" valueLabel="All Categories"/>
|
19 |
+
</Dropdown>
|
20 |
+
|
21 |
+
<Dropdown name=year>
|
22 |
+
<DropdownOption value=% valueLabel="All Years"/>
|
23 |
+
<DropdownOption value=2019/>
|
24 |
+
<DropdownOption value=2020/>
|
25 |
+
<DropdownOption value=2021/>
|
26 |
+
</Dropdown>
|
27 |
+
|
28 |
+
```sql orders_by_category
|
29 |
+
select
|
30 |
+
date_trunc('month', order_datetime) as month,
|
31 |
+
sum(sales) as sales_usd,
|
32 |
+
category
|
33 |
+
from needful_things.orders
|
34 |
+
where category like '${inputs.category.value}'
|
35 |
+
and date_part('year', order_datetime) like '${inputs.year.value}'
|
36 |
+
group by all
|
37 |
+
order by sales_usd desc
|
38 |
+
```
|
39 |
+
|
40 |
+
<BarChart
|
41 |
+
data={orders_by_category}
|
42 |
+
title="Sales by Month, {inputs.category.label}"
|
43 |
+
x=month
|
44 |
+
y=sales_usd
|
45 |
+
series=category
|
46 |
+
/>
|
47 |
+
|
48 |
+
## What's Next?
|
49 |
+
- [Connect your data sources](settings)
|
50 |
+
- Edit/add markdown files in the `pages` folder
|
51 |
+
- Deploy your project with [Evidence Cloud](https://evidence.dev/cloud)
|
52 |
+
|
53 |
+
## Get Support
|
54 |
+
- Message us on [Slack](https://slack.evidence.dev/)
|
55 |
+
- Read the [Docs](https://docs.evidence.dev/)
|
56 |
+
- Open an issue on [Github](https://github.com/evidence-dev/evidence)
|
sources/needful_things/connection.yaml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file was automatically generated
|
2 |
+
name: needful_things
|
3 |
+
type: duckdb
|
4 |
+
options:
|
5 |
+
filename: needful_things.duckdb
|
sources/needful_things/orders.sql
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
select * from orders
|