Skip to content

Commit 6a78f2e

Browse files
committed
chore: replaced poetry with uv, updated generated files
1 parent 847d427 commit 6a78f2e

File tree

15 files changed

+1329
-336
lines changed

15 files changed

+1329
-336
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ things may break randomly, or they may not even work.
2121

2222
1. Clone the repo.
2323

24-
2. Install [`poetry`](https://python-poetry.org) if you don't have it yet.
24+
2. Install [`uv`](https://astral.sh/uv) if you don't have it yet.
2525

26-
3. Run `poetry install` to prepare a virtualenv with all the required
26+
3. Run `uv sync` to prepare a virtualenv with all the required
2727
dependencies.
2828

29-
4. Run `poetry run pytest` to run the unit tests, or `poetry run python` to run
29+
4. Run `uv run pytest` to run the unit tests, or `uv run python` to run
3030
a Python interpreter where you can `import igraph_ctypes`
3131

3232
## Benchmarking
3333

3434
Benchmarks will be placed in `benchmarks` and they will compare the "old",
3535
official Python interface of igraph with this new implementation. To run the
36-
benchmarks, type `poetry run richbench benchmarks`.
36+
benchmarks, type `uv run richbench benchmarks`.
3737

3838
## Caveats
3939

benchmarks/bench_shortest_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
sources = [randint(0, n - 1) for _ in range(k)]
1313
targets = [randint(0, n - 1) for _ in range(k)]
14-
pairs = list(zip(sources, targets))
14+
pairs = list(zip(sources, targets, strict=False))
1515

1616
old_g = LegacyGraph.Lattice([n, n], directed=False, circular=False)
1717
new_g = create_square_lattice([n, n], directed=False, periodic=False)

gen.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#!/bin/bash
2-
3-
poetry run python3 -m codegen.run
2+
uv run python3 -m codegen.run

pyproject.toml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
1-
[tool.poetry]
1+
[project]
22
name = "igraph_ctypes"
3-
version = "0.0.0.post58.dev0+4ca9643"
3+
dynamic = ["version"]
44
description = ""
5-
authors = ["Tamas Nepusz <[email protected]>"]
6-
packages = [{ include = "igraph_ctypes", from = "src" }]
5+
authors = [{ name = "Tamas Nepusz", email = "[email protected]" }]
6+
requires-python = ">=3.10"
7+
dependencies = ["numpy>=2.0.0"]
78

8-
[tool.poetry.dependencies]
9-
python = "^3.10"
10-
numpy = "^2.0.0"
11-
pycapi = ">=0.82.1"
9+
[dependency-groups]
10+
dev = [
11+
"richbench>=1.0.3",
12+
"igraph>=0.10.6",
13+
"pytest>=7.2.1",
14+
"pytest-cov>=4.0.0",
15+
"pytest-datadir >= 1.4.1",
16+
"stimulus @ git+https://github.com/igraph/[email protected]",
17+
]
18+
doc = ["mkdocs-material>=9.1.21", "mkdocstrings[python]>=0.22.0"]
1219

13-
[tool.poetry.group.dev.dependencies]
14-
pytest = "^7.2.1"
15-
pytest-cov = "^4.0.0"
16-
richbench = "^1.0.3"
17-
igraph = "^0.10.6"
18-
stimulus = { git = "https://github.com/igraph/stimulus.git", tag = "0.21.0" }
19-
pytest-datadir = "^1.4.1"
20+
[tool.hatch.version]
21+
source = "uv-dynamic-versioning"
2022

21-
[tool.poetry.group.doc.dependencies]
22-
mkdocs-material = "^9.1.21"
23-
mkdocstrings = { version = "^0.22.0", extras = ["python"] }
23+
[tool.hatch.build.hooks.version]
24+
path = "src/igraph_ctypes/_version.py"
25+
template = '''__version__ = "{version}"
26+
'''
2427

25-
[tool.poetry-dynamic-versioning]
26-
enable = true
28+
[tool.hatch.build.targets.sdist]
29+
include = ["src/igraph_ctypes"]
2730

28-
[tool.poetry-dynamic-versioning.substitution]
29-
files = ["src/igraph_ctypes/_version.py"]
31+
[tool.hatch.build.targets.wheel]
32+
packages = ["src/igraph_ctypes"]
3033

3134
[[tool.mypy.overrides]]
3235
module = "igraph_ctypes._internal.wrappers"
@@ -48,12 +51,14 @@ lint.select = ["B", "C", "E", "F", "W"]
4851
legacy_tox_ini = """
4952
[tox]
5053
min_version = 4.0
51-
env_list = py311, py310, type
54+
env_list = py313, py312, py311, py310, type
5255
5356
[gh-actions]
5457
python =
5558
3.10: py310
56-
3.11: py311, type
59+
3.11: py311
60+
3.12: py312
61+
3.13: py313, type
5762
5863
[testenv]
5964
deps =
@@ -68,5 +73,5 @@ commands = mypy src
6873
"""
6974

7075
[build-system]
71-
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
72-
build-backend = "poetry_dynamic_versioning.backend"
76+
requires = ["hatchling", "uv-dynamic-versioning"]
77+
build-backend = "hatchling.build"

src/codegen/internal_lib.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ from .types import (
3434
igraph_adjlist_t,
3535
igraph_arpack_options_t,
3636
igraph_bliss_info_t,
37+
igraph_cycle_handler_t,
3738
igraph_error_handler_t,
3839
igraph_fatal_handler_t,
3940
igraph_hrg_t,

src/igraph_ctypes/_internal/enums.py

Lines changed: 114 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,46 @@ def from_(cls, value: Any):
480480
}
481481

482482

483+
class BLISSSplittingHeuristics(IntEnum):
484+
"""Python counterpart of an ``igraph_bliss_sh_t`` enum."""
485+
486+
F = 0
487+
FL = 1
488+
FS = 2
489+
FM = 3
490+
FLM = 4
491+
FSM = 5
492+
493+
_string_map: ClassVar[dict[str, BLISSSplittingHeuristics]]
494+
495+
@classmethod
496+
def from_(cls, value: Any):
497+
"""Converts an arbitrary Python object into this enum.
498+
499+
Raises:
500+
ValueError: if the object cannot be converted
501+
"""
502+
if isinstance(value, BLISSSplittingHeuristics):
503+
return value
504+
elif isinstance(value, int):
505+
return cls(value)
506+
else:
507+
try:
508+
return cls._string_map[value]
509+
except KeyError:
510+
raise ValueError(f"{value!r} cannot be converted to BLISSSplittingHeuristics") from None
511+
512+
513+
BLISSSplittingHeuristics._string_map = {
514+
'f': BLISSSplittingHeuristics.F,
515+
'fl': BLISSSplittingHeuristics.FL,
516+
'flm': BLISSSplittingHeuristics.FLM,
517+
'fm': BLISSSplittingHeuristics.FM,
518+
'fs': BLISSSplittingHeuristics.FS,
519+
'fsm': BLISSSplittingHeuristics.FSM,
520+
}
521+
522+
483523
class Multiple(IntEnum):
484524
"""Python counterpart of an ``igraph_multiple_t`` enum."""
485525

@@ -992,44 +1032,6 @@ def from_(cls, value: Any):
9921032
}
9931033

9941034

995-
class FileFormat(IntEnum):
996-
"""Python counterpart of an ``igraph_fileformat_type_t`` enum."""
997-
998-
EDGELIST = 0
999-
NCOL = 1
1000-
PAJEK = 2
1001-
LGL = 3
1002-
GRAPHML = 4
1003-
1004-
_string_map: ClassVar[dict[str, FileFormat]]
1005-
1006-
@classmethod
1007-
def from_(cls, value: Any):
1008-
"""Converts an arbitrary Python object into this enum.
1009-
1010-
Raises:
1011-
ValueError: if the object cannot be converted
1012-
"""
1013-
if isinstance(value, FileFormat):
1014-
return value
1015-
elif isinstance(value, int):
1016-
return cls(value)
1017-
else:
1018-
try:
1019-
return cls._string_map[value]
1020-
except KeyError:
1021-
raise ValueError(f"{value!r} cannot be converted to FileFormat") from None
1022-
1023-
1024-
FileFormat._string_map = {
1025-
'edgelist': FileFormat.EDGELIST,
1026-
'graphml': FileFormat.GRAPHML,
1027-
'lgl': FileFormat.LGL,
1028-
'ncol': FileFormat.NCOL,
1029-
'pajek': FileFormat.PAJEK,
1030-
}
1031-
1032-
10331035
class Rewiring(IntEnum):
10341036
"""Python counterpart of an ``igraph_rewiring_t`` enum."""
10351037

@@ -1441,6 +1443,8 @@ class FeedbackArcSetAlgorithm(IntEnum):
14411443

14421444
EXACT_IP = 0
14431445
APPROX_EADES = 1
1446+
EXACT_IP_CG = 2
1447+
EXACT_IP_TI = 3
14441448

14451449
_string_map: ClassVar[dict[str, FeedbackArcSetAlgorithm]]
14461450

@@ -1465,6 +1469,38 @@ def from_(cls, value: Any):
14651469
FeedbackArcSetAlgorithm._string_map = {
14661470
'approx_eades': FeedbackArcSetAlgorithm.APPROX_EADES,
14671471
'exact_ip': FeedbackArcSetAlgorithm.EXACT_IP,
1472+
'exact_ip_cg': FeedbackArcSetAlgorithm.EXACT_IP_CG,
1473+
'exact_ip_ti': FeedbackArcSetAlgorithm.EXACT_IP_TI,
1474+
}
1475+
1476+
1477+
class FvsAlgorithm(IntEnum):
1478+
"""Python counterpart of an ``igraph_fvs_algorithm_t`` enum."""
1479+
1480+
IP = 0
1481+
1482+
_string_map: ClassVar[dict[str, FvsAlgorithm]]
1483+
1484+
@classmethod
1485+
def from_(cls, value: Any):
1486+
"""Converts an arbitrary Python object into this enum.
1487+
1488+
Raises:
1489+
ValueError: if the object cannot be converted
1490+
"""
1491+
if isinstance(value, FvsAlgorithm):
1492+
return value
1493+
elif isinstance(value, int):
1494+
return cls(value)
1495+
else:
1496+
try:
1497+
return cls._string_map[value]
1498+
except KeyError:
1499+
raise ValueError(f"{value!r} cannot be converted to FvsAlgorithm") from None
1500+
1501+
1502+
FvsAlgorithm._string_map = {
1503+
'ip': FvsAlgorithm.IP,
14681504
}
14691505

14701506

@@ -1644,7 +1680,7 @@ class ChungLu(IntEnum):
16441680
"""Python counterpart of an ``igraph_chung_lu_t`` enum."""
16451681

16461682
ORIGINAL = 0
1647-
GRG = 1
1683+
MAXENT = 1
16481684
NR = 2
16491685

16501686
_string_map: ClassVar[dict[str, ChungLu]]
@@ -1668,7 +1704,7 @@ def from_(cls, value: Any):
16681704

16691705

16701706
ChungLu._string_map = {
1671-
'grg': ChungLu.GRG,
1707+
'maxent': ChungLu.MAXENT,
16721708
'nr': ChungLu.NR,
16731709
'original': ChungLu.ORIGINAL,
16741710
}
@@ -1706,6 +1742,42 @@ def from_(cls, value: Any):
17061742
}
17071743

