Skip to content

Commit

Permalink
Merge branch 'main' into 2721-featci-github-test-workflow-annotations…
Browse files Browse the repository at this point in the history
…-for-userwarnings-and-possibly-other-cases
  • Loading branch information
edgarrmondragon authored Feb 25, 2025
2 parents ffef3c6 + b49f734 commit 5158b57
Show file tree
Hide file tree
Showing 20 changed files with 3,959 additions and 632 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ jobs:

- name: Install dependencies
run: |
uv export --no-hashes --frozen --all-extras --group benchmark -o requirements.txt
uv pip install --system -r requirements.txt
uv pip install --system -r requirements/requirements.codspeed.txt
- uses: CodSpeedHQ/action@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/cookiecutter-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- "cookiecutter/**"
- "e2e-tests/cookiecutters/**"
- ".github/workflows/cookiecutter-e2e.yml"
- ".github/workflows/resources/requirements.txt"
push:
branches:
- main
Expand All @@ -17,6 +18,7 @@ on:
- "cookiecutter/**"
- "e2e-tests/cookiecutters/**"
- ".github/workflows/cookiecutter-e2e.yml"
- ".github/workflows/resources/requirements.txt"
workflow_dispatch:

concurrency:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/resources/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
griffe~=1.5
nox==2024.10.9
nox==2025.2.9
pre-commit==4.1.0
twine==6.1.0
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ __pycache__/
*.so

# Distribution / packaging
requirements.txt
.Python
build/
develop-eggs/
Expand Down
55 changes: 52 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.31.1
rev: 0.31.2
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.4
rev: v0.9.7
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
Expand All @@ -64,10 +64,59 @@ repos:
)$
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.26
rev: 0.6.2
hooks:
- id: uv-lock
- id: uv-sync
- id: uv-export
name: Export docs requirements
args:
- "--no-emit-project"
- "--frozen"
- "--no-dev"
- "--group"
- "docs"
- "--output-file"
- "requirements/requirements.docs.txt"
- id: uv-export
name: Export package requirements, including extras
args:
- "--no-emit-project"
- "--frozen"
- "--all-extras"
- "--no-dev"
- "--output-file"
- "requirements/requirements.txt"
- id: uv-export
name: Export testing requirements
args:
- "--no-emit-project"
- "--frozen"
- "--only-group"
- "testing"
- "--output-file"
- "requirements/requirements.test.txt"
- id: uv-export
name: Export typing requirements
args:
- "--no-emit-project"
- "--frozen"
- "--only-group"
- "typing"
- "--output-file"
- "requirements/requirements.typing.txt"
- id: uv-export
name: Export Codspeed requirements
args:
- "--no-editable"
- "--frozen"
- "--no-hashes"
- "--no-dev"
- "--all-extras"
- "--group"
- "benchmark"
- "--output-file"
- "requirements/requirements.codspeed.txt"

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
Expand Down
4 changes: 1 addition & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ sphinx:

python:
install:
# - requirements: docs/requirements.txt
- method: pip
path: .
extra_requirements:
- docs
- requirements: requirements/requirements.docs.txt
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ de-facto open source standard for extract and load pipelines.
<a href="https://results.pre-commit.ci/latest/github/meltano/sdk/main">
<img alt="pre-commit.ci status" src="https://results.pre-commit.ci/badge/github/meltano/sdk/main.svg"/>
</a>
<a href="https://github.com/astral-sh/uv">
<img alt="uv" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json"/>
</a>
</div>

---
Expand Down
10 changes: 8 additions & 2 deletions docs/guides/sql-target.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ def custom_array_to_sql(jsonschema: dict) -> VectorType | sa.types.VARCHAR:
class MyConnector(SQLConnector):
@functools.cached_property
def jsonschema_to_sql(self):
to_sql = JSONSchemaToSQL()
to_sql = JSONSchemaToSQL.from_config(
self.config,
max_varchar_length=self.max_varchar_length,
)
to_sql.register_type_handler("array", custom_array_to_sql)
return to_sql
```
Expand All @@ -46,7 +49,10 @@ from my_sqlalchemy_dialect import URI
class MyConnector(SQLConnector):
@functools.cached_property
def jsonschema_to_sql(self):
to_sql = JSONSchemaToSQL()
to_sql = JSONSchemaToSQL.from_config(
self.config,
max_varchar_length=self.max_varchar_length,
)
to_sql.register_format_handler("uri", URI)
return to_sql
```
Expand Down
51 changes: 27 additions & 24 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import nox

