Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package for distribution #29

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]],
hugovk marked this conversation as resolved.
Show resolved Hide resolved
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.

Loading