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
31 changes: 31 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/HubSpot/hubspot-sdk-python/actions/workflows/publish-pypi.yml
name: Publish PyPI
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Publish to PyPI
run: |
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.HUBSPOT_PYPI_TOKEN || secrets.PYPI_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Doctor
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'HubSpot/hubspot-sdk-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v6

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
PYPI_TOKEN: ${{ secrets.HUBSPOT_PYPI_TOKEN || secrets.PYPI_TOKEN }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.5.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 971
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hubspot%2Fhubspot-sdk-b0d8bc008db9e485496b486b6fb770a256d16caf430e7c8696cb5e2f61cb42ef.yml
openapi_spec_hash: 73818ecf3b80406f1ff2729a9f1b2c97
config_hash: e99682b006b4e757556c83a8ecac0b2f
config_hash: b00859c0731e231e20f63b0a02182b30
139 changes: 139 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g
To install via git:

```sh
$ pip install git+ssh://git@github.com/stainless-sdks/hubspot-sdk-python.git
$ pip install git+ssh://git@github.com/HubSpot/hubspot-sdk-python.git
```

Alternatively, you can build from source and install the wheel file:
Expand Down Expand Up @@ -113,7 +113,7 @@ the changes aren't made through the automated pipeline, you may want to make rel

### Publish with a GitHub workflow

You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/hubspot-sdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/HubSpot/hubspot-sdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

Expand Down
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HubSpot Python API library

<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/hubspot_sdk.svg?label=pypi%20(stable))](https://pypi.org/project/hubspot_sdk/)
[![PyPI version](https://img.shields.io/pypi/v/hubspot-sdk.svg?label=pypi%20(stable))](https://pypi.org/project/hubspot-sdk/)

The HubSpot Python library provides convenient access to HubSpot's date-versioned REST API (`2026-03` release) from any Python 3.9+
application. The library includes type definitions for all request params and response fields,
Expand All @@ -16,13 +16,10 @@ The REST API documentation can be found on [developers.hubspot.com](https://deve
## Installation

```sh
# install from this staging repo
pip install git+ssh://git@github.com/stainless-sdks/hubspot-sdk-python.git
# install from PyPI
pip install hubspot-sdk
```

> [!NOTE]
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install hubspot_sdk`

## Usage

The full API of this library can be found in [api.md](api.md).
Expand Down Expand Up @@ -72,8 +69,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
You can enable this by installing `aiohttp`:

```sh
# install from this staging repo
pip install 'hubspot_sdk[aiohttp] @ git+ssh://git@github.com/stainless-sdks/hubspot-sdk-python.git'
# install from PyPI
pip install hubspot-sdk[aiohttp]
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
Expand Down Expand Up @@ -419,9 +416,9 @@ contact = response.parse() # get the object that `crm.objects.contacts.create()
print(contact.id)
```

These methods return an [`APIResponse`](https://github.com/stainless-sdks/hubspot-sdk-python/tree/main/src/hubspot_sdk/_response.py) object.
These methods return an [`APIResponse`](https://github.com/HubSpot/hubspot-sdk-python/tree/main/src/hubspot_sdk/_response.py) object.

The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/hubspot-sdk-python/tree/main/src/hubspot_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
The async client returns an [`AsyncAPIResponse`](https://github.com/HubSpot/hubspot-sdk-python/tree/main/src/hubspot_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.

#### `.with_streaming_response`

Expand Down Expand Up @@ -538,7 +535,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/hubspot-sdk-python/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/HubSpot/hubspot-sdk-python/issues) with questions, bugs, or suggestions.

### Determining the installed version

Expand Down
21 changes: 21 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

errors=()

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
echo -e "Found the following errors in the release environment:\n"

for error in "${errors[@]}"; do
echo -e "- $error\n"
done

exit 1
fi

echo "The environment is ready to push releases!"
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "hubspot_sdk"
version = "0.4.4"
name = "hubspot-sdk"
version = "0.5.0"
description = "The official Python library for the hubspot API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -37,8 +37,8 @@ classifiers = [
]

[project.urls]
Homepage = "https://github.com/stainless-sdks/hubspot-sdk-python"
Repository = "https://github.com/stainless-sdks/hubspot-sdk-python"
Homepage = "https://github.com/HubSpot/hubspot-sdk-python"
Repository = "https://github.com/HubSpot/hubspot-sdk-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]
Expand Down Expand Up @@ -126,7 +126,7 @@ path = "README.md"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
# replace relative links with absolute links
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
replacement = '[\1](https://github.com/stainless-sdks/hubspot-sdk-python/tree/main/\g<2>)'
replacement = '[\1](https://github.com/HubSpot/hubspot-sdk-python/tree/main/\g<2>)'

[tool.pytest.ini_options]
testpaths = ["tests"]
Expand Down
66 changes: 66 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"versioning": "prerelease",
"prerelease": true,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"pull-request-header": "Automated Release PR",
"pull-request-title-pattern": "release: ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "chore",
"section": "Chores"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "refactor",
"section": "Refactors"
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
],
"release-type": "python",
"extra-files": [
"src/hubspot_sdk/_version.py"
]
}
2 changes: 1 addition & 1 deletion src/hubspot_sdk/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
if not is_file_content(obj):
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
raise RuntimeError(
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/stainless-sdks/hubspot-sdk-python/tree/main#file-uploads"
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/HubSpot/hubspot-sdk-python/tree/main#file-uploads"
) from None


Expand Down
5 changes: 3 additions & 2 deletions src/hubspot_sdk/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def _extract_items(
index += 1
if is_dict(obj):
try:
# We are at the last entry in the path so we must remove the field
if (len(path)) == index:
# Remove the field if there are no more dict keys in the path,
# only "<array>" traversal markers or end.
if all(p == "<array>" for p in path[index:]):
item = obj.pop(key)
else:
item = obj[key]
Expand Down
2 changes: 1 addition & 1 deletion src/hubspot_sdk/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "hubspot_sdk"
__version__ = "0.4.4"
__version__ = "0.5.0" # x-release-please-version
8 changes: 4 additions & 4 deletions src/hubspot_sdk/resources/account/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def with_raw_response(self) -> AccountResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#accessing-raw-response-data-eg-headers
"""
return AccountResourceWithRawResponse(self)

Expand All @@ -48,7 +48,7 @@ def with_streaming_response(self) -> AccountResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#with_streaming_response
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#with_streaming_response
"""
return AccountResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -108,7 +108,7 @@ def with_raw_response(self) -> AsyncAccountResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#accessing-raw-response-data-eg-headers
"""
return AsyncAccountResourceWithRawResponse(self)

Expand All @@ -117,7 +117,7 @@ def with_streaming_response(self) -> AsyncAccountResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#with_streaming_response
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#with_streaming_response
"""
return AsyncAccountResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/hubspot_sdk/resources/account/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def with_raw_response(self) -> ActivityResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#accessing-raw-response-data-eg-headers
"""
return ActivityResourceWithRawResponse(self)

Expand All @@ -47,7 +47,7 @@ def with_streaming_response(self) -> ActivityResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#with_streaming_response
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#with_streaming_response
"""
return ActivityResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -229,7 +229,7 @@ def with_raw_response(self) -> AsyncActivityResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#accessing-raw-response-data-eg-headers
"""
return AsyncActivityResourceWithRawResponse(self)

Expand All @@ -238,7 +238,7 @@ def with_streaming_response(self) -> AsyncActivityResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#with_streaming_response
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#with_streaming_response
"""
return AsyncActivityResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/hubspot_sdk/resources/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def with_raw_response(self) -> AuthResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#accessing-raw-response-data-eg-headers
"""
return AuthResourceWithRawResponse(self)

Expand All @@ -36,7 +36,7 @@ def with_streaming_response(self) -> AuthResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#with_streaming_response
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#with_streaming_response
"""
return AuthResourceWithStreamingResponse(self)

Expand All @@ -52,7 +52,7 @@ def with_raw_response(self) -> AsyncAuthResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#accessing-raw-response-data-eg-headers
"""
return AsyncAuthResourceWithRawResponse(self)

Expand All @@ -61,7 +61,7 @@ def with_streaming_response(self) -> AsyncAuthResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/hubspot-sdk-python#with_streaming_response
For more information, see https://www.github.com/HubSpot/hubspot-sdk-python#with_streaming_response
"""
return AsyncAuthResourceWithStreamingResponse(self)

Expand Down
Loading
Loading