Merge pull request #187 from evelynmitchell/master

pull/202/head
Eternal Reclaimer 1 year ago committed by GitHub
commit 6cb371f44a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,2 +1,2 @@
[flake8] [flake8]
extend-ignore = E501, W292, W291 extend-ignore = E501, W292, W291, W293

@ -1,13 +1,14 @@
---
# These are supported funding model platforms # These are supported funding model platforms
github: [kyegomez] github: [kyegomez]
patreon: # Replace with a single Patreon username # patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username # open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username # ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel # tidelift: # Replace with a single Tidelift platform-name/package-name
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry # community_bridge: # Replace with a single Community Bridge project-name
liberapay: # Replace with a single Liberapay username # liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username # issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username # otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry # lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name
custom: #Nothing # custom: #Nothing

@ -1,3 +1,4 @@
---
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates # https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
version: 2 version: 2
@ -11,4 +12,3 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "weekly" interval: "weekly"

@ -1,12 +1,14 @@
---
# this is a config file for the github action labeler # this is a config file for the github action labeler
# Add 'label1' to any changes within 'example' folder or any subfolders # Add 'label1' to any changes within 'example' folder or any subfolders
example_change: example_change:
- example/** - example/**
# Add 'label2' to any file changes within 'example2' folder # Add 'label2' to any file changes within 'example2' folder
example2_change: example2/* example2_change: example2/*
# Add label3 to any change to .txt files within the entire repository. Quotation marks are required for the leading asterisk # Add label3 to any change to .txt files within the entire repository.
# Quotation marks are required for the leading asterisk
text_files: text_files:
- '**/*.txt' - '**/*.txt'

@ -22,10 +22,10 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install poetry - name: Install poetry
run: pipx install poetry==$POETRY_VERSION run: pipx install poetry==$POETRY_VERSION
- name: Set up Python 3.10 - name: Set up Python 3.9
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.10" python-version: "3.9"
cache: "poetry" cache: "poetry"
- name: Build project for distribution - name: Build project for distribution
run: poetry build run: poetry build

@ -1,30 +0,0 @@
name: Linting and Formatting
on:
push:
branches:
- master
jobs:
lint_and_format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Find Python files
run: find swarms -name "*.py" -type f -exec autopep8 --in-place --aggressive --aggressive {} +
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

@ -1,42 +0,0 @@
name: Continuous Integration
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run unit tests
run: pytest tests/unit
- name: Run integration tests
run: pytest tests/integration
- name: Run code coverage
run: pytest --cov=swarms tests/
- name: Run linters
run: pylint swarms
- name: Build documentation
run: make docs
- name: Validate documentation
run: sphinx-build -b linkcheck docs build/docs
- name: Run performance tests
run: find ./tests -name '*.py' -exec pytest {} \;

@ -1,17 +1,18 @@
---
name: Docker Image CI name: Docker Image CI
on: on: # yamllint disable-line rule:truthy
push: push:
branches: [ "master" ] branches: ["master"]
pull_request: pull_request:
branches: [ "master" ] branches: ["master"]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Build Docker image
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build the Docker image - name: Build the Docker image

@ -1,28 +0,0 @@
name: Documentation Tests
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build documentation
run: make docs
- name: Validate documentation
run: sphinx-build -b linkcheck docs build/docs

@ -1,66 +0,0 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow lets you generate SLSA provenance file for your project.
# The generation satisfies level 3 for the provenance requirements - see https://slsa.dev/spec/v0.1/requirements
# The project is an initiative of the OpenSSF (openssf.org) and is developed at
# https://github.com/slsa-framework/slsa-github-generator.
# The provenance file can be verified using https://github.com/slsa-framework/slsa-verifier.
# For more information about SLSA and how it improves the supply-chain, visit slsa.dev.
name: SLSA generic generator
on:
workflow_dispatch:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
outputs:
digests: ${{ steps.hash.outputs.digests }}
steps:
- uses: actions/checkout@v3
# ========================================================
#
# Step 1: Build your artifacts.
#
# ========================================================
- name: Build artifacts
run: |
# These are some amazing artifacts.
echo "artifact1" > artifact1
echo "artifact2" > artifact2
# ========================================================
#
# Step 2: Add a step to generate the provenance subjects
# as shown below. Update the sha256 sum arguments
# to include all binaries that you generate
# provenance for.
#
# ========================================================
- name: Generate subject for provenance
id: hash
run: |
set -euo pipefail
# List the artifacts the provenance will refer to.
files=$(ls artifact*)
# Generate the subjects (base64 encoded).
echo "hashes=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"
provenance:
needs: [build]
permissions:
actions: read # To read the workflow path.
id-token: write # To sign the provenance.
contents: write # To add assets to a release.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.4.0
with:
base64-subjects: "${{ needs.build.outputs.digests }}"
upload-assets: true # Optional: Upload to a new release

@ -1,19 +1,29 @@
---
# This is a basic workflow to help you get started with Actions # This is a basic workflow to help you get started with Actions
name: Lint name: Lint
on: [push, pull_request] on: [push, pull_request] # yamllint disable-line rule:truthy
jobs: jobs:
yaml-lint:
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4
- name: yaml Lint
uses: ibiqlik/action-yamllint@v3
flake8-lint: flake8-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Lint name: flake8 Lint
steps: steps:
- name: Check out source repository - name: Check out source repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Python environment - name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: flake8 Lint
uses: py-actions/flake8@v2 uses: py-actions/flake8@v2
ruff-lint:
runs-on: ubuntu-latest
name: ruff Lint
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1

@ -1,25 +0,0 @@
name: Linting
on:
push:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run linters
run: pylint swarms

@ -1,27 +0,0 @@
name: Makefile CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: configure
run: ./configure
- name: Install dependencies
run: make
- name: Run check
run: make check
- name: Run distcheck
run: make distcheck

@ -1,3 +1,4 @@
---
name: Pull Request Checks name: Pull Request Checks
on: on:
@ -19,9 +20,11 @@ jobs:
python-version: 3.x python-version: 3.x
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt run: |
pip install -r requirements.txt
pip install pytest
- name: Run tests and checks - name: Run tests and checks
run: | run: |
find tests/ -name "*.py" | xargs pytest pytest
pylint swarms pylint swarms

@ -1,23 +0,0 @@
name: Pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')

@ -1,46 +0,0 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow integrates Pyre with GitHub's
# Code Scanning feature.
#
# Pyre is a performant type checker for Python compliant with
# PEP 484. Pyre can analyze codebases with millions of lines
# of code incrementally providing instantaneous feedback
# to developers as they write code.
#
# See https://pyre-check.org
name: Pyre
on:
workflow_dispatch:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
pyre:
permissions:
actions: read
contents: read
security-events: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Run Pyre
uses: facebook/pyre-action@60697a7858f7cc8470d8cc494a3cf2ad6b06560d
with:
# To customize these inputs:
# See https://github.com/facebook/pyre-action#inputs
repo-directory: './'
requirements-path: 'requirements.txt'

@ -1,39 +0,0 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest

@ -38,4 +38,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest - name: Test with pytest
run: | run: |
find ./tests -name '*.py' -exec pytest {} \; pytest

@ -1,7 +1,7 @@
---
name: Upload Python Package name: Upload Python Package
on: on: # yamllint disable-line rule:truthy
release: release:
types: [published] types: [published]

@ -1,23 +0,0 @@
name: Quality
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout actions
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run linter
run: |
pylint `git diff --name-only --diff-filter=d origin/master HEAD | grep -E '\.py$' | tr '\n' ' '`

@ -1,8 +0,0 @@
name: Ruff
on: [ push, pull_request ]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1

@ -1,23 +0,0 @@
name: Python application test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run tests with pytest
run: |
find tests/ -name "*.py" | xargs pytest

@ -1,3 +1,4 @@
---
name: test name: test
on: on:
@ -9,7 +10,67 @@ on:
env: env:
POETRY_VERSION: "1.4.2" POETRY_VERSION: "1.4.2"
jobs: test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
test_type:
- "core"
- "extended"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: "snok/install-poetry@v1"
with:
python-version: ${{ matrix.python-version }}
poetry-version: "1.4.2"
cache-key: ${{ matrix.test_type }}
install-command: |
if [ "${{ matrix.test_type }}" == "core" ]; then
echo "Running core tests, installing dependencies with poetry..."
poetry install
else
echo "Running extended tests, installing dependencies with poetry..."
poetry install -E extended_testing
fi
- name: Run ${{matrix.test_type}} tests
run: |
if [ "${{ matrix.test_type }}" == "core" ]; then
make test
else
make extended_tests
fi
shell: bash
name: Python ${{ matrix.python-version }} ${{ matrix.test_type }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: "./.github/actions/poetry_setup"
with:
python-version: ${{ matrix.python-version }}
poetry-version: "1.4.2"
cache-key: ${{ matrix.test_type }}
install-command: |
if [ "${{ matrix.test_type }}" == "core" ]; then
echo "Running core tests, installing dependencies with poetry..."
poetry install
else
echo "Running extended tests, installing dependencies with poetry..."
poetry install -E extended_testing
fi
- name: Run ${{matrix.test_type}} tests
run: |
if [ "${{ matrix.test_type }}" == "core" ]; then
make test
else
make extended_tests
fi
shell: bash
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:

@ -19,7 +19,9 @@ jobs:
python-version: 3.x python-version: 3.x
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt run: |
pip install -r requirements.txt
pip install pytest
- name: Run unit tests - name: Run unit tests
run: find tests/ -name "*.py" | xargs pytest run: pytest

@ -18,16 +18,18 @@ jobs:
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: '3.10' python-version: '3.9'
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt run: |
pip install -r requirements.txt
pip install pytest
- name: Run Python unit tests - name: Run Python unit tests
run: python3 -m unittest tests/ run: pytest
- name: Verify that the Docker image for the action builds - name: Verify that the Docker image for the action builds
run: docker build . --file Dockerfile run: docker build . --file Dockerfile
- name: Verify integration test results - name: Verify integration test results
run: find tests/ -name "*.py" | xargs pytest run: pytest

1
.gitignore vendored

@ -187,3 +187,4 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear # and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
.vscode/settings.json

@ -1,3 +1,4 @@
---
version: 2 version: 2
build: build:

@ -0,0 +1,4 @@
rules:
line-length:
level: warning
allow-non-breakable-inline-mappings: true

@ -72,7 +72,6 @@ pre-commit --version
Now when you make a git commit, the black code formatter and ruff linter will run. Now when you make a git commit, the black code formatter and ruff linter will run.
Furthermore, we have integrated a pre-commit GitHub Action into our workflow. This means that with every pull request opened, the pre-commit checks will be automatically enforced, streamlining the code review process and ensuring that all contributions adhere to our quality standards. Furthermore, we have integrated a pre-commit GitHub Action into our workflow. This means that with every pull request opened, the pre-commit checks will be automatically enforced, streamlining the code review process and ensuring that all contributions adhere to our quality standards.
To run the pre-commit tool, follow these steps: To run the pre-commit tool, follow these steps:
@ -124,13 +123,13 @@ You can learn more about mkdocs on the [mkdocs website](https://www.mkdocs.org/)
## 🧪 tests ## 🧪 tests
- Run all the tests in the tests folder - Run all the tests in the tests folder
`find ./tests -name '*.py' -exec pytest {} \;` ```pytest```
## Code Quality ## Code Quality
`quality.sh` runs 4 different code formatters for ultra reliable code cleanup using Autopep8, Black, Ruff, YAPF `code-quality.sh` runs 4 different code formatters for ultra reliable code cleanup using Autopep8, Black, Ruff, YAPF
1. Open your terminal. 1. Open your terminal.
2. Change directory to where `quality.sh` is located using `cd` command: 2. Change directory to where `code-quality.sh` is located using `cd` command:
```sh ```sh
cd /path/to/directory cd /path/to/directory
``` ```
@ -142,17 +141,17 @@ You can learn more about mkdocs on the [mkdocs website](https://www.mkdocs.org/)
4. Run the script: 4. Run the script:
```sh ```sh
./quality.sh ./code-quality.sh
``` ```
If the script requires administrative privileges, you might need to run it with `sudo`: If the script requires administrative privileges, you might need to run it with `sudo`:
```sh ```sh
sudo ./quality.sh sudo ./code-quality.sh
``` ```
Please replace `/path/to/directory` with the actual path where the `quality.sh` script is located on your system. Please replace `/path/to/directory` with the actual path where the `code-quality.sh` script is located on your system.
If you're asking for a specific content or functionality inside `quality.sh` related to YAPF or other code quality tools, you would need to edit the `quality.sh` script to include the desired commands, such as running YAPF on a directory. The contents of `quality.sh` would dictate exactly what happens when you run it. If you're asking for a specific content or functionality inside `code-quality.sh` related to YAPF or other code quality tools, you would need to edit the `code-quality.sh` script to include the desired commands, such as running YAPF on a directory. The contents of `code-quality.sh` would dictate exactly what happens when you run it.
## 📄 license ## 📄 license

@ -13,7 +13,7 @@ black --experimental-string-processing swarms/
# Run ruff on the 'swarms' directory. # Run ruff on the 'swarms' directory.
# Add any additional flags if needed according to your version of ruff. # Add any additional flags if needed according to your version of ruff.
#ruff --unsafe_fix ruff --unsafe_fix
# YAPF # YAPF
yapf --recursive --in-place --verbose --style=google --parallel swarms yapf --recursive --in-place --verbose --style=google --parallel swarms

@ -1,3 +1,4 @@
---
site_name: Swarms Docs site_name: Swarms Docs
plugins: plugins:
- glightbox - glightbox
@ -58,11 +59,11 @@ markdown_extensions:
- def_list - def_list
- footnotes - footnotes
nav: nav:
- Home: - Home:
- Overview: "index.md" - Overview: "index.md"
- Contributing: "contributing.md" - Contributing: "contributing.md"
- Docker Container Setup: "docker_setup.md" - Docker Container Setup: "docker_setup.md"
- Swarms: - Swarms:
- Overview: "swarms/index.md" - Overview: "swarms/index.md"
- swarms.swarms: - swarms.swarms:
- AbstractSwarm: "swarms/swarms/abstractswarm.md" - AbstractSwarm: "swarms/swarms/abstractswarm.md"
@ -104,22 +105,22 @@ nav:
- swarms.memory: - swarms.memory:
- PineconeVectorStoreStore: "swarms/memory/pinecone.md" - PineconeVectorStoreStore: "swarms/memory/pinecone.md"
- PGVectorStore: "swarms/memory/pg.md" - PGVectorStore: "swarms/memory/pg.md"
# - swarms.chunkers: # - swarms.chunkers:
# - BaseChunker: "swarms/chunkers/basechunker.md" # - BaseChunker: "swarms/chunkers/basechunker.md"
# - PdfChunker: "swarms/chunkers/pdf_chunker.md" # - PdfChunker: "swarms/chunkers/pdf_chunker.md"
- Guides: - Guides:
- Overview: "examples/index.md" - Overview: "examples/index.md"
- Agents: - Agents:
- Flow: "examples/flow.md" - Flow: "examples/flow.md"
- SequentialWorkflow: "examples/reliable_autonomous_agents.md" - SequentialWorkflow: "examples/reliable_autonomous_agents.md"
- OmniAgent: "examples/omni_agent.md" - OmniAgent: "examples/omni_agent.md"
- 2O+ Autonomous Agent Blogs: "examples/ideas.md" - 2O+ Autonomous Agent Blogs: "examples/ideas.md"
- Applications: - Applications:
- CustomerSupport: - CustomerSupport:
- Overview: "applications/customer_support.md" - Overview: "applications/customer_support.md"
- Marketing: - Marketing:
- Overview: "applications/marketing_agencies.md" - Overview: "applications/marketing_agencies.md"
- Corporate: - Corporate:
- FAQ: "corporate/faq.md" - FAQ: "corporate/faq.md"
- Purpose: "corporate/purpose.md" - Purpose: "corporate/purpose.md"
- Roadmap: "corporate/roadmap.md" - Roadmap: "corporate/roadmap.md"

@ -18,11 +18,11 @@ classifiers = [
"Intended Audience :: Developers", "Intended Audience :: Developers",
"Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Scientific/Engineering :: Artificial Intelligence",
"License :: OSI Approved :: MIT License", "License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.6" "Programming Language :: Python :: 3.10"
] ]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8.1" python = "^3.9.1"
torch = "2.1.1" torch = "2.1.1"
transformers = "*" transformers = "*"
openai = "0.28.0" openai = "0.28.0"

@ -29,4 +29,4 @@ RUN pip install swarms
RUN pip install pytest RUN pip install pytest
# Run pytest on all tests in the tests directory # Run pytest on all tests in the tests directory
CMD find ./tests -name '*.py' -exec pytest {} + CMD pytest

Loading…
Cancel
Save