17081744

1745+
class MstAlgorithm(IntEnum):
1746+
"""Python counterpart of an ``igraph_mst_algorithm_t`` enum."""
1747+
1748+
AUTOMATIC = 0
1749+
UNWEIGHTED = 1
1750+
PRIM = 2
1751+
KRUSKAL = 3
1752+
1753+
_string_map: ClassVar[dict[str, MstAlgorithm]]
1754+
1755+
@classmethod
1756+
def from_(cls, value: Any):
1757+
"""Converts an arbitrary Python object into this enum.
1758+
1759+
Raises:
1760+
ValueError: if the object cannot be converted
1761+
"""
1762+
if isinstance(value, MstAlgorithm):
1763+
return value
1764+
elif isinstance(value, int):
1765+
return cls(value)
1766+
else:
1767+
try:
1768+
return cls._string_map[value]
1769+
except KeyError:
1770+
raise ValueError(f"{value!r} cannot be converted to MstAlgorithm") from None
1771+
1772+
1773+
MstAlgorithm._string_map = {
1774+
'automatic': MstAlgorithm.AUTOMATIC,
1775+
'kruskal': MstAlgorithm.KRUSKAL,
1776+
'prim': MstAlgorithm.PRIM,
1777+
'unweighted': MstAlgorithm.UNWEIGHTED,
1778+
}
1779+
1780+
17091781
class LpaVariant(IntEnum):
17101782
"""Python counterpart of an ``igraph_lpa_variant_t`` enum."""
17111783

