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
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .git-blame-ignore-revs
# Format with Ruff
945e183c36d109e10d9699bcc40af6a431a0a7ec
47 changes: 47 additions & 0 deletions .github/workflows/python-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Python tests

on: [ push, pull_request ]

jobs:
run-tests:
name: "Run tests"
runs-on: ubuntu-latest

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

steps:
- uses: actions/checkout@v7

- name: Install uv and set up Python
uses: astral-sh/setup-uv@v10.0.1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --locked

- name: Test with pytest
run: uv run pytest

run-static-checks:
name: "Run static checks"
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v7

- name: Install uv
uses: astral-sh/setup-uv@v10.0.1

- name: Install dependencies
run: uv sync --locked --dev

- name: Run linter
run: uv run ruff check --output-format github

- name: Check formatting
run: uv run ruff format --check --output-format github
27 changes: 0 additions & 27 deletions .github/workflows/python-tests.yml

This file was deleted.

16 changes: 13 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
name = "bigc"
version = "1.0.0"
description = "Unofficial client for the BigCommerce API"
license = { text = "MIT" }
license = "MIT"
license-files = ["LICENSE.txt"]
readme = "README.md"
requires-python = ">=3.10"
authors = [
Expand All @@ -15,7 +16,6 @@ keywords = ["bigcommerce", "api", "client"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -34,8 +34,18 @@ repository = "https://github.com/MedShift/bigc.git"
[dependency-groups]
dev = [
"pytest~=7.1",
"ruff==0.16.3",
]

[build-system]
requires = ["uv_build>=0.9.5,<0.10.0"]
requires = ["uv_build>=0.12.5,<0.13.0"]
build-backend = "uv_build"

[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F401",
]

[tool.ruff.format]
line-ending = "lf"
quote-style = "single"
40 changes: 28 additions & 12 deletions src/bigc/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,51 @@

class BigCommerceAPI:
def __init__(
self,
store_hash: str,
access_token: str,
*,
timeout: float | None = None,
get_retries: int | None = None
self,
store_hash: str,
access_token: str,
*,
timeout: float | None = None,
get_retries: int | None = None,
):
# Shared so that both API versions use the same pool within a thread
thread_local = threading.local()

api_v2 = BigCommerceV2APIClient(
store_hash, access_token, timeout=timeout, get_retries=get_retries, _thread_local=thread_local,
store_hash,
access_token,
timeout=timeout,
get_retries=get_retries,
_thread_local=thread_local,
)
api_v3 = BigCommerceV3APIClient(
store_hash, access_token, timeout=timeout, get_retries=get_retries, _thread_local=thread_local,
store_hash,
access_token,
timeout=timeout,
get_retries=get_retries,
_thread_local=thread_local,
)

self.api_v2 = api_v2
self.api_v3 = api_v3

self.carts_v3: BigCommerceCartsV3API = BigCommerceCartsV3API(api_v3)
self.categories_v3: BigCommerceCategoriesV3API = BigCommerceCategoriesV3API(api_v3)
self.categories_v3: BigCommerceCategoriesV3API = BigCommerceCategoriesV3API(
api_v3
)
self.checkouts_v3: BigCommerceCheckoutsV3API = BigCommerceCheckoutsV3API(api_v3)
self.currencies_v2: BigCommerceCurrenciesV2API = BigCommerceCurrenciesV2API(api_v2)
self.customer_groups_v2: BigCommerceCustomerGroupsV2API = BigCommerceCustomerGroupsV2API(api_v2)
self.currencies_v2: BigCommerceCurrenciesV2API = BigCommerceCurrenciesV2API(
api_v2
)
self.customer_groups_v2: BigCommerceCustomerGroupsV2API = (
BigCommerceCustomerGroupsV2API(api_v2)
)
self.customers_v3: BigCommerceCustomersV3API = BigCommerceCustomersV3API(api_v3)
self.orders_v2: BigCommerceOrdersV2API = BigCommerceOrdersV2API(api_v2)
self.orders_v3: BigCommerceOrdersV3API = BigCommerceOrdersV3API(api_v3)
self.pricing_v3: BigCommercePricingV3API = BigCommercePricingV3API(api_v3)
self.product_variants_v3: BigCommerceProductVariantsV3API = BigCommerceProductVariantsV3API(api_v3)
self.product_variants_v3: BigCommerceProductVariantsV3API = (
BigCommerceProductVariantsV3API(api_v3)
)
self.products_v3: BigCommerceProductsV3API = BigCommerceProductsV3API(api_v3)
self.webhooks_v3: BigCommerceWebhooksV3API = BigCommerceWebhooksV3API(api_v3)
Loading