Skip to content

Commit 3a218f6

Browse files
committed
Project init
1 parent 77a2c30 commit 3a218f6

File tree

10 files changed

+139
-24
lines changed

10 files changed

+139
-24
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.9'
18+
- name: Install dependencies
19+
run: pip install poetry && poetry install
20+
- name: Run tests
21+
run: pytest --cov=jup_ag_sdk

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build_and_publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.9'
17+
- name: Install Poetry
18+
run: pip install poetry
19+
- name: Install dependencies
20+
run: poetry install
21+
- name: Build package
22+
run: poetry build
23+
# - name: Publish to PyPI
24+
# env:
25+
# PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
26+
# run: poetry publish --username __token__ --password $PYPI_API_TOKEN

.pre-commit-config.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,3 @@ repos:
1515
hooks:
1616
- id: flake8
1717
args: ["--max-line-length=88"]
18-
19-
- repo: https://github.com/pre-commit/mirrors-mypy
20-
rev: v1.15.0
21-
hooks:
22-
- id: mypy
23-
args:
24-
- --config-file=./pyproject.toml
25-
- --install-types
26-
- --non-interactive

check_code.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
black jup_ag_sdk tests
2+
isort jup_ag_sdk tests
3+
flake8 jup_ag_sdk tests
4+
mypy jup_ag_sdk tests
5+
pytest
File renamed without changes.

jup_ag_sdk/client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from typing import Dict
2+
3+
4+
class JupiterClient:
5+
def __init__(self, base_url: str = "https://api.jupiter.ag/v4") -> None:
6+
self.base_url = base_url
7+
8+
def get_quote(
9+
self, input_mint: str, output_mint: str, amount: int
10+
) -> Dict[str, str]:
11+
"""Placeholder method for getting a quote"""
12+
return {
13+
"inputMint": input_mint,
14+
"outputMint": output_mint,
15+
"amount": str(amount),
16+
"quote": "mocked-quote-data",
17+
}

jup_ag_sdk/example.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def add_one(number: int) -> int:
2+
return number + 1

pyproject.toml

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,61 @@
1-
[project]
2-
name = "jup_ag_sdk"
1+
[tool.poetry]
2+
name = "jup-ag-sdk"
33
version = "0.0.1"
4-
authors = [
5-
{ name="Fiji", email="[email protected]" },
6-
]
74
description = "Python SDK for Jupiter Exchange APIs."
5+
authors = ["Fiji <[email protected]>"]
6+
license = "MIT"
87
readme = "README.md"
9-
requires-python = ">=3.8"
8+
homepage = "https://github.com/cmoutafidis/jup-ag-sdk"
9+
repository = "https://github.com/cmoutafidis/jup-ag-sdk"
10+
keywords = ["solana", "jupiter", "sdk"]
11+
packages = [{include = "jup_ag_sdk"}]
1012
classifiers = [
1113
"Programming Language :: Python :: 3",
1214
"Operating System :: OS Independent",
1315
]
14-
license = "MIT"
15-
license-files = ["LICEN[CS]E*"]
1616

17-
[project.urls]
18-
Homepage = "https://github.com/cmoutafidis/jup-ag-sdk"
19-
Issues = "https://github.com/cmoutafidis/jup-ag-sdk/issues"
17+
[tool.poetry.dependencies]
18+
python = "^3.9"
19+
requests = "^2.31.0"
20+
21+
[tool.poetry.dev-dependencies]
22+
pytest = "^8.3.4"
23+
responses = "^0.25.6"
24+
flake8 = "^7.1.1"
25+
black = "^25.1.0"
26+
isort = "^6.0.0"
27+
mypy = "^1.15.0"
28+
pre-commit = "^4.1.0"
29+
pytest-cov = "^4.1"
30+
bandit = "^1.7"
31+
safety = "^2.3"
32+
33+
[tool.poetry.group.dev.dependencies]
34+
pytest = "^8.3.4"
35+
responses = "^0.25.6"
36+
flake8 = "^7.1.1"
37+
black = "^25.1.0"
38+
isort = "^6.0.0"
39+
mypy = "^1.15.0"
40+
pre-commit = "^4.1.0"
41+
42+
[tool.black]
43+
line-length = 88
44+
target-version = ['py39', 'py310']
45+
46+
[tool.isort]
47+
profile = "black"
48+
49+
[tool.flake8]
50+
max-line-length = 88
51+
exclude = ["__pycache__", "build/", "dist/"]
52+
53+
[tool.mypy]
54+
strict = true
55+
disallow_untyped_defs = true
56+
disable_error_code = ["annotation-unchecked"]
2057

2158
[build-system]
22-
requires = ["hatchling"]
23-
build-backend = "hatchling.build"
59+
requires = ["poetry-core"]
60+
build-backend = "poetry.core.masonry.api"
61+

src/jup_ag_sdk/example.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/test_client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
3+
from jup_ag_sdk.client import JupiterClient
4+
5+
6+
@pytest.fixture
7+
def client() -> JupiterClient:
8+
return JupiterClient()
9+
10+
11+
def test_get_quote(client: JupiterClient) -> None:
12+
"""Test the get_quote function."""
13+
response = client.get_quote("SOL", "USDC", 1000000)
14+
assert response["inputMint"] == "SOL"
15+
assert response["outputMint"] == "USDC"
16+
assert response["amount"] == "1000000"
17+
assert "quote" in response

0 commit comments

Comments
 (0)