idi-shipstation-sdk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ {
2
+ "features": {
3
+ "ghcr.io/devcontainers/features/python:1.7.0": {
4
+ "version": "1.7.0",
5
+ "resolved": "ghcr.io/devcontainers/features/python@sha256:8452f39db0852420728c9f7503dd94b3fc71aa558b5e7c8f6f9ce6687e494ae3",
6
+ "integrity": "sha256:8452f39db0852420728c9f7503dd94b3fc71aa558b5e7c8f6f9ce6687e494ae3"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "image": "mcr.microsoft.com/devcontainers/universal:2",
3
+ "features": {
4
+ "ghcr.io/devcontainers/features/python:1.7.0": {
5
+ "version": "3.12",
6
+ "installTools": false
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,24 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: devcontainers
4
+ directory: /
5
+ schedule:
6
+ interval: monthly
7
+
8
+ - package-ecosystem: github-actions
9
+ directory: /
10
+ schedule:
11
+ interval: monthly
12
+ groups:
13
+ ci-dependencies:
14
+ patterns:
15
+ - "*"
16
+
17
+ - package-ecosystem: uv
18
+ directory: /
19
+ schedule:
20
+ interval: monthly
21
+ groups:
22
+ python-dependencies:
23
+ patterns:
24
+ - "*"
@@ -0,0 +1,20 @@
1
+ name: Dependency Review
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ dependency-review:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout Repository
15
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16
+
17
+ - name: Dependency Review
18
+ uses: actions/dependency-review-action@ce3cf9537a52e8119d91fd484ab5b8a807627bf8 # v4.6.0
19
+ with:
20
+ config-file: impressdesigns/.github/.github/dependency-review-config.yaml@main
@@ -0,0 +1,60 @@
1
+ name: Python CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ jobs:
10
+ lint-test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout repository
15
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16
+
17
+ - name: Setup Python
18
+ uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
19
+ with:
20
+ python-version: 3.12
21
+ allow-prereleases: true
22
+ cache: pip
23
+ cache-dependency-path: uv.lock
24
+
25
+ - name: Set up uv
26
+ run: curl -LsSf https://astral.sh/uv/install.sh | sh
27
+
28
+ - name: Sync dependencies
29
+ run: uv sync --all-extras
30
+
31
+ - name: Run pre-commit
32
+ run: uv run pre-commit run --all-files
33
+
34
+ - name: Check formatting
35
+ run: uv run ruff format --check .
36
+
37
+ - name: Run Ruff checks
38
+ run: uv run ruff check --output-format=github .
39
+
40
+ - name: Run mypy
41
+ run: uv run mypy --strict src/
42
+
43
+ - name: Run tests
44
+ run: uv run coverage run -m pytest -v
45
+
46
+ - name: Create coverage report
47
+ run: uv run coverage xml
48
+
49
+ - name: Upload coverage reports to Codecov
50
+ uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
51
+ env:
52
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53
+
54
+ docs:
55
+ permissions:
56
+ contents: read
57
+ pages: write
58
+ id-token: write
59
+
60
+ uses: darbiadev/.github/.github/workflows/github-pages-python-sphinx.yaml@91dda16028f109ac78016dd740206fd109740068 # v15.0.0
@@ -0,0 +1,52 @@
1
+ name: Publish Python 🐍 distributions 📦 to PyPI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ release:
11
+ types:
12
+ - published
13
+
14
+ jobs:
15
+ build:
16
+ name: Build distribution 📦
17
+ runs-on: ubuntu-latest
18
+ permissions:
19
+ attestations: write
20
+ id-token: write
21
+
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25
+
26
+ - name: Build and inspect Python 🐍 package 📦
27
+ uses: hynek/build-and-inspect-python-package@b5076c307dc91924a82ad150cdd1533b444d3310 # v2.12.0
28
+ with:
29
+ attest-build-provenance-github: ${{ github.event.action == 'published' }}
30
+
31
+ publish-to-pypi:
32
+ name: Publish Python 🐍 distribution 📦 to PyPI
33
+ needs: build
34
+ if: ${{ github.event.action == 'published' }}
35
+ runs-on: ubuntu-latest
36
+ environment:
37
+ name: pypi
38
+ url: https://pypi.org/project/idi-shipstation-sdk/${{ github.ref_name }}
39
+ permissions:
40
+ id-token: write
41
+
42
+ steps:
43
+ - name: Download dists
44
+ uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
45
+ with:
46
+ name: Packages
47
+ path: dist/
48
+
49
+ - name: Publish distribution 📦 to PyPI
50
+ uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
51
+ with:
52
+ print-hash: true
@@ -0,0 +1,9 @@
1
+ # Packaging
2
+ *.egg-info
3
+ dist
4
+
5
+ # Cache
6
+ __pycache__
7
+
8
+ # Docs
9
+ docs/build
@@ -0,0 +1,20 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: check-case-conflict
6
+ - id: check-merge-conflict
7
+ - id: check-toml
8
+ - id: check-yaml
9
+ - id: check-json
10
+ - id: trailing-whitespace
11
+ args: [ --markdown-linebreak-ext=md ]
12
+ - id: mixed-line-ending
13
+ args: [ --fix=lf ]
14
+ - id: end-of-file-fixer
15
+ exclude: .devcontainer/devcontainer-lock.json
16
+
17
+ - repo: https://github.com/astral-sh/uv-pre-commit
18
+ rev: 0.6.5
19
+ hooks:
20
+ - id: uv-lock
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Impress Designs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: idi-shipstation-sdk
3
+ Version: 0.1.0
4
+ Summary: ShipStation API SDK
5
+ Project-URL: repository, https://github.com/impressdesigns/shipstation-sdk/
6
+ Project-URL: documentation, https://impressdesigns.dev/shipstation-sdk/
7
+ Author-email: Bradley Reynolds <bradley.reynolds@impressdesigns.com>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Requires-Python: >=3.13
11
+ Requires-Dist: httpx>=0.27.2
12
+ Requires-Dist: pydantic>=2.9.2
13
+ Provides-Extra: docs
14
+ Requires-Dist: furo>=2024.5.6; extra == 'docs'
15
+ Requires-Dist: releases>=2.1.1; extra == 'docs'
16
+ Requires-Dist: sphinx-autoapi>=3.1.2; extra == 'docs'
17
+ Requires-Dist: sphinx>=7.4.4; extra == 'docs'
18
+ Provides-Extra: tests
19
+ Requires-Dist: coverage>=7.6.1; extra == 'tests'
20
+ Requires-Dist: pytest-randomly>=3.15.0; extra == 'tests'
21
+ Requires-Dist: pytest>=8.2.2; extra == 'tests'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # shipstation-sdk
25
+
26
+ ShipStation SDK
@@ -0,0 +1,3 @@
1
+ # shipstation-sdk
2
+
3
+ ShipStation SDK
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = source
9
+ BUILDDIR = build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,5 @@
1
+ Changelog
2
+ =========
3
+
4
+ - :release:`0.1.0 <6th May 2025>`
5
+ - :feature:`-` Initial release
@@ -0,0 +1,93 @@
1
+ """Configuration file for the Sphinx documentation builder.
2
+
3
+ For the full list of built-in configuration values, see the documentation:
4
+ https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+ """
6
+
7
+ from importlib.metadata import metadata
8
+
9
+ project_metadata = metadata("idi-shipstation-sdk")
10
+ project: str = project_metadata["Name"]
11
+ release: str = project_metadata["Version"]
12
+ REPO_LINK: str = project_metadata["Project-URL"].replace("repository, ", "")
13
+ copyright: str = "Impress Designs" # noqa: A001
14
+ author: str = "Impress Designs team"
15
+
16
+ # Add any Sphinx extension module names here, as strings. They can be
17
+ # extensions coming with Sphinx (named "sphinx.ext.*") or your custom
18
+ # ones.
19
+ extensions = [
20
+ "sphinx.ext.autodoc",
21
+ "sphinx.ext.linkcode",
22
+ "sphinx.ext.intersphinx",
23
+ "sphinx.ext.napoleon",
24
+ "autoapi.extension",
25
+ "releases",
26
+ ]
27
+
28
+ autoapi_type: str = "python"
29
+ autoapi_dirs: list[str] = ["../../src"]
30
+
31
+ intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
32
+
33
+ # Add any paths that contain templates here, relative to this directory.
34
+ templates_path: list[str] = ["_templates"]
35
+
36
+ # List of patterns, relative to source directory, that match files and
37
+ # directories to ignore when looking for source files.
38
+ # This pattern also affects html_static_path and html_extra_path.
39
+ exclude_patterns: list[str] = ["_build", "Thumbs.db", ".DS_Store"]
40
+
41
+ # -- Options for HTML output -------------------------------------------------
42
+
43
+ # The theme to use for HTML and HTML Help pages. See the documentation for
44
+ # a list of builtin themes.
45
+ html_theme: str = "furo"
46
+
47
+ # Add any paths that contain custom static files (such as style sheets) here,
48
+ # relative to this directory. They are copied after the builtin static files,
49
+ # so a file named "default.css" will overwrite the builtin "default.css".
50
+ html_static_path: list[str] = ["_static"]
51
+
52
+ releases_github_path = REPO_LINK.removeprefix("https://github.com/")
53
+ releases_release_uri = f"{REPO_LINK}/releases/tag/v%s"
54
+
55
+
56
+ def linkcode_resolve(domain: str, info: dict) -> str | None:
57
+ """linkcode_resolve."""
58
+ if domain != "py":
59
+ return None
60
+ if not info["module"]:
61
+ return None
62
+
63
+ import importlib
64
+ import inspect
65
+ import types
66
+
67
+ mod = importlib.import_module(info["module"])
68
+
69
+ val = mod
70
+ for k in info["fullname"].split("."):
71
+ val = getattr(val, k, None)
72
+ if val is None:
73
+ break
74
+
75
+ filename = info["module"].replace(".", "/") + ".py"
76
+
77
+ if isinstance(
78
+ val,
79
+ types.ModuleType
80
+ | types.MethodType
81
+ | types.FunctionType
82
+ | types.TracebackType
83
+ | types.FrameType
84
+ | types.CodeType,
85
+ ):
86
+ try:
87
+ lines, first = inspect.getsourcelines(val)
88
+ last = first + len(lines) - 1
89
+ filename += f"#L{first}-L{last}"
90
+ except (OSError, TypeError):
91
+ pass
92
+
93
+ return f"{REPO_LINK}/blob/main/src/{filename}"
@@ -0,0 +1,25 @@
1
+ idi-shipstation-sdk
2
+ ====================
3
+
4
+ ShipStation API SDK
5
+
6
+ Module Index
7
+ ------------
8
+
9
+ .. toctree::
10
+ :maxdepth: 1
11
+
12
+ autoapi/index
13
+
14
+ .. toctree::
15
+ :caption: Other:
16
+ :hidden:
17
+
18
+ changelog
19
+
20
+ Extras
21
+ ------
22
+
23
+ * :ref:`genindex`
24
+ * :ref:`search`
25
+ * :doc:`changelog`
@@ -0,0 +1,52 @@
1
+ """Noxfile."""
2
+
3
+ import shutil
4
+ from pathlib import Path
5
+
6
+ import nox
7
+
8
+ nox.options.default_venv_backend = "none"
9
+ nox.options.sessions = ["lints"]
10
+
11
+
12
+ CLEANABLE_TARGETS = [
13
+ "./dist",
14
+ "./build",
15
+ "./.nox",
16
+ "./.coverage",
17
+ "./.coverage.*",
18
+ "./coverage.json",
19
+ "./**/.mypy_cache",
20
+ "./**/.pytest_cache",
21
+ "./**/__pycache__",
22
+ "./**/*.pyc",
23
+ "./**/*.pyo",
24
+ ]
25
+
26
+
27
+ @nox.session
28
+ def tests(session: nox.Session) -> None:
29
+ """Run tests."""
30
+ session.run("pytest")
31
+
32
+
33
+ @nox.session
34
+ def lints(session: nox.Session) -> None:
35
+ """Run lints."""
36
+ session.run("pre-commit", "run", "--all-files")
37
+ session.run("ruff", "format", ".")
38
+ session.run("ruff", "check", "--fix", ".")
39
+ session.run("mypy", "--strict", "src/")
40
+
41
+
42
+ @nox.session
43
+ def clean(_: nox.Session) -> None:
44
+ """Clean cache, .pyc, .pyo, and test/build artifact files from project."""
45
+ count = 0
46
+ for searchpath in CLEANABLE_TARGETS:
47
+ for filepath in Path().glob(searchpath):
48
+ if filepath.is_dir():
49
+ shutil.rmtree(filepath)
50
+ else:
51
+ filepath.unlink()
52
+ count += 1
@@ -0,0 +1,74 @@
1
+ [project]
2
+ name = "idi-shipstation-sdk"
3
+ version = "0.1.0"
4
+ description = "ShipStation API SDK"
5
+ authors = [
6
+ { name = "Bradley Reynolds", email = "bradley.reynolds@impressdesigns.com" },
7
+ ]
8
+ readme = "README.md"
9
+ license = { text = "MIT" }
10
+ requires-python = ">=3.13"
11
+ dependencies = ["pydantic>=2.9.2","httpx>=0.27.2"]
12
+
13
+ [project.optional-dependencies]
14
+ docs = [
15
+ "sphinx>=7.4.4",
16
+ "furo>=2024.5.6",
17
+ "sphinx-autoapi>=3.1.2",
18
+ "releases>=2.1.1",
19
+ ]
20
+ tests = ["pytest>=8.2.2", "pytest-randomly>=3.15.0", "coverage>=7.6.1"]
21
+
22
+ [project.urls]
23
+ repository = "https://github.com/impressdesigns/shipstation-sdk/"
24
+ documentation = "https://impressdesigns.dev/shipstation-sdk/"
25
+
26
+ [build-system]
27
+ requires = ["hatchling"]
28
+ build-backend = "hatchling.build"
29
+
30
+ [dependency-groups]
31
+ dev = [
32
+ # DX
33
+ "nox>=2024.4.15",
34
+ "pre-commit>=3.7.1",
35
+ # Linters
36
+ "ruff>=0.5.2",
37
+ "mypy>=1.10.1",
38
+ ]
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["src/shipstation_sdk"]
42
+
43
+ [tool.ruff]
44
+ target-version = "py313"
45
+ line-length = 120
46
+
47
+ [tool.ruff.lint]
48
+ select = ["ALL"]
49
+ ignore = [
50
+ "CPY001", # (Missing copyright notice at top of file) - No license
51
+ ]
52
+
53
+ [tool.ruff.lint.extend-per-file-ignores]
54
+ "docs/*" = [
55
+ "INP001", # (File `docs/conf.py` is part of an implicit namespace package. Add an `__init__.py`.) - Docs are not modules
56
+ ]
57
+ "tests/*" = [
58
+ "S101", # (Use of `assert` detected) - Yes, that's the point
59
+ ]
60
+
61
+ [tool.ruff.lint.isort]
62
+ known-first-party = ["shipstation_sdk"]
63
+
64
+ [tool.ruff.lint.pydocstyle]
65
+ convention = "numpy"
66
+
67
+ [tool.mypy]
68
+ plugins = ["pydantic.mypy"]
69
+
70
+ [tool.coverage.run]
71
+ source = ["shipstation_sdk"]
72
+
73
+ [tool.pytest.ini_options]
74
+ addopts = "--strict-markers"
@@ -0,0 +1,5 @@
1
+ """ShipStation API SDK."""
2
+
3
+ from .client import ShipStationClient
4
+
5
+ __all__ = ["ShipStationClient"]
@@ -0,0 +1,62 @@
1
+ """Interacting with ShipStation."""
2
+
3
+ from datetime import date
4
+ from typing import Any
5
+
6
+ from httpx import Client, Response
7
+
8
+ from .models import ShipmentsResponse
9
+
10
+
11
+ class ShipStationClient:
12
+ """A class wrapping ShipStation interaction."""
13
+
14
+ def __init__(
15
+ self,
16
+ base_url: str,
17
+ client_id: str,
18
+ client_secret: str,
19
+ timeout: float,
20
+ ) -> None:
21
+ """Initialize the ShipStationClient class."""
22
+ self.client = Client(
23
+ base_url=base_url,
24
+ auth=(client_id, client_secret),
25
+ timeout=timeout,
26
+ )
27
+
28
+ def make_request(
29
+ self,
30
+ method: str,
31
+ path: str,
32
+ params: dict[str, Any] | None = None,
33
+ json: dict[str, Any] | None = None,
34
+ ) -> Response:
35
+ """Make a request to ShipStation."""
36
+ args: dict[str, str | dict[str, str]] = {
37
+ "url": path,
38
+ "method": method,
39
+ }
40
+
41
+ if params is not None:
42
+ args["params"] = params
43
+
44
+ if json is not None:
45
+ args["json"] = json
46
+
47
+ return self.client.request(**args) # type: ignore[arg-type]
48
+
49
+ def get_shipments(
50
+ self,
51
+ ship_date_start: date | None = None,
52
+ ship_date_end: date | None = None,
53
+ ) -> ShipmentsResponse:
54
+ """Get a list of shipments."""
55
+ params = {}
56
+ if ship_date_start:
57
+ params["shipDateStart"] = ship_date_start.isoformat()
58
+ if ship_date_end:
59
+ params["shipDateEnd"] = ship_date_end.isoformat()
60
+ response = self.make_request("GET", "/shipments", params=params)
61
+ response.raise_for_status()
62
+ return ShipmentsResponse.model_validate(response.json())