nox.needs_version = ">=2024.4.15"
nox.needs_version = ">=2025.2.9"
nox.options.default_venv_backend = "uv"

RUFF_OVERRIDES = """\
Expand Down Expand Up @@ -39,17 +39,17 @@
"test_cookiecutter",
]

dependency_groups = nox.project.load_toml("pyproject.toml")["dependency-groups"]
test_dependencies: list[str] = dependency_groups["dev"]
typing_dependencies: list[str] = dependency_groups["typing"]


@nox.session(python=main_python_version)
def mypy(session: nox.Session) -> None:
"""Check types with mypy."""
args = session.posargs or ["singer_sdk"]
session.install(".[faker,jwt,parquet,s3,testing]")
session.install(*typing_dependencies)
session.install(
".[faker,jwt,parquet,s3,testing]",
"-c",
"requirements/requirements.txt",
)
session.install("-r", "requirements/requirements.typing.txt")
session.run("mypy", *args)
if not session.posargs:
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")
Expand All @@ -65,8 +65,8 @@ def tests(session: nox.Session) -> None:
"s3",
]

session.install(f".[{','.join(extras)}]")
session.install(*test_dependencies)
session.install(f".[{','.join(extras)}]", "-c", "requirements/requirements.txt")
session.install("-r", "requirements/requirements.test.txt")

env = {"COVERAGE_CORE": "sysmon"} if session.python == "3.12" else {}

Expand All @@ -90,8 +90,8 @@ def tests(session: nox.Session) -> None:
@nox.session(python=main_python_version)
def benches(session: nox.Session) -> None:
"""Run benchmarks."""
session.install(".[jwt,s3]")
session.install(*test_dependencies)
session.install(".[jwt,s3]", "-c", "requirements/requirements.txt")
session.install("-r", "requirements/requirements.test.txt")
session.run(
"pytest",
"--benchmark-only",
Expand All @@ -103,7 +103,11 @@ def benches(session: nox.Session) -> None:
@nox.session(name="deps", python=main_python_version)
def dependencies(session: nox.Session) -> None:
"""Check issues with dependencies."""
session.install(".[docs,faker,jwt,parquet,s3,ssh,testing]")
session.install(
".[faker,jwt,parquet,s3,ssh,testing]",
"-c",
"requirements/requirements.txt",
)
session.install("deptry")
session.run("deptry", "singer_sdk", *session.posargs)

Expand All @@ -113,8 +117,8 @@ def update_snapshots(session: nox.Session) -> None:
"""Update pytest snapshots."""
args = session.posargs or ["-m", "snapshot"]

session.install(".[faker,jwt,parquet]")
session.install(*test_dependencies)
session.install(".[faker,jwt,parquet]", "-c", "requirements/requirements.txt")
session.install("-r", "requirements/requirements.test.txt")
session.run("pytest", "--snapshot-update", *args)


Expand All @@ -128,7 +132,7 @@ def doctest(session: nox.Session) -> None:
if "FORCE_COLOR" in os.environ:
args.append("--xdoctest-colored=1")

session.install(".")
session.install(".", "-c", "requirements/requirements.txt")
session.install("pytest", "xdoctest[colors]")
session.run("pytest", "--xdoctest", *args)

Expand All @@ -153,7 +157,8 @@ def docs(session: nox.Session) -> None:
if not session.posargs and "FORCE_COLOR" in os.environ:
args.insert(0, "--color")

session.install(".[docs]")
session.install(".", "-c", "requirements/requirements.txt")
session.install("-r", "requirements/requirements.docs.txt")

build_dir = Path("build")
if build_dir.exists():
Expand All @@ -175,7 +180,8 @@ def docs_serve(session: nox.Session) -> None:
"build",
"-W",
]
session.install(".[docs]", "sphinx-autobuild")
session.install(".", "-c", "requirements/requirements.txt")
session.install("-r", "requirements/requirements.docs.txt", "sphinx-autobuild")

build_dir = Path("build")
if build_dir.exists():
Expand Down Expand Up @@ -219,9 +225,7 @@ def test_cookiecutter(session: nox.Session, replay_file_path: Path) -> None:
# TODO: Use uvx
# https://github.com/wntrblm/nox/pull/920
session.run(
"uv",
"tool",
"run",
"uvx",
"cookiecutter",
"--replay-file",
str(replay_file),
Expand All @@ -243,11 +247,11 @@ def test_cookiecutter(session: nox.Session, replay_file_path: Path) -> None:

# Check that the project can be built for distribution
session.run("uv", "build")
session.run("uv", "tool", "run", "twine", "check", "dist/*")
session.run("uvx", "twine", "check", "dist/*")

session.run("git", "init", "-b", "main", external=True)
session.run("git", "add", ".", external=True)
session.run("uv", "tool", "run", "pre-commit", "run", "--all-files", external=True)
session.run("uvx", "pre-commit", "run", "--all-files", external=True)


@nox.session(name="version-bump")
Expand Down Expand Up @@ -276,7 +280,6 @@ def version_bump(session: nox.Session) -> None:
def api_changes(session: nox.Session) -> None:
"""Check for API changes."""
args = [
"griffe",
"check",
"singer_sdk",
]
Expand All @@ -287,4 +290,4 @@ def api_changes(session: nox.Session) -> None:
if "GITHUB_ACTIONS" in os.environ:
args.append("-f=github")

session.run("uv", "tool", "run", *args, external=True)
session.run("uvx", "griffe", *args, external=True)
32 changes: 18 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,6 @@ dependencies = [
]

[project.optional-dependencies]
# Sphinx dependencies installed as optional 'docs' extras
# https://github.com/readthedocs/readthedocs.org/issues/4912#issuecomment-664002569
docs = [
"furo>=2024.5.6",
"myst-parser>=3",
"pytest>=7.2.1",
"sphinx>=7",
"sphinx-copybutton>=0.5.2",
"sphinx-inline-tabs>=2023.4.21",
"sphinx-notfound-page>=1.0.0",
"sphinx-reredirects>=0.1.5",
]

# File storage dependencies installed as optional 'filesystem' extras
s3 = [
"fs-s3fs>=1.1.1",
Expand Down Expand Up @@ -116,12 +103,28 @@ Documentation = "https://sdk.meltano.com/en/latest/"

[dependency-groups]
dev = [
"coverage[toml]>=7.4",
{"include-group" = "docs"},
{"include-group" = "testing"},
{"include-group" = "typing"},
"deptry>=0.15.0",
]
docs = [
"furo>=2024.5.6",
"myst-parser>=3",
"pytest>=7.2.1",
"sphinx>=7",
"sphinx-copybutton>=0.5.2",
"sphinx-inline-tabs>=2023.4.21",
"sphinx-notfound-page>=1.0.0",
"sphinx-reredirects>=0.1.5",
]
testing = [
"coverage[toml]>=7.4",
"duckdb>=0.8.0",
"duckdb-engine>=0.9.4; python_version<'4'",
"fastjsonschema>=2.19.1",
"moto>=5.0.14",
"pytest>=7.2.1",
"pytest-benchmark>=4.0.0",
"pytest-snapshot>=0.9.0",
"pytest-subtests>=0.13.1",
Expand All @@ -141,6 +144,7 @@ typing = [
"types-PyYAML>=6.0.12",
]
benchmark = [
{"include-group" = "testing"},
"pytest-codspeed>=2.2.0",
]

Expand Down
Loading

0 comments on commit 5158b57

Please sign in to comment.