plotnine 0.15.1__py3-none-any.whl → 0.15.3__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.
@@ -4,6 +4,7 @@ from dataclasses import dataclass
4
4
  from typing import TYPE_CHECKING
5
5
 
6
6
  import pandas as pd
7
+ from packaging.version import Version
7
8
 
8
9
  if TYPE_CHECKING:
9
10
  from typing_extensions import Self
@@ -11,6 +12,8 @@ if TYPE_CHECKING:
11
12
  from plotnine import ggplot
12
13
  from plotnine.composition import Compose
13
14
 
15
+ PANDAS_LT_3 = Version(pd.__version__) < Version("3.0")
16
+
14
17
 
15
18
  def reopen(fig):
16
19
  """
@@ -55,12 +58,11 @@ class plot_context:
55
58
 
56
59
  # Contexts
57
60
  self.rc_context = mpl.rc_context(plot.theme.rcParams)
58
- # TODO: Remove this context when copy-on-write is permanent, i.e.
59
- # pandas >= 3.0
60
- self.pd_option_context = pd.option_context(
61
- "mode.copy_on_write",
62
- True,
63
- )
61
+ if PANDAS_LT_3:
62
+ self.pd_option_context = pd.option_context(
63
+ "mode.copy_on_write",
64
+ True,
65
+ )
64
66
 
65
67
  def __enter__(self) -> Self:
66
68
  """
