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
69 changes: 26 additions & 43 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload Python Package
name: Publish

on:
release:
Expand All @@ -8,74 +8,57 @@ on:
permissions:
contents: read

jobs:
release-checks:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.10"
enable-cache: true
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

- name: Check lint
run: uv run ruff check src tests

- name: Run tests
run: uv run pytest

- name: Build docs
run: uv run sphinx-build -b html docs /tmp/pymax-docs

release-build:
jobs:
package:
name: Build package
runs-on: ubuntu-latest
needs: release-checks

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up uv
uses: astral-sh/setup-uv@v4
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
Comment thread
m-xim marked this conversation as resolved.
with:
python-version: "3.10"
enable-cache: true

- name: Build release distributions
- name: Build package distributions
run: uv build

- name: Check distributions
- name: Validate package distributions
run: uv run twine check dist/*

- name: Upload distributions
- name: Upload package distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
name: package-distributions
path: dist/

pypi-publish:
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: release-build
needs: [package]

environment:
name: pypi
url: https://pypi.org/project/maxapi-python/

permissions:
contents: read
id-token: write

steps:
- name: Retrieve release distributions
- name: Download package distributions
uses: actions/download-artifact@v4
with:
name: release-dists
name: package-distributions
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0

- name: Publish package to PyPI
run: uv publish
66 changes: 66 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Tests

on:
pull_request:
push:
branches: [main, "dev/**"]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: checks-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
Comment thread
m-xim marked this conversation as resolved.
with:
enable-cache: true

- name: Install development dependencies
run: uv sync --group dev

- name: Check code formatting
run: uv run ruff format --check .

- name: Run Ruff linting
run: uv run ruff check .

tests:
name: Tests / Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Install development dependencies
run: uv sync --group dev

- name: Run tests with coverage
run: |
uv run pytest \
--cov=src/pymax \
--cov-report=term-missing:skip-covered \
--cov-report=markdown-append:$GITHUB_STEP_SUMMARY
23 changes: 6 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = [
"aiofiles>=25.1.0",
Expand All @@ -36,20 +37,8 @@ dependencies = [
Homepage = "https://github.com/MaxApiTeam/PyMax"
Repository = "https://github.com/MaxApiTeam/PyMax"
Issues = "https://github.com/MaxApiTeam/PyMax/issues"
Documentation = "https://maxapiteam.github.io/PyMax/"
Documentation = "https://docs.pymax.org"

[project.optional-dependencies]
docs = [
"furo>=2025.12.19",
"sphinx>=8.1.3",
"sphinx-copybutton>=0.5.2",
]
test = [
"pytest>=8.0.0",
"pytest-asyncio>=0.24.0",
"pytest-cov>=5.0.0",
"pytest-timeout>=2.1.0",
]

[build-system]
requires = ["hatchling"]
Expand Down Expand Up @@ -88,27 +77,27 @@ test = [
dev = [
{include-group = "docs"},
{include-group = "test"},
"build>=1.2.0",
"pre-commit>=4.0.0",
"twine>=5.0.0",
"pyright>=1.1.390",
"ruff>=0.8.0",
]

[tool.uv]
package = true

[tool.pyright]
venv = ".venv"
venvPath = "."

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

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

[tool.ruff.lint.per-file-ignores]
"src/pymax/**/__init__.py" = ["F401", "F403"]
"tests/**" = ["F401"]

[tool.ruff.format]
Expand Down
12 changes: 6 additions & 6 deletions src/pymax/api/models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from pydantic import BaseModel
from pydantic import BaseModel, ConfigDict
from pydantic.alias_generators import to_camel


class CamelModel(BaseModel):
model_config = {
"alias_generator": to_camel,
"populate_by_name": True,
"arbitrary_types_allowed": True,
}
model_config = ConfigDict(
alias_generator=to_camel,
populate_by_name=True,
arbitrary_types_allowed=True
)
Comment thread
m-xim marked this conversation as resolved.

def to_payload(self) -> dict:
return self.model_dump(by_alias=True, exclude_none=True)
Loading