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
28 changes: 0 additions & 28 deletions .github/workflows/npm-publish.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,25 @@ on:
branches: [master]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Install ruff
run: pip install ruff

- name: Run ruff check
run: ruff check .

test:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
Expand Down
1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# Add user site-packages for dependencies installed outside venv
import site

user_site = site.getusersitepackages()
if user_site and user_site not in sys.path:
sys.path.insert(0, user_site)
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ datamorph = "datamorph.cli:cli"
[tool.setuptools.packages.find]
where = ["src"]

[tool.ruff]
target-version = "py310"
line-length = 120

[tool.ruff.lint]
select = ["E", "F", "W", "I"]

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
11 changes: 7 additions & 4 deletions src/datamorph/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

import json
import sys
from pathlib import Path
from typing import Any

import click
from rich.console import Console
from rich.table import Table

from . import __version__

try:
from revenueholdings_core import check_license_and_limit
except ImportError:
check_license_and_limit = None
from .converters import (
convert,
convert_batch,
supported_formats,
detect_format,
supported_formats,
validate,
)

Expand Down Expand Up @@ -144,7 +144,7 @@ def batch_cmd(
success = [r for r in results if not r.errors]
failed = [r for r in results if r.errors]

console.print(f"\n[bold]Batch Conversion Complete[/bold]")
console.print("\n[bold]Batch Conversion Complete[/bold]")
console.print(f" Files: {len(success)} converted, {len(failed)} failed")

if failed:
Expand Down Expand Up @@ -231,7 +231,10 @@ def formats_cmd() -> None:
@cli.command()
@click.argument("file", type=click.Path(exists=True))
@click.option("--format", "-f", "fmt", default=None, help="File format (auto-detected if omitted)")
@click.option("--schema", "-s", "schema_file", default=None, type=click.Path(exists=True), help="JSON schema file to validate against")
@click.option(
"--schema", "-s", "schema_file", default=None,
type=click.Path(exists=True), help="JSON schema file to validate against",
)
@click.option("--strict", is_flag=True, help="Strict mode: fail on type mismatches and missing fields")
@click.option("--max-rows", default=0, type=int, help="Maximum rows to validate (0 = all)")
@click.option("--json-output", "-j", is_flag=True, help="Output validation result as JSON")
Expand Down
5 changes: 1 addition & 4 deletions src/datamorph/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
from __future__ import annotations

import csv
import io
import json
import os
import sys
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Callable, Generator, Iterator
from typing import Any, Generator

# ── Types ────────────────────────────────────────────────────────────

Expand Down
9 changes: 2 additions & 7 deletions tests/test_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@
from __future__ import annotations

import json
import os
import tempfile
from pathlib import Path

import pytest
import yaml

from datamorph.cli import cli
from datamorph.converters import (
convert,
detect_format,
supported_formats,
get_reader,
get_writer,
Row,
supported_formats,
)
from datamorph.cli import cli

# ── Fixtures ──────────────────────────────────────────────────────────

Expand Down
4 changes: 1 addition & 3 deletions tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
from __future__ import annotations

import json
from pathlib import Path

import pytest

from datamorph.converters import validate, ValidationResult
from datamorph.cli import cli

from datamorph.converters import ValidationResult, validate

# ── Fixtures ──────────────────────────────────────────────────────────

Expand Down