Skip to content

Commit f03316f

Browse files
committed
update version
1 parent 9367f59 commit f03316f

File tree

12 files changed

+669
-95
lines changed

12 files changed

+669
-95
lines changed

.github/workflows/version-sync.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Version Synchronization
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths: ['src/project_x_py/__init__.py']
7+
workflow_dispatch:
8+
inputs:
9+
force_sync:
10+
description: 'Force version synchronization'
11+
required: false
12+
default: 'false'
13+
14+
jobs:
15+
sync-versions:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.12'
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v3
29+
30+
- name: Check version synchronization
31+
id: check-sync
32+
run: |
33+
python scripts/version_sync.py
34+
if git diff --quiet; then
35+
echo "sync_needed=false" >> $GITHUB_OUTPUT
36+
else
37+
echo "sync_needed=true" >> $GITHUB_OUTPUT
38+
fi
39+
40+
- name: Commit version updates
41+
if: steps.check-sync.outputs.sync_needed == 'true'
42+
run: |
43+
git config --local user.email "[email protected]"
44+
git config --local user.name "GitHub Action"
45+
git add -A
46+
git commit -m "🔄 Auto-sync version numbers [skip ci]"
47+
git push
48+
49+
- name: Create version tag
50+
if: steps.check-sync.outputs.sync_needed == 'true'
51+
run: |
52+
VERSION=$(python -c "from src.project_x_py import __version__; print(__version__)")
53+
git tag "v$VERSION" || echo "Tag v$VERSION already exists"
54+
git push origin "v$VERSION" || echo "Tag v$VERSION already pushed"

Makefile

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
.PHONY: version-sync build docs clean test lint help
2+
3+
# Version management
4+
version-sync:
5+
@echo "🔄 Synchronizing version numbers..."
6+
@python scripts/version_sync.py
7+
8+
# Build with version sync
9+
build: version-sync
10+
@echo "🔨 Building package with synchronized versions..."
11+
uv build
12+
13+
# Development build (faster, no version sync)
14+
build-dev:
15+
@echo "🔨 Development build..."
16+
uv build
17+
18+
# Documentation build
19+
docs: version-sync
20+
@echo "📚 Building documentation..."
21+
python scripts/build-docs.py
22+
23+
# Testing
24+
test:
25+
@echo "🧪 Running tests..."
26+
uv run pytest
27+
28+
# Linting and formatting
29+
lint:
30+
@echo "🔍 Running linters..."
31+
uv run ruff check .
32+
uv run mypy src/
33+
34+
format:
35+
@echo "✨ Formatting code..."
36+
uv run ruff format .
37+
38+
# Clean build artifacts
39+
clean:
40+
@echo "🧹 Cleaning build artifacts..."
41+
rm -rf dist/
42+
rm -rf build/
43+
rm -rf *.egg-info/
44+
find . -type d -name "__pycache__" -delete
45+
find . -type f -name "*.pyc" -delete
46+
47+
# Version bumping
48+
bump-patch: version-sync
49+
@echo "📦 Bumping patch version..."
50+
@python -c "\
51+
import re; \
52+
from pathlib import Path; \
53+
init_file = Path('src/project_x_py/__init__.py'); \
54+
content = init_file.read_text(); \
55+
current = re.search(r'__version__ = \"([^\"]+)\"', content).group(1); \
56+
major, minor, patch = current.split('.'); \
57+
new_version = f'{major}.{minor}.{int(patch)+1}'; \
58+
new_content = re.sub(r'__version__ = \"[^\"]+\"', f'__version__ = \"{new_version}\"', content); \
59+
init_file.write_text(new_content); \
60+
print(f'Version bumped: {current} → {new_version}'); \
61+
"
62+
@$(MAKE) version-sync
63+
64+
bump-minor: version-sync
65+
@echo "📦 Bumping minor version..."
66+
@python -c "\
67+
import re; \
68+
from pathlib import Path; \
69+
init_file = Path('src/project_x_py/__init__.py'); \
70+
content = init_file.read_text(); \
71+
current = re.search(r'__version__ = \"([^\"]+)\"', content).group(1); \
72+
major, minor, patch = current.split('.'); \
73+
new_version = f'{major}.{int(minor)+1}.0'; \
74+
new_content = re.sub(r'__version__ = \"[^\"]+\"', f'__version__ = \"{new_version}\"', content); \
75+
init_file.write_text(new_content); \
76+
print(f'Version bumped: {current} → {new_version}'); \
77+
"
78+
@$(MAKE) version-sync
79+
80+
# Release process
81+
release: clean test lint version-sync build
82+
@echo "🚀 Release package ready!"
83+
@echo " Next steps:"
84+
@echo " 1. uv publish"
85+
@echo " 2. git tag v$$(python -c 'from src.project_x_py import __version__; print(__version__)')"
86+
@echo " 3. git push --tags"
87+
88+
# Help
89+
help:
90+
@echo "📋 Available targets:"
91+
@echo " version-sync Sync version across all files"
92+
@echo " build Build package (with version sync)"
93+
@echo " build-dev Build package (no version sync)"
94+
@echo " docs Build documentation"
95+
@echo " test Run tests"
96+
@echo " lint Run linters"
97+
@echo " format Format code"
98+
@echo " clean Clean build artifacts"
99+
@echo " bump-patch Bump patch version"
100+
@echo " bump-minor Bump minor version"
101+
@echo " release Full release process"
102+
@echo " help Show this help"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A **high-performance Python client** for the TopStepX ProjectX Gateway API, desi
99

