Skip to content

Commit 729a078

Browse files
committed
feat: python sdks
1 parent 66a61e7 commit 729a078

50 files changed

Lines changed: 4749 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Bug Report
2+
description: Report a bug in the SDK
3+
labels: ["bug"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to report a bug!
9+
10+
- type: input
11+
id: sdk-version
12+
attributes:
13+
label: SDK Version
14+
description: What version of the SDK are you using?
15+
placeholder: "0.1.0"
16+
validations:
17+
required: true
18+
19+
- type: input
20+
id: python-version
21+
attributes:
22+
label: Python Version
23+
description: What version of Python are you using?
24+
placeholder: "3.12.0"
25+
validations:
26+
required: true
27+
28+
- type: dropdown
29+
id: os
30+
attributes:
31+
label: Operating System
32+
options:
33+
- macOS
34+
- Linux
35+
- Windows
36+
validations:
37+
required: true
38+
39+
- type: textarea
40+
id: description
41+
attributes:
42+
label: Description
43+
description: A clear description of the bug
44+
validations:
45+
required: true
46+
47+
- type: textarea
48+
id: reproduction
49+
attributes:
50+
label: Steps to Reproduce
51+
description: Steps to reproduce the behavior
52+
placeholder: |
53+
1. Initialize client with...
54+
2. Call method...
55+
3. See error
56+
validations:
57+
required: true
58+
59+
- type: textarea
60+
id: expected
61+
attributes:
62+
label: Expected Behavior
63+
description: What did you expect to happen?
64+
validations:
65+
required: true
66+
67+
- type: textarea
68+
id: actual
69+
attributes:
70+
label: Actual Behavior
71+
description: What actually happened?
72+
validations:
73+
required: true
74+
75+
- type: textarea
76+
id: code
77+
attributes:
78+
label: Code Sample
79+
description: Minimal code to reproduce the issue
80+
render: python

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Documentation
4+
url: https://docs.polymarket.us
5+
about: Check the documentation for usage guides
6+
- name: Discord
7+
url: https://discord.gg/polymarket
8+
about: Ask questions in our Discord community
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Feature Request
2+
description: Suggest a new feature
3+
labels: ["enhancement"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for suggesting a feature!
9+
10+
- type: textarea
11+
id: description
12+
attributes:
13+
label: Description
14+
description: A clear description of the feature you'd like
15+
validations:
16+
required: true
17+
18+
- type: textarea
19+
id: use-case
20+
attributes:
21+
label: Use Case
22+
description: Why do you need this feature? What problem does it solve?
23+
validations:
24+
required: true
25+
26+
- type: textarea
27+
id: alternatives
28+
attributes:
29+
label: Alternatives Considered
30+
description: Any alternative solutions or workarounds you've considered
31+
32+
- type: textarea
33+
id: additional
34+
attributes:
35+
label: Additional Context
36+
description: Any other context, screenshots, or code samples

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Changes
2+
3+
<!-- What does this PR do? -->
4+
5+
## Testing
6+
7+
<!-- How was this tested? -->
8+
9+
## Checklist
10+
11+
- [ ] Tests pass (`pytest`)
12+
- [ ] Linting passes (`ruff check .`)
13+
- [ ] Types check (`mypy polymarket_us`)

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12'
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v4
25+
26+
- name: Install dependencies
27+
run: uv sync --all-extras
28+
29+
- name: Run ruff check
30+
run: uv run ruff check .
31+
32+
- name: Run ruff format check
33+
run: uv run ruff format --check .
34+
35+
typecheck:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Set up Python
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.12'
44+
45+
- name: Install uv
46+
uses: astral-sh/setup-uv@v4
47+
48+
- name: Install dependencies
49+
run: uv sync --all-extras
50+
51+
- name: Run mypy
52+
run: uv run mypy polymarket_us
53+
54+
test:
55+
runs-on: ubuntu-latest
56+
strategy:
57+
matrix:
58+
python-version: ['3.10', '3.11', '3.12', '3.13']
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: Set up Python ${{ matrix.python-version }}
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: ${{ matrix.python-version }}
66+
67+
- name: Install uv
68+
uses: astral-sh/setup-uv@v4
69+
70+
- name: Install dependencies
71+
run: uv sync --all-extras
72+
73+
- name: Run tests
74+
run: uv run pytest

.github/workflows/publish.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
id-token: write
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
token: ${{ secrets.GH_PAT }}
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.12'
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v4
29+
30+
- name: Install dependencies
31+
run: uv sync --all-extras
32+
33+
- name: Run tests
34+
run: uv run pytest
35+
36+
- name: Configure Git
37+
run: |
38+
git config user.name "github-actions[bot]"
39+
git config user.email "github-actions[bot]@users.noreply.github.com"
40+
41+
- name: Determine version bump type
42+
id: version
43+
run: |
44+
COMMIT_MSG=$(git log -1 --pretty=%B)
45+
if echo "$COMMIT_MSG" | grep -iq "^feat!:\|BREAKING CHANGE"; then
46+
echo "bump=major" >> $GITHUB_OUTPUT
47+
elif echo "$COMMIT_MSG" | grep -iq "^feat:"; then
48+
echo "bump=minor" >> $GITHUB_OUTPUT
49+
else
50+
echo "bump=patch" >> $GITHUB_OUTPUT
51+
fi
52+
53+
- name: Bump version
54+
run: |
55+
# Get current version from pyproject.toml
56+
CURRENT_VERSION=$(grep -oP 'version = "\K[^"]+' pyproject.toml)
57+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
58+
59+
BUMP_TYPE="${{ steps.version.outputs.bump }}"
60+
61+
if [ "$BUMP_TYPE" = "major" ]; then
62+
MAJOR=$((MAJOR + 1))
63+
MINOR=0
64+
PATCH=0
65+
elif [ "$BUMP_TYPE" = "minor" ]; then
66+
MINOR=$((MINOR + 1))
67+
PATCH=0
68+
else
69+
PATCH=$((PATCH + 1))
70+
fi
71+
72+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
73+
74+
# Update version in pyproject.toml
75+
sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" pyproject.toml
76+
77+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
78+
79+
- name: Commit and push version bump
80+
run: |
81+
git add pyproject.toml
82+
git commit -m "chore: bump version to ${{ env.NEW_VERSION }} [skip ci]"
83+
git push
84+
85+
- name: Build package
86+
run: uv build
87+
88+
- name: Publish to PyPI
89+
uses: pypa/gh-action-pypi-publish@release/v1
90+
with:
91+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.nox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
*.py,cover
48+
.hypothesis/
49+
.pytest_cache/
50+
51+
# Translations
52+
*.mo
53+
*.pot
54+
55+
# Environments
56+
.env
57+
.venv
58+
env/
59+
venv/
60+
ENV/
61+
env.bak/
62+
venv.bak/
63+
64+
# IDEs
65+
.idea/
66+
.vscode/
67+
*.swp
68+
*.swo
69+
*~
70+
71+
# mypy
72+
.mypy_cache/
73+
.dmypy.json
74+
dmypy.json
75+
76+
# ruff
77+
.ruff_cache/
78+
79+
# OS
80+
.DS_Store
81+
Thumbs.db
82+
83+
# Secrets
84+
.env.local
85+
.env.*.local

0 commit comments

Comments
 (0)