Skip to content

Commit aff3c46

Browse files
committed
feat(api): update via SDK Studio
1 parent 7b99dc3 commit aff3c46

File tree

332 files changed

+18168
-12382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

332 files changed

+18168
-12382
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
33

44
USER vscode
55

6-
RUN curl -sSf https://rye-up.com/get | RYE_VERSION="0.15.2" RYE_INSTALL_OPTION="--yes" bash
6+
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash
77
ENV PATH=/home/vscode/.rye/shims:$PATH
88

99
RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc

.github/workflows/ci.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,42 @@ jobs:
1111
lint:
1212
name: lint
1313
runs-on: ubuntu-latest
14-
if: github.repository == 'intercom/intercom-python'
14+
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818

1919
- name: Install Rye
2020
run: |
21-
curl -sSf https://rye-up.com/get | bash
21+
curl -sSf https://rye.astral.sh/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: 0.15.2
25-
RYE_INSTALL_OPTION: "--yes"
24+
RYE_VERSION: 0.24.0
25+
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Install dependencies
28-
run: |
29-
rye sync --all-features
28+
run: rye sync --all-features
3029

31-
- name: Run ruff
32-
run: |
33-
rye run check:ruff
30+
- name: Run lints
31+
run: ./scripts/lint
32+
test:
33+
name: test
34+
runs-on: ubuntu-latest
3435

35-
- name: Run type checking
36-
run: |
37-
rye run typecheck
36+
steps:
37+
- uses: actions/checkout@v4
3838

39-
- name: Ensure importable
39+
- name: Install Rye
4040
run: |
41-
rye run python -c 'import intercom'
41+
curl -sSf https://rye.astral.sh/get | bash
42+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
43+
env:
44+
RYE_VERSION: 0.24.0
45+
RYE_INSTALL_OPTION: '--yes'
46+
47+
- name: Bootstrap
48+
run: ./scripts/bootstrap
49+
50+
- name: Run tests
51+
run: ./scripts/test
52+

.github/workflows/create-releases.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Create releases
2+
on:
3+
schedule:
4+
- cron: '0 5 * * *' # every day at 5am UTC
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
release:
11+
name: release
12+
if: github.ref == 'refs/heads/main' && github.repository == 'intercom/intercom-python'
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: stainless-api/trigger-release-please@v1
19+
id: release
20+
with:
21+
repo: ${{ github.event.repository.full_name }}
22+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
23+
24+
- name: Install Rye
25+
if: ${{ steps.release.outputs.releases_created }}
26+
run: |
27+
curl -sSf https://rye.astral.sh/get | bash
28+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
29+
env:
30+
RYE_VERSION: 0.24.0
31+
RYE_INSTALL_OPTION: "--yes"
32+
33+
- name: Publish to PyPI
34+
if: ${{ steps.release.outputs.releases_created }}
35+
run: |
36+
bash ./bin/publish-pypi
37+
env:
38+
PYPI_TOKEN: ${{ secrets.INTERCOM_PYPI_TOKEN || secrets.PYPI_TOKEN }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Handle release PR title edits
2+
on:
3+
pull_request:
4+
types:
5+
- edited
6+
- unlabeled
7+
8+
jobs:
9+
update_pr_content:
10+
name: Update pull request content
11+
if: |
12+
((github.event.action == 'edited' && github.event.changes.title.from != github.event.pull_request.title) ||
13+
(github.event.action == 'unlabeled' && github.event.label.name == 'autorelease: custom version')) &&
14+
startsWith(github.event.pull_request.head.ref, 'release-please--') &&
15+
github.event.pull_request.state == 'open' &&
16+
github.event.sender.login != 'stainless-bot' &&
17+
github.event.sender.login != 'stainless-app' &&
18+
github.repository == 'intercom/intercom-python'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: stainless-api/trigger-release-please@v1
23+
with:
24+
repo: ${{ github.event.repository.full_name }}
25+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}

