Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version #39

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
26 changes: 26 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "polymind"
copyright = "2024, TechTao"
author = "TechTao"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ["_templates"]
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "alabaster"
html_static_path = ["_static"]
20 changes: 20 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. polymind documentation master file, created by
sphinx-quickstart on Tue Mar 19 21:51:36 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to polymind's documentation!
====================================

.. toctree::
:maxdepth: 2
:caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
11 changes: 10 additions & 1 deletion polymind/core/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ def __str__(self) -> str:
@field_validator("type")
def check_type(cls, v: str) -> str:
allowed_simple_types = [
"str", "int", "float", "bool", "ndarray", "np.ndarray", "pandas.DataFrame", "pd.DataFrame"
"str",
"int",
"float",
"bool",
"ndarray",
"np.ndarray",
"numpy.ndarray",
"pandas.DataFrame",
"pd.DataFrame",
"DataFrame",
]
if v in allowed_simple_types:
return v
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "polymind"
version = "0.0.21" # Update this version before publishing to PyPI
version = "0.0.22" # Update this version before publishing to PyPI
description = "PolyMind is a customizable collaborative multi-agent framework for collective intelligence and distributed problem solving."
authors = ["TechTao"]
license = "MIT License"
Expand Down
20 changes: 19 additions & 1 deletion tests/polymind/core/test_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,21 @@


class TestParam:
@pytest.mark.parametrize("type_str", ["str", "int", "float"])
@pytest.mark.parametrize(
"type_str",
[
"str",
"int",
"float",
"bool",
"ndarray",
"np.ndarray",
"numpy.ndarray",
"DataFrame",
"pd.DataFrame",
"pandas.DataFrame",
],
)
def test_valid_simple_types(self, type_str):
"""Test that Param accepts valid simple type strings."""
param = Param(
Expand All @@ -32,6 +46,10 @@ def test_valid_simple_types(self, type_str):
("Dict[str, int]", "{'key': 123}"),
("List[int]", "[1, 2, 3]"),
("np.ndarray", "np.array([1, 2, 3])"),
(
"pd.DataFrame",
"pd.DataFrame({'col1': [1, 2, 3], 'col2': ['a', 'b', 'c']})",
),
],
)
def test_valid_complex_types_with_example(self, type_str, example):
Expand Down
Loading