Skip to content

Commit 98cb658

Browse files
committed
Merge branch 'main' of github.com:Zipstack/visitran into fix/global-schema-state-with-info-chip
2 parents 20cca01 + 6f17c7e commit 98cb658

139 files changed

Lines changed: 2397 additions & 1323 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/setup-python/action.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Setup Python'
2-
description: 'Prints a greeting message'
2+
description: 'Sets up Python, uv, and installs backend dependencies'
33
inputs:
44
python-version:
55
required: true
@@ -16,7 +16,8 @@ runs:
1616
with:
1717
python-version: ${{ inputs.python-version }}
1818
enable-cache: true
19-
cache-dependency-path: ./uv.lock
20-
- name: Install visitran-cloud dependencies
19+
cache-dependency-path: backend/uv.lock
20+
- name: Install backend dependencies
2121
shell: bash
22-
run: uv sync
22+
working-directory: backend
23+
run: uv sync --group test

.github/pull_request_template.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
## Database Migrations
1818

19-
-
19+
-
2020

2121
## Env Config
2222

23-
-
23+
-
2424

2525
## Relevant Docs
2626

@@ -42,4 +42,4 @@
4242

4343
## Checklist
4444

45-
I have read and understood the [Contribution Guidelines]().
45+
I have read and understood the [Contribution Guidelines]().

.github/workflows/core-backend-full-tests-parallel.yaml

Lines changed: 0 additions & 87 deletions
This file was deleted.
Lines changed: 64 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,71 @@
11
---
2+
name: Minimal Tests
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches: ["main"]
8+
pull_request:
9+
branches: ["main"]
10+
11+
concurrency:
12+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
13+
cancel-in-progress: true
14+
15+
env:
16+
FORCE_COLOR: "1"
17+
18+
jobs:
19+
minimal_tests:
220
name: Minimal Tests
21+
runs-on: ubuntu-latest
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
python-version: ["3.10"]
26+
defaults:
27+
run:
28+
working-directory: backend
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
lfs: true
33+
34+
- name: Setup Python
35+
uses: ./.github/actions/setup-python/
36+
with:
37+
python-version: ${{ matrix.python-version }}
338

4-
on:
5-
workflow_dispatch:
6-
push:
7-
branches: ["main"]
8-
pull_request:
9-
branches: [ "main"]
39+
# pre-commit checks handled by pre-commit.ci
1040

11-
concurrency:
12-
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
13-
cancel-in-progress: true
14-
env:
15-
FORCE_COLOR: "1"
16-
jobs:
17-
minimal_tests:
18-
name: Minimal Tests
19-
runs-on: ubuntu-latest
20-
strategy:
21-
fail-fast: true
22-
matrix:
23-
python-version: ["3.11"] #,"3.9","3.10"]
24-
steps:
25-
#----------------------------------------------
26-
# check-out repo and set-up python
27-
#----------------------------------------------
28-
- uses: actions/checkout@v4
29-
with:
30-
lfs: true
31-
- name: Setup Python
32-
uses: ./.github/actions/setup-python/
33-
with:
34-
python-version: ${{ matrix.python-version }}
35-
- name: Cache pre-commit hooks
36-
uses: actions/cache@v4
37-
if: github.ref != 'refs/heads/main'
38-
with:
39-
path: ~/.cache/pre-commit
40-
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
41+
- name: Run tests
42+
env:
43+
DJANGO_SETTINGS_MODULE: backend.server.settings.dev
44+
run: |
45+
uv run coverage run --rcfile=pyproject.toml --source=. -m \
46+
pytest -x -vv ../tests/unit \
47+
--ignore=../tests/unit/test_logs.py \
48+
--ignore=../tests/unit/test_visitran_adapters \
49+
--ignore=../tests/unit/test_visitran_backend \
50+
-m "not snowflake and not bigquery and not trino and not postgres"
4151
42-
- name: Check pre-commit
43-
if: github.ref != 'refs/heads/main'
44-
run: |
45-
uv run pre-commit run --all-files
46-
- name: Run minimal core tests
47-
run: |
48-
uv run coverage run --rcfile=pyproject.toml --data-file=minimal.cov --context="minimal" --source=. -m \
49-
pytest -x -vv -m "not snowflake and not bigquery and not trino and not postgres"
50-
- name: Run backend tests
51-
run: |
52-
uv run coverage run --rcfile=pyproject.toml --data-file=backend.cov --context="backend" --source=. -m \
53-
pytest -x -vv ./visitran_backend
52+
- name: Generate coverage report
53+
run: |
54+
uv run coverage report -m
55+
uv run coverage xml
5456
55-
- name: Combine to coverage xml
56-
run: |
57-
uv run coverage combine backend.cov minimal.cov
58-
uv run coverage report -m
59-
uv run coverage xml
60-
- name: Git fetch unshallow
61-
run: |
62-
git fetch --unshallow
57+
- name: Git fetch unshallow
58+
working-directory: .
59+
run: git fetch --unshallow
6360

64-
- name: Core SonarCloud Scan
65-
uses: SonarSource/sonarcloud-github-action@master
66-
if: ${{ github.actor != 'dependabot[bot]' }}
67-
env:
68-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
69-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
70-
with:
71-
projectBaseDir: ./
72-
args: >
73-
-Dproject.settings=./sonar-project.properties
61+
- name: SonarCloud Scan
62+
uses: SonarSource/sonarcloud-github-action@v3
63+
if: ${{ github.actor != 'dependabot[bot]' }}
64+
continue-on-error: true
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
68+
with:
69+
projectBaseDir: ./
70+
args: >
71+
-Dproject.settings=./sonar-project.properties

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,4 @@ backend/backend/utils/load_models/yaml_models.yaml
213213

