├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .idea └── pytools.iml ├── .pre-commit-config.yaml ├── LICENSE ├── README.rst ├── RELEASE_NOTES.rst ├── azure-pipelines.yml ├── condabuild └── meta.yaml ├── config └── spelling.dic ├── dev-setup.sh ├── environment.yml ├── make.py ├── pypi_description.rst ├── pyproject.toml ├── sphinx ├── .gitignore ├── base │ ├── _static │ │ ├── css │ │ │ └── gamma.css │ │ ├── gamma_logo.png │ │ └── js │ │ │ └── gamma.js │ ├── _templates │ │ ├── custom-class-template.rst │ │ ├── custom-module-template.rst │ │ └── getting-started-header.rst │ ├── bootstrap.py │ ├── conf_base.py │ ├── make_base.py │ └── make_util.py ├── make.py └── source │ ├── _images │ └── gamma_pytools_logo.png │ ├── api_landing.rst │ ├── conf.py │ ├── contribution_guide.rst │ ├── faqs.rst │ └── index.rst ├── src └── pytools │ ├── __init__.py │ ├── api │ ├── __init__.py │ ├── _all.py │ ├── _alltracker.py │ ├── _api.py │ ├── _decorators.py │ ├── _doc_validator.py │ ├── _introspection.py │ ├── _missing.py │ └── doc │ │ ├── __init__.py │ │ └── _doc.py │ ├── asyncio │ ├── __init__.py │ └── _asyncio.py │ ├── data │ ├── __init__.py │ ├── _linkage.py │ ├── _matrix.py │ ├── _simulation.py │ ├── linkage │ │ ├── __init__.py │ │ └── _linkage.py │ └── taxonomy │ │ ├── __init__.py │ │ ├── _category.py │ │ └── _taxonomy.py │ ├── expression │ ├── __init__.py │ ├── _expression.py │ ├── _initparams.py │ ├── atomic │ │ ├── __init__.py │ │ └── _atomic.py │ ├── base │ │ ├── __init__.py │ │ └── _base.py │ ├── composite │ │ ├── __init__.py │ │ ├── _composite.py │ │ └── base │ │ │ ├── __init__.py │ │ │ └── _base.py │ ├── formatter │ │ ├── __init__.py │ │ └── _python.py │ ├── operator │ │ ├── __init__.py │ │ └── _operator.py │ └── repr │ │ ├── __init__.py │ │ └── _repr.py │ ├── fit │ ├── __init__.py │ └── _fit.py │ ├── http │ ├── __init__.py │ └── _http.py │ ├── meta │ ├── __init__.py │ └── _meta.py │ ├── parallelization │ ├── __init__.py │ └── _parallelization.py │ ├── py.typed │ ├── repr │ ├── __init__.py │ └── _dict.py │ ├── sphinx │ ├── __init__.py │ ├── _sphinx.py │ └── util │ │ ├── __init__.py │ │ └── _util.py │ ├── text │ ├── __init__.py │ ├── _strings.py │ ├── _template.py │ └── _text.py │ ├── typing │ ├── __init__.py │ └── _typing.py │ └── viz │ ├── __init__.py │ ├── _html.py │ ├── _matplot.py │ ├── _notebook.py │ ├── _text.py │ ├── _viz.py │ ├── color │ ├── __init__.py │ ├── _color.py │ └── _rgb.py │ ├── dendrogram │ ├── __init__.py │ ├── _draw.py │ ├── _style.py │ └── base │ │ ├── __init__.py │ │ └── _style.py │ ├── distribution │ ├── __init__.py │ ├── _distribution.py │ └── base │ │ ├── __init__.py │ │ └── _base.py │ ├── matrix │ ├── __init__.py │ ├── _matrix.py │ └── base │ │ ├── __init__.py │ │ └── _base.py │ └── util │ ├── __init__.py │ └── _matplot.py ├── test └── test │ ├── __init__.py │ ├── conftest.py │ ├── paths.py │ ├── pytools │ ├── __init__.py │ ├── test_api.py │ ├── test_data.py │ ├── test_dict_repr.py │ ├── test_expression.py │ ├── test_http.py │ ├── test_jobs.py │ ├── test_meta.py │ ├── test_repr.py │ ├── test_sphinx.py │ ├── test_taxonomy.py │ ├── test_typing.py │ ├── text │ │ ├── __init__.py │ │ ├── test_template.py │ │ └── test_text.py │ └── viz │ │ ├── __init__.py │ │ ├── dendrogram │ │ ├── __init__.py │ │ └── test_dendrogram.py │ │ ├── test_color.py │ │ └── test_import.py │ └── test_docs.py ├── tmp └── README.md └── tox.ini /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea to improve this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen (including suggestions on how the API should look for the implemented feature) 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Python template 3 | # Byte-compiled / optimized / DLL files 4 | __pycache__/ 5 | *$py.class 6 | 7 | # C extensions 8 | *.so 9 | 10 | # Distribution / packaging 11 | .Python 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *.cover 48 | .hypothesis/ 49 | .pytest_cache/ 50 | 51 | # Translations 52 | *.mo 53 | *.pot 54 | 55 | # Django stuff: 56 | *.log 57 | local_settings.py 58 | db.sqlite3 59 | 60 | # Flask stuff: 61 | instance/ 62 | .webassets-cache 63 | 64 | # Scrapy stuff: 65 | .scrapy 66 | 67 | # Sphinx documentation 68 | sphinx/build/ 69 | 70 | # PyBuilder 71 | target/ 72 | 73 | # Jupyter Notebook 74 | .ipynb_checkpoints 75 | 76 | # pyenv 77 | .python-version 78 | 79 | # celery beat schedule file 80 | celerybeat-schedule 81 | 82 | # SageMath parsed files 83 | *.sage.py 84 | 85 | # Environments 86 | .env 87 | .venv 88 | env/ 89 | venv/ 90 | ENV/ 91 | env.bak/ 92 | venv.bak/ 93 | 94 | # Spyder project settings 95 | .spyderproject 96 | .spyproject 97 | 98 | # Rope project settings 99 | .ropeproject 100 | 101 | # mkdocs documentation 102 | /site 103 | 104 | # mypy 105 | .mypy_cache/ 106 | 107 | ### JetBrains template 108 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 109 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 110 | 111 | # User-specific stuff 112 | .idea/**/workspace.xml 113 | .idea/**/tasks.xml 114 | .idea/**/dictionaries 115 | .idea/**/shelf 116 | 117 | # Sensitive or high-churn files 118 | .idea/**/dataSources/ 119 | .idea/**/dataSources.ids 120 | .idea/**/dataSources.local.xml 121 | .idea/**/sqlDataSources.xml 122 | .idea/**/dynamic.xml 123 | .idea/**/uiDesigner.xml 124 | .idea/**/dbnavigator.xml 125 | 126 | # Gradle 127 | .idea/**/gradle.xml 128 | .idea/**/libraries 129 | 130 | # CMake 131 | cmake-build-debug/ 132 | cmake-build-release/ 133 | 134 | # Mongo Explorer plugin 135 | .idea/**/mongoSettings.xml 136 | 137 | # File-based project format 138 | *.iws 139 | 140 | # IntelliJ 141 | out/ 142 | 143 | # mpeltonen/sbt-idea plugin 144 | .idea_modules/ 145 | 146 | # JIRA plugin 147 | atlassian-ide-plugin.xml 148 | 149 | # Cursive Clojure plugin 150 | .idea/replstate.xml 151 | 152 | # Crashlytics plugin (for Android Studio and IntelliJ) 153 | com_crashlytics_export_strings.xml 154 | crashlytics.properties 155 | crashlytics-build.properties 156 | fabric.properties 157 | 158 | # Editor-based Rest Client 159 | .idea/httpRequests 160 | ### TeX template 161 | ## Core latex/pdflatex auxiliary files: 162 | *.aux 163 | *.lof 164 | *.lot 165 | *.fls 166 | *.out 167 | *.toc 168 | *.fmt 169 | *.fot 170 | *.cb 171 | *.cb2 172 | .*.lb 173 | 174 | ## Intermediate documents: 175 | *.dvi 176 | *.xdv 177 | *-converted-to.* 178 | # these rules might exclude image files for figures etc. 179 | # *.ps 180 | # *.eps 181 | # *.pdf 182 | 183 | ## Generated if empty string is given at "Please type another file name for output:" 184 | .pdf 185 | 186 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 187 | *.bbl 188 | *.bcf 189 | *.blg 190 | *-blx.aux 191 | *-blx.bib 192 | *.run.xml 193 | 194 | ## Build tool auxiliary files: 195 | *.fdb_latexmk 196 | *.synctex 197 | *.synctex(busy) 198 | *.synctex.gz 199 | *.synctex.gz(busy) 200 | *.pdfsync 201 | 202 | ## Build tool directories for auxiliary files 203 | # latexrun 204 | latex.out/ 205 | 206 | ## Auxiliary and intermediate files from other packages: 207 | # algorithms 208 | *.alg 209 | *.loa 210 | 211 | # achemso 212 | acs-*.bib 213 | 214 | # amsthm 215 | *.thm 216 | 217 | # beamer 218 | *.nav 219 | *.pre 220 | *.snm 221 | *.vrb 222 | 223 | # changes 224 | *.soc 225 | 226 | # cprotect 227 | *.cpt 228 | 229 | # elsarticle (documentclass of Elsevier journals) 230 | *.spl 231 | 232 | # endnotes 233 | *.ent 234 | 235 | # fixme_ 236 | *.lox 237 | 238 | # feynmf/feynmp 239 | *.mf 240 | *.mp 241 | *.t[1-9] 242 | *.t[1-9][0-9] 243 | *.tfm 244 | 245 | #(r)(e)ledmac/(r)(e)ledpar 246 | *.end 247 | *.?end 248 | *.[1-9] 249 | *.[1-9][0-9] 250 | *.[1-9][0-9][0-9] 251 | *.[1-9]R 252 | *.[1-9][0-9]R 253 | *.[1-9][0-9][0-9]R 254 | *.eledsec[1-9] 255 | *.eledsec[1-9]R 256 | *.eledsec[1-9][0-9] 257 | *.eledsec[1-9][0-9]R 258 | *.eledsec[1-9][0-9][0-9] 259 | *.eledsec[1-9][0-9][0-9]R 260 | 261 | # glossaries 262 | *.acn 263 | *.acr 264 | *.glg 265 | *.glo 266 | *.gls 267 | *.glsdefs 268 | 269 | # gnuplottex 270 | *-gnuplottex-* 271 | 272 | # gregoriotex 273 | *.gaux 274 | *.gtex 275 | 276 | # htlatex 277 | *.4ct 278 | *.4tc 279 | *.idv 280 | *.lg 281 | *.trc 282 | *.xref 283 | 284 | # hyperref 285 | *.brf 286 | 287 | # knitr 288 | *-concordance.tex 289 | # Comment the next line if you want to keep your tikz graphics files 290 | *.tikz 291 | *-tikzDictionary 292 | 293 | # listings 294 | *.lol 295 | 296 | # makeidx 297 | *.idx 298 | *.ilg 299 | *.ind 300 | *.ist 301 | 302 | # minitoc 303 | *.maf 304 | *.mlf 305 | *.mlt 306 | *.mtc[0-9]* 307 | *.slf[0-9]* 308 | *.slt[0-9]* 309 | *.stc[0-9]* 310 | 311 | # minted 312 | _minted* 313 | *.pyg 314 | 315 | # morewrites 316 | *.mw 317 | 318 | # nomencl 319 | *.nlg 320 | *.nlo 321 | *.nls 322 | 323 | # pax 324 | *.pax 325 | 326 | # pdfpcnotes 327 | *.pdfpc 328 | 329 | # sagetex 330 | *.sagetex.sage 331 | *.sagetex.py 332 | *.sagetex.scmd 333 | 334 | # scrwfile 335 | *.wrt 336 | 337 | # sympy 338 | *.sout 339 | *.sympy 340 | sympy-plots-for-*.tex/ 341 | 342 | # pdfcomment 343 | *.upa 344 | *.upb 345 | 346 | # pythontex 347 | *.pytxcode 348 | pythontex-files-*/ 349 | 350 | # thmtools 351 | *.loe 352 | 353 | # TikZ & PGF 354 | *.dpth 355 | *.md5 356 | *.auxlock 357 | 358 | # todonotes 359 | *.tdo 360 | 361 | # easy-todo_ 362 | *.lod 363 | 364 | # xmpincl 365 | *.xmpi 366 | 367 | # xindy 368 | *.xdy 369 | 370 | # xypic precompiled matrices 371 | *.xyc 372 | 373 | # endfloat 374 | *.ttt 375 | *.fff 376 | 377 | # Latexian 378 | TSWLatexianTemp* 379 | 380 | ## Editors: 381 | # WinEdt 382 | *.bak 383 | *.sav 384 | 385 | # Texpad 386 | .texpadtmp 387 | 388 | # Kile 389 | *.backup 390 | 391 | # KBibTeX 392 | *~[0-9]* 393 | 394 | *.el 395 | 396 | # expex forward references with \gathertags 397 | *-tags.tex 398 | 399 | # standalone packages 400 | *.sta 401 | 402 | .DS_Store 403 | 404 | # 405 | # project specific 406 | # 407 | /docs 408 | /tmp 409 | !/tmp/README.md 410 | -------------------------------------------------------------------------------- /.idea/pytools.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 28 | 29 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/asottile/pyupgrade 3 | rev: v3.16.0 4 | hooks: 5 | - id: pyupgrade 6 | args: [--py310-plus] 7 | 8 | - repo: https://github.com/PyCQA/isort 9 | rev: 5.12.0 10 | hooks: 11 | - id: isort 12 | 13 | - repo: https://github.com/psf/black-pre-commit-mirror 14 | rev: 24.4.2 15 | hooks: 16 | - id: black 17 | language: python 18 | language_version: python310 19 | 20 | - repo: https://github.com/pycqa/flake8 21 | rev: 7.0.0 22 | hooks: 23 | - id: flake8 24 | name: flake8 25 | entry: flake8 --config tox.ini 26 | language: python 27 | language_version: python310 28 | additional_dependencies: 29 | - flake8-comprehensions ~= 3.10 30 | types: [ python ] 31 | 32 | - repo: https://github.com/pre-commit/pre-commit-hooks 33 | rev: v4.3.0 34 | hooks: 35 | - id: check-added-large-files 36 | - id: check-json 37 | - id: check-xml 38 | - id: check-yaml 39 | language: python 40 | exclude: condabuild/meta.yaml 41 | 42 | - repo: https://github.com/pre-commit/mirrors-mypy 43 | rev: v1.11.0 44 | hooks: 45 | - id: mypy 46 | entry: mypy src/ test/ sphinx/ 47 | args: [--config-file, pyproject.toml] 48 | files: \.pyi?$ 49 | language: python 50 | language_version: python310 51 | pass_filenames: false 52 | additional_dependencies: 53 | - numpy~=2.0 54 | - pytest 55 | - packaging 56 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | .. image:: sphinx/source/_images/gamma_pytools_logo.png 2 | 3 | | 4 | 5 | *pytools* is an open source library containing general machine learning and visualisation 6 | utilities for reuse, including: 7 | 8 | - Basic tools for API development, supporting documentation, deprecation, and run-time validation 9 | - Support for simulating classification and regression data 10 | - Utilities for constructing complex expressions and rendering them as indented strings 11 | - Support for fitting objects to data, and testing whether an object is fitted 12 | - Parallelization based on the joblib package 13 | - A lean MVC framework for rendering basic visualizations in different styles, e.g., as *matplotlib* charts or as plain text 14 | 15 | .. Begin-Badges 16 | 17 | |pypi| |conda| |azure_build| |azure_code_cov| 18 | |python_versions| |code_style| |made_with_sphinx_doc| |License_badge| 19 | 20 | .. End-Badges 21 | 22 | 23 | Installation 24 | ------------ 25 | 26 | *pytools* supports both PyPI and Anaconda. 27 | We recommend to install *pytools* into a dedicated environment. 28 | 29 | Anaconda 30 | ~~~~~~~~ 31 | 32 | .. code-block:: sh 33 | 34 | conda create -n pytools 35 | conda activate pytools 36 | conda install -c bcg_gamma -c conda-forge gamma-pytools 37 | 38 | 39 | Pip 40 | ~~~ 41 | 42 | macOS and Linux: 43 | ^^^^^^^^^^^^^^^^ 44 | 45 | .. code-block:: sh 46 | 47 | python -m venv pytools 48 | source pytools/bin/activate 49 | pip install gamma-pytools 50 | 51 | Windows: 52 | ^^^^^^^^ 53 | 54 | .. code-block:: dosbatch 55 | 56 | python -m venv pytools 57 | pytools\Scripts\activate.bat 58 | pip install gamma-pytools 59 | 60 | 61 | Documentation 62 | ------------- 63 | 64 | For the *pytools* API reference see the `documentation `__. 65 | 66 | Changes and additions to new versions are summarized in the `release notes `__. 67 | 68 | 69 | Contributing 70 | ------------ 71 | 72 | *pytools* is stable and is being supported long-term. 73 | 74 | Contributions to *pytools* are welcome and appreciated. 75 | For any bug reports or feature requests/enhancements please use the appropriate 76 | `GitHub form `_, and if you wish to do so, 77 | please open a PR addressing the issue. 78 | 79 | We do ask that for any major changes please discuss these with us first via an issue or 80 | at our team email: FacetTeam@bcg.com. 81 | 82 | For further information on contributing please see our `contribution guide 83 | `_. 84 | 85 | 86 | License 87 | ------- 88 | 89 | *pytools* is licensed under Apache 2.0 as described in the 90 | `LICENSE `_ file. 91 | 92 | 93 | BCG GAMMA 94 | --------- 95 | 96 | We are always on the lookout for passionate and talented data scientists to join the 97 | BCG GAMMA team. If you would like to know more you can find out about BCG GAMMA 98 | `here `_, 99 | or have a look at 100 | `career opportunities `_. 101 | 102 | .. Begin-Badges 103 | 104 | .. |conda| image:: https://anaconda.org/bcg_gamma/gamma-pytools/badges/version.svg 105 | :target: https://anaconda.org/BCG_Gamma/gamma-pytools 106 | 107 | .. |pypi| image:: https://badge.fury.io/py/gamma-pytools.svg 108 | :target: https://pypi.org/project/gamma-pytools/ 109 | 110 | .. |azure_build| image:: https://dev.azure.com/gamma-facet/facet/_apis/build/status/BCG-X-Official.pytools?branchName=develop 111 | :target: https://dev.azure.com/gamma-facet/facet/_build?definitionId=9&_a=summary 112 | 113 | .. |azure_code_cov| image:: https://img.shields.io/azure-devops/coverage/gamma-facet/facet/9/2.1.x 114 | :target: https://dev.azure.com/gamma-facet/facet/_build?definitionId=9&_a=summary 115 | 116 | .. |python_versions| image:: https://img.shields.io/badge/python-3.10|3.11|3.12-blue.svg 117 | :target: https://www.python.org/downloads/release/python-380/ 118 | 119 | .. |code_style| image:: https://img.shields.io/badge/code%20style-black-000000.svg 120 | :target: https://github.com/psf/black 121 | 122 | .. |made_with_sphinx_doc| image:: https://img.shields.io/badge/Made%20with-Sphinx-1f425f.svg 123 | :target: https://bcg-x-official.github.io/pytools/index.html 124 | 125 | .. |license_badge| image:: https://img.shields.io/badge/License-Apache%202.0-olivegreen.svg 126 | :target: https://opensource.org/licenses/Apache-2.0 127 | 128 | .. End-Badges -------------------------------------------------------------------------------- /condabuild/meta.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: gamma-pytools 3 | version: {{ environ.get('FACET_BUILD_PYTOOLS_VERSION') }} 4 | 5 | source: 6 | git_url: ../ 7 | 8 | build: 9 | noarch: python 10 | script: "flit install --deps none" 11 | 12 | requirements: 13 | host: 14 | - pip >=21 15 | - python {{ environ.get('FACET_V_PYTHON') }} 16 | - numpy {{ environ.get('FACET_V_NUMPY') }} 17 | - flit =3 18 | run: 19 | - joblib {{ environ.get('FACET_V_JOBLIB') }} 20 | - matplotlib-base {{ environ.get('FACET_V_MATPLOTLIB') }} 21 | - numpy {{ environ.get('FACET_V_NUMPY') }} 22 | - pandas {{ environ.get('FACET_V_PANDAS') }} 23 | - python {{ environ.get('FACET_V_PYTHON') }} 24 | - scipy {{ environ.get('FACET_V_SCIPY') }} 25 | - typing_inspect {{ environ.get('FACET_V_TYPING_INSPECT') }} 26 | test: 27 | imports: 28 | - pytools 29 | - pytools.api 30 | - pytools.data 31 | - pytools.expression 32 | - pytools.fit 33 | - pytools.parallelization 34 | - pytools.sphinx 35 | - pytools.viz 36 | requires: 37 | - pytest ~= 7.1 38 | commands: 39 | - conda list 40 | - python -c 'import pytools; 41 | import os; 42 | assert pytools.__version__ == os.environ["PKG_VERSION"]' 43 | - cd "${FACET_PATH}/pytools" 44 | - pytest -vs test 45 | 46 | about: 47 | home: https://github.com/BCG-X-Official/pytools 48 | license: Apache Software License v2.0 49 | license_file: LICENSE 50 | description: | 51 | A collection of generic Python extensions and tools, used across GAMMA's open-source 52 | libraries. 53 | dev_url: https://github.com/BCG-X-Official/pytools 54 | doc_url: https://bcg-x-official.github.io/pytools/ 55 | doc_source_url: https://github.com/BCG-X-Official/pytools/blob/develop/README.rst -------------------------------------------------------------------------------- /config/spelling.dic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BCG-X-Official/pytools/9d6d37280b72724bd64f69fe7c98d687cbfa5317/config/spelling.dic -------------------------------------------------------------------------------- /dev-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | conda env create -f environment.yml 3 | conda activate pytools-develop 4 | pre-commit install -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: pytools-develop 2 | channels: 3 | - conda-forge 4 | dependencies: 5 | # run 6 | - joblib ~= 1.2 7 | - matplotlib ~= 3.6 8 | - numpy ~= 2.0 9 | - pandas ~= 2.0 10 | - python ~= 3.10.14 11 | - scipy ~= 1.10 12 | - typing_extensions ~= 4.3 13 | - typing_inspect ~= 0.9 14 | # test 15 | - pytest ~= 7.2.1 16 | - pytest-cov ~= 2.12.1 17 | # sphinx 18 | - nbsphinx ~= 0.8.9 19 | - sphinx ~= 4.5.0 20 | - sphinx-autodoc-typehints ~= 1.19.2 21 | - pydata-sphinx-theme ~= 0.8.1 22 | # notebooks 23 | - ipywidgets ~= 8.0 24 | - jupyterlab ~= 3.5 25 | - openpyxl ~= 3.0 26 | - seaborn ~= 0.12 27 | - tableone ~= 0.7 28 | -------------------------------------------------------------------------------- /pypi_description.rst: -------------------------------------------------------------------------------- 1 | *pytools* is an open source library containing general machine learning and visualisation 2 | utilities for reuse, including: 3 | 4 | - Basic tools for API development, supporting documentation, deprecation, and run-time validation 5 | - Support for simulating classification and regression data 6 | - Utilities for constructing complex expressions and rendering them as indented strings 7 | - Support for fitting objects to data, and testing whether an object is fitted 8 | - Parallelization based on the joblib package 9 | - A lean MVC framework for rendering basic visualizations in different styles, e.g., as *matplotlib* charts or as plain text 10 | 11 | .. Begin-Badges 12 | 13 | |pypi| |conda| |python_versions| |code_style| |made_with_sphinx_doc| |License_badge| 14 | 15 | .. End-Badges 16 | 17 | License 18 | --------------------------- 19 | 20 | *pytools* is licensed under Apache 2.0 as described in the 21 | `LICENSE `_ file. 22 | 23 | .. |conda| image:: https://anaconda.org/bcg_gamma/gamma-pytools/badges/version.svg 24 | :target: https://anaconda.org/BCG_Gamma/gamma-pytools 25 | 26 | .. |pypi| image:: https://badge.fury.io/py/gamma-pytools.svg 27 | :target: https://pypi.org/project/gamma-pytools/ 28 | 29 | .. |python_versions| image:: https://img.shields.io/badge/python-3.10|3.11|3.12-blue.svg 30 | :target: https://www.python.org/downloads/release/python-380/ 31 | 32 | .. |code_style| image:: https://img.shields.io/badge/code%20style-black-000000.svg 33 | :target: https://github.com/psf/black 34 | 35 | .. |made_with_sphinx_doc| image:: https://img.shields.io/badge/Made%20with-Sphinx-1f425f.svg 36 | :target: https://bcg-x-official.github.io/pytools/index.html 37 | 38 | .. |license_badge| image:: https://img.shields.io/badge/License-Apache%202.0-olivegreen.svg 39 | :target: https://opensource.org/licenses/Apache-2.0 -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["flit_core >=2,<4"] 3 | build-backend = "flit_core.buildapi" 4 | 5 | [tool.flit.sdist] 6 | exclude = [".idea", "tmp", "dist", ".tox", ".pytest_cache"] 7 | 8 | [tool.flit.metadata] 9 | module = "pytools" 10 | author = "Boston Consulting Group (BCG)" 11 | home-page = "https://github.com/BCG-X-Official/pytools" 12 | description-file = "pypi_description.rst" 13 | dist-name = "gamma-pytools" 14 | license = "Apache Software License v2.0" 15 | 16 | requires = [ 17 | "joblib ~=1.0", 18 | "matplotlib ~=3.6", 19 | "numpy >=1.23,<3a", # cannot use ~= due to conda bug 20 | "pandas >=1.5", 21 | "scipy ~=1.9", 22 | "typing_inspect ~=0.7", 23 | "typing_extensions ~=4.0", 24 | ] 25 | 26 | requires-python = ">=3.10,<4a" 27 | 28 | classifiers = [ 29 | "Development Status :: 5 - Production/Stable", 30 | "Intended Audience :: Science/Research", 31 | "License :: OSI Approved :: Apache Software License", 32 | "Operating System :: MacOS", 33 | "Operating System :: Microsoft :: Windows", 34 | "Operating System :: POSIX :: Linux", 35 | "Operating System :: Unix", 36 | "Programming Language :: Python", 37 | "Programming Language :: Python :: 3", 38 | "Programming Language :: Python :: 3.10", 39 | "Topic :: Scientific/Engineering", 40 | ] 41 | 42 | [tool.flit.metadata.requires-extra] 43 | testing = [ 44 | "pytest ~= 7.1", 45 | "pytest-cov ~= 2.12", 46 | ] 47 | docs = [ 48 | "sphinx ~= 4.5", 49 | "sphinx-autodoc-typehints ~= 1.19", 50 | "pydata-sphinx-theme ~= 0.8.1", 51 | "jinja2 ~= 2.11", 52 | "nbsphinx ~= 0.8.9", 53 | "jupyter == 1", 54 | "docutils ~= 0.17", 55 | "xlrd ~= 1.2", 56 | "m2r ~= 0.2", 57 | "mypy ~= 1.10", 58 | ] 59 | 60 | [tool.flit.metadata.urls] 61 | Documentation = "https://bcg-x-official.github.io/pytools/" 62 | Repository = "https://github.com/BCG-X-Official/pytools" 63 | 64 | [build] 65 | # comma-separated list of packages to be built from source in pip min builds 66 | no-binary.min = [] 67 | 68 | [build.matrix.min] 69 | # minimum requirements of gamma-pytools 70 | joblib = "~=1.0.1" 71 | matplotlib = "~=3.6.3" 72 | numpy = ">=1.23.5,<1.24a" # cannot use ~= due to conda bug 73 | pandas = "~=1.5.3" 74 | python = ">=3.10.14,<3.11a" # cannot use ~= due to conda bug 75 | scipy = "~=1.9.3" 76 | typing_inspect = "~=0.7.1" 77 | typing_extensions = "~=4.0.0" 78 | 79 | [build.matrix.max] 80 | # maximum requirements of gamma-pytools 81 | joblib = "~=1.3" 82 | matplotlib = "~=3.8" 83 | numpy = ">=2,<3a" # cannot use ~= due to conda bug 84 | pandas = "~=2.0" 85 | python = ">=3.12,<4a" # cannot use ~= due to conda bug 86 | scipy = "~=1.12" 87 | typing_inspect = "~=0.7" 88 | typing_extensions = "~=4.3" 89 | 90 | [tool.black] 91 | required-version = '24.4.2' 92 | line-length = 88 93 | target_version = ['py311'] 94 | include = '\.pyi?$' 95 | exclude = ''' 96 | ( 97 | /( 98 | \.eggs # exclude a few common directories in the 99 | | \.git # root of the project 100 | | \.hg 101 | | \.mypy_cache 102 | | \.tox 103 | | \.venv 104 | | data 105 | | docs 106 | | notebooks 107 | | sphinx 108 | )/ 109 | ) 110 | ''' 111 | 112 | [tool.mypy] 113 | show_error_codes = true 114 | strict = true 115 | 116 | [[tool.mypy.overrides]] 117 | module = [ 118 | "docutils.*", 119 | "packaging.*", 120 | "pandas.*", 121 | "matplotlib.*", 122 | "joblib.*", 123 | "scipy.*", 124 | "sphinx.*", 125 | "typing_inspect.*", 126 | "google.*", 127 | "IPython.*", 128 | ] 129 | ignore_missing_imports = true 130 | -------------------------------------------------------------------------------- /sphinx/.gitignore: -------------------------------------------------------------------------------- 1 | base/_static/js/versions.js 2 | source/_generated 3 | source/apidoc 4 | -------------------------------------------------------------------------------- /sphinx/base/_static/css/gamma.css: -------------------------------------------------------------------------------- 1 | h1, h2 { 2 | color:#29BA74; 3 | } 4 | 5 | a { 6 | color: #3333ff; 7 | } 8 | 9 | a:hover { 10 | color: #30C1D7; 11 | } 12 | 13 | code { 14 | color: #295E7E; 15 | background-color: #E0E0E0; 16 | padding-left: 1pt; 17 | padding-right: 1pt; 18 | } 19 | 20 | .bd-content .longtable.table { 21 | display: table; 22 | } 23 | 24 | .longtable.table { 25 | width: 100%; 26 | } 27 | 28 | .longtable.table td, .longtable.table th { 29 | padding: .25rem; 30 | vertical-align: top; 31 | border-top: 1px solid #DEE2E6; 32 | border-bottom: 1px solid #DEE2E6; 33 | } 34 | 35 | .longtable.table tr:nth-child(odd) { 36 | background-color: #F1F5FA; 37 | } 38 | 39 | p.rubric { 40 | border-bottom: none; 41 | border-top: 1px #295E7E solid; 42 | padding-top: 8px; 43 | } 44 | 45 | dl { 46 | padding-bottom: 8px; 47 | padding-top: 8px; 48 | margin-bottom: unset; 49 | margin-top: unset; 50 | } 51 | 52 | dl.py + dl.py { 53 | border-top: 1px #DEE2E6 solid; 54 | } 55 | 56 | .navbar-brand img { 57 | max-width: 175px; 58 | height:auto; 59 | width:auto; 60 | } 61 | 62 | .navbar-nav > .active > .nav-link { 63 | color:#29BA74 !important; 64 | } 65 | 66 | .bd-sidebar .nav > .active:hover > a, .bd-sidebar .nav > .active > a, 67 | .bd-sidebar .nav > li > ul > .active:hover > a, .bd-sidebar .nav > li > ul > .active > a { 68 | color:#29BA74; 69 | } 70 | 71 | .toc-entry > .nav-link.active { 72 | color: #29BA74; 73 | border-left-color: #29BA74; 74 | } 75 | 76 | img.team-pic { 77 | height: 200px; 78 | padding-top: 5pt; 79 | padding-bottom: 5pt; 80 | padding-left: 5pt; 81 | padding-right: 5pt; 82 | } 83 | 84 | /* 85 | .py.class { 86 | margin-top: 32pt; 87 | padding-top: 32pt; 88 | border-top: 2pt solid #295E7E; 89 | } 90 | */ 91 | -------------------------------------------------------------------------------- /sphinx/base/_static/gamma_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BCG-X-Official/pytools/9d6d37280b72724bd64f69fe7c98d687cbfa5317/sphinx/base/_static/gamma_logo.png -------------------------------------------------------------------------------- /sphinx/base/_static/js/gamma.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $('a.reference.external').attr('target', '_blank'); 3 | DOCUMENTATION_OPTIONS.VERSION = DOCS_VERSIONS.current; 4 | buildVersionSelector(); 5 | }); 6 | 7 | 8 | const buildVersionSelector = function() { 9 | 10 | const versionDropdown = $('