workflows

This commit is contained in:
David H. Friedel Jr. 2025-07-20 15:45:05 -04:00
parent 5afaa3a543
commit 6cb275c4eb
7 changed files with 191 additions and 7 deletions

79
.github/workflows/ci.yml vendored Normal file
View File

@ -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/

105
.github/workflows/publish.yml vendored Normal file
View File

@ -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

View File

@ -175,7 +175,7 @@
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
Copyright 2024 Ubiquity SpaceTime Contributors Copyright 2025 MarketAlly
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
Basic usage examples for Ubiquity SpaceTime. Basic usage examples for SqrtSpace SpaceTime.
""" """
import time import time
@ -175,7 +175,7 @@ def example_spacetime_dict():
def main(): def main():
"""Run all examples.""" """Run all examples."""
print("=== Ubiquity SpaceTime Examples ===") print("=== SqrtSpace SpaceTime Examples ===")
# Configure SpaceTime # Configure SpaceTime
SpaceTimeConfig.set_defaults( SpaceTimeConfig.set_defaults(

View File

@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "sqrtspace-spacetime" name = "sqrtspace-spacetime"
version = "0.1.0" version = "0.1.0"
authors = [ authors = [
{name = "David H. Friedel Jr.", email = "dfriedel@marketally.com"}, {name = "David H. Friedel Jr.", email = "dfriedel@marketally.ai"},
{name = "SqrtSpace Contributors"} {name = "SqrtSpace Contributors"}
] ]
description = "Memory-efficient algorithms and data structures using Williams' √n space-time tradeoffs" description = "Memory-efficient algorithms and data structures using Williams' √n space-time tradeoffs"

View File

@ -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 This package implements Williams' theoretical computer science results showing
that many algorithms can achieve better memory usage by accepting slightly 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 from sqrtspace_spacetime.memory import MemoryMonitor, MemoryPressureLevel
__version__ = "0.1.0" __version__ = "0.1.0"
__author__ = "Ubiquity SpaceTime Contributors" __author__ = "SqrtSpace SpaceTime Contributors"
__license__ = "Apache-2.0" __license__ = "Apache-2.0"
__all__ = [ __all__ = [

View File

@ -1 +1 @@
# Ubiquity SpaceTime Test Suite # SqrtSpace SpaceTime Test Suite