214214
# macOS
215215
.DS_Store
216-
**/.DS_Store
216+
**/.DS_Store

.pre-commit-config.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@ ci:
77
- mypy # Uses language: system, not available in pre-commit.ci sandbox
88
- protolint-docker # Needs Docker, not available in pre-commit.ci
99
- hadolint-docker # Needs Docker, not available in pre-commit.ci
10-
autofix_prs: true
10+
- pycln # Path resolution bug in pre-commit.ci sandbox
11+
- end-of-file-fixer # Inconsistent behavior between local and CI environments
12+
- flake8 # Pre-existing violations — will clean up separately
13+
- markdownlint # Pre-existing violations — will clean up separately
14+
- absolufy-imports # Incorrectly rewrites relative imports in monorepo structure
15+
- black # Large-scale reformatting — will clean up in dedicated PR
16+
- pyupgrade # Pre-existing across 43 files
17+
- isort # Pre-existing import ordering across codebase
18+
- yesqa # Pre-existing unnecessary noqa comments
19+
- docformatter # Pre-existing docstring formatting
20+
autofix_prs: false
1121
autoupdate_schedule: monthly
1222

1323
# Force all unspecified python hooks to run python 3.10
@@ -22,7 +32,10 @@ repos:
2232
- id: trailing-whitespace
2333
exclude_types:
2434
- "markdown"
35+
- "svg"
2536
- id: end-of-file-fixer
37+
exclude_types:
38+
- "svg"
2639
- id: check-yaml
2740
args: [--unsafe]
2841
- id: check-added-large-files
@@ -36,6 +49,7 @@ repos:
3649
- id: check-toml
3750
- id: debug-statements
3851
- id: detect-private-key
52+
exclude: sample\.env$
3953
# - id: detect-aws-credentials
4054
# args: ["--allow-missing-credentials"]
4155
- id: check-merge-conflict
@@ -54,7 +68,7 @@ repos:
5468
rev: 24.1.1
5569
hooks:
5670
- id: black
57-
args: [--config=pyproject.toml]
71+
args: [--config=backend/pyproject.toml]
5872
# - id: black
5973
# alias: black-check
6074
# stages: [manual]
@@ -82,13 +96,13 @@ repos:
8296
rev: v2.4.0
8397
hooks:
8498
- id: pycln
85-
args: [--config=pyproject.toml]
99+
args: [--config=backend/pyproject.toml]
86100
- repo: https://github.com/pycqa/isort
87101
rev: 5.13.2
88102
hooks:
89103
- id: isort
90104
files: "\\.(py)$"
91-
args: [--settings-path=pyproject.toml]
105+
args: [--settings-path=backend/pyproject.toml]
92106
- repo: https://github.com/pycqa/flake8
93107
rev: 7.0.0
94108
hooks:
@@ -161,7 +175,7 @@ repos:
161175
- id: markdownlint
162176
args: ["--config", "markdownlint.yaml"]
163177
- repo: https://github.com/pycqa/docformatter
164-
rev: v1.7.5
178+
rev: v1.7.7
165179
hooks:
166180
- id: docformatter
167181
- repo: https://github.com/adrienverge/yamllint

backend/backend/application/config_parser/config_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def unique_keys(self) -> list[str]:
9191
@property
9292
def delta_strategy(self) -> dict[str, Any]:
9393
return self.incremental_config.get("delta_strategy", {})
94-
94+
9595
@property
9696
def reference(self) -> list[str]:
9797
if not self._reference:

backend/backend/application/config_parser/constants.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,15 @@
318318
"description": "Tests whether a number is greater than a supplied threshold value ",
319319
"function_type": "Math",
320320
},
321+
"HASH": {
322+
"key": "HASH",
323+
"value": "HASH",
324+
"description": (
325+
"Returns a hash of the concatenated values. Accepts one or more columns."
326+
" \n Example: HASH(col1) or HASH(col1, col2, col3)"
327+
),
328+
"function_type": "Text",
329+
},
321330
"HOUR": {
322331
"key": "HOUR",
323332
"value": "HOUR",

backend/backend/application/config_parser/transformation_parser.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ def transform_orders(self) -> list[str]:
6565
def get_transforms(self) -> list[BaseParser]:
6666
"""
6767
Generate and yield transformation parsers in the order defined by the configuration.
68-
69-
This method processes the `transform_order` list and corresponding `transform` dictionary
68+
69+
This method processes the `transform_order` list and corresponding `transform` dictionary
7070
from the configuration to create parser instances of appropriate types for each transformation.
71-
71+
7272
- It iterates through the `transform_order` to ensure transformations are applied sequentially.
7373
- For each transformation, it determines the type and maps it to the corresponding parser class.
74-
- Certain transformation types (`combine_columns`, `group`, `find_and_replace`, and `distinct`)
75-
require special handling for their configuration. These are instantiated with a modified
74+
- Certain transformation types (`combine_columns`, `group`, `find_and_replace`, and `distinct`)
75+
require special handling for their configuration. These are instantiated with a modified
7676
configuration structure.
7777
- Other transformations are instantiated normally with their respective configuration data.
78-
78+
7979
Yields:
80-
BaseParser: An instance of the transformation parser for each transformation in the order
80+
BaseParser: An instance of the transformation parser for each transformation in the order
8181
defined by `transform_order`.
8282
"""
8383
if self._transforms:

0 commit comments

Comments
 (0)