@@ -68,7 +70,8 @@ class plot_context:
68
70
  """
69
71
 
70
72
  self.rc_context.__enter__()
71
- self.pd_option_context.__enter__()
73
+ if PANDAS_LT_3:
74
+ self.pd_option_context.__enter__()
72
75
 
73
76
  return self
74
77
 
@@ -89,7 +92,8 @@ class plot_context:
89
92
  plt.close(self.plot.figure)
90
93
 
91
94
  self.rc_context.__exit__(exc_type, exc_value, exc_traceback)
92
- self.pd_option_context.__exit__(exc_type, exc_value, exc_traceback)
95
+ if PANDAS_LT_3:
96
+ self.pd_option_context.__exit__(exc_type, exc_value, exc_traceback)
93
97
 
94
98
 
95
99
  @dataclass
plotnine/_utils/quarto.py CHANGED
@@ -47,8 +47,13 @@ def is_knitr_engine() -> bool:
47
47
  import json
48
48
  from pathlib import Path
49
49
 
50
- info = json.loads(Path(filename).read_text())
51
- return info["format"]["execute"]["engine"] == "knitr"
50
+ try:
51
+ info = json.loads(Path(filename).read_text())
52
+ except FileNotFoundError:
53
+ # NOTE: Remove this branch some time after quarto 1.9 is released
54
+ # https://github.com/quarto-dev/quarto-cli/issues/13613
55
+ return "rpytools" in sys.modules
56
+ return info["format"]["execute"].get("engine") == "knitr"
52
57
  else:
53
58
  # NOTE: Remove this branch some time after quarto 1.9 is released
54
59
  return "rpytools" in sys.modules
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotnine
3
- Version: 0.15.1
3
+ Version: 0.15.3
4
4
  Summary: A Grammar of Graphics for Python
5
5
  Author-email: Hassan Kibirige <has2k1@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -49,7 +49,7 @@ Requires-Dist: pandas>=2.2.0
49
49
  Requires-Dist: mizani~=0.14.0
50
50
  Requires-Dist: numpy>=1.23.5
51
51
  Requires-Dist: scipy>=1.8.0
52
- Requires-Dist: statsmodels>=0.14.5
52
+ Requires-Dist: statsmodels>=0.14.6
53
53
  Provides-Extra: all
54
54
  Requires-Dist: plotnine[extra]; extra == "all"
55
55
  Requires-Dist: plotnine[doc]; extra == "all"
@@ -26,10 +26,10 @@ plotnine/_mpl/layout_manager/_layout_items.py,sha256=QikIoiYKDDfy2mrX9rZUIqD7Cy0
26
26
  plotnine/_mpl/layout_manager/_layout_tree.py,sha256=xJTPkhKcOY21qOBfFrxuDr1Xu5_kmgiIqReVLCf5Lyo,32065
27
27
  plotnine/_mpl/layout_manager/_spaces.py,sha256=5gSfYSoymH5prauGq1h9MZG4IlBbzd0-cSaS5RedMyU,38290
28
28
  plotnine/_utils/__init__.py,sha256=3tcSTng6Mtk1o6NPEikALHKD3ZGuAYofjQJREHX84a4,30992
29
- plotnine/_utils/context.py,sha256=FLKPhltYqkZRvzufG2WxXV0sMnZxNXqqZyb3nrnsFyY,3906
29
+ plotnine/_utils/context.py,sha256=7KMN9LJRRHGNfFnH-oA1D1tpYQYgr1cHDgkI9zekcvE,3998
30
30
  plotnine/_utils/dev.py,sha256=0qgRbMhcd4dfuLuYxx0skocKAtfwHF02ntyILRBogbg,1629
31
31
  plotnine/_utils/ipython.py,sha256=r5JfBCO9BEqXHoP5JGxxYdGTj5zuLNs44kdLhTz5o2o,1684
32
- plotnine/_utils/quarto.py,sha256=oHYZ2p5G5i-72fx7WCBBtxa_1uXVx9_NvTBoB4TS46A,1541
32
+ plotnine/_utils/quarto.py,sha256=S2wa9lx8I6S3yFiDvVEjB3X6WumSm-y9iYPupmgAQNo,1787
33
33
  plotnine/_utils/registry.py,sha256=HoiB2NnbEHufXjYnVJyrJKflk2RwKtTYk2L3n7tH4XA,3321
34
34
  plotnine/_utils/yippie.py,sha256=DbmxvVrd34P24CCmOZrAulyGQ35rXNaSr8BuutS2Uio,2392
35
35
  plotnine/composition/__init__.py,sha256=yJSYKBDmHw9viTijLRaczD3LNpjOtx9nRGPg3PNIvpA,198
@@ -214,8 +214,8 @@ plotnine/themes/elements/element_line.py,sha256=yZvj9B3M2a7a8o2J0n-q0uviNv34PtJV
214
214
  plotnine/themes/elements/element_rect.py,sha256=w5cLH-Sr4cTRXVdkRiu8kBqFt3TXHhIb1MUITfi89gE,1767
215
215
  plotnine/themes/elements/element_text.py,sha256=8yhwBa9s9JKCtBcqcBNybbCGK6ieDnZv4SHiC4Sy2qc,6255
216
216
  plotnine/themes/elements/margin.py,sha256=jMHe-UKHHer_VYwAVDC-Tz2-AP_4YDuXPTWAuacoqgU,4080
217
- plotnine-0.15.1.dist-info/licenses/LICENSE,sha256=GY4tQiUd17Tq3wWR42Zs9MRTFOTf6ahIXhZTcwAdOeU,1082
218
- plotnine-0.15.1.dist-info/METADATA,sha256=rDMZR95-O9S5B-0Qpcbds6L6FmF6-ojjx3PpvVDgFaA,9496
219
- plotnine-0.15.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
220
- plotnine-0.15.1.dist-info/top_level.txt,sha256=t340Mbko1ZbmvYPkQ81dIiPHcaQdTUszYz-bWUpr8ys,9
221
- plotnine-0.15.1.dist-info/RECORD,,
217
+ plotnine-0.15.3.dist-info/licenses/LICENSE,sha256=GY4tQiUd17Tq3wWR42Zs9MRTFOTf6ahIXhZTcwAdOeU,1082
218
+ plotnine-0.15.3.dist-info/METADATA,sha256=ee-eYUI68rEw7_YKmUud5mr-uyWe5jWojlFJ6ZzjSDU,9496
219
+ plotnine-0.15.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
220
+ plotnine-0.15.3.dist-info/top_level.txt,sha256=t340Mbko1ZbmvYPkQ81dIiPHcaQdTUszYz-bWUpr8ys,9
221
+ plotnine-0.15.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5