Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
[flake8]
max-complexity = 33
# Default plus E266 - There should be only one leading # for a block comment
max-complexity = 34
ignore =
E121, # A line is less indented than it should be for hanging indents
E123, # Closing brackets should match the same indentation level of the line that their opening bracket started on
E126, # A continuation line is indented farther than it should be for a hanging indent
E226, # There should be one space before and after an arithmetic operator (+, -, /, and *)
E704, # Multiple statements of a function definition should be on their own separate lines
W503, # Line breaks should occur after the binary operator to keep all variable names aligned
W504, # Line breaks should occur before the binary operator to keep all operators aligned
E266, # There should be only one leading # for a block comment
E203, # Colons should not have any space before them
E501, # Line lengths are recommended to be no greater than 79 characters
# A line is less indented than it should be for hanging indents
E121,
# Closing brackets should match the same indentation level
E123,
# A continuation line is indented farther than it should be
E126,
# There should be one space before and after an arithmetic operator
E226,
# Multiple statements of a function definition should be on their own lines
E704,
# Line breaks should occur after the binary operator
W503,
# Line breaks should occur before the binary operator
W504,
# There should be only one leading # for a block comment
E266,
# Colons should not have any space before them
E203,
# Line lengths are recommended to be no greater than 79 characters
E501,
per-file-ignores =
# Auto-generated OpenAPI client — forward-reference annotations flagged as undefined
domino/_impl/custommetrics/*.py: F821
105 changes: 105 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install lint tools
run: pip install black==25.1.0 isort==5.13.2 "flake8==7.2.0"

- name: black
run: black --check .

- name: isort
run: isort --check .

- name: flake8
run: flake8 .


typecheck:
name: Type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install package and type stubs
run: |
pip install -e .
pip install "mypy==1.15.0" \
types-pyyaml \
types-requests \
types-retry \
types-pytz \
types-tabulate \
types-python-dateutil \
types-redis \
types-protobuf \
types-frozendict \
types-urllib3

- name: mypy
run: |
mypy domino/ \
--no-warn-no-return \
--namespace-packages \
--explicit-package-bases \
--ignore-missing-imports \
--follow-imports=silent \
--python-version=3.10

test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install -e .
pip install pytest pytest-cov requests-mock docker pytest-mock

- name: Run tests
run: |
pytest tests/ \
Comment thread
ddl-bira-ignacio marked this conversation as resolved.
--ignore=tests/agents \
--ignore=tests/integration \
--ignore=tests/scripts \
--ignore=tests/test_operator.py \
--ignore=tests/test_spark_operator.py \
-v --tb=short \
--cov=domino \
--cov-report=xml \
--cov-report=term-missing

- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: coverage.xml
25 changes: 16 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
repos:
- repo: local
hooks:
- id: check-snake-case
name: Check snake_case naming
entry: python scripts/check_snake_case.py
language: python
files: ^domino/.*\.py$
exclude: ^domino/_impl/|^domino/airflow/
pass_filenames: true
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
Expand All @@ -11,21 +20,20 @@ repos:
- id: no-commit-to-branch
args: [-b, master]
- id: trailing-whitespace
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/PyCQA/flake8
rev: 7.2.0
hooks:
- id: flake8
- repo: https://github.com/PyCQA/isort
rev: 5.9.3
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 25.1.0
hooks:
- id: black
language_version: python # Should be a command that runs python3.6+
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
rev: v1.15.0
hooks:
- id: mypy
args:
Expand All @@ -35,6 +43,7 @@ repos:
--explicit-package-bases,
--ignore-missing-imports,
--follow-imports=silent,
--python-version=3.10,
]
additional_dependencies:
- "types-pyyaml"
Expand All @@ -45,7 +54,5 @@ repos:
- "types-python-dateutil"
- "types-redis"
- "types-protobuf"
- "types-python-dateutil"
- "types-frozendict"
- "types-typing-extensions"
- "types-urllib3"
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ All notable changes to the `python-domino` library will be documented in this fi
## [Unreleased]

### Added
* Updated app_publish() to allow selecting branch/commitRef
* Updated app_publish() to allow selecing specific app
* `scripts/check_snake_case.py` — AST-based lint script that catches camelCase parameter names in new code.
* GitHub Actions CI workflow (`.github/workflows/ci.yml`) that runs lint, type-checking, and tests on every PR and push to `master`. All checks must pass before a PR can be merged.
* `pyproject.toml` with `isort` and `black` configuration (`profile = "black"`, `target-version = ["py310"]`).

### Changed
* Resolved all 38 pre-existing `mypy` type errors across `domino/`, bringing the codebase to a clean `mypy` pass with `--python-version=3.10`.
* Resolved all `flake8`, `isort`, and `black` formatting errors across the codebase.
* Updated `.pre-commit-config.yaml` to latest tool versions: `pre-commit-hooks` v5.0.0, `flake8` 7.2.0, `isort` 5.13.2, `black` 25.1.0, `mypy` v1.15.0. Added the `check-snake-case` hook.
* Updated `tox.ini` to run the full test suite across Python 3.10, 3.11, and 3.12 (previously only ran two files on Python 3.9).
* Updated `pytest.ini` with coverage configuration.

## [2.1.0]

Expand Down
88 changes: 88 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Contributing

## Running checks locally

The CI pipeline runs four categories of checks. You can run all of them locally before pushing.

### Formatting (auto-fixable)

`black` and `isort` can reformat your code in place:

```bash
pip install black==25.1.0 isort==5.13.2

# auto-fix
black .
isort .

# check only (what CI does)
black --check .
isort --check .
```

### Linting

```bash
pip install "flake8==7.2.0"
flake8 .
```

flake8 does not auto-fix. Check `.flake8` for project-specific rules (ignored codes, max line length, complexity threshold).

### Type checking

```bash
pip install -e .
pip install "mypy==1.15.0" \
types-pyyaml types-requests types-retry types-pytz \
types-tabulate types-python-dateutil types-redis \
types-protobuf types-frozendict types-urllib3

mypy domino/ \
--no-warn-no-return \
--namespace-packages \
--explicit-package-bases \
--ignore-missing-imports \
--follow-imports=silent \
--python-version=3.10
```

### Snake case (new parameters only)

A lightweight AST check ensures new parameters in `domino/` use `snake_case`:

```bash
python scripts/check_snake_case.py domino/domino.py
```

This check is scoped to `domino/` source files only and ignores existing camelCase parameters that are kept for backwards compatibility.

### Tests

```bash
pip install pytest pytest-cov requests-mock docker pytest-mock
pytest tests/ \
--ignore=tests/agents \
--ignore=tests/integration \
--ignore=tests/scripts \
--ignore=tests/test_operator.py \
--ignore=tests/test_spark_operator.py \
-v --tb=short
```

The ignored paths either require a live Domino deployment (`tests/integration`) or optional dependencies not installed by default (`tests/agents`, `tests/test_operator.py`, and `tests/test_spark_operator.py` require `apache-airflow` or the tracing extras).

### Pre-commit (optional)

You can run all checks automatically on every commit by installing the pre-commit hooks:

```bash
pip install pre-commit
pre-commit install
```

To run them manually against all files:

```bash
pre-commit run --all-files
```
41 changes: 28 additions & 13 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# -- General configuration ---------------------------------------------------
extensions = [
"sphinx.ext.autodoc",
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
]

autodoc_default_options = {
'members': True,
'undoc-members': False, # Don't show undocumented members
'show-inheritance': False,
"members": True,
"undoc-members": False, # Don't show undocumented members
"show-inheritance": False,
}

# If you want Sphinx to evaluate forward refs safely
Expand All @@ -37,14 +37,29 @@
# Mock heavy/optional dependencies to keep autodoc imports lightweight in CI
autodoc_mock_imports = [
"domino._impl",
"attrs", "yaml", "pytest",
"apache_airflow", "airflow",
"pandas", "numpy", "semver",
"mlflow", "mlflow_tracing", "mlflow-skinny",
"requests", "urllib3", "beautifulsoup4", "bs4",
"polling2", "typing_extensions", "frozendict", "python_dateutil", "dateutil",
"retry", "docker",
"attrs",
"yaml",
"pytest",
"apache_airflow",
"airflow",
"pandas",
"numpy",
"semver",
"mlflow",
"mlflow_tracing",
"mlflow-skinny",
"requests",
"urllib3",
"beautifulsoup4",
"bs4",
"polling2",
"typing_extensions",
"frozendict",
"python_dateutil",
"dateutil",
"retry",
"docker",
]

# -- Options for HTML output -------------------------------------------------
html_static_path = ['_static']
html_static_path = ["_static"]
Loading
Loading