.github/workflows/publish-pypi.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# workflow for re-running publishing to PyPI in case it fails for some reason
2+
# you can run this workflow by navigating to https://www.github.com/intercom/intercom-python/actions/workflows/publish-pypi.yml
3+
name: Publish PyPI
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
publish:
9+
name: publish
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Rye
16+
run: |
17+
curl -sSf https://rye.astral.sh/get | bash
18+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
19+
env:
20+
RYE_VERSION: 0.24.0
21+
RYE_INSTALL_OPTION: "--yes"
22+
23+
- name: Publish to PyPI
24+
run: |
25+
bash ./bin/publish-pypi
26+
env:
27+
PYPI_TOKEN: ${{ secrets.INTERCOM_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.github/workflows/release-doctor.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release Doctor
2+
on:
3+
pull_request:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release_doctor:
8+
name: release doctor
9+
runs-on: ubuntu-latest
10+
if: github.repository == 'intercom/intercom-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Check release environment
16+
run: |
17+
bash ./bin/check-release-environment
18+
env:
19+
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
20+
PYPI_TOKEN: ${{ secrets.INTERCOM_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ dist
1212
.env
1313
.envrc
1414
codegen.log
15+
Brewfile.lock.json

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.1"
3+
}

.stats.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
configured_endpoints: 103
1+
configured_endpoints: 109
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/intercom%2Fintercom-d02ca8e30fc99f5cb4f6b9b3f6300ccb515819f7a75c6c56fcad9de0a744c1ce.yml

Brewfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
brew "rye"
2+

CONTRIBUTING.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
## Setting up the environment
2+
3+
### With Rye
4+
5+
We use [Rye](https://rye.astral.sh/) to manage dependencies so we highly recommend [installing it](https://rye.astral.sh/guide/installation/) as it will automatically provision a Python environment with the expected Python version.
6+
7+
After installing Rye, you'll just have to run this command:
8+
9+
```sh
10+
$ rye sync --all-features
11+
```
12+
13+
You can then run scripts using `rye run python script.py` or by activating the virtual environment:
14+
15+
```sh
16+
$ rye shell
17+
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
18+
$ source .venv/bin/activate
19+
20+
# now you can omit the `rye run` prefix
21+
$ python script.py
22+
```
23+
24+
### Without Rye
25+
26+
Alternatively if you don't want to install `Rye`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command:
27+
28+
```sh
29+
$ pip install -r requirements-dev.lock
30+
```
31+
32+
## Modifying/Adding code
33+
34+
Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
35+
`src/intercom/lib/` and `examples/` directories are exceptions and will never be overridden.
36+
37+
## Adding and running examples
38+
39+
All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or
40+
added to.
41+
42+
```bash
43+
# add an example to examples/<your-example>.py
44+
45+
#!/usr/bin/env -S rye run python
46+
47+
```
48+
49+
```
50+
chmod +x examples/<your-example>.py
51+
# run the example against your api
52+
./examples/<your-example>.py
53+
```
54+
55+
## Using the repository from source
56+
57+
If you’d like to use the repository from source, you can either install from git or link to a cloned repository:
58+
59+
To install via git:
60+
61+
```bash
62+
pip install git+ssh://git@github.com/intercom/intercom-python.git
63+
```
64+
65+
Alternatively, you can build from source and install the wheel file:
66+
67+
Building this package will create two files in the `dist/` directory, a `.tar.gz` containing the source files and a `.whl` that can be used to install the package efficiently.
68+
69+
To create a distributable version of the library, all you have to do is run this command:
70+
71+
```bash
72+
rye build
73+
# or
74+
python -m build
75+
```
76+
77+
Then to install:
78+
79+
```sh
80+
pip install ./path-to-wheel-file.whl
81+
```
82+
83+
## Running tests
84+
85+
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
86+
87+
```bash
88+
# you will need npm installed
89+
npx prism mock path/to/your/openapi.yml
90+
```
91+
92+
```bash
93+
rye run pytest
94+
```
95+
96+
## Linting and formatting
97+
98+
This repository uses [ruff](https://github.com/astral-sh/ruff) and
99+
[black](https://github.com/psf/black) to format the code in the repository.
100+
101+
To lint:
102+
103+
```bash
104+
rye run lint
105+
```
106+
107+
To format and fix all ruff issues automatically:
108+
109+
```bash
110+
rye run format
111+
```
112+
113+
## Publishing and releases
114+
115+
Changes made to this repository via the automated release PR pipeline should publish to PyPI automatically. If
116+
the changes aren't made through the automated pipeline, you may want to make releases manually.
117+
118+
### Publish with a GitHub workflow
119+
120+
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/intercom/intercom-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
121+
122+
### Publish manually
123+
124+
If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on
125+
the environment.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2023 Intercom
189+
Copyright 2024 Intercom
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)