hedonic 0.0.4__py3-none-any.whl

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/__init__.py ADDED
@@ -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"]
hedonic/py.typed ADDED
File without changes
@@ -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).
@@ -0,0 +1,5 @@
1
+ hedonic/__init__.py,sha256=3518e44ae13cf9e028b11ec0d9c07279e2e901524367d1d6247160f1eeea21a1,1145
2
+ hedonic/py.typed,sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855,0
3
+ hedonic-0.0.4.dist-info/WHEEL,sha256=76443c98c0efcfdd1191eac5fa1d8223dba1c474dbd47676674a255e7ca48770,79
4
+ hedonic-0.0.4.dist-info/METADATA,sha256=2cc66059253143e751ca5469a51ff80d2dec77d0b6374fea670314725d35a042,2250
5
+ hedonic-0.0.4.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.8.12
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any