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
15 changes: 13 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ on:
pull_request:

jobs:
test:
test-matrix:
name: test (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v7

- uses: actions/setup-python@v7
with:
python-version: "3.12"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pip install -e ".[dev]"
Expand All @@ -35,3 +39,10 @@ jobs:
python -m venv /tmp/wheel-env
/tmp/wheel-env/bin/pip install dist/*.whl
cd /tmp && /tmp/wheel-env/bin/python -c "import decodo; assert decodo._codegen_available; from decodo import ScrapeRequest"

test:
needs: test-matrix
if: always()
runs-on: ubuntu-latest
steps:
- run: test "${{ needs.test-matrix.result }}" = success
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Decodo Python SDK

![Python](https://img.shields.io/badge/python-%3E%3D3.12-green)
![Python](https://img.shields.io/badge/python-%3E%3D3.10-green)
![License](https://img.shields.io/badge/license-MIT-blue)

[![](https://dcbadge.limes.pink/api/server/https://discord.gg/Ja8dqKgvbZ)](https://discord.gg/Ja8dqKgvbZ)
Expand All @@ -14,7 +14,7 @@ Build scraping workflows for search engines, eCommerce platforms, social media,

- Fully typed targets and parameters with IDE autocomplete
- Sync, async, and batch scraping methods
- Built on `httpx`, Python 3.12+
- Built on `httpx`, Python 3.10+
- Typed error hierarchy for safer integrations
- Built for Python and modern tooling

Expand All @@ -34,7 +34,7 @@ Instead of manually constructing HTTP requests and validating payloads, you can

## Requirements

- Python 3.12+
- Python 3.10+

## Installation

Expand Down
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ authors = [{ name = "Decodo" }]
keywords = ["decodo", "scraping", "web-scraping", "api"]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Developers",
"Topic :: Internet :: WWW/HTTP",
]
requires-python = ">=3.12"
requires-python = ">=3.10"
dependencies = [
"httpx>=0.27.0",
"pydantic>=2.0",
"jsonschema>=4.0",
"typing-extensions>=4.6",
]

[project.urls]
Expand Down Expand Up @@ -54,6 +58,7 @@ select = ["E", "F", "I", "UP"]

[tool.mypy]
strict = true
python_version = "3.10"
packages = ["decodo"]
exclude = "src/decodo/generated|^examples/|^build/"

Expand Down
20 changes: 20 additions & 0 deletions src/decodo/_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from __future__ import annotations

import sys
from enum import Enum

if sys.version_info >= (3, 11):
from enum import StrEnum
else:

class StrEnum(str, Enum):
"""Backport of ``enum.StrEnum`` (3.11+): members are strings and ``str()`` gives the value."""

def __str__(self) -> str:
return str(self.value)

def __format__(self, format_spec: str) -> str:
return str.__format__(str(self.value), format_spec)


__all__ = ["StrEnum"]
2 changes: 1 addition & 1 deletion src/decodo/codegen/web_scraping_api/generate_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _get_targets_enum_file_contents(api: WebScrapingApiIR) -> str:
lines.append("# Run `python -m decodo.codegen.codegen` to regenerate when the IR schema changes.")
lines.append("from __future__ import annotations")
lines.append("")
lines.append("from enum import StrEnum")
lines.append("from decodo._compat import StrEnum")
lines.append("")
lines.append("")

Expand Down
4 changes: 3 additions & 1 deletion src/decodo/schema/types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

from typing import Any, Protocol, Required, TypedDict
from typing import Any, Protocol

from typing_extensions import Required, TypedDict


class TargetMeta(TypedDict):
Expand Down
2 changes: 1 addition & 1 deletion src/decodo/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Run `python -m decodo.codegen.codegen` to regenerate when the IR schema changes.
from __future__ import annotations

from enum import StrEnum
from decodo._compat import StrEnum


class Target(StrEnum):
Expand Down
Loading