poli-sci-kit 2.0.0__tar.gz → 2.0.2__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.
Files changed (22) hide show
  1. {poli_sci_kit-2.0.0/src/poli_sci_kit.egg-info → poli_sci_kit-2.0.2}/PKG-INFO +6 -16
  2. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/README.md +2 -2
  3. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/pyproject.toml +10 -10
  4. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit/appointment/checks.py +3 -4
  5. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit/appointment/methods.py +11 -12
  6. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit/appointment/metrics.py +1 -2
  7. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit/plot/disproportionality_bar_plot.py +8 -10
  8. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit/plot/parliament_plot.py +4 -6
  9. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit/utils.py +2 -3
  10. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2/src/poli_sci_kit.egg-info}/PKG-INFO +6 -16
  11. poli_sci_kit-2.0.2/src/poli_sci_kit.egg-info/requires.txt +7 -0
  12. poli_sci_kit-2.0.0/src/poli_sci_kit.egg-info/requires.txt +0 -19
  13. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/LICENSE.txt +0 -0
  14. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/NOTICE.txt +0 -0
  15. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/setup.cfg +0 -0
  16. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit/__init__.py +0 -0
  17. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit/appointment/__init__.py +0 -0
  18. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit/plot/__init__.py +0 -0
  19. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit.egg-info/SOURCES.txt +0 -0
  20. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit.egg-info/dependency_links.txt +0 -0
  21. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/src/poli_sci_kit.egg-info/top_level.txt +0 -0
  22. {poli_sci_kit-2.0.0 → poli_sci_kit-2.0.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: poli-sci-kit
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Political elections, appointment, analysis and visualization in Python
5
5
  Author-email: Andrew Tavis McAllister <andrew.t.mcallister@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/andrewtavis/poli-sci-kit
@@ -21,22 +21,12 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.txt
22
22
  License-File: NOTICE.txt
23
23
  Requires-Dist: colormath>=3.0.0
24
- Requires-Dist: matplotlib>=3.10.9
25
- Requires-Dist: numpy>=2.4.6
24
+ Requires-Dist: matplotlib>=3.11.0
25
+ Requires-Dist: numpy>=2.5.1
26
26
  Requires-Dist: packaging>=26.2
27
27
  Requires-Dist: pandas>=3.0.3
28
- Requires-Dist: scipy>=1.17.1
28
+ Requires-Dist: scipy>=1.18.0
29
29
  Requires-Dist: seaborn>=0.13.2
30
- Provides-Extra: dev
31
- Requires-Dist: prek>=0.4.1; extra == "dev"
32
- Requires-Dist: pytest>=9.0.3; extra == "dev"
33
- Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
34
- Requires-Dist: ruff>=0.15.14; extra == "dev"
35
- Requires-Dist: ty>=0.0.38; extra == "dev"
36
- Provides-Extra: docs
37
- Requires-Dist: m2r2>=0.3.4; extra == "docs"
38
- Requires-Dist: numpydoc>=1.10.0; extra == "docs"
39
- Requires-Dist: sphinx-rtd-theme>=3.1.0; extra == "docs"
40
30
  Dynamic: license-file
41
31
 
42
32
  <a id="top"></a>
@@ -93,7 +83,7 @@ git clone https://github.com/andrewtavis/poli-sci-kit.git
93
83
  cd poli-sci-kit
94
84
 
95
85
  # With uv (recommended):
96
- uv sync --all-extras # install all dependencies
86
+ uv sync --all-groups # install all dependencies
97
87
  source .venv/bin/activate # activate venv (macOS/Linux)
98
88
  # .venv\Scripts\activate # activate venv (Windows)
99
89
 
@@ -328,7 +318,7 @@ Create a virtual environment for poli-sci-kit (Python `>=3.12`), activate it and
328
318
  #### uv venv
329
319
 
330
320
  ```bash
331
- uv sync --all-extras # create .venv and install all dependencies from uv.lock
321
+ uv sync --all-groups # create .venv and install all dependencies from uv.lock
332
322
 
333
323
  # Unix or macOS:
334
324
  source .venv/bin/activate
@@ -52,7 +52,7 @@ git clone https://github.com/andrewtavis/poli-sci-kit.git
52
52
  cd poli-sci-kit
53
53
 
54
54
  # With uv (recommended):
55
- uv sync --all-extras # install all dependencies
55
+ uv sync --all-groups # install all dependencies
56
56
  source .venv/bin/activate # activate venv (macOS/Linux)
57
57
  # .venv\Scripts\activate # activate venv (Windows)
58
58
 
@@ -287,7 +287,7 @@ Create a virtual environment for poli-sci-kit (Python `>=3.12`), activate it and
287
287
  #### uv venv
288
288
 
289
289
  ```bash
290
- uv sync --all-extras # create .venv and install all dependencies from uv.lock
290
+ uv sync --all-groups # create .venv and install all dependencies from uv.lock
291
291
 
292
292
  # Unix or macOS:
293
293
  source .venv/bin/activate
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "poli-sci-kit"
9
- version = "2.0.0"
9
+ version = "2.0.2"
10
10
  description = "Political elections, appointment, analysis and visualization in Python"
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.12"
@@ -44,26 +44,26 @@ classifiers = [
44
44
 
45
45
  dependencies = [
46
46
  "colormath>=3.0.0",
47
- "matplotlib>=3.10.9",
48
- "numpy>=2.4.6",
47
+ "matplotlib>=3.11.0",
48
+ "numpy>=2.5.1",
49
49
  "packaging>=26.2",
50
50
  "pandas>=3.0.3",
51
- "scipy>=1.17.1",
51
+ "scipy>=1.18.0",
52
52
  "seaborn>=0.13.2",
53
53
  ]
54
54
 
55
- [project.optional-dependencies]
55
+ [dependency-groups]
56
56
  dev = [
57
- "prek>=0.4.1",
58
- "pytest>=9.0.3",
57
+ "prek>=0.4.10",
58
+ "pytest>=9.1.1",
59
59
  "pytest-cov>=7.1.0",
60
- "ruff>=0.15.14",
61
- "ty>=0.0.38",
60
+ "ruff>=0.15.22",
61
+ "ty>=0.0.61",
62
62
  ]
63
63
 
64
64
  docs = [
65
65
  # Keep docs dependencies formatted in this way with ruff to allow for upgrades via VS Code extension.
66
- "m2r2>=0.3.4",
66
+ "myst-parser>=5.1.0",
67
67
  "numpydoc>=1.10.0",
68
68
  "sphinx-rtd-theme>=3.1.0",
69
69
  ]
@@ -4,7 +4,6 @@ Functions to conditionally check appointment methods.
4
4
  """
5
5
 
6
6
  from math import ceil, floor
7
- from typing import Dict, Optional, Tuple
8
7
 
9
8
  import pandas as pd
10
9
 
@@ -13,7 +12,7 @@ from poli_sci_kit.appointment.metrics import ideal_share
13
12
 
14
13
  def quota_condition(
15
14
  shares: list[float], seats: list[int]
16
- ) -> bool | Dict[int, Tuple[int | float, int]]:
15
+ ) -> bool | dict[int, tuple[int | float, int]]:
17
16
  """
18
17
  Check whether assignment method results fall within the range of the ideal share rounded down and up.
19
18
 
@@ -64,8 +63,8 @@ def quota_condition(
64
63
 
65
64
 
66
65
  def consistency_condition(
67
- df_shares: Optional[pd.DataFrame] = None,
68
- df_seats: Optional[pd.DataFrame] = None,
66
+ df_shares: pd.DataFrame | None = None,
67
+ df_seats: pd.DataFrame | None = None,
69
68
  check_type: str = "seat_monotony",
70
69
  ) -> bool | pd.DataFrame:
71
70
  """
@@ -21,15 +21,14 @@ Contents:
21
21
  from math import ceil, modf, sqrt
22
22
  from operator import itemgetter
23
23
  from random import shuffle
24
- from typing import Optional
25
24
 
26
25
 
27
26
  def largest_remainder(
28
27
  quota_style: str = "Hare",
29
- shares: Optional[list[int]] = None,
30
- total_allocation: Optional[int] = None,
31
- allocation_threshold: Optional[float] = None,
32
- min_alloc: Optional[int] = None,
28
+ shares: list[int] | None = None,
29
+ total_allocation: int | None = None,
30
+ allocation_threshold: float | None = None,
31
+ min_alloc: int | None = None,
33
32
  tie_break: str = "majority",
34
33
  majority_bonus: bool = False,
35
34
  ) -> list:
@@ -279,13 +278,13 @@ def largest_remainder(
279
278
 
280
279
  def highest_averages(
281
280
  averaging_style: str = "Jefferson",
282
- shares: Optional[list[int]] = None,
283
- total_allocation: Optional[int] = None,
284
- allocation_threshold: Optional[float] = None,
285
- min_alloc: Optional[int] = None,
286
- tie_break: Optional[str] = "majority",
287
- majority_bonus: Optional[bool] = False,
288
- modifier: Optional[float] = None,
281
+ shares: list[int] | None = None,
282
+ total_allocation: int | None = None,
283
+ allocation_threshold: float | None = None,
284
+ min_alloc: int | None = None,
285
+ tie_break: str | None = "majority",
286
+ majority_bonus: bool | None = False,
287
+ modifier: float | None = None,
289
288
  ) -> list:
290
289
  r"""
291
290
  Apportion seats using the Highest Averages (Jefferson, Webster, Huntington-Hill) methods.
@@ -21,7 +21,6 @@ Based on
21
21
  """
22
22
 
23
23
  from math import exp, log, sqrt
24
- from typing import Optional
25
24
 
26
25
  from scipy.stats import linregress
27
26
 
@@ -265,7 +264,7 @@ def total_representative_weight_error(
265
264
 
266
265
 
267
266
  def diversity_index(
268
- shares: list, q: Optional[float] = None, metric_type: str = "Shannon"
267
+ shares: list, q: float | None = None, metric_type: str = "Shannon"
269
268
  ) -> float:
270
269
  """
271
270
  Calculate the diversity index: the uncertainty associated with predicting further elements within the vote or population distributions.
@@ -3,8 +3,6 @@
3
3
  The plotting function to create disproportionality bar plots.
4
4
  """
5
5
 
6
- from typing import Optional
7
-
8
6
  import pandas as pd
9
7
  import seaborn as sns
10
8
  from matplotlib.axes import Axes
@@ -17,13 +15,13 @@ default_sat = 0.95
17
15
  def disproportionality_bar_plot(
18
16
  shares: list,
19
17
  allocations: list,
20
- labels: Optional[list[str]] = None,
21
- colors: Optional[list[str]] = None,
22
- total_shares: Optional[int] = None,
23
- total_allocation: Optional[int] = None,
18
+ labels: list[str] | None = None,
19
+ colors: list[str] | None = None,
20
+ total_shares: int | None = None,
21
+ total_allocation: int | None = None,
24
22
  percent: bool = False,
25
23
  dsat: float = default_sat,
26
- axis: Optional[str] = None,
24
+ axis: str | None = None,
27
25
  ) -> Axes:
28
26
  """
29
27
  Plot the difference in allocated seats to received shares.
@@ -36,18 +34,18 @@ def disproportionality_bar_plot(
36
34
  allocations : list
37
35
  The allocated amounts.
38
36
 
39
- labels : list[str] (default=None)
37
+ labels : list[str] : optional (default=None)
40
38
  A list of group names as labels for the x-axis.
41
39
 
42
40
  colors : list[str] : optional (default=None)
43
41
  The colors of the groups as hex keys.
44
42
 
45
- total_shares : int (default=None)
43
+ total_shares : int : optional (default=None)
46
44
  The total share amounts.
47
45
 
48
46
  Note: allows for subsets of the total groups.
49
47
 
50
- total_allocation : int (default=None)
48
+ total_allocation : int : optional (default=None)
51
49
  The total number of allocations amounts.
52
50
 
53
51
  Note: allows for subsets of the total groups.
@@ -3,8 +3,6 @@
3
3
  The plotting function to create parliament plots.
4
4
  """
5
5
 
6
- from typing import Optional
7
-
8
6
  import pandas as pd
9
7
  import seaborn as sns
10
8
  from matplotlib.axes import Axes
@@ -21,15 +19,15 @@ default_sat = 0.95
21
19
 
22
20
  def parliament_plot(
23
21
  allocations: list,
24
- labels: Optional[list[str]] = None,
25
- colors: Optional[list] = None,
22
+ labels: list[str] | None = None,
23
+ colors: list | None = None,
26
24
  style: str = "semicircle",
27
25
  num_rows: int = 2,
28
26
  marker_size: int | float = 200,
29
27
  speaker: bool = False,
30
- df_seat_lctns: Optional[pd.DataFrame] = None,
28
+ df_seat_lctns: pd.DataFrame | None = None,
31
29
  dsat: float = default_sat,
32
- axis: Optional[str] = None,
30
+ axis: str | None = None,
33
31
  legend: bool = False,
34
32
  **kwargs,
35
33
  ) -> Axes:
@@ -4,7 +4,6 @@ Utility functions for general operations and plotting.
4
4
  """
5
5
 
6
6
  import colorsys
7
- from typing import Optional, Tuple
8
7
 
9
8
  import numpy as np
10
9
  import pandas as pd
@@ -90,7 +89,7 @@ def gen_faction_groups(
90
89
 
91
90
  def gen_parliament_plot_points(
92
91
  allocations: list[int],
93
- labels: Optional[list[str]] = None,
92
+ labels: list[str] | None = None,
94
93
  style: str = "semicircle",
95
94
  num_rows: int = 2,
96
95
  speaker: bool | str = False,
@@ -165,7 +164,7 @@ def gen_parliament_plot_points(
165
164
 
166
165
  def arc_coordinates(
167
166
  r: float, seats: int
168
- ) -> Tuple[list[float], list[float], list[float]]:
167
+ ) -> tuple[list[float], list[float], list[float]]:
169
168
  """
170
169
  Generates an arc of the parliament plot given a radius and the number of seats.
171
170
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: poli-sci-kit
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Political elections, appointment, analysis and visualization in Python
5
5
  Author-email: Andrew Tavis McAllister <andrew.t.mcallister@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/andrewtavis/poli-sci-kit
@@ -21,22 +21,12 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.txt
22
22
  License-File: NOTICE.txt
23
23
  Requires-Dist: colormath>=3.0.0
24
- Requires-Dist: matplotlib>=3.10.9
25
- Requires-Dist: numpy>=2.4.6
24
+ Requires-Dist: matplotlib>=3.11.0
25
+ Requires-Dist: numpy>=2.5.1
26
26
  Requires-Dist: packaging>=26.2
27
27
  Requires-Dist: pandas>=3.0.3
28
- Requires-Dist: scipy>=1.17.1
28
+ Requires-Dist: scipy>=1.18.0
29
29
  Requires-Dist: seaborn>=0.13.2
30
- Provides-Extra: dev
31
- Requires-Dist: prek>=0.4.1; extra == "dev"
32
- Requires-Dist: pytest>=9.0.3; extra == "dev"
33
- Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
34
- Requires-Dist: ruff>=0.15.14; extra == "dev"
35
- Requires-Dist: ty>=0.0.38; extra == "dev"
36
- Provides-Extra: docs
37
- Requires-Dist: m2r2>=0.3.4; extra == "docs"
38
- Requires-Dist: numpydoc>=1.10.0; extra == "docs"
39
- Requires-Dist: sphinx-rtd-theme>=3.1.0; extra == "docs"
40
30
  Dynamic: license-file
41
31
 
42
32
  <a id="top"></a>
@@ -93,7 +83,7 @@ git clone https://github.com/andrewtavis/poli-sci-kit.git
93
83
  cd poli-sci-kit
94
84
 
95
85
  # With uv (recommended):
96
- uv sync --all-extras # install all dependencies
86
+ uv sync --all-groups # install all dependencies
97
87
  source .venv/bin/activate # activate venv (macOS/Linux)
98
88
  # .venv\Scripts\activate # activate venv (Windows)
99
89
 
@@ -328,7 +318,7 @@ Create a virtual environment for poli-sci-kit (Python `>=3.12`), activate it and
328
318
  #### uv venv
329
319
 
330
320
  ```bash
331
- uv sync --all-extras # create .venv and install all dependencies from uv.lock
321
+ uv sync --all-groups # create .venv and install all dependencies from uv.lock
332
322
 
333
323
  # Unix or macOS:
334
324
  source .venv/bin/activate
@@ -0,0 +1,7 @@
1
+ colormath>=3.0.0
2
+ matplotlib>=3.11.0
3
+ numpy>=2.5.1
4
+ packaging>=26.2
5
+ pandas>=3.0.3
6
+ scipy>=1.18.0
7
+ seaborn>=0.13.2
@@ -1,19 +0,0 @@
1
- colormath>=3.0.0
2
- matplotlib>=3.10.9
3
- numpy>=2.4.6
4
- packaging>=26.2
5
- pandas>=3.0.3
6
- scipy>=1.17.1
7
- seaborn>=0.13.2
8
-
9
- [dev]
10
- prek>=0.4.1
11
- pytest>=9.0.3
12
- pytest-cov>=7.1.0
13
- ruff>=0.15.14
14
- ty>=0.0.38
15
-
16
- [docs]
17
- m2r2>=0.3.4
18
- numpydoc>=1.10.0
19
- sphinx-rtd-theme>=3.1.0
File without changes
File without changes
File without changes