-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs with material-from-mkdocs (#70)
* removing old docs * removing docs from codespell * adding mkdocs-material * adding docstring generator and jupyter extension * creating new project with mkdocs * moving to docs and appending mesa-frames path * adding markdownlint to pre-commit hooks * moving mkdocs to root folder * modeling mkdocs on polars * adding automatic fixing for markdown lint * update markdownlint * adding index.md * renaming to .markdownlint.json * creating api docs * adding pydoclint * pydoclint fix for abstract/agents.py * adding DataFrameInput type hint * pydoclint fix for mesa_frames/abstract/mixin * adding raises skip checking * allowing init docstring (clearer) * pydoclint fix for mesa_frames/abstract/space * pydoclint fixes for mesa_frames.concrete.agents * pydoclint fixes for mesa_frames/concrete/model * pydoclint fixes for mesa_frames/concrete/polars/agentset * explaining pre-commit use * removing mkdocstrings (better to do it with sphinx) * removing api documentation with mkdocs * moving mkdocs.yml to docs folder * automatic gh action for publishing mkdocs * moving mkdocs.yml to root * mkdocs.yml in root directory * removing material-for-mkdocs branch * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * change Pandas to pandas --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
7075624
commit 18fe881
Showing
14 changed files
with
243 additions
and
2,432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Publish docs via GitHub Pages | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Deploy docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout main | ||
uses: actions/checkout@v2 | ||
|
||
- name: Deploy docs | ||
uses: mhausenblas/mkdocs-deploy-gh-pages@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
REQUIREMENTS: docs/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"MD013": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Welcome to mesa-frames 🚀 | ||
|
||
mesa-frames is an extension of the [mesa](https://github.com/projectmesa/mesa) framework, designed for complex simulations with thousands of agents. By storing agents in a DataFrame, mesa-frames significantly enhances the performance and scalability of mesa, while maintaining a similar syntax. | ||
|
||
## Why DataFrames? 📊 | ||
|
||
DataFrames are optimized for simultaneous operations through [SIMD processing](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data). Currently, mesa-frames supports two main libraries: | ||
|
||
- [pandas](https://pandas.pydata.org/): A popular data-manipulation Python library, known for its ease of use and high performance. | ||
- [Polars](https://pola.rs/): A new DataFrame library with a Rust backend, offering innovations like Apache Arrow memory format and support for larger-than-memory DataFrames. | ||
|
||
## Performance Boost 🏎️ | ||
|
||
Check out our performance graphs comparing mesa and mesa-frames for the [Boltzmann Wealth model](https://mesa.readthedocs.io/en/stable/tutorials/intro_tutorial.html): | ||
|
||
 | ||
|
||
 | ||
|
||
## Quick Start 🚀 | ||
|
||
### Installation | ||
|
||
```bash | ||
git clone https://github.com/adamamer20/mesa_frames.git | ||
cd mesa_frames | ||
pip install -e .[pandas] # For pandas backend | ||
# or | ||
pip install -e .[polars] # For Polars backend | ||
``` | ||
|
||
### Basic Usage | ||
|
||
Here's a quick example of how to create an agent set using mesa-frames: | ||
|
||
```python | ||
from mesa-frames import AgentSetPolars, ModelDF | ||
|
||
class MoneyAgentPolars(AgentSetPolars): | ||
def __init__(self, n: int, model: ModelDF): | ||
super().__init__(model) | ||
self += pl.DataFrame( | ||
{"unique_id": pl.arange(n, eager=True), "wealth": pl.ones(n, eager=True)} | ||
) | ||
|
||
def step(self) -> None: | ||
self.do("give_money") | ||
|
||
def give_money(self): | ||
# ... (implementation details) | ||
|
||
class MoneyModelDF(ModelDF): | ||
def __init__(self, N: int): | ||
super().__init__() | ||
self.agents += MoneyAgentPolars(N, self) | ||
|
||
def step(self): | ||
self.agents.do("step") | ||
|
||
def run_model(self, n): | ||
for _ in range(n): | ||
self.step() | ||
``` | ||
|
||
## What's Next? 🔮 | ||
|
||
- API refinement for seamless transition from mesa | ||
- Support for default mesa functions | ||
- GPU functionality (cuDF and Rapids) | ||
- Automatic vectorization of existing mesa models | ||
- Backend-independent AgentSet class | ||
|
||
## Get Involved! 🤝 | ||
|
||
mesa-frames is in its early stages, and we welcome your feedback and contributions! Check out our [GitHub repository](https://github.com/adamamer20/mesa_frames) to get started. | ||
|
||
## License | ||
|
||
mesa-frames is available under the MIT License. See the [LICENSE](https://github.com/adamamer20/mesa_frames/blob/main/LICENSE) file for full details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mkdocs-jupyter | ||
mkdocs-git-revision-date-localized-plugin | ||
mkdocs-minify-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# Project information | ||
site_name: mesa-frames | ||
site_url: https://adamamer20.github.io/mesa-frames | ||
repo_url: https://github.com/adamamer20/mesa-frames | ||
repo_name: adamamer20/mesa-frames | ||
|
||
# Theme configuration | ||
theme: | ||
name: material | ||
features: | ||
- navigation.tabs | ||
- navigation.sections | ||
- navigation.top | ||
- navigation.tracking | ||
- navigation.indexes | ||
- toc.follow | ||
- search.suggest | ||
- search.highlight | ||
- search.share | ||
- header.autohide | ||
- content.tabs.link | ||
- content.code.annotation | ||
- content.code.copy | ||
palette: | ||
# Palette toggle for light mode | ||
- media: "(prefers-color-scheme: light)" | ||
scheme: default | ||
toggle: | ||
icon: material/brightness-7 | ||
name: Switch to dark mode | ||
# Palette toggle for dark mode | ||
- media: "(prefers-color-scheme: dark)" | ||
scheme: slate | ||
toggle: | ||
icon: material/brightness-4 | ||
name: Switch to light mode | ||
font: | ||
text: Roboto | ||
code: Roboto Mono | ||
icon: | ||
repo: fontawesome/brands/github | ||
|
||
# Plugins | ||
plugins: | ||
- search | ||
- mkdocs-jupyter | ||
- git-revision-date-localized: | ||
enable_creation_date: true | ||
- minify: | ||
minify_html: true | ||
|
||
# Extensions | ||
markdown_extensions: | ||
- admonition | ||
- attr_list | ||
- def_list | ||
- footnotes | ||
- md_in_html | ||
- toc: | ||
permalink: true | ||
- pymdownx.arithmatex: | ||
generic: true | ||
- pymdownx.betterem: | ||
smart_enable: all | ||
- pymdownx.caret | ||
- pymdownx.details | ||
- pymdownx.highlight: | ||
anchor_linenums: true | ||
line_spans: __span | ||
pygments_lang_class: true | ||
- pymdownx.inlinehilite | ||
- pymdownx.keys | ||
- pymdownx.magiclink: | ||
repo_url_shorthand: true | ||
user: adamamer20 | ||
repo: mesa-frames | ||
- pymdownx.mark | ||
- pymdownx.smartsymbols | ||
- pymdownx.superfences: | ||
custom_fences: | ||
- name: mermaid | ||
class: mermaid | ||
- pymdownx.tabbed: | ||
alternate_style: true | ||
- pymdownx.tasklist: | ||
custom_checkbox: true | ||
- pymdownx.tilde | ||
|
||
# Extra JavaScript and CSS for rendering | ||
extra_javascript: | ||
- javascripts/mathjax.js | ||
- https://polyfill.io/v3/polyfill.min.js?features=es6 | ||
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js | ||
|
||
# Customization | ||
extra: | ||
social: | ||
- icon: fontawesome/brands/github | ||
link: https://github.com/adamamer20 | ||
- icon: fontawesome/brands/python | ||
link: https://pypi.org/project/mesa-frames/ | ||
|
||
# Navigation | ||
nav: | ||
- Home: index.md | ||
- User Guide: | ||
- Getting Started: user-guide/getting-started.md | ||
- Tutorial: user-guide/tutorial.md | ||
- API Reference: api/index.html | ||
- Development: | ||
- Contributing: development/contributing.md | ||
- Changelog: development/changelog.md | ||
- About: | ||
- License: about/license.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters