Skip to content

Commit 094f0e9

Browse files
authored
Initial commit
0 parents  commit 094f0e9

24 files changed

Lines changed: 1020 additions & 0 deletions

.devcontainer/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Use the official Python image
2+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
3+
4+
# Install the project into `/app`
5+
WORKDIR /app
6+
ADD . /app
7+
8+
# Install system packages:
9+
# curl
10+
RUN apt-get update && apt-get install -y curl
11+
# gnupg
12+
RUN apt-get update && apt-get install -y gnupg
13+
# git
14+
RUN apt-get update && apt-get install -y git
15+
# duckdb
16+
RUN curl -sL https://install.duckdb.org | sh && \
17+
mkdir -p /usr/local/bin && \
18+
cp /root/.duckdb/cli/latest/duckdb /usr/local/bin/duckdb && \
19+
chmod +x /usr/local/bin/duckdb
20+
# github cli
21+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | \
22+
gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg && \
23+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | \
24+
tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
25+
apt-get update && apt-get install -y gh
26+
27+
# Default shell
28+
SHELL ["/bin/bash", "-c"]
29+
30+
# Create vscode user to satisfy Codespaces requirement
31+
RUN useradd -m vscode
32+
USER vscode

.devcontainer/devcontainer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "uv-python-dev",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"ms-python.python",
10+
"ms-python.vscode-pylance",
11+
"charliermarsh.ruff",
12+
"atlassian.atlascode",
13+
"njpwerner.autodocstring",
14+
"ms-azuretools.vscode-docker",
15+
"github.vscode-github-actions",
16+
"eamodio.gitlens",
17+
"ms-toolsai.jupyter",
18+
"mechatroner.rainbow-csv",
19+
],
20+
"settings": {
21+
"terminal.integrated.defaultProfile.linux": "bash",
22+
"files.trimTrailingWhitespace": true,
23+
"files.insertFinalNewline": true,
24+
"files.trimFinalNewlines": true,
25+
"files.autoSave": "afterDelay",
26+
}
27+
}
28+
},
29+
"postCreateCommand": "uv venv --force && uv sync -v",
30+
"features": {},
31+
"remoteUser": "vscode"
32+
}

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @eed85
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
applyTo: '**/*.py'
3+
---
4+
Coding standards, domain knowledge, and preferences for AI to follow:
5+
6+
- Write all function and class docstrings in NumPy style.
7+
- Before implementing new features, check the `eed_*_utils` packages (e.g., `eed_basic_utils`) for reusable code.
8+
- Always include type hints in new functions.
9+
- Add tests for every new function.
10+
- Use the `logging` module instead of `print` statements.
11+
- Obtain the logger with `logging.getLogger(__name__)` in each module.
12+
- Add a logger to functions and use trace-level logging to track program flow.
13+
- Use `enumerate` in loops when the index is needed.
14+
- Prefer f-strings for formatting strings.
15+
- Use `Path` from `pathlib` for file and directory operations.
16+
- Join paths using the `/` operator with `Path`.
17+
- Favor list comprehensions for list creation when readability is maintained.
18+
- Use `with` statements for file operations to ensure proper closure.
19+
- Use `pytest` for testing:
20+
- Apply `pytest.mark.parametrize` for parameterized tests.
21+
- Run all tests before committing code.
22+
- Use `ruff` for linting and formatting; refer to `.pre-commit-config.yaml` for configuration.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"id": 6732598,
3+
"name": "main",
4+
"target": "branch",
5+
"source_type": "Repository",
6+
"source": "EED-Solutions/eed_package_template",
7+
"enforcement": "active",
8+
"conditions": {
9+
"ref_name": {
10+
"exclude": [],
11+
"include": [
12+
"~DEFAULT_BRANCH"
13+
]
14+
}
15+
},
16+
"rules": [
17+
{
18+
"type": "deletion"
19+
},
20+
{
21+
"type": "non_fast_forward"
22+
},
23+
{
24+
"type": "required_status_checks",
25+
"parameters": {
26+
"strict_required_status_checks_policy": true,
27+
"do_not_enforce_on_create": false,
28+
"required_status_checks": [
29+
{
30+
"context": "Run Ruff",
31+
"integration_id": 15368
32+
},
33+
{
34+
"context": "Run Pytests (3.13)",
35+
"integration_id": 15368
36+
}
37+
]
38+
}
39+
},
40+
{
41+
"type": "pull_request",
42+
"parameters": {
43+
"required_approving_review_count": 1,
44+
"dismiss_stale_reviews_on_push": false,
45+
"require_code_owner_review": true,
46+
"require_last_push_approval": true,
47+
"required_review_thread_resolution": false,
48+
"automatic_copilot_code_review_enabled": false,
49+
"allowed_merge_methods": [
50+
"merge",
51+
"squash",
52+
"rebase"
53+
]
54+
}
55+
}
56+
],
57+
"bypass_actors": [
58+
{
59+
"actor_id": 5,
60+
"actor_type": "RepositoryRole",
61+
"bypass_mode": "pull_request"
62+
}
63+
]
64+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"id": 6732884,
3+
"name": "semantic versioning",
4+
"target": "tag",
5+
"source_type": "Repository",
6+
"source": "EED-Solutions/eed_package_template",
7+
"enforcement": "active",
8+
"conditions": {
9+
"ref_name": {
10+
"exclude": [],
11+
"include": [
12+
"refs/tags/*.*.*"
13+
]
14+
}
15+
},
16+
"rules": [
17+
{
18+
"type": "deletion"
19+
},
20+
{
21+
"type": "non_fast_forward"
22+
},
23+
{
24+
"type": "creation"
25+
},
26+
{
27+
"type": "update"
28+
},
29+
{
30+
"type": "required_signatures"
31+
},
32+
{
33+
"type": "required_status_checks",
34+
"parameters": {
35+
"strict_required_status_checks_policy": false,
36+
"do_not_enforce_on_create": false,
37+
"required_status_checks": [
38+
{
39+
"context": "ruff",
40+
"integration_id": 15368
41+
},
42+
{
43+
"context": "pytests (3.11)",
44+
"integration_id": 15368
45+
},
46+
{
47+
"context": "pytests (3.12)",
48+
"integration_id": 15368
49+
},
50+
{
51+
"context": "pytests (3.13)",
52+
"integration_id": 15368
53+
}
54+
]
55+
}
56+
}
57+
],
58+
"bypass_actors": []
59+
}

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
11+
jobs:
12+
lint:
13+
name: Run Ruff
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: "checkout repository"
17+
uses: EED-Solutions/eed_gha_workflows/.github/actions/checkout_code@main
18+
19+
- name: ruff
20+
uses: EED-Solutions/eed_gha_workflows/.github/actions/ruff@main
21+
with:
22+
checkout_code: false
23+
generate-parameters:
24+
runs-on: ubuntu-latest
25+
name: generate parameters
26+
outputs:
27+
matrix: ${{ steps.set_matrix.outputs.matrix }}
28+
steps:
29+
- name: install duckdb
30+
uses: EED-Solutions/eed_gha_workflows/.github/actions/install_duckdb@main
31+
- name: checkout_gha_workflows
32+
uses: EED-Solutions/eed_gha_workflows/.github/actions/checkout_code@main
33+
with:
34+
repository: EED-Solutions/eed_gha_workflows
35+
ref: main # change for development purposes
36+
path: config
37+
sparse-checkout: |
38+
.github/actions/pytests/.python-versions
39+
- name: Debug - List files
40+
run: |
41+
find config -type f | sort
42+
- name: Get Python Version for pytests
43+
id: get_python_version
44+
run: |
45+
python_versions=$(duckdb -csv -noheader -c "SELECT JSON_GROUP_ARRAY(column0) FROM READ_CSV('config/.github/actions/pytests/.python-versions', HEADER=FALSE, ALL_VARCHAR=TRUE)") # ["3.12", "3.13"]
46+
echo "python_versions=$python_versions" >> $GITHUB_OUTPUT
47+
echo "Python version for tests: ${python_versions}"
48+
- name: Set up matrix for pytests
49+
id: set_matrix
50+
run: |
51+
python_versions=${{ steps.get_python_version.outputs.python_versions }}
52+
matrix_json="{\"python-version\": $python_versions}"
53+
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
54+
echo "matrix=$matrix_json"
55+
pytests:
56+
name: Run Pytests
57+
runs-on: ubuntu-latest
58+
needs: generate-parameters
59+
strategy:
60+
matrix: ${{ fromJson(needs.generate-parameters.outputs.matrix) }}
61+
steps:
62+
- name: "checkout repository"
63+
uses: EED-Solutions/eed_gha_workflows/.github/actions/checkout_code@main
64+
- name: "install uv and python"
65+
uses: EED-Solutions/eed_gha_workflows/.github/actions/install_uv@main
66+
with:
67+
python-version: ${{ matrix.python-version }}
68+
version-file: ''
69+
- name: set up python environment
70+
uses: EED-Solutions/eed_gha_workflows/.github/actions/set_up_py_env@main
71+
- name: pytests
72+
uses: EED-Solutions/eed_gha_workflows/.github/actions/pytests@main
73+
with:
74+
checkout_code: false
75+
install_uv: false
76+
install_dependencies: false
77+
pytests_cov:
78+
name: Run Pytests with Coverage
79+
runs-on: ubuntu-latest
80+
needs: generate-parameters
81+
steps:
82+
- name: "checkout repository"
83+
uses: EED-Solutions/eed_gha_workflows/.github/actions/checkout_code@main
84+
- name: "install uv and python"
85+
uses: EED-Solutions/eed_gha_workflows/.github/actions/install_uv@main
86+
- name: set up python environment
87+
uses: EED-Solutions/eed_gha_workflows/.github/actions/set_up_py_env@main
88+
- name: pytests with coverage
89+
uses: EED-Solutions/eed_gha_workflows/.github/actions/pytests_cov@main
90+
with:
91+
checkout_code: false
92+
install_uv: false
93+
install_dependencies: false
94+
fail-under: 80