1010
## 📊 Project Status
1111

12-
**Current Version**: v1.0.12 (Enhanced with Complete TA-Lib Overlap Indicators)
12+
**Current Version**: v1.0.13 (Enhanced with Complete TA-Lib Overlap Indicators)
1313

1414
**Production Ready Features**:
1515
- Complete futures trading API integration with connection pooling
@@ -594,7 +594,7 @@ We welcome contributions! Please follow these guidelines:
594594

595595
## 📝 Changelog
596596

597-
### Version 1.0.12 (Latest)
597+
### Version 1.0.13 (Latest)
598598
**🔄 Order-Position Synchronization & Enhanced Testing**
599599
-**Order-Position Sync**: Automatic synchronization between orders and positions
600600
-**Position Order Tracking**: Orders automatically tracked and associated with positions

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
project = "project-x-py"
2525
copyright = "2025, Jeff West"
2626
author = "Jeff West"
27-
release = "1.0.11"
28-
version = "1.0.11"
27+
release = "1.0.13"
28+
version = "1.0.13"
2929

3030
# -- General configuration ---------------------------------------------------
3131

justfile

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# project-x-py development commands
2+
3+
# Default recipe to display help
4+
default:
5+
@just --list
6+
7+
# Sync version numbers across all files
8+
version-sync:
9+
@echo "🔄 Synchronizing version numbers..."
10+
python scripts/version_sync.py
11+
12+
# Build package with version sync
13+
build: version-sync
14+
@echo "🔨 Building package with synchronized versions..."
15+
uv build
16+
17+
# Development build (faster, no version sync)
18+
build-dev:
19+
@echo "🔨 Development build..."
20+
uv build
21+
22+
# Build documentation with version sync
23+
docs: version-sync
24+
@echo "📚 Building documentation..."
25+
python scripts/build-docs.py
26+
27+
# Run tests
28+
test:
29+
@echo "🧪 Running tests..."
30+
uv run pytest
31+
32+
# Run linters
33+
lint:
34+
@echo "🔍 Running linters..."
35+
uv run ruff check .
36+
uv run mypy src/
37+
38+
# Format code
39+
format:
40+
@echo "✨ Formatting code..."
41+
uv run ruff format .
42+
43+
# Clean build artifacts
44+
clean:
45+
@echo "🧹 Cleaning build artifacts..."
46+
rm -rf dist/
47+
rm -rf build/
48+
rm -rf *.egg-info/
49+
find . -type d -name "__pycache__" -delete
50+
find . -type f -name "*.pyc" -delete
51+
52+
# Bump patch version (1.0.1 -> 1.0.2)
53+
bump-patch: version-sync
54+
#!/usr/bin/env python3
55+
import re
56+
from pathlib import Path
57+
58+
init_file = Path("src/project_x_py/__init__.py")
59+
content = init_file.read_text()
60+
current = re.search(r'__version__ = "([^"]+)"', content).group(1)
61+
major, minor, patch = current.split(".")
62+
new_version = f"{major}.{minor}.{int(patch)+1}"
63+
new_content = re.sub(r'__version__ = "[^"]+"', f'__version__ = "{new_version}"', content)
64+
init_file.write_text(new_content)
65+
print(f"Version bumped: {current} → {new_version}")
66+
just version-sync
67+
68+
# Bump minor version (1.0.1 -> 1.1.0)
69+
bump-minor: version-sync
70+
#!/usr/bin/env python3
71+
import re
72+
from pathlib import Path
73+
74+
init_file = Path("src/project_x_py/__init__.py")
75+
content = init_file.read_text()
76+
current = re.search(r'__version__ = "([^"]+)"', content).group(1)
77+
major, minor, patch = current.split(".")
78+
new_version = f"{major}.{int(minor)+1}.0"
79+
new_content = re.sub(r'__version__ = "[^"]+"', f'__version__ = "{new_version}"', content)
80+
init_file.write_text(new_content)
81+
print(f"Version bumped: {current} → {new_version}")
82+
just version-sync
83+
84+
# Bump major version (1.0.1 -> 2.0.0)
85+
bump-major: version-sync
86+
#!/usr/bin/env python3
87+
import re
88+
from pathlib import Path
89+
90+
init_file = Path("src/project_x_py/__init__.py")
91+
content = init_file.read_text()
92+
current = re.search(r'__version__ = "([^"]+)"', content).group(1)
93+
major, minor, patch = current.split(".")
94+
new_version = f"{int(major)+1}.0.0"
95+
new_content = re.sub(r'__version__ = "[^"]+"', f'__version__ = "{new_version}"', content)
96+
init_file.write_text(new_content)
97+
print(f"Version bumped: {current} → {new_version}")
98+
just version-sync
99+
100+
# Full release process
101+
release: clean test lint version-sync build
102+
@echo "🚀 Release package ready!"
103+
@echo " Next steps:"
104+
@echo " 1. uv publish"
105+
@echo " 2. git tag v$(python -c 'from src.project_x_py import __version__; print(__version__)')"
106+
@echo " 3. git push --tags"
107+
108+
# Show current version
109+
version:
110+
@python -c "from src.project_x_py import __version__; print(f'Current version: v{__version__}')"
111+
112+
# Check if versions are synchronized
113+
check-version:
114+
@echo "🔍 Checking version synchronization..."
115+
python scripts/version_sync.py

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "project-x-py"
3-
version = "1.0.12"
3+
version = "1.0.13"
44
description = "Professional Python client for TopStepX ProjectX Gateway API - futures trading, real-time data, and market analysis"
55
readme = "README.md"
66
license = { text = "MIT" }
@@ -85,6 +85,8 @@ Changelog = "https://github.com/TexasCoding/project-x-py/blob/main/CHANGELOG.md"
8585
projectx-check = "project_x_py.cli:check_setup"
8686
projectx-config = "project_x_py.cli:create_config"
8787

