From 6cb275c4eba0406c8ed3dd6db4e62e70eee6ba32 Mon Sep 17 00:00:00 2001 From: Dave Friedel Date: Sun, 20 Jul 2025 15:45:05 -0400 Subject: [PATCH] workflows --- .github/workflows/ci.yml | 79 +++++++++++++++++++++ .github/workflows/publish.yml | 105 ++++++++++++++++++++++++++++ LICENSE | 2 +- examples/basic_usage.py | 4 +- pyproject.toml | 2 +- src/sqrtspace_spacetime/__init__.py | 4 +- tests/__init__.py | 2 +- 7 files changed, 191 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0f46b20 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,79 @@ +name: CI + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[dev] + + - name: Lint with flake8 + run: | + flake8 src tests --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 src tests --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics + + - name: Type check with mypy + run: | + mypy src/sqrtspace_spacetime + + - name: Test with pytest + run: | + pytest tests -v --cov=sqrtspace_spacetime --cov-report=xml --cov-report=term + + - name: Upload coverage to Codecov + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' + uses: codecov/codecov-action@v4 + with: + file: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false + + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build package + run: python -m build + + - name: Check package + run: twine check dist/* + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..1fc6bd6 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,105 @@ +name: Publish to PyPI + +on: + release: + types: [published] + workflow_dispatch: + inputs: + test_pypi: + description: 'Publish to TestPyPI instead of PyPI' + required: false + type: boolean + default: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build package + run: python -m build + + - name: Check package + run: twine check dist/* + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + test-install: + needs: build + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ["3.8", "3.12"] + + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Test installation + run: | + pip install dist/*.whl + python -c "import sqrtspace_spacetime; print(sqrtspace_spacetime.__version__)" + + publish-testpypi: + if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_pypi == 'true' + needs: test-install + runs-on: ubuntu-latest + environment: testpypi + permissions: + id-token: write + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + skip-existing: true + + publish-pypi: + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_pypi == 'false') + needs: test-install + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/LICENSE b/LICENSE index 537ed35..40767fd 100644 --- a/LICENSE +++ b/LICENSE @@ -175,7 +175,7 @@ END OF TERMS AND CONDITIONS - Copyright 2024 Ubiquity SpaceTime Contributors + Copyright 2025 MarketAlly Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/examples/basic_usage.py b/examples/basic_usage.py index 78d4c94..02f3e8f 100644 --- a/examples/basic_usage.py +++ b/examples/basic_usage.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Basic usage examples for Ubiquity SpaceTime. +Basic usage examples for SqrtSpace SpaceTime. """ import time @@ -175,7 +175,7 @@ def example_spacetime_dict(): def main(): """Run all examples.""" - print("=== Ubiquity SpaceTime Examples ===") + print("=== SqrtSpace SpaceTime Examples ===") # Configure SpaceTime SpaceTimeConfig.set_defaults( diff --git a/pyproject.toml b/pyproject.toml index 6d415e7..8784096 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "sqrtspace-spacetime" version = "0.1.0" authors = [ - {name = "David H. Friedel Jr.", email = "dfriedel@marketally.com"}, + {name = "David H. Friedel Jr.", email = "dfriedel@marketally.ai"}, {name = "SqrtSpace Contributors"} ] description = "Memory-efficient algorithms and data structures using Williams' √n space-time tradeoffs" diff --git a/src/sqrtspace_spacetime/__init__.py b/src/sqrtspace_spacetime/__init__.py index 3657841..d115914 100644 --- a/src/sqrtspace_spacetime/__init__.py +++ b/src/sqrtspace_spacetime/__init__.py @@ -1,5 +1,5 @@ """ -Ubiquity SpaceTime: Memory-efficient algorithms using √n space-time tradeoffs. +SqrtSpace SpaceTime: Memory-efficient algorithms using √n space-time tradeoffs. This package implements Williams' theoretical computer science results showing that many algorithms can achieve better memory usage by accepting slightly @@ -13,7 +13,7 @@ from sqrtspace_spacetime.streams import Stream from sqrtspace_spacetime.memory import MemoryMonitor, MemoryPressureLevel __version__ = "0.1.0" -__author__ = "Ubiquity SpaceTime Contributors" +__author__ = "SqrtSpace SpaceTime Contributors" __license__ = "Apache-2.0" __all__ = [ diff --git a/tests/__init__.py b/tests/__init__.py index 32da5db..77b1ddf 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -# Ubiquity SpaceTime Test Suite \ No newline at end of file +# SqrtSpace SpaceTime Test Suite \ No newline at end of file