Skip to content

Commit 8095676

Browse files
Automatically update Python SDK
1 parent 2402df4 commit 8095676

149 files changed

Lines changed: 10453 additions & 2164 deletions

File tree

Some content is hidden

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

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "trophy"
7-
version = "1.14.0"
7+
version = "1.15.0"
88
description = "A Python library for the Trophy API"
99
license = {text = "MIT"}
1010
readme = "README.md"

‎trophy/.fern/metadata.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"cliVersion": "5.62.0",
3+
"generatorName": "fernapi/fern-python-sdk",
4+
"generatorVersion": "5.15.1",
5+
"generatorConfig": {},
6+
"originGitCommit": "b18b99972464468a34beacaa16d18002f3d55fce",
7+
"originGitCommitIsDirty": false,
8+
"invokedBy": "ci",
9+
"ciProvider": "github"
10+
}

‎trophy/CONTRIBUTING.md‎

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project.
4+
5+
## Getting Started
6+
7+
### Prerequisites
8+
9+
- Python 3.9+
10+
- pip
11+
- poetry
12+
13+
### Installation
14+
15+
Install the project dependencies:
16+
17+
```bash
18+
poetry install
19+
```
20+
21+
### Building
22+
23+
Build the project:
24+
25+
```bash
26+
poetry build
27+
```
28+
29+
### Testing
30+
31+
Run the test suite:
32+
33+
```bash
34+
poetry run pytest
35+
```
36+
37+
### Linting and Formatting
38+
39+
Check code style:
40+
41+
```bash
42+
poetry run ruff check .
43+
poetry run ruff format .
44+
```
45+
46+
### Type Checking
47+
48+
Run the type checker:
49+
50+
```bash
51+
poetry run mypy .
52+
```
53+
54+
## About Generated Code
55+
56+
**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated.
57+
58+
### Generated Files
59+
60+
The following directories contain generated code:
61+
- `src/` - API client classes and types
62+
- Most Python files in the project
63+
64+
### How to Customize
65+
66+
If you need to customize the SDK, you have two options:
67+
68+
#### Option 1: Use `.fernignore`
69+
70+
For custom code that should persist across SDK regenerations:
71+
72+
1. Create a `.fernignore` file in the project root
73+
2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax)
74+
3. Add your custom code to those files
75+
76+
Files listed in `.fernignore` will not be overwritten when the SDK is regenerated.
77+
78+
For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code).
79+
80+
#### Option 2: Contribute to the Generator
81+
82+
If you want to change how code is generated for all users of this SDK:
83+
84+
1. The Python SDK generator lives in the [Fern repository](https://github.com/fern-api/fern)
85+
2. Generator code is located at `generators/python-v2/`
86+
3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md)
87+
4. Submit a pull request with your changes to the generator
88+
89+
This approach is best for:
90+
- Bug fixes in generated code
91+
- New features that would benefit all users
92+
- Improvements to code generation patterns
93+
94+
## Making Changes
95+
96+
### Workflow
97+
98+
1. Create a new branch for your changes
99+
2. Make your modifications
100+
3. Run tests to ensure nothing breaks: `poetry run pytest`
101+
4. Run linting and formatting: `poetry run ruff check .` and `poetry run ruff format .`
102+
5. Run type checking: `poetry run mypy .`
103+
6. Build the project: `poetry build`
104+
7. Commit your changes with a clear commit message
105+
8. Push your branch and create a pull request
106+
107+
### Commit Messages
108+
109+
Write clear, descriptive commit messages that explain what changed and why.
110+
111+
### Code Style
112+
113+
This project uses automated code formatting and linting. Run `poetry run ruff format .` and `poetry run ruff check .` before committing to ensure your code meets the project's style guidelines.
114+
115+
## Questions or Issues?
116+
117+
If you have questions or run into issues:
118+
119+
1. Check the [Fern documentation](https://buildwithfern.com)
120+
2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues)
121+
3. Open a new issue if your question hasn't been addressed
122+
123+
## License
124+
125+
By contributing to this project, you agree that your contributions will be licensed under the same license as the project.

