Skip to content

Commit

Permalink
Merge pull request #12 from sbalian/maintenance
Browse files Browse the repository at this point in the history
Maintenance
  • Loading branch information
sbalian committed Feb 25, 2024
2 parents bbeed3b + 761ee52 commit 8d45f3f
Show file tree
Hide file tree
Showing 10 changed files with 780 additions and 181 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
name: Upload Python Package
name: Publish

on:
release:
types: [published]
push:
tags:
- '*'

jobs:
deploy:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: actions/setup-python@v5
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
python-version: '3.10'
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Build
run: poetry build
- name: Publish
run: poetry publish
91 changes: 36 additions & 55 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,49 @@
name: Testing, type checking and linting
name: Tests

on: [push]
on: push

jobs:

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Prepare
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tests
run: |
tox -e py
test-numpy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
exclude:
- os: macos-latest
python-version: '3.11'
python-version: ['3.9', '3.10', '3.11', '3.12']
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Prepare
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tests
run: |
tox -e numpy
- name: Check types
run: |
mkdir .mypy_cache
tox -e mypy
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install the package (no lock file)
run: rm poetry.lock && poetry install -E numpy
- name: Run pytest
run: QRANDOM_API_KEY=key poetry run pytest
- name: Run mypy
run: poetry run mypy --install-types --non-interactive .

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Prepare
run: |
python -m pip install --upgrade pip
pip install tox
- name: Lint
run: |
tox -e flake8,black,isort
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install the package
run: poetry install -E numpy
- name: Run black
run: poetry run black --check .
- name: Run isort
run: poetry run isort --check .
- name: Run flake8
run: poetry run flake8
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
*.pyc
.tox/
dist/
*.egg-info/
TODO
src/qrandom/version.py
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2023 Seto Balian
Copyright 2024 Seto Balian

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Quantum random numbers in Python

[![Tests](https://img.shields.io/github/actions/workflow/status/sbalian/quantum-random/tests.yml?label=tests
)](https://github.com/sbalian/quantum-random/actions/workflows/tests.yml)
[![Version](https://img.shields.io/pypi/v/quantum-random)](https://pypi.org/project/quantum-random/)
![Python Versions](https://img.shields.io/pypi/pyversions/quantum-random)
[![Download Stats](https://img.shields.io/pypi/dm/quantum-random)](https://pypistats.org/packages/quantum-random)
Expand Down Expand Up @@ -42,12 +44,11 @@ array([[0.37220278, 0.24337193, 0.67534826],
[0.35894084, 0.72219929, 0.55388594]])
```

NumPy is supported using [RandomGen][randomgen]. Note that there are currently
no RandomGen wheels available for Python 3.11.
NumPy is supported using [RandomGen][randomgen].

## Installation

The minimum supported Python version is 3.7. Install with `pip`:
The minimum supported Python version is 3.9. Install with `pip`:

```bash
pip install -U quantum-random
Expand Down Expand Up @@ -87,10 +88,8 @@ if you need to pre-fetch at the start of your computation.

## Tests

The tests run for Python 3.7 - 3.11 on the latest Windows,
macOS and Ubuntu runner images. For Python 3.11 on macOS, the tests run
only with no NumPy support as RandomGen fails to compile. Use [tox][tox] to run
the tests locally.
The tests run for Python 3.9 - 3.12 on the latest Windows,
macOS and Ubuntu runner images. Use [tox][tox] to run the tests locally.

See [here](./analysis/uniform.md) for a visualisation and a Kolmogorov–Smirnov
test.
Expand Down
Loading

0 comments on commit 8d45f3f

Please sign in to comment.