Skip to content

Commit f270bbf

Browse files
authored
Docs infra (#156)
1 parent 7ba9be0 commit f270bbf

File tree

16 files changed

+910
-33
lines changed

16 files changed

+910
-33
lines changed

.github/workflows/docs.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: true
16+
17+
defaults:
18+
run:
19+
shell: bash
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v6
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v5
32+
33+
- name: Build documentation
34+
run: uv run --extra docs zensical build
35+
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v4
38+
with:
39+
path: ./site
40+
41+
deploy:
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}
45+
runs-on: ubuntu-latest
46+
needs: build
47+
steps:
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v5

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ jobs:
4040
with:
4141
python-version: ${{ matrix.python-version }}
4242
- name: Run pre-commit (with uvx)
43-
run: uvx pre-commit run --all-files
43+
run: uvx pre-commit run --all-files --verbose

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ test_data
1212
.chainlink
1313
.claude
1414
CHANGELOG.md
15+
*.ipynb
16+
/site

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ repos:
33
rev: v6.0.0
44
hooks:
55
- id: trailing-whitespace
6+
exclude: README.md
67
- id: end-of-file-fixer
78
- id: check-yaml
89
- id: check-added-large-files

CONTRIBUTING.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,36 @@ reading [Xarray's contributing guide](https://docs.xarray.dev/en/stable/contribu
1212

1313
## Developer setup
1414

15-
0. We use `uv` to manage the project: https://docs.astral.sh/uv/getting-started/installation/
15+
We use [uv](https://docs.astral.sh/uv/) to manage the project.
16+
17+
0. Install uv: https://docs.astral.sh/uv/getting-started/installation/
1618
1. Clone the repository (bonus: [via SSH](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account))
1719
and `cd xarray_sql` (the project root).
18-
2. Install dev dependencies via: `uv sync --dev`
19-
3. Install pre-commit hooks: `uv run pre-commit install`
20+
2. Install dev dependencies: `uv sync --dev`
21+
3. Install pre-commit hooks: `uvx pre-commit install`
2022

21-
This will automatically run code formatting (pyink) and type checking (mypy) before each commit.
22-
You can also run the hooks manually with: `uv run pre-commit run --all-files`
23+
This will automatically run code formatting and type checking before each commit.
24+
You can also run the hooks manually with: `uvx pre-commit run --all-files`
25+
4. Build and serve docs locally: `uvx zensical serve`
2326

2427

2528
## Before submitting a pull request...
2629

2730
Thanks so much for your contribution! For a volunteer led project, we so
2831
appreciate your help. A few things to keep in mind:
32+
2933
- Please be nice. We assume good intent from you, and we ask you to do the same for us.
3034
- Development in this project will be slow if not sporadic. Reviews will come
3135
as time allows.
3236
- Every contribution, big or small, matters and deserves credit.
3337

3438
Here are a few requests for your development process:
39+
3540
- We require all code to be formatted with `pyink` and type-checked with `mypy`.
3641
These checks run automatically via pre-commit hooks (see Developer setup above).
3742
If you need to run them manually:
38-
- Formatting: `uv run pre-commit run pyink --all-files` or `uvx pyink .`
39-
- Type checking: `uv run pre-commit run mypy --all-files` or `uv run mypy xarray_sql/`
43+
- Formatting: `uvx pre-commit run pyink --all-files` or `uvx pyink .`
44+
- Type checking: `uvx pre-commit run mypy --all-files` or `uvx mypy xarray_sql/`
4045
- Please include unit tests, if possible, and performance tests when you touch the core functionality (see `perf_tests/`).
4146
- It's polite to do a self review before asking for one from a maintainer. Don't stress if you forget; we all do sometimes.
4247
- Please add (or update) documentation when adding new code. We use [Google Style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html).

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/logo.svg

Lines changed: 104 additions & 0 deletions
Loading

docs/contributing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--8<-- "CONTRIBUTING.md"

docs/examples.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Examples
2+
3+
```python
4+
import xarray as xr
5+
import xarray_sql as xql
6+
7+
ds = xr.tutorial.open_dataset('air_temperature')
8+
9+
ctx = xql.XarrayContext()
10+
ctx.from_dataset('air', ds, chunks=dict(time=24))
11+
12+
result = ctx.sql('''
13+
SELECT
14+
"lat", "lon", AVG("air") as air_avg
15+
FROM
16+
"air"
17+
GROUP BY
18+
"lat", "lon"
19+
''')
20+
21+
df = result.to_pandas()
22+
df.head()
23+
```

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--8<-- "README.md"

0 commit comments

Comments
 (0)