@@ -2028,46 +2100,6 @@ def from_(cls, value: Any):
20282100
}
20292101

20302102

2031-
class BLISSSplittingHeuristics(IntEnum):
2032-
"""Python counterpart of an ``igraph_bliss_sh_t`` enum."""
2033-
2034-
F = 0
2035-
FL = 1
2036-
FS = 2
2037-
FM = 3
2038-
FLM = 4
2039-
FSM = 5
2040-
2041-
_string_map: ClassVar[dict[str, BLISSSplittingHeuristics]]
2042-
2043-
@classmethod
2044-
def from_(cls, value: Any):
2045-
"""Converts an arbitrary Python object into this enum.
2046-
2047-
Raises:
2048-
ValueError: if the object cannot be converted
2049-
"""
2050-
if isinstance(value, BLISSSplittingHeuristics):
2051-
return value
2052-
elif isinstance(value, int):
2053-
return cls(value)
2054-
else:
2055-
try:
2056-
return cls._string_map[value]
2057-
except KeyError:
2058-
raise ValueError(f"{value!r} cannot be converted to BLISSSplittingHeuristics") from None
2059-
2060-
2061-
BLISSSplittingHeuristics._string_map = {
2062-
'f': BLISSSplittingHeuristics.F,
2063-
'fl': BLISSSplittingHeuristics.FL,
2064-
'flm': BLISSSplittingHeuristics.FLM,
2065-
'fm': BLISSSplittingHeuristics.FM,
2066-
'fs': BLISSSplittingHeuristics.FS,
2067-
'fsm': BLISSSplittingHeuristics.FSM,
2068-
}
2069-
2070-
20712103
class LaplacianNormalization(IntEnum):
20722104
"""Python counterpart of an ``igraph_laplacian_normalization_t`` enum."""
20732105

@@ -2161,8 +2193,8 @@ def from_(cls, value: Any):
21612193
'ErdosRenyiType',
21622194
'ErrorCode',
21632195
'FeedbackArcSetAlgorithm',
2164-
'FileFormat',
21652196
'FloydWarshallAlgorithm',
2197+
'FvsAlgorithm',
21662198
'GetAdjacency',
21672199
'GreedyColoringHeuristics',
21682200
'ImitateAlgorithm',
@@ -2174,6 +2206,7 @@ def from_(cls, value: Any):
21742206
'Loops',
21752207
'LpaVariant',
21762208
'MatrixStorage',
2209+
'MstAlgorithm',
21772210
'Multiple',
21782211
'NeighborMode',
21792212
'Optimality',

0 commit comments

Comments
 (0)