# Project export: Financ!al

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 11.0
- Tagline: Financial statements contain information critical to determining a company’s health. AI generated context makes information accessible, analyzing financial and economic contexts to explain trends.
- Devpost: https://devpost.com/software/ai-powered-context-generator-for-financial-statements
- GitHub: https://github.com/Ky13C/CalHacks2024/
- Team: 2 GitHub contributor(s) — j-w-pan (10 commits), Kyle Cheung (6 commits)

## Devpost submission (written by the team)

### Inspiration

One day after business class, we realized just how boring financial statements sounded in class (income, asset, and balance sheets were). Many would not think of looking at financial statements before investing in a company, due to the difficulty of comprehending what the statement means without prior knowledge, even though the statement could provide very crucial indicators for how a company is doing. Utilizing an AI agent would increase financial statement accessibility for a dataset that was meant to be accessible.

### What it does

Our program contextualizes financial statements from time series bar graphs of financial statement data using AI upon cursor hover of a graph, it provides both micro (company & industry) and macroeconomic (Fed policy & global) contexts.

### How we built it

SEC data pulled through financialmodelingprep transformed with pandas into graphs hosted on streamlit integrated Groq api (mixtral-8x7b-32768, "Mixtral of experts") to provide AI context on hover for graphs.

### Challenges we ran into

One big challenge was getting a website with data up and running. Initially, we wanted to do SQL calls on a dolthub data and integrate it with a website built in reflex.dev, but we couldn't get the SQL calls to return any data at all. We spent a lot of time debugging but never got it to work which is why we switched to another API (financialmodelingprep) to call data, despite it having a shorter time series. The most challenging thing was probably figuring out how to get the AI to function. We have never done an AI API call before, so setting it up required countless hours of consulting GPT and the internet to discover the easiest way we could get it work with our site.

### Accomplishments we're proud of

We're proud that we got something within our initial vision and built something out with newbies 🔥 Here’s to many more projects!

### What we learned

We learnt to type up the devpost locally because the page crashing literally wiped out our first iteration that we typed up. We also learnt that FUD regarding LLMs replacing programmers might just be what it is: FUD. We were basically three non-technicals and found it almost impossibly hard to create something like we envisioned with GPT. We thought we could prompt it with examples and specific contexts and it would build something extremely sleek, but most of the code it generated didn't run at all, so we had to watch youtube tutorials.

### What's next

Switch dataset from financialmodelingprep to dolthub (larger range of data + free) and pull data using SQL. Better UI, improve visibility of graphs, customizability of layout. Improving AI model for narrower context and accuracy. Adding more customizability for graphs (line, bar, etc), incorporate a automatic sankey style diagram generation for income statements (which is cool to have), and make the AI generated text be less intrusive (move it to bottom left corner and have it disappear upon clicking outside the context window) Not financial advice, please perform your own due dilligence. AI could hallucinate as project was bootstrapped in a day. Utilize with soft caution!

## README (from the GitHub repository)

# Financ!al 