‎trophy/__init__.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
AchievementWithStatsResponse,
1717
AdminAttribute,
1818
AdminAttributeType,
19+
AdminErrorBody,
1920
AdminIssue,
2021
AdminIssueSeverity,
2122
AdminLeaderboard,
@@ -221,6 +222,7 @@
221222
)
222223
from .errors import BadRequestError, ForbiddenError, NotFoundError, UnauthorizedError, UnprocessableEntityError
223224
from . import achievements, admin, leaderboards, metrics, points, streaks, users
225+
from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient
224226
from .client import AsyncTrophyApi, TrophyApi
225227
from .environment import TrophyApiEnvironment
226228
from .leaderboards import LeaderboardsAllResponseItem, LeaderboardsAllResponseItemStatus
@@ -240,6 +242,7 @@
240242
"AchievementWithStatsResponse": ".types",
241243
"AdminAttribute": ".types",
242244
"AdminAttributeType": ".types",
245+
"AdminErrorBody": ".types",
243246
"AdminIssue": ".types",
244247
"AdminIssueSeverity": ".types",
245248
"AdminLeaderboard": ".types",
@@ -310,6 +313,8 @@
310313
"CreatedAdminPointsSystem": ".types",
311314
"CreatedMetric": ".types",
312315
"CreatedMetricUnitType": ".types",
316+
"DefaultAioHttpClient": "._default_clients",
317+
"DefaultAsyncHttpxClient": "._default_clients",
313318
"DeleteAttributesResponse": ".types",
314319
"DeleteLeaderboardsResponse": ".types",
315320
"DeleteMetricsResponse": ".types",
@@ -497,6 +502,7 @@ def __dir__():
497502
"AchievementWithStatsResponse",
498503
"AdminAttribute",
499504
"AdminAttributeType",
505+
"AdminErrorBody",
500506
"AdminIssue",
501507
"AdminIssueSeverity",
502508
"AdminLeaderboard",
@@ -567,6 +573,8 @@ def __dir__():
567573
"CreatedAdminPointsSystem",
568574
"CreatedMetric",
569575
"CreatedMetricUnitType",
576+
"DefaultAioHttpClient",
577+
"DefaultAsyncHttpxClient",
570578
"DeleteAttributesResponse",
571579
"DeleteLeaderboardsResponse",
572580
"DeleteMetricsResponse",

‎trophy/_default_clients.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
import httpx
6+
7+
SDK_DEFAULT_TIMEOUT = 60
8+
9+
try:
10+
import httpx_aiohttp # type: ignore[import-not-found]
11+
except ImportError:
12+
13+
class DefaultAioHttpClient(httpx.AsyncClient): # type: ignore
14+
def __init__(self, **kwargs: typing.Any) -> None:
15+
raise RuntimeError("To use the aiohttp client, install the aiohttp extra: pip install trophy[aiohttp]")
16+
17+
else:
18+
19+
class DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
20+
def __init__(self, **kwargs: typing.Any) -> None:
21+
kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
22+
kwargs.setdefault("follow_redirects", True)
23+
super().__init__(**kwargs)
24+
25+
26+
class DefaultAsyncHttpxClient(httpx.AsyncClient):
27+
def __init__(self, **kwargs: typing.Any) -> None:
28+
kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
29+
kwargs.setdefault("follow_redirects", True)
30+
super().__init__(**kwargs)

‎trophy/achievements/client.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def all_(
5252
from trophy import TrophyApi
5353
5454
client = TrophyApi(
55+
"1.15.0",
5556
tenant_id="YOUR_TENANT_ID",
5657
api_key="YOUR_API_KEY",
5758
)
@@ -89,6 +90,7 @@ def complete(
8990
from trophy import TrophyApi, UpsertedUser
9091
9192
client = TrophyApi(
93+
"1.15.0",
9294
tenant_id="YOUR_TENANT_ID",
9395
api_key="YOUR_API_KEY",
9496
)
@@ -146,6 +148,7 @@ async def all_(
146148
from trophy import AsyncTrophyApi
147149
148150
client = AsyncTrophyApi(
151+
"1.15.0",
149152
tenant_id="YOUR_TENANT_ID",
150153
api_key="YOUR_API_KEY",
151154
)
@@ -191,6 +194,7 @@ async def complete(
191194
from trophy import AsyncTrophyApi, UpsertedUser
192195
193196
client = AsyncTrophyApi(
197+
"1.15.0",
194198
tenant_id="YOUR_TENANT_ID",
195199
api_key="YOUR_API_KEY",
196200
)

0 commit comments

Comments
 (0)