Skip to content

Commit

Permalink
update repo setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Graeme22 committed Jan 13, 2025
1 parent 7f4786a commit 582be34
Show file tree
Hide file tree
Showing 10 changed files with 286 additions and 252 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: tastyware
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is, with screenshots or logs of problematic behavior.

**How to reproduce**
Post your code so the source of the problem can be identified.
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Description

## Related issue(s)
Fixes ...

## Pre-merge checklist
- [ ] Code formatted correctly (check with `make lint`)
- [ ] Code implemented for both sync and async
- [ ] Passing tests locally (check with `make test`)
- [ ] New tests added (if applicable)
15 changes: 5 additions & 10 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.12"
python-version: "3.10"
- uses: yezz123/setup-uv@v4
- name: Setup uv venv
run: |
uv sync
uv pip install .
- name: Lint with ruff
run: |
uv run ruff check tradestation/
uv run ruff check tests/
env:
TS_API_KEY: ${{ secrets.TS_API_KEY }}
- name: Type check with mypy
uv run ruff check tradestation/ tests/
- name: Type check with pyright
run: |
uv run mypy -p tradestation
uv run mypy -p tests
uv run pyright tradestation/ tests/
- name: Test with pytest
run: |
uv run pytest --cov=tradestation --cov-report=term-missing tests/ --cov-fail-under=95
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.10
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
.PHONY: install lint test docs
.PHONY: install lint test

install:
uv sync
uv pip install -e .

lint:
uv run ruff check tradestation/
uv run ruff check tests/
uv run mypy -p tradestation
uv run mypy -p tests
uv run ruff format tradestation/ tests/
uv run ruff check tradestation/ tests/
uv run pyright tradestation/ tests/

test:
uv run pytest --cov=tradestation --cov-report=term-missing tests/ --cov-fail-under=95

docs:
cd docs; make html
22 changes: 19 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,34 @@ build-backend = "hatchling.build"
[project]
name = "tradestation"
version = "0.2"
description = "An unofficial Python SDK for Tradestation!"
description = "An unofficial, sync/async SDK for Tradestation!"
readme = "README.md"
requires-python = ">=3.10"
license = {file = "LICENSE"}
authors = [
{name = "Graeme Holliday", email = "[email protected]"},
{name = "Ethan Corgatelli", email = "[email protected]"},
]
dependencies = [
"httpx>=0.27.2",
"pydantic>=2.9.2",
]

[project.urls]
Homepage = "https://github.com/tastyware/tradestation"
Documentation = "https://tradestation.readthedocs.io/en/latest"

[tool.uv]
dev-dependencies = [
"mypy>=1.11.2",
"pytest>=8.3.3",
"pytest-cov>=5.0.0",
"ruff>=0.6.7",
"sphinx>=8.0.2",
"pyright>=1.1.391",
"pytest-aio>=1.9.0",
]

[tool.setuptools.package-data]
"tradestation" = ["py.typed"]

[tool.setuptools.packages.find]
where = ["tradestation"]
27 changes: 27 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

from pytest import fixture

from tradestation import Session


# Run all tests with asyncio only
@fixture(scope="session")
def aiolib():
return "asyncio"


@fixture(scope="session")
def credentials():
username = os.getenv("TS_USERNAME")
password = os.getenv("TS_PASSWORD")
assert username is not None
assert password is not None
return username, password


@fixture(scope="session")
async def session(credentials, aiolib):
session = Session(*credentials)
yield session
# session.destroy()
15 changes: 8 additions & 7 deletions tradestation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import logging

from .session import Session

API_URL_V3 = 'https://api.tradestation.com/v3'
API_URL_V2 = 'https://api.tradestation.com/v2'
API_URL_SIM = 'https://sim-api.tradestation.com/v3'
VERSION = '0.2'
API_URL_V3 = "https://api.tradestation.com/v3"
API_URL_V2 = "https://api.tradestation.com/v2"
API_URL_SIM = "https://sim-api.tradestation.com/v3"
VERSION = "0.2"

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

__all__ = ['Session']
# ruff: noqa: E402

from .session import Session

__all__ = ["Session"]
420 changes: 197 additions & 223 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit 582be34

Please sign in to comment.