(This was a CalHacks2024 Project: https://devpost.com/software/ai-powered-context-generator-for-financial-statements)

Financial statements contain information critical to determining a company’s health. AI generated context makes information accessible, analyzing financial and economic contexts to explain trends.

The program contextualizes financial statements from time series bar graphs of financial statement data using AI upon cursor hover of a graph, it attempts to provides both micro (company & industry) and macroeconomic (Fed policy & global) contexts.

![alt text](https://d112y698adiu2z.cloudfront.net/photos/production/software_photos/003/093/315/datas/original.png)
Financ!al: Sleek, Easy, and Comprehensive

![alt text](https://d112y698adiu2z.cloudfront.net/photos/production/software_photos/003/093/317/datas/original.png)
4000+ Comapanies Available at Your Fingertips: Just Type in a Ticker

![alt text](https://d112y698adiu2z.cloudfront.net/photos/production/software_photos/003/093/318/datas/original.png)
AI Analyst Provides Relevant and Critical Information

![alt text](https://d112y698adiu2z.cloudfront.net/photos/production/software_photos/003/093/322/datas/original.png)
Compare Trends Overtime: Determine Bubbles Before Investing

<br>
<br>
<br>
<br>
<br>
To run, ensure you have Python 3.4+ (pip comes installed by default)
<br>
<br>
- Download/clone the entire project
<br>
<br>
- Open Terminal
<br>
<br>
- CD into the downloaded/cloned folder
<br>
<br>
- "pip install -r requirements.txt" through Terminal
<br>
<br>
- "streamlit run main.py" to run the program


<br>
<br>
<br>
<br>
**Not financial advice, please perform your own due dilligence. AI could hallucinate as project was bootstrapped in a day. Utilize with soft caution!**


## Detected evidence (automated analysis)

Indexed codebase: 20442 recognized source files, 150717 KB.
- C (language) — detected in the code
- C++ (language) — detected in the code
- CSS (language) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- PostgreSQL (technology) — detected in the code
- Python (language) — detected in the code
- Streamlit (technology) — detected in the code

## Codebase structure (from repository index)

### Files (120 of 22760)

```
.DS_Store
.idea/.gitignore
.idea/CalHacks2024.iml
.idea/inspectionProfiles/profiles_settings.xml
.idea/material_theme_project_new.xml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
main.py
myenv/bin/activate
myenv/bin/activate.csh
myenv/bin/activate.fish
myenv/bin/Activate.ps1
myenv/bin/distro
myenv/bin/f2py
myenv/bin/httpx
myenv/bin/jsonschema
myenv/bin/markdown-it
myenv/bin/normalizer
myenv/bin/numpy-config
myenv/bin/pip
myenv/bin/pip3
myenv/bin/pip3.9
myenv/bin/pygmentize
myenv/bin/python
myenv/bin/python3
myenv/bin/python3.9
myenv/bin/streamlit
myenv/bin/streamlit.cmd
myenv/etc/jupyter/nbconfig/notebook.d/jupyterlab-plotly.json
myenv/etc/jupyter/nbconfig/notebook.d/pydeck.json
myenv/lib/python3.9/site-packages/_distutils_hack/__init__.py
myenv/lib/python3.9/site-packages/_distutils_hack/override.py
myenv/lib/python3.9/site-packages/_plotly_future_/__init__.py
myenv/lib/python3.9/site-packages/_plotly_future_/extract_chart_studio.py
myenv/lib/python3.9/site-packages/_plotly_future_/orca_defaults.py
myenv/lib/python3.9/site-packages/_plotly_future_/remove_deprecations.py
myenv/lib/python3.9/site-packages/_plotly_future_/renderer_defaults.py
myenv/lib/python3.9/site-packages/_plotly_future_/template_defaults.py
myenv/lib/python3.9/site-packages/_plotly_future_/timezones.py
myenv/lib/python3.9/site-packages/_plotly_future_/trace_uids.py
myenv/lib/python3.9/site-packages/_plotly_future_/v4_subplots.py
myenv/lib/python3.9/site-packages/_plotly_future_/v4.py
myenv/lib/python3.9/site-packages/_plotly_utils/__init__.py
myenv/lib/python3.9/site-packages/_plotly_utils/basevalidators.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/__init__.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/_swatches.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/carto.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/cmocean.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/colorbrewer.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/cyclical.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/diverging.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/plotlyjs.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/qualitative.py
myenv/lib/python3.9/site-packages/_plotly_utils/colors/sequential.py
myenv/lib/python3.9/site-packages/_plotly_utils/data_utils.py
myenv/lib/python3.9/site-packages/_plotly_utils/exceptions.py
myenv/lib/python3.9/site-packages/_plotly_utils/files.py
myenv/lib/python3.9/site-packages/_plotly_utils/importers.py
myenv/lib/python3.9/site-packages/_plotly_utils/optional_imports.py
myenv/lib/python3.9/site-packages/_plotly_utils/png.py
myenv/lib/python3.9/site-packages/_plotly_utils/utils.py
myenv/lib/python3.9/site-packages/.DS_Store
myenv/lib/python3.9/site-packages/altair-5.4.1.dist-info/INSTALLER
myenv/lib/python3.9/site-packages/altair-5.4.1.dist-info/licenses/LICENSE
myenv/lib/python3.9/site-packages/altair-5.4.1.dist-info/METADATA
myenv/lib/python3.9/site-packages/altair-5.4.1.dist-info/RECORD
myenv/lib/python3.9/site-packages/altair-5.4.1.dist-info/WHEEL
myenv/lib/python3.9/site-packages/altair/__init__.py
myenv/lib/python3.9/site-packages/altair/_magics.py
myenv/lib/python3.9/site-packages/altair/expr/__init__.py
myenv/lib/python3.9/site-packages/altair/expr/consts.py
myenv/lib/python3.9/site-packages/altair/expr/core.py
myenv/lib/python3.9/site-packages/altair/expr/funcs.py
myenv/lib/python3.9/site-packages/altair/jupyter/__init__.py
myenv/lib/python3.9/site-packages/altair/jupyter/js/index.js
myenv/lib/python3.9/site-packages/altair/jupyter/js/README.md
myenv/lib/python3.9/site-packages/altair/jupyter/jupyter_chart.py
myenv/lib/python3.9/site-packages/altair/py.typed
myenv/lib/python3.9/site-packages/altair/typing.py
myenv/lib/python3.9/site-packages/altair/utils/__init__.py
myenv/lib/python3.9/site-packages/altair/utils/_dfi_types.py
myenv/lib/python3.9/site-packages/altair/utils/_importers.py
myenv/lib/python3.9/site-packages/altair/utils/_show.py
myenv/lib/python3.9/site-packages/altair/utils/_transformed_data.py
myenv/lib/python3.9/site-packages/altair/utils/_vegafusion_data.py
myenv/lib/python3.9/site-packages/altair/utils/compiler.py
myenv/lib/python3.9/site-packages/altair/utils/core.py
myenv/lib/python3.9/site-packages/altair/utils/data.py
myenv/lib/python3.9/site-packages/altair/utils/deprecation.py
myenv/lib/python3.9/site-packages/altair/utils/display.py
myenv/lib/python3.9/site-packages/altair/utils/execeval.py
myenv/lib/python3.9/site-packages/altair/utils/html.py
myenv/lib/python3.9/site-packages/altair/utils/mimebundle.py
myenv/lib/python3.9/site-packages/altair/utils/plugin_registry.py
myenv/lib/python3.9/site-packages/altair/utils/save.py
myenv/lib/python3.9/site-packages/altair/utils/schemapi.py
myenv/lib/python3.9/site-packages/altair/utils/selection.py
myenv/lib/python3.9/site-packages/altair/utils/server.py
myenv/lib/python3.9/site-packages/altair/utils/theme.py
myenv/lib/python3.9/site-packages/altair/vegalite/__init__.py
myenv/lib/python3.9/site-packages/altair/vegalite/api.py
myenv/lib/python3.9/site-packages/altair/vegalite/data.py
myenv/lib/python3.9/site-packages/altair/vegalite/display.py
myenv/lib/python3.9/site-packages/altair/vegalite/schema.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/__init__.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/api.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/compiler.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/data.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/display.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/schema/__init__.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/schema/_typing.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/schema/channels.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/schema/core.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/schema/mixins.py
myenv/lib/python3.9/site-packages/altair/vegalite/v5/schema/vega-lite-schema.json
myenv/lib/python3.9/site-packages/altair/vegalite/v5/schema/vega-themes.json
myenv/lib/python3.9/site-packages/altair/vegalite/v5/theme.py
myenv/lib/python3.9/site-packages/annotated_types-0.7.0.dist-info/INSTALLER
myenv/lib/python3.9/site-packages/annotated_types-0.7.0.dist-info/licenses/LICENSE
[22640 more files omitted for size]
```

### Dependencies

- myenv/lib/python3.9/site-packages/jupyterlab_plotly/labextension/package.json: @jupyter-widgets/base@>=2.0.0 <7.0.0, @jupyterlab/builder@^3.0.0, @jupyterlab/rendermime-interfaces@^1.3.0 || ^2.0.0 || ^3.0.0, @lumino/application@^1.6.0, @lumino/messaging@^1.2.3, @lumino/widgets@^1.8.1, @types/plotly.js@^1.54.10, @types/webpack-env@^1.13.6, acorn@^7.2.0, css-loader@^5.2.6, fs-extra@^7.0.0, lodash@^4.17.4, mkdirp@^0.5.1, npm-run-all@^4.1.3, plotly.js@^2.35.2, prettier@^2.0.5, rimraf@^2.6.2, source-map-loader@^1.1.3, style-loader@^1.0.0, ts-loader@^8.0.0, typescript@~4.1.3, webpack@^5.0.0, webpack-cli@^4.0.0
- myenv/lib/python3.9/site-packages/pandas/pyproject.toml: adbc-driver-postgresql@>=0.8.0, adbc-driver-postgresql@>=0.8.0, adbc-driver-postgresql@>=0.8.0, adbc-driver-sqlite@>=0.8.0, adbc-driver-sqlite@>=0.8.0, beautifulsoup4@>=4.11.2, beautifulsoup4@>=4.11.2, bottleneck@>=1.3.6, bottleneck@>=1.3.6, dataframe-api-compat@>=0.1.7, dataframe-api-compat@>=0.1.7, fastparquet@>=2022.12.0, fsspec@>=2022.11.0, fsspec@>=2022.11.0, gcsfs@>=2022.11.0, gcsfs@>=2022.11.0, html5lib@>=1.1, html5lib@>=1.1, hypothesis@>=6.46.1, hypothesis@>=6.46.1, jinja2@>=3.1.2, jinja2@>=3.1.2, lxml@>=4.9.2, lxml@>=4.9.2, lxml@>=4.9.2, matplotlib@>=3.6.3, matplotlib@>=3.6.3, numba@>=0.56.4, numba@>=0.56.4, numexpr@>=2.8.4, numexpr@>=2.8.4, numpy@>=1.26.0, odfpy@>=1.4.1, odfpy@>=1.4.1, openpyxl@>=3.1.0, openpyxl@>=3.1.0, pandas-gbq@>=0.19.0, pandas-gbq@>=0.19.0, psycopg2@>=2.9.6, psycopg2@>=2.9.6, pyarrow@>=10.0.1, pyarrow@>=10.0.1, pyarrow@>=10.0.1, pyarrow@>=10.0.1, pymysql@>=1.0.2, pymysql@>=1.0.2, PyQt5@>=5.15.9, PyQt5@>=5.15.9, pyreadstat@>=1.2.0, pyreadstat@>=1.2.0, pytest@>=7.3.2, pytest@>=7.3.2, pytest-xdist@>=2.2.0, pytest-xdist@>=2.2.0, python-calamine@>=0.1.7, python-calamine@>=0.1.7, python-dateutil@>=2.8.2, pytz@>=2020.1, pyxlsb@>=1.0.10, pyxlsb@>=1.0.10, qtpy@>=2.3.0, qtpy@>=2.3.0, s3fs@>=2022.11.0, s3fs@>=2022.11.0, scipy@>=1.10.0, scipy@>=1.10.0, SQLAlchemy@>=2.0.0, SQLAlchemy@>=2.0.0, SQLAlchemy@>=2.0.0, SQLAlchemy@>=2.0.0, tables@>=3.8.0, tables@>=3.8.0, tabulate@>=0.9.0, tabulate@>=0.9.0, tzdata@>=2022.7, xarray@>=2022.12.0, xarray@>=2022.12.0, xlrd@>=2.0.1, xlrd@>=2.0.1, xlsxwriter@>=3.0.5, xlsxwriter@>=3.0.5, zstandard@>=0.19.0, zstandard@>=0.19.0
- myenv/share/jupyter/labextensions/jupyterlab-plotly/package.json: @jupyter-widgets/base@>=2.0.0 <7.0.0, @jupyterlab/builder@^3.0.0, @jupyterlab/rendermime-interfaces@^1.3.0 || ^2.0.0 || ^3.0.0, @lumino/application@^1.6.0, @lumino/messaging@^1.2.3, @lumino/widgets@^1.8.1, @types/plotly.js@^1.54.10, @types/webpack-env@^1.13.6, acorn@^7.2.0, css-loader@^5.2.6, fs-extra@^7.0.0, lodash@^4.17.4, mkdirp@^0.5.1, npm-run-all@^4.1.3, plotly.js@^2.35.2, prettier@^2.0.5, rimraf@^2.6.2, source-map-loader@^1.1.3, style-loader@^1.0.0, ts-loader@^8.0.0, typescript@~4.1.3, webpack@^5.0.0, webpack-cli@^4.0.0
- requirements.txt: groq, os, pandas, plotly, plotly.express, plotly.graph_objects, random, requests, streamlit, streamlit_plotly_events

### Recent commits (newest first)

- Update README.md
- Update README.md
- Delete ai_analyzer.py
- Update README.md
- Update README.md
- Update main.py
- Update README.md
- Update README.md
- Update README.md
- Update README.md
- colorful graphs
- got rid of unnecessary files
- another api fix (i hit the limit)
- my git was weird so manually updating
- Delete CalHacks2024 directory
- Rename main.ipynb to main.ipynb(test)
- Update requirements.txt
- Groq AI integration for contextual/macroeconomic financial indicators
- api update
- WE GOT BARS FOR GRAPHS

## Key source files (fetched from GitHub, selected and truncated for size)

### myenv/lib/python3.9/site-packages/idna-3.10.dist-info/LICENSE.md

```markdown
BSD 3-Clause License

Copyright (c) 2013-2024, Kim Davies and contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

```

### myenv/lib/python3.9/site-packages/narwhals-1.9.4.dist-info/licenses/LICENSE.md

```markdown
MIT License

Copyright (c) 2024, Marco Gorelli

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.

```

### requirements.txt

```
pandas
plotly
requests
streamlit
plotly.express
os
groq
streamlit_plotly_events
plotly.graph_objects
random
```

### myenv/share/jupyter/labextensions/jupyterlab-plotly/package.json

```
{
  "name": "jupyterlab-plotly",
  "version": "5.24.1",
  "description": "The plotly Jupyter extension",
  "author": "The plotly.py team",
  "license": "MIT",
  "main": "lib/index.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/plotly/plotly.py"
  },
  "keywords": [
    "jupyter",
    "widgets",
    "ipython",
    "ipywidgets",
    "plotly"
  ],
  "files": [
    "lib/**/*.js",
    "dist/*.js",
    "style/*.*"
  ],
  "scripts": {
    "build:dev": "npm run build:lib && npm run build:nbextension && npm run build:labextension:dev",
    "build:prod": "npm run build:lib && npm run build:nbextension && npm run build:labextension",
    "build:labextension": "jupyter labextension build .",
    "build:labextension:dev": "jupyter labextension build --development True .",
    "build:lib": "tsc",
    "build:nbextension": "webpack --mode=production",
    "clean": "npm run clean:lib && npm run clean:nbextension && npm run clean:labextension",
    "clean:lib": "rimraf lib",
    "clean:labextension": "rimraf ../../python/plotly/jupyterlab_plotly/labextension",
    "clean:nbextension": "rimraf ../../python/plotly/jupyterlab_plotly/nbextension/index.js*",
    "lint": "eslint . --ext .ts,.tsx --fix",
    "lint:check": "eslint . --ext .ts,.tsx",
    "prepack": "npm run build:lib",
    "test": "echo \"Error: no test specified\" && exit 1",
    "watch": "npm-run-all -p watch:*",
    "watch:lib": "tsc -w",
    "watch:nbextension": "webpack --watch"
  },
  "devDependencies": {
    "@jupyterlab/builder": "^3.0.0",
    "@lumino/application": "^1.6.0",
    "@types/plotly.js": "^1.54.10",
    "@types/webpack-env": "^1.13.6",
    "acorn": "^7.2.0",
    "css-loader": "^5.2.6",
    "fs-extra": "^7.0.0",
    "mkdirp": "^0.5.1",
    "npm-run-all": "^4.1.3",
    "prettier": "^2.0.5",
    "rimraf": "^2.6.2",
    "source-map-loader": "^1.1.3",
    "style-loader": "^1.0.0",
    "ts-loader": "^8.0.0",
    "typescript": "~4.1.3",
    "webpack": "^5.0.0",
    "webpack-cli": "^4.0.0"
  },
  "dependencies": {
    "@jupyter-widgets/base": ">=2.0.0 <7.0.0",
    "@jupyterlab/rendermime-interfaces": "^1.3.0 || ^2.0.0 || ^3.0.0",
    "@lumino/messaging": "^1.2.3",
    "@lumino/widgets": "^1.8.1",
    "lodash": "^4.17.4",
    "plotly.js": "^2.35.2"
  },
  "jupyterlab": {
    "extension": "lib/jupyterlab-plugin",
    "mimeExtension": "lib/plotly-renderer",
    "outputDir": "../../python/plotly/jupyterlab_plotly/labextension",
    "sharedPackages": {
      "@jupyter-widgets/base": {
        "bundled": false,
        "singleton": true
      }
    },
    "_build": {
      "load": "static/remoteEntry.c6c768d682b3638efd6b.js",
      "extension": "./extension",
      "mimeExtension": "./mimeExtension"
    }
  }
}

```

### myenv/lib/python3.9/site-packages/examples/minimal_build/docker-compose.yml

```yaml
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

version: '3.5'

services:
  minimal-fedora-conda:
    build:
      context: .
      dockerfile: Dockerfile.fedora
    volumes: &minimal-volumes
      - ../../../:/arrow:delegated
      - .:/io:delegated
    command:
      - "/io/build_conda.sh"

  minimal-fedora-venv:
    build:
      context: .
      dockerfile: Dockerfile.fedora
    volumes: *minimal-volumes
    command:
      - "/io/build_venv.sh"

  minimal-ubuntu-conda:
    build:
      context: .
      dockerfile: Dockerfile.ubuntu
    volumes: *minimal-volumes
    command:
      - "/io/build_conda.sh"

  minimal-ubuntu-venv:
    build:
      context: .
      dockerfile: Dockerfile.ubuntu
    volumes: *minimal-volumes
    command:
      - "/io/build_venv.sh"

```

### myenv/lib/python3.9/site-packages/jupyterlab_plotly/labextension/package.json

```
{
  "name": "jupyterlab-plotly",
  "version": "5.24.1",
  "description": "The plotly Jupyter extension",
  "author": "The plotly.py team",
  "license": "MIT",
  "main": "lib/index.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/plotly/plotly.py"
  },
  "keywords": [
    "jupyter",
    "widgets",
    "ipython",
    "ipywidgets",
    "plotly"
  ],
  "files": [
    "lib/**/*.js",
    "dist/*.js",
    "style/*.*"
  ],
  "scripts": {
    "build:dev": "npm run build:lib && npm run build:nbextension && npm run build:labextension:dev",
    "build:prod": "npm run build:lib && npm run build:nbextension && npm run build:labextension",
    "build:labextension": "jupyter labextension build .",
    "build:labextension:dev": "jupyter labextension build --development True .",
    "build:lib": "tsc",
    "build:nbextension": "webpack --mode=production",
    "clean": "npm run clean:lib && npm run clean:nbextension && npm run clean:labextension",
    "clean:lib": "rimraf lib",
    "clean:labextension": "rimraf ../../python/plotly/jupyterlab_plotly/labextension",
    "clean:nbextension": "rimraf ../../python/plotly/jupyterlab_plotly/nbextension/index.js*",
    "lint": "eslint . --ext .ts,.tsx --fix",
    "lint:check": "eslint . --ext .ts,.tsx",
    "prepack": "npm run build:lib",
    "test": "echo \"Error: no test specified\" && exit 1",
    "watch": "npm-run-all -p watch:*",
    "watch:lib": "tsc -w",
    "watch:nbextension": "webpack --watch"
  },
  "devDependencies": {
    "@jupyterlab/builder": "^3.0.0",
    "@lumino/application": "^1.6.0",
    "@types/plotly.js": "^1.54.10",
    "@types/webpack-env": "^1.13.6",
    "acorn": "^7.2.0",
    "css-loader": "^5.2.6",
    "fs-extra": "^7.0.0",
    "mkdirp": "^0.5.1",
    "npm-run-all": "^4.1.3",
    "prettier": "^2.0.5",
    "rimraf": "^2.6.2",
    "source-map-loader": "^1.1.3",
    "style-loader": "^1.0.0",
    "ts-loader": "^8.0.0",
    "typescript": "~4.1.3",
    "webpack": "^5.0.0",
    "webpack-cli": "^4.0.0"
  },
  "dependencies": {
    "@jupyter-widgets/base": ">=2.0.0 <7.0.0",
    "@jupyterlab/rendermime-interfaces": "^1.3.0 || ^2.0.0 || ^3.0.0",
    "@lumino/messaging": "^1.2.3",
    "@lumino/widgets": "^1.8.1",
    "lodash": "^4.17.4",
    "plotly.js": "^2.35.2"
  },
  "jupyterlab": {
    "extension": "lib/jupyterlab-plugin",
    "mimeExtension": "lib/plotly-renderer",
    "outputDir": "../../python/plotly/jupyterlab_plotly/labextension",
    "sharedPackages": {
      "@jupyter-widgets/base": {
        "bundled": false,
        "singleton": true
      }
    },
    "_build": {
      "load": "static/remoteEntry.c6c768d682b3638efd6b.js",
      "extension": "./extension",
      "mimeExtension": "./mimeExtension"
    }
  }
}

```

### myenv/lib/python3.9/site-packages/pandas/pyproject.toml

```
[build-system]
# Minimum requirements for the build system to execute.
# See https://github.com/scipy/scipy/pull/12940 for the AIX issue.
requires = [
    "meson-python==0.13.1",
    "meson==1.2.1",
    "wheel",
    "Cython~=3.0.5",  # Note: sync with setup.py, environment.yml and asv.conf.json
    # Force numpy higher than 2.0, so that built wheels are compatible
    # with both numpy 1 and 2
    "numpy>=2.0",
    "versioneer[toml]"
]

build-backend = "mesonpy"

[project]
name = 'pandas'
dynamic = [
  'version'
]
description = 'Powerful data structures for data analysis, time series, and statistics'
readme = 'README.md'
authors = [
  { name = 'The Pandas Development Team', email='pandas-dev@python.org' },
]
license = {file = 'LICENSE'}
requires-python = '>=3.9'
dependencies = [
  "numpy>=1.22.4; python_version<'3.11'",
  "numpy>=1.23.2; python_version=='3.11'",
  "numpy>=1.26.0; python_version>='3.12'",
  "python-dateutil>=2.8.2",
  "pytz>=2020.1",
  "tzdata>=2022.7"
]
classifiers = [
    'Development Status :: 5 - Production/Stable',
    'Environment :: Console',
    'Intended Audience :: Science/Research',
    'License :: OSI Approved :: BSD License',
    'Operating System :: OS Independent',
    'Programming Language :: Cython',
    'Programming Language :: Python',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3 :: Only',
    'Programming Language :: Python :: 3.9',
    'Programming Language :: Python :: 3.10',
    'Programming Language :: Python :: 3.11',
    'Programming Language :: Python :: 3.12',
    'Topic :: Scientific/Engineering'
]

[project.urls]
homepage = 'https://pandas.pydata.org'
documentation = 'https://pandas.pydata.org/docs/'
repository = 'https://github.com/pandas-dev/pandas'

[project.entry-points."pandas_plotting_backends"]
matplotlib = "pandas:plotting._matplotlib"

[project.optional-dependencies]
test = ['hypothesis>=6.46.1', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0']
pyarrow = ['pyarrow>=10.0.1']
performance = ['bottleneck>=1.3.6', 'numba>=0.56.4', 'numexpr>=2.8.4']
computation = ['scipy>=1.10.0', 'xarray>=2022.12.0']
fss = ['fsspec>=2022.11.0']
aws = ['s3fs>=2022.11.0']
gcp = ['gcsfs>=2022.11.0', 'pandas-gbq>=0.19.0']
excel = ['odfpy>=1.4.1', 'openpyxl>=3.1.0', 'python-calamine>=0.1.7', 'pyxlsb>=1.0.10', 'xlrd>=2.0.1', 'xlsxwriter>=3.0.5']
parquet = ['pyarrow>=10.0.1']
feather = ['pyarrow>=10.0.1']
hdf5 = [# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
        #'blosc>=1.20.1',
        'tables>=3.8.0']
spss = ['pyreadstat>=1.2.0']
postgresql = ['SQLAlchemy>=2.0.0', 'psycopg2>=2.9.6', 'adbc-driver-postgresql>=0.8.0']
mysql = ['SQLAlchemy>=2.0.0', 'pymysql>=1.0.2']
sql-other = ['SQLAlchemy>=2.0.0', 'adbc-driver-postgresql>=0.8.0', 'adbc-driver-sqlite>=0.8.0']
html = ['beautifulsoup4>=4.11.2', 'html5lib>=1.1', 'lxml>=4.9.2']
xml = ['lxml>=4.9.2']
plot = ['matplotlib>=3.6.3']
output-formatting = ['jinja2>=3.1.2', 'tabulate>=0.9.0']
clipboard = ['PyQt5>=5.15.9', 'qtpy>=2.3.0']
compression = ['zstandard>=0.19.0']
consortium-standard = ['dataframe-api-compat>=0.1.7']
all = ['adbc-driver-postgresql>=0.8.0',
       'adbc-driver-sqlite>=0.8.0',
       'beautifulsoup4>=4.11.2',
       # blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
       #'blosc>=1.21.3',
       'bottleneck>=1.3.6',
       'dataframe-api-compat>=0.1.7',
       'fastparquet>=2022.12.0',
       'fsspec>=2022.11.0',
       'gcsfs>=2022.11.0',
       'html5lib>=1.1',
       'hypothesis>=6.46.1',
       'jinja2>=3.1.2',
       'lxml>=4.9.2',
       'matplotlib>=3.6.3',
       'numba>=0.56.4',
       'numexpr>=2.8.4',
       'odfpy>=1.4.1',
       'openpyxl>=3.1.0',
       'pandas-gbq>=0.19.0',
       'psycopg2>=2.9.6',
       'pyarrow>=10.0.1',
       'pymysql>=1.0.2',
       'PyQt5>=5.15.9',
       'pyreadstat>=1.2.0',
       'pytest>=7.3.2',
       'pytest-xdist>=2.2.0',
       'python-calamine>=0.1.7',
       'pyxlsb>=1.0.10',
       'qtpy>=2.3.0',
       'scipy>=1.10.0',
       's3fs>=2022.11.0',
       'SQLAlchemy>=2.0.0',
       'tables>=3.8.0',
       'tabulate>=0.9.0',
       'xarray>=2022.12.0',
       'xlrd>=2.0.1',
       'xlsxwriter>=3.0.5',
       'zstandard>=0.19.0']

# TODO: Remove after setuptools support is dropped.
[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
include = ["pandas", "pandas.*"]
namespaces = false

[tool.setuptools.exclude-package-data]
"*" = ["*.c", "*.h"]

# See the docstring in versioneer.py for instructions. Note that you must
# re-run 'versioneer.py setup' after changing this section, and commit the
# resulting files.
[tool.versioneer]
VCS = "git"
style = "pep440"
versionfile_source = "pandas/_version.py"
versionfile_build = "pandas/_version.py"
tag_prefix = "v"
parentdir_prefix = "pandas-"

[tool.meson-python.args]
setup = ['--vsenv'] # For Windows

[tool.cibuildwheel]
skip = "cp36-* cp37-* cp38-* pp* *_i686 *_ppc64le *_s390x"
build-verbosity = "3"
environment = {LDFLAGS="-Wl,--strip-all"}
# pytz 2024.2 causing some failures
test-requires = "hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytz<2024.2"
test-command = """
  PANDAS_CI='1' python -c 'import pandas as pd; \
  pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db", "-n 2", "--no-strict-data-files"]); \
  pd.test(extra_args=["-m not clipboard and single_cpu and not slow and not network and not db", "--no-strict-data-files"]);' \
  """
free-threaded-support = true
before-build = "PACKAGE_DIR={package} bash {package}/scripts/cibw_before_build.sh"

[tool.cibuildwheel.windows]
before-build = "pip install delvewheel && bash {package}/scripts/cibw_before_build.sh"
repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel}"

[[tool.cibuildwheel.overrides]]
select = "*-manylinux_aarch64*"
test-command = """
  PANDAS_CI='1' python -c 'import pandas as pd; \
  pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and
[truncated — 18456 more characters]
```

### main.py

```python
import requests
import pandas as pd
import streamlit as st
import plotly.express as px
from groq import Groq
import os
from streamlit_plotly_events import plotly_events
import plotly.graph_objects as go
import random

# Configuration
base_url = 'https://financialmodelingprep.com/api'
API_KEY = 'REPLACE-WITH-YOUR-FINANCIALMODELINGPREP-API-KEY' # https://site.financialmodelingprep.com Grab a Free API Key
GROQ = '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'  # Replace with your actual GROQ API key

st.set_page_config(layout="wide")
st.title('AI-Powered Financial Insight')

# Sidebar for user input
ticker = st.sidebar.text_input('Ticker:', value='AAPL')

# Initialize Groq client
client = Groq(api_key=GROQ)

# Function definitions
def get_financial_data(statement_type):
    url = f'{base_url}/v3/{statement_type}/{ticker}?period=annual&limit=5&apikey={API_KEY}'
    try:
        response = requests.get(url)
        response.raise_for_status()  # Raises an HTTPError for bad responses
        data = response.json()

        if isinstance(data, str):
            st.error(f"Error in {statement_type} data: {data}")
            return []
        elif isinstance(data, list) and len(data) > 0:
            return data
        else:
            st.error(f"Invalid data format for {statement_type}")
            return []
    except requests.exceptions.RequestException as e:
        st.error(f"Error fetching {statement_type} data: {e}")
        return []
    except ValueError as e:
        st.error(f"Error parsing JSON for {statement_type}: {e}")
        return []

def create_plot(x, y, title, y_axis_title):
    colors = [
        '#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3',
        '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd',
        '#ccebc5', '#ffed6f', '#aec7e8', '#c7c7c7', '#dbdb8d'
    ]
    
    color_index = hash(title) % len(colors)
    color = colors[color_index]
    
    fig = px.bar(x=x, y=y, title=title, color_discrete_sequence=[color])
    fig.update_layout(xaxis_title='Year', yaxis_title=y_axis_title)
    return fig

def get_ai_insight(ticker, data, year_range, metric):
    if len(year_range) == 1:
        prompt = f"Analyze the {metric} data point for {ticker} in {year_range[0]}. The value is {data[0]}. Provide insights on this specific data point, its significance, and how it compares to industry standards or the company's historical performance. Most importantly, you are to only utilize specific company performance data from the dataset that we have provided from financialmodelingprep.com. Consider any relevant macroeconomic factors or company specific factors from this period that might explain this value. Make the information as concise as possible. Most importantly, you are to only utilize specific company performance data from the dataset that we have provided from financialmodelingprep.com."
    else:
        prompt = f"Analyze the {metric} data for {ticker} from {year_range[0]} to {year_range[1]}. The data is {data}. Provide insights on this specific data point, its significance, and how it compares to industry standards or the company's historical performance. Most importantly, you are to only utilize specific company performance data from the dataset that we have provided from financialmodelingprep.com. Consider any relevant macroeconomic factors or company specific factors from this period that might explain this value. Make the information as concise as possible. Most importantly, you are to only utilize specific company performance data from the dataset that we have provided from financialmodelingprep.com."
    
    response = client.chat.completions.create(
        model="mixtral-8x7b-32768",
        messages=[
            {"role": "system", "content": "Provide insights on this specific data point, its significance, and how it compares to industry standards or the company's historical performance. Most importantly, you are to only utilize specific company performance data from the dataset that we have provided from financialmodelingprep.com. Consider any relevant macroeconomic factors or company specific factors from this period that might explain this value. Make the information as concise as possible. Most importantly, you are to only utilize specific company performance data from the dataset that we have provided from financialmodelingprep.com."},
            {"role": "user", "content": prompt}
        ]
    )

    return response.choices[0].message.content

# Fetch data
income_data = get_financial_data('income-statement')
balance_sheet_data = get_financial_data('balance-sheet-statement')
cash_flow_data = get_financial_data('cash-flow-statement')

# Process data
if income_data and balance_sheet_data and cash_flow_data:
    try:
        years = [data['date'][:4] for data in income_data]
        revenue = [data['revenue'] for data in income_data]
        eps = [data['eps'] for data in income_data]
        gross_profit_ratio = [data['grossProfitRatio'] for data in income_data] 
        net_income_ratio = [data['netIncomeRatio'] for data in income_data] 
        net_income = [data['netIncome'] for data in income_data]
        total_assets = [data['totalAssets'] for data in balance_sheet_data]
        total_liabilities = [data['totalLiabilities'] for data in balance_sheet_data]
        operating_cash_flow = [data['operatingCashFlow'] for data in cash_flow_data]
        free_cash_flow = [data['freeCashFlow'] for data in cash_flow_data]
        total_current_assets = [data['totalCurrentAssets'] for data in balance_sheet_data] 
        total_current_liabilities = [data['totalCurrentLiabilities'] for data in balance_sheet_data]
        liquidity = [int(a)/int(b) for a,b in zip(total_current_assets, total_current_liabilities)]
    except (KeyError, TypeError) as e:
        st.error(f"Error processing financial data: {e}")
        st.error("Please check the API response format and ensure all required fields are present.")
        years, revenue, eps, gr
[truncated — 1915 more characters]
```

### myenv/lib/python3.9/site-packages/jsonschema/cli.py

```python
"""
The ``jsonschema`` command line.
"""

from importlib import metadata
from json import JSONDecodeError
from textwrap import dedent
import argparse
import json
import sys
import traceback
import warnings

try:
    from pkgutil import resolve_name
except ImportError:
    from pkgutil_resolve_name import resolve_name  # type: ignore[no-redef]

from attrs import define, field

from jsonschema.exceptions import SchemaError
from jsonschema.validators import _RefResolver, validator_for

warnings.warn(
    (
        "The jsonschema CLI is deprecated and will be removed in a future "
        "version. Please use check-jsonschema instead, which can be installed "
        "from https://pypi.org/project/check-jsonschema/"
    ),
    DeprecationWarning,
    stacklevel=2,
)


class _CannotLoadFile(Exception):
    pass


@define
class _Outputter:

    _formatter = field()
    _stdout = field()
    _stderr = field()

    @classmethod
    def from_arguments(cls, arguments, stdout, stderr):
        if arguments["output"] == "plain":
            formatter = _PlainFormatter(arguments["error_format"])
        elif arguments["output"] == "pretty":
            formatter = _PrettyFormatter()
        return cls(formatter=formatter, stdout=stdout, stderr=stderr)

    def load(self, path):
        try:
            file = open(path)  # noqa: SIM115, PTH123
        except FileNotFoundError as error:
            self.filenotfound_error(path=path, exc_info=sys.exc_info())
            raise _CannotLoadFile() from error

        with file:
            try:
                return json.load(file)
            except JSONDecodeError as error:
                self.parsing_error(path=path, exc_info=sys.exc_info())
                raise _CannotLoadFile() from error

    def filenotfound_error(self, **kwargs):
        self._stderr.write(self._formatter.filenotfound_error(**kwargs))

    def parsing_error(self, **kwargs):
        self._stderr.write(self._formatter.parsing_error(**kwargs))

    def validation_error(self, **kwargs):
        self._stderr.write(self._formatter.validation_error(**kwargs))

    def validation_success(self, **kwargs):
        self._stdout.write(self._formatter.validation_success(**kwargs))


@define
class _PrettyFormatter:

    _ERROR_MSG = dedent(
        """\
        ===[{type}]===({path})===

        {body}
        -----------------------------
        """,
    )
    _SUCCESS_MSG = "===[SUCCESS]===({path})===\n"

    def filenotfound_error(self, path, exc_info):
        return self._ERROR_MSG.format(
            path=path,
            type="FileNotFoundError",
            body=f"{path!r} does not exist.",
        )

    def parsing_error(self, path, exc_info):
        exc_type, exc_value, exc_traceback = exc_info
        exc_lines = "".join(
            traceback.format_exception(exc_type, exc_value, exc_traceback),
        )
        return self._ERROR_MSG.format(
            path=path,
            type=exc_type.__name__,
            body=exc_lines,
        )

    def validation_error(self, instance_path, error):
        return self._ERROR_MSG.format(
            path=instance_path,
            type=error.__class__.__name__,
            body=error,
        )

    def validation_success(self, instance_path):
        return self._SUCCESS_MSG.format(path=instance_path)


@define
class _PlainFormatter:

    _error_format = field()

    def filenotfound_error(self, path, exc_info):
        return f"{path!r} does not exist.\n"

    def parsing_error(self, path, exc_info):
        return "Failed to parse {}: {}\n".format(
            "<stdin>" if path == "<stdin>" else repr(path),
            exc_info[1],
        )

    def validation_error(self, instance_path, error):
        return self._error_format.format(file_name=instance_path, error=error)

    def validation_success(self, instance_path):
        return ""


def _resolve_name_with_default(name):
    if "." not in name:
        name = "jsonschema." + name
    return resolve_name(name)


parser = argparse.ArgumentParser(
    description="JSON Schema Validation CLI",
)
parser.add_argument(
    "-i", "--instance",
    action="append",
    dest="instances",
    help="""
        a path to a JSON instance (i.e. filename.json) to validate (may
        be specified multiple times). If no instances are provided via this
        option, one will be expected on standard input.
    """,
)
parser.add_argument(
    "-F", "--error-format",
    help="""
        the format to use for each validation error message, specified
        in a form suitable for str.format. This string will be passed
        one formatted object named 'error' for each ValidationError.
        Only provide this option when using --output=plain, which is the
        default. If this argument is unprovided and --output=plain is
        used, a simple default representation will be used.
    """,
)
parser.add_argument(
    "-o", "--output",
    choices=["plain", "pretty"],
    default="plain",
    help="""
        an output format to use. 'plain' (default) will produce minimal
        text with one line for each error, while 'pretty' will produce
        more detailed human-readable output on multiple lines.
    """,
)
parser.add_argument(
    "-V", "--validator",
    type=_resolve_name_with_default,
    help="""
        the fully qualified object name of a validator to use, or, for
        validators that are registered with jsonschema, simply the name
        of the class.
    """,
)
parser.add_argument(
    "--base-uri",
    help="""
        a base URI to assign to the provided schema, even if it does not
        declare one (via e.g. $id). This option can be used if you wish to
        resolve relative references to a particular URI (or local path)
    """,
)
parser.add_argument(
    "--version",
    action="version",
    version=metadata.version("jsonschema"),
)
parser.add_argument(
    "schema",
    help="the path to a JSON Schema to validate with (i.e. schema.json)",
)


def parse_args
[truncated — 2551 more characters]
```

### myenv/lib/python3.9/site-packages/markdown_it/main.py

```python
from __future__ import annotations

from collections.abc import Callable, Generator, Iterable, Mapping, MutableMapping
from contextlib import contextmanager
from typing import Any, Literal, overload

from . import helpers, presets
from .common import normalize_url, utils
from .parser_block import ParserBlock
from .parser_core import ParserCore
from .parser_inline import ParserInline
from .renderer import RendererHTML, RendererProtocol
from .rules_core.state_core import StateCore
from .token import Token
from .utils import EnvType, OptionsDict, OptionsType, PresetType

try:
    import linkify_it
except ModuleNotFoundError:
    linkify_it = None


_PRESETS: dict[str, PresetType] = {
    "default": presets.default.make(),
    "js-default": presets.js_default.make(),
    "zero": presets.zero.make(),
    "commonmark": presets.commonmark.make(),
    "gfm-like": presets.gfm_like.make(),
}


class MarkdownIt:
    def __init__(
        self,
        config: str | PresetType = "commonmark",
        options_update: Mapping[str, Any] | None = None,
        *,
        renderer_cls: Callable[[MarkdownIt], RendererProtocol] = RendererHTML,
    ):
        """Main parser class

        :param config: name of configuration to load or a pre-defined dictionary
        :param options_update: dictionary that will be merged into ``config["options"]``
        :param renderer_cls: the class to load as the renderer:
            ``self.renderer = renderer_cls(self)
        """
        # add modules
        self.utils = utils
        self.helpers = helpers

        # initialise classes
        self.inline = ParserInline()
        self.block = ParserBlock()
        self.core = ParserCore()
        self.renderer = renderer_cls(self)
        self.linkify = linkify_it.LinkifyIt() if linkify_it else None

        # set the configuration
        if options_update and not isinstance(options_update, Mapping):
            # catch signature change where renderer_cls was not used as a key-word
            raise TypeError(
                f"options_update should be a mapping: {options_update}"
                "\n(Perhaps you intended this to be the renderer_cls?)"
            )
        self.configure(config, options_update=options_update)

    def __repr__(self) -> str:
        return f"{self.__class__.__module__}.{self.__class__.__name__}()"

    @overload
    def __getitem__(self, name: Literal["inline"]) -> ParserInline:
        ...

    @overload
    def __getitem__(self, name: Literal["block"]) -> ParserBlock:
        ...

    @overload
    def __getitem__(self, name: Literal["core"]) -> ParserCore:
        ...

    @overload
    def __getitem__(self, name: Literal["renderer"]) -> RendererProtocol:
        ...

    @overload
    def __getitem__(self, name: str) -> Any:
        ...

    def __getitem__(self, name: str) -> Any:
        return {
            "inline": self.inline,
            "block": self.block,
            "core": self.core,
            "renderer": self.renderer,
        }[name]

    def set(self, options: OptionsType) -> None:
        """Set parser options (in the same format as in constructor).
        Probably, you will never need it, but you can change options after constructor call.

        __Note:__ To achieve the best possible performance, don't modify a
        `markdown-it` instance options on the fly. If you need multiple configurations
        it's best to create multiple instances and initialize each with separate config.
        """
        self.options = OptionsDict(options)

    def configure(
        self, presets: str | PresetType, options_update: Mapping[str, Any] | None = None
    ) -> MarkdownIt:
        """Batch load of all options and component settings.
        This is an internal method, and you probably will not need it.
        But if you will - see available presets and data structure
        [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)

        We strongly recommend to use presets instead of direct config loads.
        That will give better compatibility with next versions.
        """
        if isinstance(presets, str):
            if presets not in _PRESETS:
                raise KeyError(f"Wrong `markdown-it` preset '{presets}', check name")
            config = _PRESETS[presets]
        else:
            config = presets

        if not config:
            raise ValueError("Wrong `markdown-it` config, can't be empty")

        options = config.get("options", {}) or {}
        if options_update:
            options = {**options, **options_update}  # type: ignore

        self.set(options)  # type: ignore

        if "components" in config:
            for name, component in config["components"].items():
                rules = component.get("rules", None)
                if rules:
                    self[name].ruler.enableOnly(rules)
                rules2 = component.get("rules2", None)
                if rules2:
                    self[name].ruler2.enableOnly(rules2)

        return self

    def get_all_rules(self) -> dict[str, list[str]]:
        """Return the names of all active rules."""
        rules = {
            chain: self[chain].ruler.get_all_rules()
            for chain in ["core", "block", "inline"]
        }
        rules["inline2"] = self.inline.ruler2.get_all_rules()
        return rules

    def get_active_rules(self) -> dict[str, list[str]]:
        """Return the names of all active rules."""
        rules = {
            chain: self[chain].ruler.get_active_rules()
            for chain in ["core", "block", "inline"]
        }
        rules["inline2"] = self.inline.ruler2.get_active_rules()
        return rules

    def enable(
        self, names: str | Iterable[str], ignoreInvalid: bool = False
    ) -> MarkdownIt:
        """Enable list or rules. (chainable)

        :param names: rule name or list of rule names to enable.
        :param ignoreInvalid: set `true` to ignore errors when rule not found.

        It will a
[truncated — 6772 more characters]
```

[19796 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]