A Python implementation of the celebrated Gale-Shapley Algorithm.
Project description
This is a Python implementation of the celebrated Gale-Shapley (a.k.a. the Deferred Acceptance) Algorithm.
Time complexity is O(n^2), space complexity is O(n).
User Guide
Requirements
- Python >= 3.12
- OS: Ubuntu, MacOS, Windows
Installation
There are three easy ways to install the package.
Install from PyPI
pip install gale-shapley-algorithm
For CLI support:
pip install "gale-shapley-algorithm[cli]"
For the GUI:
pip install "gale-shapley-algorithm[gui]"
Using Docker
An easy way to run the project is to use Docker. First, install Docker. Then, run the following command in the project directory.
docker build -t gale-shapley .
This will build the Docker image. After the image is built, the following are some examples of how to run the project.
docker run --rm -it \
-v $(pwd)/config/example_config_custom_input.yaml:/app/config/config.yaml \
-v $(pwd)/logs:/app/logs \
gale-shapley
The -v option mounts the specified config file and logs directory to the container. The --rm option removes the container after it exits. The -it option is for interactive mode.
To run the GUI instead:
docker run --rm -p 8000:8000 gale-shapley uv run uvicorn gale_shapley._api.app:app --host 0.0.0.0 --port 8000
Using Git
If you have git installed, simply run
git clone https://github.com/oedokumaci/gale-shapley-algorithm
to clone the repository locally. After cloning, install the dependencies using uv:
pip install uvcd gale-shapleyuvx --from taskipy task setup
Usage
Configuration
First edit the ./config/config.yaml to your liking. Example config files can be found at ./config/example_config_*.
Quick Start
After configuring the ./config/config.yaml, simply run the following command in the project directory.
uvx --from taskipy task run
Detailed Usage
For a list of all the CLI arguments and options, run
uvx --from taskipy task run -- --help
A sample output with currently implemented CLI arguments and options is shown below.
Developer Guide
Setup
This project is managed with uv and uses taskipy for task running. First install uv, then clone the project and run uvx --from taskipy task setup in the project directory to install all dependencies.
Development
Pre-commit Hooks
The project uses pre-commit hooks. Run
uv run pre-commit install
in the project directory to install hooks to your local .git.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gale_shapley_algorithm-1.1.2.tar.gz.
File metadata
- Download URL: gale_shapley_algorithm-1.1.2.tar.gz
- Upload date:
- Size: 373.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae50a4fa7f86980bfeff084e62ddd0670e22b59642c8af93d9c1d7eca08fc2c1
|
|
| MD5 |
74d9195799bfafa19150fa47533dbbcf
|
|
| BLAKE2b-256 |
adc34ecd18c817822ab9461e984522025aa487d3904e29ce1816d564c1a3ab56
|
File details
Details for the file gale_shapley_algorithm-1.1.2-py3-none-any.whl.
File metadata
- Download URL: gale_shapley_algorithm-1.1.2-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f3cb7ea9cd0824ac0a6af8c2c7b261d15a5568e2be1870cd50e94fe9cbbc06b
|
|
| MD5 |
4608df6c9d6501163af579e0fc43ee7d
|
|
| BLAKE2b-256 |
95089fdc604ce1b91d923ffc820720ad838e86f44f1253251805e207949c16ae
|