Metadata-Version: 2.4
Name: ligonlibrary
Version: 0.2.1
Summary: Utilities for DataFrames, Google Sheets, fuzzy string matching, GPG-encrypted credentials, and other little hacks.
License: BSD-3-Clause
License-File: LICENSE
Keywords: pandas,dataframe,google-sheets,org-mode,fuzzy-matching,stata,gpg
Author: Ethan Ligon
Author-email: ligon@berkeley.edu
Requires-Python: >=3.11
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Dist: google-api-python-client (>=2.178.0)
Requires-Dist: google-auth-oauthlib (>=1.2.2)
Requires-Dist: gspread (>=5.12.0)
Requires-Dist: gspread-pandas (>=3.3.0)
Requires-Dist: openpyxl (>=3.1.5)
Requires-Dist: pandas (>=2.3.1)
Requires-Dist: python-gnupg (>=0.5.2)
Requires-Dist: python-magic (>=0.4.27)
Requires-Dist: thefuzz (>=0.22.1)
Project-URL: Changelog, https://github.com/ligon/LigonLibrary/blob/master/CHANGELOG.md
Project-URL: Homepage, https://github.com/ligon/LigonLibrary
Project-URL: Issues, https://github.com/ligon/LigonLibrary/issues
Project-URL: Repository, https://github.com/ligon/LigonLibrary
Description-Content-Type: text/markdown

# LigonLibrary

A Python utility library for working with DataFrames, Google Sheets,
fuzzy string matching, and more.

## Installation

From PyPI:

```bash
pip install ligonlibrary
```

Or pin in your project's dependencies (e.g. in `pyproject.toml`):

```toml
dependencies = [
    "ligonlibrary>=0.2.1",
]
```

To install the development version straight from GitHub:

```bash
pip install git+https://github.com/ligon/LigonLibrary.git
```

Requires Python 3.11+.

## What's included

### DataFrame utilities

- **`get_dataframe(f)`** — Read a DataFrame from nearly any file: CSV, Excel,
  Parquet, Feather, Stata (.dta), SPSS, fixed-width, org-tables, and
  GPG-encrypted variants of all of the above.
- **`df_to_orgtbl(df)`** — Render a DataFrame as an Emacs org-mode table,
  with optional standard errors, confidence intervals, and significance stars.
- **`orgtbl_to_df(table)`** — Parse an org-mode table back into a DataFrame.
- **`df_from_orgfile(path)`** — Read named tables from `.org` files.
- **`from_dta(fn)`** — Read Stata `.dta` files with automatic label decoding.
- **`normalize_strings(df, ...)`** — Normalize string columns in a DataFrame.
- **`find_similar_pairs(s1, s2)`** — Find fuzzy-matching pairs between two Series.

### Google Sheets

- **`read_sheets(key, ...)`** / **`read_public_sheet(key)`** — Read a Google Sheet into a DataFrame.
- **`write_sheet(df, key, ...)`** — Write a DataFrame to a Google Sheet.
- **`delete_sheet(key)`** — Delete a Google Sheet.
- **`get_credentials(...)`** — Load Google service-account credentials (supports GPG-encrypted JSON).

### String matching

- **`normalized(s)`** — Normalize a string (case, whitespace, hyphens).
- **`similar(a, b)`** — Check whether two strings are fuzzy-similar.
- **`most_similar(s, candidates)`** — Find the best fuzzy match from a list.

### Other

- **`email_from_ligon(...)`** — Send email via the Gmail API.
- **`get_password_for_machine(host)`** — Look up a password in a GPG-encrypted `~/.authinfo.gpg` file, with fallback to `pass` (password-store).

## License

BSD 3-Clause. See [LICENSE](LICENSE).

