mergeron_extra 2024.739099.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.
- mergeron_extra-2024.739099.2/PKG-INFO +67 -0
- mergeron_extra-2024.739099.2/README.rst +39 -0
- mergeron_extra-2024.739099.2/pyproject.toml +172 -0
- mergeron_extra-2024.739099.2/src/mergeron_extra/__init__.py +23 -0
- mergeron_extra-2024.739099.2/src/mergeron_extra/proportions_tests.py +515 -0
- mergeron_extra-2024.739099.2/src/mergeron_extra/tol_colors.py +848 -0
- mergeron_extra-2024.739099.2/src/mergeron_extra/xlsxw_helper.py +631 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: mergeron_extra
|
|
3
|
+
Version: 2024.739099.2
|
|
4
|
+
Summary: Tools for users of the mergeron package.
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: Murthy Kambhampaty
|
|
7
|
+
Author-email: smk@capeconomics.com
|
|
8
|
+
Requires-Python: >=3.12,<4.0
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
20
|
+
Requires-Dist: aenum (>=3.1.15,<4.0.0)
|
|
21
|
+
Requires-Dist: certifi (>=2023.11.17)
|
|
22
|
+
Requires-Dist: matplotlib (>=3.8)
|
|
23
|
+
Requires-Dist: numpy (>=1.26,<2)
|
|
24
|
+
Requires-Dist: scipy (>=1.12)
|
|
25
|
+
Requires-Dist: xlsxwriter (>=3.1)
|
|
26
|
+
Description-Content-Type: text/x-rst
|
|
27
|
+
|
|
28
|
+
mergeron_extra: Support package for users of `mergeron`
|
|
29
|
+
=======================================================
|
|
30
|
+
|
|
31
|
+
Modules potentially useful to users of the :code:`mergeron` package, but which do not implement the principal functions of the package, and are hence considered "extras" or "external" modules. One of these modules is, in fact, repackaged here although published independently.
|
|
32
|
+
|
|
33
|
+
The module :code:`mergeron_extra.proportions_tests` provides methods for estimating confidence intervals for proportions and for contrasts (differences) in proportions. This module is coded for conformance to the literature and to results from the corresponding modules in :code:`R`. Although written from scratch, the APIs implemented in the module included here are designed for consistency with the APIs in, :code:`statsmodels.stats.proportion` from the package, :code:`statsmodels` (https://pypi.org/project/statsmodels/). To access these directly:
|
|
34
|
+
|
|
35
|
+
.. code-block:: python
|
|
36
|
+
|
|
37
|
+
import mergeron_extra.proportions_tests as prci
|
|
38
|
+
|
|
39
|
+
Module :code:`mergeron_extra.xlsxw_helper` is useful for writing highly formatted output to spreadsheets with xlsx format. The class, :code:`mergeron_extra.xlsxw_helper.CFmt` and function, :code:`mergeron_extra.xlsxw_helper.array_to_sheet` are of particular interest, and can be accessed as :code:`xlh.CFmt` and :code:`xlh.array_to_sheet` with the following import:
|
|
40
|
+
|
|
41
|
+
.. code-block:: python
|
|
42
|
+
|
|
43
|
+
import mergeron_extra.xlsxw_helper as xlh
|
|
44
|
+
|
|
45
|
+
A recent version of Paul Tol's python module, :code:`tol_colors.py`, which provides high-contrast color schemes for making displays with improved visibility for individuals with color-blindness, is redistributed within this package. Other than re-formatting and type annotation, the :code:`mergeron_extra.tol_colors` module is re-distributed as downloaded from, https://personal.sron.nl/~pault/data/tol_colors.py. The :code:`tol_colors.py` module is distributed under the Standard 3-clause BSD license. To access the :code:`mergeron_extra.tol_colors` module directly:
|
|
46
|
+
|
|
47
|
+
.. code-block:: python
|
|
48
|
+
|
|
49
|
+
import mergeron_extra.tol_colors as ptc
|
|
50
|
+
|
|
51
|
+
.. image:: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
|
|
52
|
+
:alt: Poetry
|
|
53
|
+
:target: https://python-poetry.org/
|
|
54
|
+
|
|
55
|
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
|
56
|
+
:alt: Ruff
|
|
57
|
+
:target: https://github.com/astral-sh/ruff
|
|
58
|
+
|
|
59
|
+
.. image:: https://www.mypy-lang.org/static/mypy_badge.svg
|
|
60
|
+
:alt: Checked with mypy
|
|
61
|
+
:target: https://mypy-lang.org/
|
|
62
|
+
|
|
63
|
+
.. image:: https://img.shields.io/badge/License-MIT-yellow.svg
|
|
64
|
+
:alt: License: MIT
|
|
65
|
+
:target: https://opensource.org/licenses/MIT
|
|
66
|
+
|
|
67
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
mergeron_extra: Support package for users of `mergeron`
|
|
2
|
+
=======================================================
|
|
3
|
+
|
|
4
|
+
Modules potentially useful to users of the :code:`mergeron` package, but which do not implement the principal functions of the package, and are hence considered "extras" or "external" modules. One of these modules is, in fact, repackaged here although published independently.
|
|
5
|
+
|
|
6
|
+
The module :code:`mergeron_extra.proportions_tests` provides methods for estimating confidence intervals for proportions and for contrasts (differences) in proportions. This module is coded for conformance to the literature and to results from the corresponding modules in :code:`R`. Although written from scratch, the APIs implemented in the module included here are designed for consistency with the APIs in, :code:`statsmodels.stats.proportion` from the package, :code:`statsmodels` (https://pypi.org/project/statsmodels/). To access these directly:
|
|
7
|
+
|
|
8
|
+
.. code-block:: python
|
|
9
|
+
|
|
10
|
+
import mergeron_extra.proportions_tests as prci
|
|
11
|
+
|
|
12
|
+
Module :code:`mergeron_extra.xlsxw_helper` is useful for writing highly formatted output to spreadsheets with xlsx format. The class, :code:`mergeron_extra.xlsxw_helper.CFmt` and function, :code:`mergeron_extra.xlsxw_helper.array_to_sheet` are of particular interest, and can be accessed as :code:`xlh.CFmt` and :code:`xlh.array_to_sheet` with the following import:
|
|
13
|
+
|
|
14
|
+
.. code-block:: python
|
|
15
|
+
|
|
16
|
+
import mergeron_extra.xlsxw_helper as xlh
|
|
17
|
+
|
|
18
|
+
A recent version of Paul Tol's python module, :code:`tol_colors.py`, which provides high-contrast color schemes for making displays with improved visibility for individuals with color-blindness, is redistributed within this package. Other than re-formatting and type annotation, the :code:`mergeron_extra.tol_colors` module is re-distributed as downloaded from, https://personal.sron.nl/~pault/data/tol_colors.py. The :code:`tol_colors.py` module is distributed under the Standard 3-clause BSD license. To access the :code:`mergeron_extra.tol_colors` module directly:
|
|
19
|
+
|
|
20
|
+
.. code-block:: python
|
|
21
|
+
|
|
22
|
+
import mergeron_extra.tol_colors as ptc
|
|
23
|
+
|
|
24
|
+
.. image:: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
|
|
25
|
+
:alt: Poetry
|
|
26
|
+
:target: https://python-poetry.org/
|
|
27
|
+
|
|
28
|
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
|
29
|
+
:alt: Ruff
|
|
30
|
+
:target: https://github.com/astral-sh/ruff
|
|
31
|
+
|
|
32
|
+
.. image:: https://www.mypy-lang.org/static/mypy_badge.svg
|
|
33
|
+
:alt: Checked with mypy
|
|
34
|
+
:target: https://mypy-lang.org/
|
|
35
|
+
|
|
36
|
+
.. image:: https://img.shields.io/badge/License-MIT-yellow.svg
|
|
37
|
+
:alt: License: MIT
|
|
38
|
+
:target: https://opensource.org/licenses/MIT
|
|
39
|
+
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "mergeron_extra"
|
|
3
|
+
description = "Tools for users of the mergeron package."
|
|
4
|
+
authors = ["Murthy Kambhampaty <smk@capeconomics.com>"]
|
|
5
|
+
license = "MIT"
|
|
6
|
+
readme = "README.rst"
|
|
7
|
+
version = "2024.739099.2"
|
|
8
|
+
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 4 - Beta",
|
|
11
|
+
"Environment :: Console",
|
|
12
|
+
"Intended Audience :: End Users/Desktop",
|
|
13
|
+
"Intended Audience :: Science/Research",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[build-system]
|
|
24
|
+
requires = ["poetry-core"]
|
|
25
|
+
build-backend = "poetry.core.masonry.api"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
[tool.poetry.dependencies]
|
|
29
|
+
# You may need to apply the fixes in, https://github.com/python-poetry/poetry/issues/3365
|
|
30
|
+
# if poetry dependency resolution appears to hang (read the page at link to the end)
|
|
31
|
+
aenum = "^3.1.15"
|
|
32
|
+
matplotlib = ">=3.8"
|
|
33
|
+
numpy = ">=1.26, <2"
|
|
34
|
+
python = "^3.12"
|
|
35
|
+
scipy = ">=1.12"
|
|
36
|
+
xlsxwriter = ">=3.1"
|
|
37
|
+
certifi = ">=2023.11.17"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
[tool.poetry.group.dev.dependencies]
|
|
41
|
+
icecream = ">=2.1.0"
|
|
42
|
+
mypy = ">=1.8"
|
|
43
|
+
openpyxl = ">=3.1.2"
|
|
44
|
+
pendulum = ">=3.0.0"
|
|
45
|
+
ruff = ">=0.5"
|
|
46
|
+
poetry-plugin-export = "^1.8.0"
|
|
47
|
+
pytest = ">=8.0"
|
|
48
|
+
semver = ">=3.0"
|
|
49
|
+
sphinx = ">=7.2"
|
|
50
|
+
sphinx-autodoc-typehints = ">=2.0.0"
|
|
51
|
+
sphinx-autoapi = ">=3.0"
|
|
52
|
+
sphinx-immaterial = ">=0.11"
|
|
53
|
+
pipdeptree = ">=2.15.1"
|
|
54
|
+
types-openpyxl = ">=3.0.0"
|
|
55
|
+
google-re2 = "^1.1.20240702"
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
|
|
59
|
+
# Exclude a variety of commonly ignored directories.
|
|
60
|
+
exclude = [
|
|
61
|
+
".bzr",
|
|
62
|
+
".direnv",
|
|
63
|
+
".eggs",
|
|
64
|
+
".git",
|
|
65
|
+
".git-rewrite",
|
|
66
|
+
".hg",
|
|
67
|
+
".mypy_cache",
|
|
68
|
+
".nox",
|
|
69
|
+
".pants.d",
|
|
70
|
+
".pytype",
|
|
71
|
+
".ruff_cache",
|
|
72
|
+
".svn",
|
|
73
|
+
".tox",
|
|
74
|
+
".venv",
|
|
75
|
+
"__pypackages__",
|
|
76
|
+
"_build",
|
|
77
|
+
"buck-out",
|
|
78
|
+
"build",
|
|
79
|
+
"dist",
|
|
80
|
+
"node_modules",
|
|
81
|
+
".venv",
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
target-version = "py312"
|
|
85
|
+
fix = true
|
|
86
|
+
|
|
87
|
+
# Same as Black.
|
|
88
|
+
line-length = 88
|
|
89
|
+
indent-width = 4
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
[tool.ruff.lint]
|
|
93
|
+
# From, https://github.com/sphinx-doc/sphinx/blob/master/pyproject.toml
|
|
94
|
+
select = [
|
|
95
|
+
"E", # pycodestyle
|
|
96
|
+
"F", # Pyflakes
|
|
97
|
+
"I", # isort
|
|
98
|
+
"W", # pycodestyle
|
|
99
|
+
# plugins:
|
|
100
|
+
"B", # flake8-bugbear
|
|
101
|
+
"C4", # flake8-comprehensions
|
|
102
|
+
"FURB", # refurb
|
|
103
|
+
"ICN", # flake8-import-conventions
|
|
104
|
+
"NPY", # NumPy-specific rules
|
|
105
|
+
"PIE", # flake8-pie
|
|
106
|
+
"PL", # pylint
|
|
107
|
+
"PTH", # flake8-use-pathlib
|
|
108
|
+
"S", # flake8-bandit
|
|
109
|
+
"SIM", # flake8-simplify
|
|
110
|
+
"TID", # flake8-tidy-imports
|
|
111
|
+
"TCH", # flake8-type-checking
|
|
112
|
+
"UP", # pyupgrade
|
|
113
|
+
"RUF", # ruff-specific
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
ignore = [
|
|
117
|
+
# flake-8 line length
|
|
118
|
+
"E501",
|
|
119
|
+
# pycodestyle
|
|
120
|
+
'E741',
|
|
121
|
+
# flake8-bugbear
|
|
122
|
+
'B006',
|
|
123
|
+
'B023',
|
|
124
|
+
# flake8-bugbear opinionated (disabled by default in flake8)
|
|
125
|
+
'B904',
|
|
126
|
+
'B905',
|
|
127
|
+
"PLR2004", # avoid magic values
|
|
128
|
+
# flake8-type-checking
|
|
129
|
+
"TCH001", # move application import into a type-checking block
|
|
130
|
+
"TCH002", # move third-party import into a type-checking block
|
|
131
|
+
"TCH003", # move third-party import into a type-checking block
|
|
132
|
+
# Use typing.TypeAlias for now:
|
|
133
|
+
# mypy yet to implements PEP 695 type aliases;
|
|
134
|
+
# sphinx (as setup here) gives different results with TypeAlias and typing statement
|
|
135
|
+
"UP040",
|
|
136
|
+
]
|
|
137
|
+
isort.split-on-trailing-comma = false
|
|
138
|
+
|
|
139
|
+
[tool.ruff.format]
|
|
140
|
+
quote-style = "double"
|
|
141
|
+
indent-style = "space"
|
|
142
|
+
skip-magic-trailing-comma = true
|
|
143
|
+
line-ending = "lf"
|
|
144
|
+
preview = true
|
|
145
|
+
|
|
146
|
+
[tool.mypy]
|
|
147
|
+
python_version = "3.12"
|
|
148
|
+
ignore_missing_imports = false
|
|
149
|
+
strict = true
|
|
150
|
+
|
|
151
|
+
show_column_numbers = true
|
|
152
|
+
show_error_codes = true
|
|
153
|
+
show_error_context = true
|
|
154
|
+
|
|
155
|
+
no_implicit_optional = true
|
|
156
|
+
no_implicit_reexport = true
|
|
157
|
+
|
|
158
|
+
allow_redefinition = true
|
|
159
|
+
|
|
160
|
+
plugins = "numpy.typing.mypy_plugin"
|
|
161
|
+
|
|
162
|
+
[tool.pytest.ini_options]
|
|
163
|
+
log_auto_indent = 4
|
|
164
|
+
minversion = "8.0"
|
|
165
|
+
testpaths = ["tests"]
|
|
166
|
+
addopts = ["--import-mode=importlib"]
|
|
167
|
+
filterwarnings = [
|
|
168
|
+
"all",
|
|
169
|
+
"ignore::DeprecationWarning:dateutil.tz.tz",
|
|
170
|
+
"ignore::DeprecationWarning:openpyxl.packaging.core",
|
|
171
|
+
]
|
|
172
|
+
tmp_path_retention_policy = "failed"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
_PKG_NAME: str = Path(__file__).parent.stem
|
|
8
|
+
|
|
9
|
+
VERSION = "2024.739097.4"
|
|
10
|
+
|
|
11
|
+
__version__ = VERSION
|
|
12
|
+
|
|
13
|
+
DATA_DIR: Path = Path.home() / _PKG_NAME
|
|
14
|
+
"""
|
|
15
|
+
Defines a subdirectory named for this package in the user's home path.
|
|
16
|
+
|
|
17
|
+
If the subdirectory doesn't exist, it is created on package invocation.
|
|
18
|
+
"""
|
|
19
|
+
if not DATA_DIR.is_dir():
|
|
20
|
+
DATA_DIR.mkdir(parents=False)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
np.set_printoptions(precision=18)
|