ssb-flextab 0.9.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright © 2026 Kristian LØønø
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: ssb-flextab
3
+ Version: 0.9.2
4
+ Summary: SSB flextab
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Author: Kristian Lønø
8
+ Author-email: krl@ssb.no
9
+ Maintainer: Statistics Norway, IT-Architecture Department (702)
10
+ Requires-Python: >=3.12
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Requires-Dist: numpy (>=2.2.6,<3.0.0)
17
+ Requires-Dist: openpyxl (>=3.1.0,<4.0.0)
18
+ Requires-Dist: pandas (>=2.2.3,<4.0.0)
19
+ Requires-Dist: pandas-stubs (>=3.0.5.260730,<4.0.0.0)
20
+ Project-URL: Changelog, https://github.com/statisticsnorway/ssb-flextab/releases
21
+ Project-URL: Documentation, https://statisticsnorway.github.io/ssb-flextab
22
+ Project-URL: Homepage, https://github.com/statisticsnorway/ssb-flextab
23
+ Project-URL: Repository, https://github.com/statisticsnorway/ssb-flextab
24
+ Description-Content-Type: text/markdown
25
+
26
+ # SSB flextab
27
+
28
+ [![PyPI](https://img.shields.io/pypi/v/ssb-flextab.svg)][pypi status]
29
+ [![Status](https://img.shields.io/pypi/status/ssb-flextab.svg)][pypi status]
30
+ [![Python Version](https://img.shields.io/pypi/pyversions/ssb-flextab)][pypi status]
31
+ [![License](https://img.shields.io/pypi/l/ssb-flextab)][license]
32
+
33
+ [![Documentation](https://github.com/statisticsnorway/ssb-flextab/actions/workflows/docs.yml/badge.svg)][documentation]
34
+ [![Tests](https://github.com/statisticsnorway/ssb-flextab/actions/workflows/tests.yml/badge.svg)][tests]
35
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=statisticsnorway_ssb-flextab&metric=coverage)][sonarcov]
36
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=statisticsnorway_ssb-flextab&metric=alert_status)][sonarquality]
37
+
38
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]
39
+ [![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
40
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
41
+ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)][poetry]
42
+
43
+ [pypi status]: https://pypi.org/project/ssb-flextab/
44
+ [documentation]: https://statisticsnorway.github.io/ssb-flextab
45
+ [tests]: https://github.com/statisticsnorway/ssb-flextab/actions?workflow=Tests
46
+ [sonarcov]: https://sonarcloud.io/summary/overall?id=statisticsnorway_ssb-flextab
47
+ [sonarquality]: https://sonarcloud.io/summary/overall?id=statisticsnorway_ssb-flextab
48
+ [pre-commit]: https://github.com/pre-commit/pre-commit
49
+ [black]: https://github.com/psf/black
50
+ [poetry]: https://python-poetry.org/
51
+
52
+ ## Features
53
+
54
+ Flextab is a Python package for making *flex*ible *tab*ulation. It is made with Claude AI, models Sonnet 4.5 and Sonnet 5.
55
+
56
+ Flextab is inspired by the Sas procedure [proc tabulate]( https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n00yutbvvckjwrn1ldg5xkvjy1pu.htm) which again was based on the [tpl language](https://en.wikipedia.org/wiki/TPL_Tables)
57
+
58
+ It makes flexible tables in two dimensions, rows an columns, based on Pandas dataframes.
59
+
60
+ ## Requirements
61
+
62
+ - pandas
63
+ - numpy
64
+ - openpyxl when exporting tables to Excel
65
+
66
+ ## Installation
67
+
68
+ You can install _SSB flextab_ via [pip] from [PyPI]:
69
+
70
+ ```console
71
+ pip install ssb-flextab
72
+ ```
73
+
74
+ ## Usage
75
+
76
+ A [tutorial](docs/flextab_tutorial.md) is found in the in the `docs` folder.
77
+
78
+ ## Contributing
79
+
80
+ Contributions are very welcome.
81
+ To learn more, see the [Contributor Guide].
82
+
83
+ ## License
84
+
85
+ Distributed under the terms of the [MIT license][license],
86
+ _SSB flextab_ is free and open source software.
87
+
88
+ ## Issues
89
+
90
+ If you encounter any problems,
91
+ please [file an issue] along with a detailed description.
92
+
93
+ ## Credits
94
+
95
+ This project was generated from [Statistics Norway]'s [SSB PyPI Template].
96
+
97
+ [statistics norway]: https://www.ssb.no/en
98
+ [pypi]: https://pypi.org/
99
+ [ssb pypi template]: https://github.com/statisticsnorway/ssb-pypitemplate
100
+ [file an issue]: https://github.com/statisticsnorway/ssb-flextab/issues
101
+ [pip]: https://pip.pypa.io/
102
+
103
+ <!-- github-only -->
104
+
105
+ [license]: https://github.com/statisticsnorway/ssb-flextab/blob/main/LICENSE
106
+ [contributor guide]: https://github.com/statisticsnorway/ssb-flextab/blob/main/CONTRIBUTING.md
107
+ [reference guide]: https://statisticsnorway.github.io/ssb-flextab/reference.html
108
+
@@ -0,0 +1,82 @@
1
+ # SSB flextab
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/ssb-flextab.svg)][pypi status]
4
+ [![Status](https://img.shields.io/pypi/status/ssb-flextab.svg)][pypi status]
5
+ [![Python Version](https://img.shields.io/pypi/pyversions/ssb-flextab)][pypi status]
6
+ [![License](https://img.shields.io/pypi/l/ssb-flextab)][license]
7
+
8
+ [![Documentation](https://github.com/statisticsnorway/ssb-flextab/actions/workflows/docs.yml/badge.svg)][documentation]
9
+ [![Tests](https://github.com/statisticsnorway/ssb-flextab/actions/workflows/tests.yml/badge.svg)][tests]
10
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=statisticsnorway_ssb-flextab&metric=coverage)][sonarcov]
11
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=statisticsnorway_ssb-flextab&metric=alert_status)][sonarquality]
12
+
13
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]
14
+ [![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
15
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
16
+ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)][poetry]
17
+
18
+ [pypi status]: https://pypi.org/project/ssb-flextab/
19
+ [documentation]: https://statisticsnorway.github.io/ssb-flextab
20
+ [tests]: https://github.com/statisticsnorway/ssb-flextab/actions?workflow=Tests
21
+ [sonarcov]: https://sonarcloud.io/summary/overall?id=statisticsnorway_ssb-flextab
22
+ [sonarquality]: https://sonarcloud.io/summary/overall?id=statisticsnorway_ssb-flextab
23
+ [pre-commit]: https://github.com/pre-commit/pre-commit
24
+ [black]: https://github.com/psf/black
25
+ [poetry]: https://python-poetry.org/
26
+
27
+ ## Features
28
+
29
+ Flextab is a Python package for making *flex*ible *tab*ulation. It is made with Claude AI, models Sonnet 4.5 and Sonnet 5.
30
+
31
+ Flextab is inspired by the Sas procedure [proc tabulate]( https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n00yutbvvckjwrn1ldg5xkvjy1pu.htm) which again was based on the [tpl language](https://en.wikipedia.org/wiki/TPL_Tables)
32
+
33
+ It makes flexible tables in two dimensions, rows an columns, based on Pandas dataframes.
34
+
35
+ ## Requirements
36
+
37
+ - pandas
38
+ - numpy
39
+ - openpyxl when exporting tables to Excel
40
+
41
+ ## Installation
42
+
43
+ You can install _SSB flextab_ via [pip] from [PyPI]:
44
+
45
+ ```console
46
+ pip install ssb-flextab
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ A [tutorial](docs/flextab_tutorial.md) is found in the in the `docs` folder.
52
+
53
+ ## Contributing
54
+
55
+ Contributions are very welcome.
56
+ To learn more, see the [Contributor Guide].
57
+
58
+ ## License
59
+
60
+ Distributed under the terms of the [MIT license][license],
61
+ _SSB flextab_ is free and open source software.
62
+
63
+ ## Issues
64
+
65
+ If you encounter any problems,
66
+ please [file an issue] along with a detailed description.
67
+
68
+ ## Credits
69
+
70
+ This project was generated from [Statistics Norway]'s [SSB PyPI Template].
71
+
72
+ [statistics norway]: https://www.ssb.no/en
73
+ [pypi]: https://pypi.org/
74
+ [ssb pypi template]: https://github.com/statisticsnorway/ssb-pypitemplate
75
+ [file an issue]: https://github.com/statisticsnorway/ssb-flextab/issues
76
+ [pip]: https://pip.pypa.io/
77
+
78
+ <!-- github-only -->
79
+
80
+ [license]: https://github.com/statisticsnorway/ssb-flextab/blob/main/LICENSE
81
+ [contributor guide]: https://github.com/statisticsnorway/ssb-flextab/blob/main/CONTRIBUTING.md
82
+ [reference guide]: https://statisticsnorway.github.io/ssb-flextab/reference.html
@@ -0,0 +1,178 @@
1
+ [project]
2
+ name = "ssb-flextab"
3
+ version = "0.9.2"
4
+ description = "SSB flextab"
5
+ authors = [{ name = "Kristian Lønø", email = "krl@ssb.no" }]
6
+ maintainers = [{ name = "Statistics Norway, IT-Architecture Department (702)" }]
7
+ license = "MIT"
8
+ readme = "README.md"
9
+ requires-python = ">=3.12"
10
+ dynamic = ["classifiers"]
11
+ dependencies = [
12
+ "numpy>=2.2.6,<3.0.0",
13
+ "pandas>=2.2.3,<4.0.0",
14
+ "openpyxl>=3.1.0,<4.0.0",
15
+ "pandas-stubs (>=3.0.5.260730,<4.0.0.0)",
16
+ ]
17
+
18
+ [project.urls]
19
+ homepage = "https://github.com/statisticsnorway/ssb-flextab"
20
+ repository = "https://github.com/statisticsnorway/ssb-flextab"
21
+ documentation = "https://statisticsnorway.github.io/ssb-flextab"
22
+ Changelog = "https://github.com/statisticsnorway/ssb-flextab/releases"
23
+
24
+ [project.scripts]
25
+ ssb-flextab = "ssb_flextab.__main__:main"
26
+
27
+ [dependency-groups]
28
+ lint = [
29
+ "black[jupyter]>=25.11.0",
30
+ "pre-commit>=4.4.0",
31
+ "pre-commit-hooks>=6.0.0",
32
+ "pydoclint>=0.8.3",
33
+ "ruff>=0.14.5",
34
+ ]
35
+ doc = [
36
+ "furo>=2025.9.25",
37
+ "myst-parser>=4.0.1",
38
+ "sphinx>=8.2.3",
39
+ "sphinx-autobuild>=2025.8.25",
40
+ "sphinx-autodoc-typehints>=3.5.2",
41
+ "sphinx-click>=6.1.0",
42
+ ]
43
+
44
+ # Type hint stubs should be placed in the dev dependency group
45
+ dev = [
46
+ {include-group = "lint"},
47
+ {include-group = "doc"},
48
+ "coverage[toml]>=7.11.3",
49
+ "deptry>=0.24.0; python_version < '4.0'",
50
+ "ipykernel>=7.3.0,<8.0.0",
51
+ "mypy>=1.18.2",
52
+ "pygments>=2.19.0",
53
+ "pytest>=9.0.0",
54
+ "typeguard>=2.13.3",
55
+ "xdoctest[colors]>=1.3.0",
56
+ "pandas-stubs (>=3.0.5.260730,<4.0.0.0)",
57
+ "types-openpyxl (>=3.1.5.20260827,<4.0.0.0)",
58
+ ]
59
+
60
+ [tool.poetry]
61
+ classifiers = ["Development Status :: 4 - Beta"]
62
+ requires-poetry = ">=2.3"
63
+ packages = [{ include = "ssb_flextab", from = "src" }]
64
+
65
+ [tool.poetry.requires-plugins]
66
+ poetry-plugin-export = ">=1.9"
67
+
68
+ [tool.pytest.ini_options]
69
+ pythonpath = ["src"]
70
+
71
+ [tool.coverage.paths]
72
+ source = ["src", "*/site-packages"]
73
+ tests = ["tests", "*/tests"]
74
+
75
+ [tool.coverage.run]
76
+ branch = true
77
+ source = ["ssb_flextab", "tests"]
78
+ relative_files = true
79
+
80
+ [tool.coverage.report]
81
+ show_missing = true
82
+ fail_under = 50
83
+
84
+ [tool.deptry.per_rule_ignores]
85
+ DEP001 = ["nox", "nox_poetry"] # packages available by default
86
+
87
+ [tool.mypy]
88
+ mypy_path = "src"
89
+ strict = true
90
+ warn_unreachable = true
91
+ pretty = true
92
+ show_column_numbers = true
93
+ show_error_context = true
94
+
95
+ [tool.pydoclint]
96
+ style = "numpy"
97
+ exclude = '\.git|\.nox'
98
+ arg-type-hints-in-docstring = true
99
+ check-return-types = false
100
+ check-yield-types = false
101
+ allow-init-docstring = true
102
+ quiet = true
103
+
104
+ [tool.ruff]
105
+ force-exclude = true # Apply excludes to pre-commit
106
+ show-fixes = true
107
+ src = ["src", "tests"]
108
+ target-version = "py313" # Minimum Python version supported
109
+ include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
110
+ extend-exclude = [
111
+ "__pycache__",
112
+ "old",
113
+ ".ipynb_checkpoints",
114
+ "noxfile.py",
115
+ "docs/conf.py",
116
+ ]
117
+
118
+ # Ruff rules may be customized as desired: https://docs.astral.sh/ruff/rules/
119
+ [tool.ruff.lint]
120
+ select = [
121
+ "A", # prevent using keywords that clobber python builtins
122
+ "ANN", # check type annotations
123
+ "B", # bugbear: security warnings
124
+ "D", # documentation
125
+ "E", # pycodestyle
126
+ "F", # pyflakes
127
+ "ISC", # implicit string concatenation
128
+ "I", # sort imports
129
+ "UP", # alert you when better syntax is available in your python version
130
+ "RUF", # the ruff developer's own rules
131
+ ]
132
+ ignore = [
133
+ "ANN202", # Don't require return type annotation for private functions.
134
+ "ANN401", # Allow type annotation with type Any.
135
+ "D100", # Supress undocumented-public-module. Only doc of public api required.
136
+ "FBT001", # Allow boolean positional arguments in a function.
137
+ "FBT002", # Allow boolean default positional arguments in a function.
138
+ "E402", # Supress module-import-not-at-top-of-file, needed in jupyter notebooks.
139
+ "E501", # Supress line-too-long warnings: trust black's judgement on this one.
140
+ "PLR2004", # Allow to compare with unnamed numerical constants.
141
+ ]
142
+ external = ["DOC"] # Avoiding removing any codes starting with `DOC` from any `# noqa` directives.
143
+
144
+ [tool.ruff.lint.isort]
145
+ force-single-line = true
146
+
147
+ [tool.ruff.lint.mccabe]
148
+ max-complexity = 15
149
+
150
+ [tool.ruff.lint.pydocstyle]
151
+ convention = "numpy" # You can also use "google".
152
+
153
+ [tool.ruff.lint.pylint]
154
+ max-args = 8
155
+
156
+ [tool.ruff.lint.pep8-naming]
157
+ classmethod-decorators = ["classmethod", "validator", "root_validator", "pydantic.validator"]
158
+
159
+ [tool.ruff.lint.per-file-ignores]
160
+ "*/__init__.py" = ["F401"]
161
+ "**/tests/*" = [
162
+ "ANN001", # type annotations don't add value for test functions
163
+ "ANN002", # type annotations don't add value for test functions
164
+ "ANN003", # type annotations don't add value for test functions
165
+ "ANN201", # type annotations don't add value for test functions
166
+ "ANN204", # type annotations don't add value for test functions
167
+ "ANN205", # type annotations don't add value for test functions
168
+ "ANN206", # type annotations don't add value for test functions
169
+ "D100", # docstrings are overkill for test functions
170
+ "D101",
171
+ "D102",
172
+ "D103",
173
+ "S101", # asserts are encouraged in pytest
174
+ ]
175
+
176
+ [build-system]
177
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
178
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,13 @@
1
+ """Tools for creating flexible summary tables with pandas."""
2
+
3
+ from .flextab import flextab
4
+ from .formatting import flextab_to_markdown
5
+ from .formatting import flextab_to_string
6
+ from .result import FlextabResult
7
+
8
+ __all__ = [
9
+ "FlextabResult",
10
+ "flextab",
11
+ "flextab_to_markdown",
12
+ "flextab_to_string",
13
+ ]