hedonic 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hedonic-0.0.4/PKG-INFO +97 -0
- hedonic-0.0.4/README.md +88 -0
- hedonic-0.0.4/pyproject.toml +14 -0
- hedonic-0.0.4/src/hedonic/__init__.py +33 -0
- hedonic-0.0.4/src/hedonic/py.typed +0 -0
hedonic-0.0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: hedonic
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: A Python library for hedonic games
|
|
5
|
+
Author: Lucas Lopes Felipe
|
|
6
|
+
Requires-Dist: igraph
|
|
7
|
+
Requires-Python: >=3.12
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# Hedonic
|
|
11
|
+
|
|
12
|
+
A Python library for hedonic games.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install hedonic
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from hedonic import Game
|
|
24
|
+
|
|
25
|
+
# Create a new game
|
|
26
|
+
game = Game("My Hedonic Game")
|
|
27
|
+
|
|
28
|
+
# Add players
|
|
29
|
+
game.add_player("Alice")
|
|
30
|
+
game.add_player("Bob")
|
|
31
|
+
game.add_player("Charlie")
|
|
32
|
+
|
|
33
|
+
# Get all players
|
|
34
|
+
players = game.get_players()
|
|
35
|
+
print(players) # ['Alice', 'Bob', 'Charlie']
|
|
36
|
+
|
|
37
|
+
# Print game info
|
|
38
|
+
print(game) # Game: My Hedonic Game with 3 players
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Development
|
|
42
|
+
|
|
43
|
+
This project uses `uv` for dependency management and building.
|
|
44
|
+
|
|
45
|
+
To set up development environment:
|
|
46
|
+
```bash
|
|
47
|
+
uv venv
|
|
48
|
+
source .venv/bin/activate
|
|
49
|
+
uv sync
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
To build the package:
|
|
53
|
+
```bash
|
|
54
|
+
uv build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
To publish to PyPI:
|
|
58
|
+
```bash
|
|
59
|
+
uv publish --token <your-pypi-token>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## GitHub Actions Publishing
|
|
63
|
+
|
|
64
|
+
This repository includes GitHub Actions workflows for automated publishing:
|
|
65
|
+
|
|
66
|
+
- **TestPyPI workflow**: Currently active, publishes to TestPyPI on `v*` tags
|
|
67
|
+
- **PyPI workflow**: Currently disabled (can be re-enabled later)
|
|
68
|
+
- **Automatic publishing** when you push version tags
|
|
69
|
+
- **Manual publishing** from the Actions tab
|
|
70
|
+
- **Secure authentication** using OIDC for TestPyPI
|
|
71
|
+
|
|
72
|
+
### Quick Release
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Bump version and prepare release
|
|
76
|
+
./scripts/release.sh patch # or minor/major
|
|
77
|
+
|
|
78
|
+
# Push everything (triggers TestPyPI workflow)
|
|
79
|
+
git push origin main && git push origin v0.0.2
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### **Version Types**
|
|
83
|
+
- `patch`: `0.0.1` → `0.0.2` (bug fixes, small changes)
|
|
84
|
+
- `minor`: `0.0.1` → `0.1.0` (new features, backward compatible)
|
|
85
|
+
- `major`: `0.0.1` → `1.0.0` (breaking changes)
|
|
86
|
+
|
|
87
|
+
### **Current Status**
|
|
88
|
+
- **TestPyPI**: ✅ Active - publishes on `v*` tags
|
|
89
|
+
- **PyPI**: ❌ Disabled - workflow file is commented out
|
|
90
|
+
|
|
91
|
+
### **Enabling PyPI Publishing Later**
|
|
92
|
+
When you're ready to publish to PyPI:
|
|
93
|
+
1. Rename `.github/workflows/publish-pypi.yml.disabled` to `publish-pypi.yml`
|
|
94
|
+
2. Add `PYPI_API_TOKEN` secret to your GitHub repository
|
|
95
|
+
3. Both workflows will then be active with different tag patterns
|
|
96
|
+
|
|
97
|
+
For detailed setup instructions, see [docs/OIDC_SETUP.md](docs/OIDC_SETUP.md).
|
hedonic-0.0.4/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Hedonic
|
|
2
|
+
|
|
3
|
+
A Python library for hedonic games.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install hedonic
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from hedonic import Game
|
|
15
|
+
|
|
16
|
+
# Create a new game
|
|
17
|
+
game = Game("My Hedonic Game")
|
|
18
|
+
|
|
19
|
+
# Add players
|
|
20
|
+
game.add_player("Alice")
|
|
21
|
+
game.add_player("Bob")
|
|
22
|
+
game.add_player("Charlie")
|
|
23
|
+
|
|
24
|
+
# Get all players
|
|
25
|
+
players = game.get_players()
|
|
26
|
+
print(players) # ['Alice', 'Bob', 'Charlie']
|
|
27
|
+
|
|
28
|
+
# Print game info
|
|
29
|
+
print(game) # Game: My Hedonic Game with 3 players
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Development
|
|
33
|
+
|
|
34
|
+
This project uses `uv` for dependency management and building.
|
|
35
|
+
|
|
36
|
+
To set up development environment:
|
|
37
|
+
```bash
|
|
38
|
+
uv venv
|
|
39
|
+
source .venv/bin/activate
|
|
40
|
+
uv sync
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To build the package:
|
|
44
|
+
```bash
|
|
45
|
+
uv build
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
To publish to PyPI:
|
|
49
|
+
```bash
|
|
50
|
+
uv publish --token <your-pypi-token>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## GitHub Actions Publishing
|
|
54
|
+
|
|
55
|
+
This repository includes GitHub Actions workflows for automated publishing:
|
|
56
|
+
|
|
57
|
+
- **TestPyPI workflow**: Currently active, publishes to TestPyPI on `v*` tags
|
|
58
|
+
- **PyPI workflow**: Currently disabled (can be re-enabled later)
|
|
59
|
+
- **Automatic publishing** when you push version tags
|
|
60
|
+
- **Manual publishing** from the Actions tab
|
|
61
|
+
- **Secure authentication** using OIDC for TestPyPI
|
|
62
|
+
|
|
63
|
+
### Quick Release
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Bump version and prepare release
|
|
67
|
+
./scripts/release.sh patch # or minor/major
|
|
68
|
+
|
|
69
|
+
# Push everything (triggers TestPyPI workflow)
|
|
70
|
+
git push origin main && git push origin v0.0.2
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### **Version Types**
|
|
74
|
+
- `patch`: `0.0.1` → `0.0.2` (bug fixes, small changes)
|
|
75
|
+
- `minor`: `0.0.1` → `0.1.0` (new features, backward compatible)
|
|
76
|
+
- `major`: `0.0.1` → `1.0.0` (breaking changes)
|
|
77
|
+
|
|
78
|
+
### **Current Status**
|
|
79
|
+
- **TestPyPI**: ✅ Active - publishes on `v*` tags
|
|
80
|
+
- **PyPI**: ❌ Disabled - workflow file is commented out
|
|
81
|
+
|
|
82
|
+
### **Enabling PyPI Publishing Later**
|
|
83
|
+
When you're ready to publish to PyPI:
|
|
84
|
+
1. Rename `.github/workflows/publish-pypi.yml.disabled` to `publish-pypi.yml`
|
|
85
|
+
2. Add `PYPI_API_TOKEN` secret to your GitHub repository
|
|
86
|
+
3. Both workflows will then be active with different tag patterns
|
|
87
|
+
|
|
88
|
+
For detailed setup instructions, see [docs/OIDC_SETUP.md](docs/OIDC_SETUP.md).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "hedonic"
|
|
3
|
+
version = "0.0.4"
|
|
4
|
+
description = "A Python library for hedonic games"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Lucas Lopes Felipe" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
dependencies = ["igraph"]
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["uv_build>=0.8.11,<0.9.0"]
|
|
14
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from igraph import Graph # type: ignore
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Game(Graph):
|
|
5
|
+
"""A hedonic game represented as an `igraph.Graph`."""
|
|
6
|
+
|
|
7
|
+
def __init__(self, graph: Graph | None = None, *args, **kwargs) -> None:
|
|
8
|
+
super().__init__(*args, **kwargs)
|
|
9
|
+
if isinstance(graph, Graph):
|
|
10
|
+
self.add_vertices(graph.vcount())
|
|
11
|
+
self.add_edges(graph.get_edgelist())
|
|
12
|
+
for attr in graph.vertex_attributes():
|
|
13
|
+
self.vs[attr] = graph.vs[attr]
|
|
14
|
+
for attr in graph.edge_attributes():
|
|
15
|
+
self.es[attr] = graph.es[attr]
|
|
16
|
+
for attr in graph.attributes():
|
|
17
|
+
self[attr] = graph[attr]
|
|
18
|
+
|
|
19
|
+
def to_igraph(self) -> Graph:
|
|
20
|
+
"""Convert the `Game` object to a standalone `igraph.Graph` instance."""
|
|
21
|
+
g = Graph()
|
|
22
|
+
g.add_vertices(self.vcount())
|
|
23
|
+
g.add_edges(self.get_edgelist())
|
|
24
|
+
for attr in self.vertex_attributes():
|
|
25
|
+
g.vs[attr] = self.vs[attr]
|
|
26
|
+
for attr in self.edge_attributes():
|
|
27
|
+
g.es[attr] = self.es[attr]
|
|
28
|
+
for attr in self.attributes():
|
|
29
|
+
g[attr] = self[attr]
|
|
30
|
+
return g
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
__all__ = ["Game"]
|
|
File without changes
|