Skip to content

Commit 1df63e3

Browse files
Merge pull request #2 from CASParser/release-please--branches--main--changes--next
release: 1.0.0
2 parents 1c228e4 + 5ca5ffe commit 1df63e3

16 files changed

+246
-151
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/CASParser/cas-parser-python/actions/workflows/publish-pypi.yml
4+
name: Publish PyPI
5+
on:
6+
workflow_dispatch:
7+
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
publish:
13+
name: publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Rye
20+
run: |
21+
curl -sSf https://rye.astral.sh/get | bash
22+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
23+
env:
24+
RYE_VERSION: '0.44.0'
25+
RYE_INSTALL_OPTION: '--yes'
26+
27+
- name: Publish to PyPI
28+
run: |
29+
bash ./bin/publish-pypi
30+
env:
31+
PYPI_TOKEN: ${{ secrets.CAS_PARSER_PYPI_TOKEN || secrets.PYPI_TOKEN }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release Doctor
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
jobs:
9+
release_doctor:
10+
name: release doctor
11+
runs-on: ubuntu-latest
12+
if: github.repository == 'CASParser/cas-parser-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Check release environment
18+
run: |
19+
bash ./bin/check-release-environment
20+
env:
21+
PYPI_TOKEN: ${{ secrets.CAS_PARSER_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.release-please-manifest.json

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

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 5
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-b7fdba3d3f97c7debc22c7ca30b828bce81bcd64648df8c94029b27a3321ebb9.yml
33
openapi_spec_hash: 03f1315f1d32ada42445ca920f047dff
4-
config_hash: 2632d49bed76591e5ca0ddf94f518f17
4+
config_hash: a09a453fc58f48d89b5b8fce49bfb354

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
## 1.0.0 (2025-08-18)
4+
5+
Full Changelog: [v0.0.1...v1.0.0](https://github.com/CASParser/cas-parser-python/compare/v0.0.1...v1.0.0)
6+
7+
### Features
8+
9+
* **api:** manual updates ([635bd26](https://github.com/CASParser/cas-parser-python/commit/635bd26431623f00d3af06a3256c2b7085c83487))
10+
11+
12+
### Chores
13+
14+
* configure new SDK language ([5748dab](https://github.com/CASParser/cas-parser-python/commit/5748dab8b8241dc537456d9b8c1dae3c0e4a5d5a))
15+
* update SDK settings ([13b5c47](https://github.com/CASParser/cas-parser-python/commit/13b5c470a31ac72d95078236e0e16b76e753939e))
16+
* update SDK settings ([25126eb](https://github.com/CASParser/cas-parser-python/commit/25126eb2330f0e84bd4dd9e814e6a2e5b2ebbddc))

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g
6262
To install via git:
6363

6464
```sh
65-
$ pip install git+ssh://[email protected]/stainless-sdks/cas-parser-python.git
65+
$ pip install git+ssh://[email protected]/CASParser/cas-parser-python.git
6666
```
6767

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

121121
### Publish with a GitHub workflow
122122

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

125125
### Publish manually
126126

README.md

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ The REST API documentation can be found on [docs.casparser.in](https://docs.casp
1616
## Installation
1717

1818
```sh
19-
# install from this staging repo
20-
pip install git+ssh://[email protected]/stainless-sdks/cas-parser-python.git
19+
# install from PyPI
20+
pip install cas_parser
2121
```
2222

23-
> [!NOTE]
24-
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install cas_parser`
25-
2623
## Usage
2724

2825
The full API of this library can be found in [api.md](api.md).
@@ -33,11 +30,12 @@ from cas_parser import CasParser
3330

3431
client = CasParser(
3532
api_key=os.environ.get("CAS_PARSER_API_KEY"), # This is the default and can be omitted
36-
# defaults to "production".
37-
environment="local",
3833
)
3934

40-
unified_response = client.cas_parser.cams_kfintech()
35+
unified_response = client.cas_parser.smart_parse(
36+
password="ABCDF",
37+
pdf_url="https://your-cas-pdf-url-here.com",
38+
)
4139
print(unified_response.demat_accounts)
4240
```
4341

@@ -57,13 +55,14 @@ from cas_parser import AsyncCasParser
5755

5856
client = AsyncCasParser(
5957
api_key=os.environ.get("CAS_PARSER_API_KEY"), # This is the default and can be omitted
60-
# defaults to "production".
61-
environment="local",
6258
)
6359

6460

6561
async def main() -> None:
66-
unified_response = await client.cas_parser.cams_kfintech()
62+
unified_response = await client.cas_parser.smart_parse(
63+
password="ABCDF",
64+
pdf_url="https://your-cas-pdf-url-here.com",
65+
)
6766
print(unified_response.demat_accounts)
6867

6968

@@ -79,8 +78,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
7978
You can enable this by installing `aiohttp`:
8079

8180
```sh
82-
# install from this staging repo
83-
pip install 'cas_parser[aiohttp] @ git+ssh://[email protected]/stainless-sdks/cas-parser-python.git'
81+
# install from PyPI
82+
pip install cas_parser[aiohttp]
8483
```
8584

8685
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
@@ -96,7 +95,10 @@ async def main() -> None:
9695
api_key="My API Key",
9796
http_client=DefaultAioHttpClient(),
9897
) as client:
99-
unified_response = await client.cas_parser.cams_kfintech()
98+
unified_response = await client.cas_parser.smart_parse(
99+
password="ABCDF",
100+
pdf_url="https://your-cas-pdf-url-here.com",
101+
)
100102
print(unified_response.demat_accounts)
101103

102104

@@ -128,7 +130,10 @@ from cas_parser import CasParser
128130
client = CasParser()
129131

130132
try:
131-
client.cas_parser.cams_kfintech()
133+
client.cas_parser.smart_parse(
134+
password="ABCDF",
135+
pdf_url="https://you-cas-pdf-url-here.com",
136+
)
132137
except cas_parser.APIConnectionError as e:
133138
print("The server could not be reached")
134139
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -171,7 +176,10 @@ client = CasParser(
171176
)
172177

173178
# Or, configure per-request:
174-
client.with_options(max_retries=5).cas_parser.cams_kfintech()
179+
client.with_options(max_retries=5).cas_parser.smart_parse(
180+
password="ABCDF",
181+
pdf_url="https://you-cas-pdf-url-here.com",
182+
)
175183
```
176184

177185
### Timeouts
@@ -194,7 +202,10 @@ client = CasParser(
194202
)
195203

196204
# Override per-request:
197-
client.with_options(timeout=5.0).cas_parser.cams_kfintech()
205+
client.with_options(timeout=5.0).cas_parser.smart_parse(
206+
password="ABCDF",
207+
pdf_url="https://you-cas-pdf-url-here.com",
208+
)
198209
```
199210

200211
On timeout, an `APITimeoutError` is thrown.
@@ -235,16 +246,19 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
235246
from cas_parser import CasParser
236247

237248
client = CasParser()
238-
response = client.cas_parser.with_raw_response.cams_kfintech()
249+
response = client.cas_parser.with_raw_response.smart_parse(
250+
password="ABCDF",
251+
pdf_url="https://you-cas-pdf-url-here.com",
252+
)
239253
print(response.headers.get('X-My-Header'))
240254

241-
cas_parser = response.parse() # get the object that `cas_parser.cams_kfintech()` would have returned
255+
cas_parser = response.parse() # get the object that `cas_parser.smart_parse()` would have returned
242256
print(cas_parser.demat_accounts)
243257
```
244258

245-
These methods return an [`APIResponse`](https://github.com/stainless-sdks/cas-parser-python/tree/main/src/cas_parser/_response.py) object.
259+
These methods return an [`APIResponse`](https://github.com/CASParser/cas-parser-python/tree/main/src/cas_parser/_response.py) object.
246260

247-
The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/cas-parser-python/tree/main/src/cas_parser/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
261+
The async client returns an [`AsyncAPIResponse`](https://github.com/CASParser/cas-parser-python/tree/main/src/cas_parser/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
248262

249263
#### `.with_streaming_response`
250264

@@ -253,7 +267,10 @@ The above interface eagerly reads the full response body when you make the reque
253267
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
254268

255269
```python
256-
with client.cas_parser.with_streaming_response.cams_kfintech() as response:
270+
with client.cas_parser.with_streaming_response.smart_parse(
271+
password="ABCDF",
272+
pdf_url="https://you-cas-pdf-url-here.com",
273+
) as response:
257274
print(response.headers.get("X-My-Header"))
258275

259276
for line in response.iter_lines():
@@ -348,7 +365,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
348365

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

351-
We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/cas-parser-python/issues) with questions, bugs, or suggestions.
368+
We are keen for your feedback; please open an [issue](https://www.github.com/CASParser/cas-parser-python/issues) with questions, bugs, or suggestions.
352369

353370
### Determining the installed version
354371

bin/check-release-environment

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
errors=()
4+
5+
if [ -z "${PYPI_TOKEN}" ]; then
6+
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
7+
fi
8+
9+
lenErrors=${#errors[@]}
10+
11+
if [[ lenErrors -gt 0 ]]; then
12+
echo -e "Found the following errors in the release environment:\n"
13+
14+
for error in "${errors[@]}"; do
15+
echo -e "- $error\n"
16+
done
17+
18+
exit 1
19+
fi
20+
21+
echo "The environment is ready to push releases!"

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cas_parser"
3-
version = "0.0.1"
3+
version = "1.0.0"
44
description = "The official Python library for the CAS Parser API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -35,8 +35,8 @@ classifiers = [
3535
]
3636

3737
[project.urls]
38-
Homepage = "https://github.com/stainless-sdks/cas-parser-python"
39-
Repository = "https://github.com/stainless-sdks/cas-parser-python"
38+
Homepage = "https://github.com/CASParser/cas-parser-python"
39+
Repository = "https://github.com/CASParser/cas-parser-python"
4040

4141
[project.optional-dependencies]
4242
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
@@ -125,7 +125,7 @@ path = "README.md"
125125
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
126126
# replace relative links with absolute links
127127
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
128-
replacement = '[\1](https://github.com/stainless-sdks/cas-parser-python/tree/main/\g<2>)'
128+
replacement = '[\1](https://github.com/CASParser/cas-parser-python/tree/main/\g<2>)'
129129

130130
[tool.pytest.ini_options]
131131
testpaths = ["tests"]

release-please-config.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"packages": {
3+
".": {}
4+
},
5+
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
6+
"include-v-in-tag": true,
7+
"include-component-in-tag": false,
8+
"versioning": "prerelease",
9+
"prerelease": true,
10+
"bump-minor-pre-major": true,
11+
"bump-patch-for-minor-pre-major": false,
12+
"pull-request-header": "Automated Release PR",
13+
"pull-request-title-pattern": "release: ${version}",
14+
"changelog-sections": [
15+
{
16+
"type": "feat",
17+
"section": "Features"
18+
},
19+
{
20+
"type": "fix",
21+
"section": "Bug Fixes"
22+
},
23+
{
24+
"type": "perf",
25+
"section": "Performance Improvements"
26+
},
27+
{
28+
"type": "revert",
29+
"section": "Reverts"
30+
},
31+
{
32+
"type": "chore",
33+
"section": "Chores"
34+
},
35+
{
36+
"type": "docs",
37+
"section": "Documentation"
38+
},
39+
{
40+
"type": "style",
41+
"section": "Styles"
42+
},
43+
{
44+
"type": "refactor",
45+
"section": "Refactors"
46+
},
47+
{
48+
"type": "test",
49+
"section": "Tests",
50+
"hidden": true
51+
},
52+
{
53+
"type": "build",
54+
"section": "Build System"
55+
},
56+
{
57+
"type": "ci",
58+
"section": "Continuous Integration",
59+
"hidden": true
60+
}
61+
],
62+
"release-type": "python",
63+
"extra-files": [
64+
"src/cas_parser/_version.py"
65+
]
66+
}

0 commit comments

Comments
 (0)