Skip to content

Commit

Permalink
Merge pull request #29 from hugovk/package
Browse files Browse the repository at this point in the history
Package for distribution
  • Loading branch information
ArendPeter authored Dec 18, 2024
2 parents 539d3b1 + 8b17581 commit 964a13e
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: CI
on:
push:
pull_request:
workflow_dispatch:

env:
FORCE_COLOR: 1
Expand All @@ -28,11 +29,10 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pip install -r requirements.txt
run: pip install .[tests]

- name: Check Python version
run: python -V

- name: Test with pytest
run: pytest -vs

18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ Python implementation of the [STAR Voting](https://www.starvoting.org/) system.
## Getting started
Install the required packages

`pip install -r requirements.txt`
```shell
pip install .
```

## Usage
### Single winner STAR
To run a single winner election create a pandas dataframe of the ballot data and pass it into the STAR function

```
from STAR import STAR
```python
from starpy.STAR import STAR
import pandas as pd
ballots = pd.DataFrame(columns=['Allie', 'Billy', 'Candace'],
data=[*2*[[5, 4, 0]],
Expand All @@ -22,16 +24,16 @@ print(results['elected'])
```

### Multi-winner Bloc STAR
To run a multi-winner bloc STAR race, set the input parameter numwinners
```
results = STAR(ballots,numwinners=2)
To run a multi-winner bloc STAR race, set the input parameter `numwinners`
```python
results = STAR(ballots, numwinners=2)
```

### Multi-winner Proportional STAR
To run proportional STAR
```
```python
from starpy.Allocated_Score import Allocated_Score
import pandas as pd
from Allocated_Score import Allocated_Score
numwinners=2
ballots = pd.DataFrame(columns=['Allie', 'Billy', 'Candace'],
data=[*2*[[5, 4, 0]],
Expand Down
40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[build-system]
build-backend = "hatchling.build"
requires = [
"hatchling",
]

[project]
name = "starpy"
version = "0.0.001"
description = "Python implementation of the STAR Voting system"
readme = "README.md"
keywords = [
"STAR voting",
"voting",
]
license-files = { paths = [ "LICENSE" ] }
requires-python = ">=3.9"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"numpy>=1.21.4",
"pandas>=1.3.4",
]
optional-dependencies.tests = [
"pytest",
]
urls.Changelog = "https://github.com/Equal-Vote/starpy/releases"
urls.Homepage = "https://github.com/Equal-Vote/starpy"
urls.Source = "https://github.com/Equal-Vote/starpy"
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

9 changes: 0 additions & 9 deletions setup.py

This file was deleted.

0 comments on commit 964a13e

Please sign in to comment.