Metadata-Version: 2.4
Name: dgreenwald-py-tools
Version: 0.1.0
Summary: Numerical economics and research utilities.
Author-email: Dan Greenwald <greenw2@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Dan Greenwald
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/dgreenwald/py_tools
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21
Requires-Dist: pandas>=1.3
Requires-Dist: scipy>=1.8
Requires-Dist: matplotlib>=3.5
Requires-Dist: statsmodels>=0.13
Requires-Dist: tabulate>=0.9
Provides-Extra: ml
Requires-Dist: scikit-learn>=1.1; extra == "ml"
Requires-Dist: patsy>=0.5; extra == "ml"
Provides-Extra: mpi
Requires-Dist: mpi4py>=3.1; extra == "mpi"
Provides-Extra: datasets
Requires-Dist: pandas-datareader>=0.10; extra == "datasets"
Requires-Dist: python-dotenv>=1.0; extra == "datasets"
Requires-Dist: pandas<3; extra == "datasets"
Provides-Extra: scraping
Requires-Dist: requests>=2.28; extra == "scraping"
Requires-Dist: beautifulsoup4>=4.11; extra == "scraping"
Requires-Dist: lxml>=4.9; extra == "scraping"
Provides-Extra: nlp
Requires-Dist: nltk>=3.7; extra == "nlp"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Provides-Extra: all
Requires-Dist: scikit-learn>=1.1; extra == "all"
Requires-Dist: patsy>=0.5; extra == "all"
Requires-Dist: mpi4py>=3.1; extra == "all"
Requires-Dist: pandas-datareader>=0.10; extra == "all"
Requires-Dist: python-dotenv>=1.0; extra == "all"
Requires-Dist: pandas<3; extra == "all"
Requires-Dist: requests>=2.28; extra == "all"
Requires-Dist: beautifulsoup4>=4.11; extra == "all"
Requires-Dist: lxml>=4.9; extra == "all"
Requires-Dist: nltk>=3.7; extra == "all"
Dynamic: license-file

# PyTools

`py_tools` is a research-oriented Python toolkit for numerical economics, time series, estimation, and dataset loading utilities.

## Installation

Install from PyPI:

```bash
pip install dgreenwald-py-tools
```

Or clone the repository and install in editable mode:

```bash
pip install -e .
```

Optional extras:

```bash
pip install "dgreenwald-py-tools[ml]"        # scikit-learn, patsy
pip install "dgreenwald-py-tools[datasets]"  # pandas-datareader, python-dotenv
pip install "dgreenwald-py-tools[scraping]"  # requests, beautifulsoup4, lxml
pip install "dgreenwald-py-tools[nlp]"       # nltk
pip install "dgreenwald-py-tools[mpi]"       # mpi4py
pip install "dgreenwald-py-tools[dev]"       # pytest, ruff
```

If you use dataset loaders, set:

```bash
export PY_TOOLS_DATA_DIR=/path/to/data
```

Or create a `.env` file in the repository root (or a parent directory):

```env
PY_TOOLS_DATA_DIR=/path/to/data
```

`py_tools.datasets` will load `.env` automatically when `python-dotenv` is installed
(included in the `datasets` extra).

## Quick Start

```python
from py_tools import data, time_series, state_space

# Example: call a utility function from a core module
# (see module docstrings/source for full APIs)
```

You can also import dataset loaders through:

```python
from py_tools import datasets

available = datasets.list_datasets()
df = datasets.load_dataset("fred", codes=["UNRATE"])
```

## Module Overview

| Import path | Contents |
|---|---|
| `py_tools.time_series` | Kalman filter, state-space models, VAR/BVAR, HMMs |
| `py_tools.econometrics` | NLS/GMM, bootstrap, local projections, high-dimensional FE |
| `py_tools.bayesian` | MCMC sampling, prior distributions |
| `py_tools.numerical` | Root-finding, Chebyshev approximation |
| `py_tools.datasets` | Loaders for ~38 economic data sources |
| `py_tools.data` | Data manipulation, aggregation, matching |
| `py_tools.econ` | Discrete choice, yield curves, AIM solver |
| `py_tools.plot` | Plotting utilities |
| `py_tools.config` | Named model specification registry |
| `py_tools.scraping` | HTML scraping and text utilities |
| `py_tools.compute` | MPI array distribution |

## Development

```bash
pip install -e ".[dev]"
python -m pytest          # run tests
ruff check .              # lint
```

## Contributing

- Keep changes focused and commit one logical change at a time.
- Follow repository coding and workflow guidelines in `AGENTS.md`.
- Prefer adding deterministic tests in `tests/` for new behavior.

## License

MIT — see [LICENSE](LICENSE).
