Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ labels: ''
assignees: ''

---


69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v2

- name: Set up Python
run: uv python install 3.10

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run ruff format check
run: uv run ruff format --check src

- name: Run ruff linter
run: uv run ruff check src

- name: Run mypy
run: uv run mypy src/

test:
runs-on: ubuntu-latest
strategy:
max-parallel: 1 # Run tests sequentially to avoid rate limiting
matrix:
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v2

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Add delay to avoid rate limiting
run: |
echo "Waiting 30 seconds to avoid API rate limiting..."
sleep 30

- name: Run tests with coverage
env:
ALPACA_API_KEY: ${{ secrets.ALPACA_API_KEY }}
ALPACA_SECRET_KEY: ${{ secrets.ALPACA_SECRET_KEY }}
run: |
uv run pytest --cov=py_alpaca_api --cov-report=xml --cov-report=term-missing tests

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
verbose: true
12 changes: 6 additions & 6 deletions .github/workflows/test-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
pull_request:

env:
POETRY_VERSION: 1.8.3
ALPACA_API_KEY: ${{ secrets.ALPACA_API_KEY }}
Expand All @@ -13,7 +13,7 @@ jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
max-parallel: 1 # Run sequentially to avoid rate limiting
fail-fast: false
matrix:
python-version: ["3.12"]
Expand All @@ -40,7 +40,7 @@ jobs:
# - uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}

# # Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow
# # from installing Poetry every time, which can be slow. Note the use of the Poetry version
# # number in the cache key, and the "-0" suffix: this allows you to invalidate the cache
Expand All @@ -50,7 +50,7 @@ jobs:
# with:
# path: ~/.local
# key: poetry-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ env.POETRY_VERSION }}

# # Install Poetry. You could do this manually, or there are several actions that do this.
# # `snok/install-poetry` seems to be minimal yet complete, and really just calls out to
# # Poetry's default install script, which feels correct. I pin the Poetry version here
Expand All @@ -65,7 +65,7 @@ jobs:
# version: 1.8.3
# virtualenvs-create: true
# virtualenvs-in-project: true

# # Cache your dependencies (i.e. all the stuff in your `pyproject.toml`)
# - name: cache venv
# uses: actions/cache@v4
Expand All @@ -76,4 +76,4 @@ jobs:
# if: steps.cache-deps.outputs.cache-hit != 'true'
# - run: poetry install --no-interaction
# - run: poetry run ruff check --fix
# - run: poetry run pytest
# - run: poetry run pytest
38 changes: 32 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@
__pycache__/
*.py[cod]
*$py.class

.ruff_cache/
.mypy_cache/
.pytest_cache/
.coverage
.coverage.*
.coverage.xml
.coverage.html
.coverage.json
.coverage.yaml
.coverage.yml
.coverage.xml
.coverage.html
.coverage.json
.coverage.yaml
.coverage.yml
# C extensions
*.so
.idea/
Expand Down Expand Up @@ -164,8 +178,20 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

<<<<<<< HEAD
test.sh
=======
# test.sh
>>>>>>> e0e18b93a48f51c1ed656a62155be25a128e460c
# test.sh - keep this file for local testing

# Ruff
.ruff_cache/

# UV
.venv/

# MacOS
.DS_Store

# Editor directories and files
.idea/
.vscode/
*.swp
*.swo
*~
3 changes: 0 additions & 3 deletions .grok/settings.json

This file was deleted.

61 changes: 52 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,53 @@
# Pre-commit hooks for code quality and consistency
# See https://pre-commit.com for more information

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.8
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
# Pre-commit framework hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-private-key
- id: debug-statements
- id: mixed-line-ending
args: ['--fix=lf']

# Ruff - Fast Python linter and formatter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
hooks:
# Run the linter
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
# Run the formatter
- id: ruff-format

# MyPy - Static type checker
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
additional_dependencies:
- types-requests
- types-beautifulsoup4
- pandas-stubs
args: [--config-file=pyproject.toml]
pass_filenames: true
exclude: ^tests/

# Configuration
default_language_version:
python: python3.10

ci:
autofix_prs: true
autoupdate_schedule: weekly
autoupdate_commit_msg: 'chore: update pre-commit hooks'
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ sphinx:

python:
install:
- requirements: docs/rtd_requirements.txt
- requirements: docs/rtd_requirements.txt
Loading