.github/workflows/pytests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: pytests
2+
3+
on:
4+
workflow_dispatch:
5+
jobs:
6+
pytests:
7+
uses: EED-Solutions/eed_gha_workflows/.github/workflows/callable_pytests.yml@main

.github/workflows/pytests_cov.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: pytests_cov
2+
3+
on:
4+
# pull_request:
5+
workflow_dispatch:
6+
jobs:
7+
pytpytests_covests:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: install duckdb
11+
uses: opt-nc/setup-duckdb-action@v1.0.14
12+
with:
13+
version: latest
14+
- name: Get triggering repo
15+
id: get_package_name
16+
run: |
17+
gh_org_repo="${{ GITHUB.REPOSITORY }}"
18+
package_name=$(duckdb -csv -noheader -c "SELECT SPLIT('${gh_org_repo}', '/')[-1] AS repo")
19+
echo "package_name=$package_name" >> $GITHUB_OUTPUT
20+
echo "Workflow triggered by: ${package_name}"
21+
- name: run callabale pytest cov
22+
uses: EED-Solutions/eed_gha_workflows/.github/workflows/callable_pytests_cov.yml@dev
23+
with:
24+
package_name: ${{ steps.get_package_name.outputs.package_name }}

.github/workflows/ruff.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: ruff
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
ruff:
8+
uses: EED-Solutions/eed_gha_workflows/.github/workflows/callable_ruff.yml@main

0 commit comments

Comments
 (0)