How pmorissette/ffn works
Project Type and Purpose
• Project type: Open-source Python library for quantitative finance.
• Purpose: Provide performance measurement, evaluation, and data-transformation utilities on top of Pandas/Numpy/Scipy, plus documentation and CI/CD pipelines.
File Structure
• Top-level packages/directories:
– ffn/ – core library modules: core.py, data.py, utils.py
– tests/ – unit tests (test_core.py, test_utils.py) and test data
– docs/ – Sphinx documentation source, custom theme (_themes/klink)
– GitHub workflows (.github/workflows) for build, deploy, regression
– Packaging/config: setup.py, pyproject.toml, Makefile, MANIFEST.in
• CI/CD: GitHub Actions build, regression, deploy pipelines in YAML.
Extract Key Insights from README
• Dependencies: Pandas, Numpy, Scipy, plus graphing libraries.
• Workflow: Users install via pip; project uses Sphinx to generate online docs; CI deploys to PyPI and to GitHub Pages.
Main Components & Their Roles
a. Core Library (ffn)
– Sub-modules: core, data, utils
– Exposes public API (e.g., get, to_returns, calc_mean_var_weights)
b. External Dependencies
– Data‐analysis stack: Pandas, Numpy, Scipy, Matplotlib etc.
c. Testing Suite
– Pytest tests in tests/
– Test data under tests/data
d. Documentation System
– Sphinx project under docs/
– Custom theme “klink” under docs/source/_themes/klink
– Makefiles to build HTML docs
e. CI/CD Pipeline
– Build & test workflows (build.yml, regression.yml)
– Deploy workflow (deploy.yml) publishes to PyPI (via setup.py) and updates docs site
f. Distribution
– PyPI package created from setup.py/pyproject.toml
– Documentation website hosted (e.g., GitHub Pages)
Relationships & Data Flow
• User → installs package from PyPI → invokes ffn API → ffn imports/uses external libs → returns results
• Developer push → GitHub Actions → runs tests on Core Library → on success builds docs → on success publishes package + docs
• Sphinx → reads docs/source/ + custom theme → outputs HTML docs
• Packaging config → defines package metadata, dependencies
Architectural Patterns & Principles
• Modular design: separate modules for core logic (core.py), data ingestion (data.py), utilities (utils.py).
• Layered architecture:
1. Public API layer (ffn)
2. Infrastructure layer (external libs)
3. Supporting systems (tests, docs, CI/CD)
• Convention over configuration for packaging (standard Python project layout).
• Continuous Integration and Delivery using GitHub Actions.
Minimum Elements
1. Library Module: ffn (with sub-modules)
2. External Data/Computation Dependencies (Pandas, Numpy, etc.)
3. Test Suite (pytest)
4. Documentation Pipeline (Sphinx + theme)
5. CI/CD (GitHub Actions workflows)
6. Packaging & Distribution (setup.py, PyPI)
7. User Interaction (installation, API usage)