88+
89+
8890
[build-system]
8991
requires = ["hatchling>=1.13.0"]
9092
build-backend = "hatchling.build"
@@ -130,6 +132,8 @@ exclude = [
130132
"node_modules",
131133
"site-packages",
132134
"venv",
135+
"justfile",
136+
"Makefile",
133137
]
134138

135139
[tool.ruff.lint]

scripts/build.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Build script for project-x-py that ensures version synchronization.
4+
5+
Usage:
6+
python scripts/build.py
7+
# Or with uv
8+
uv run scripts/build.py
9+
"""
10+
11+
import subprocess
12+
import sys
13+
from pathlib import Path
14+
15+
16+
def run_command(cmd: str, description: str) -> bool:
17+
"""Run a command and return success status."""
18+
print(f"🔄 {description}...")
19+
try:
20+
result = subprocess.run(cmd, shell=True, check=True, capture_output=True, text=True)
21+
if result.stdout.strip():
22+
print(result.stdout)
23+
return True
24+
except subprocess.CalledProcessError as e:
25+
print(f"❌ {description} failed:")
26+
print(e.stdout)
27+
print(e.stderr)
28+
return False
29+
30+
31+
def main():
32+
"""Main build process with version synchronization."""
33+
print("🚀 Building project-x-py with version synchronization...")
34+
35+
# Ensure we're in the project root
36+
project_root = Path(__file__).parent.parent
37+
original_cwd = Path.cwd()
38+
try:
39+
import os
40+
os.chdir(project_root)
41+
42+
# Step 1: Sync versions
43+
if not run_command("python scripts/version_sync.py", "Synchronizing versions"):
44+
return 1
45+
46+
# Step 2: Clean previous builds
47+
if not run_command("rm -rf dist/ build/ *.egg-info/", "Cleaning build artifacts"):
48+
print("⚠️ Clean failed, continuing...")
49+
50+
# Step 3: Build package
51+
if not run_command("uv build", "Building package"):
52+
return 1
53+
54+
print("✅ Build complete! Package ready in dist/")
55+
return 0
56+
57+
finally:
58+
os.chdir(original_cwd)
59+
60+
61+
if __name__ == "__main__":
62+
sys.exit(main())

0 commit comments

Comments
 (0)