Merge pull request #443 from Wyatt-Stanke/master

CI/Code Style Rework
pull/446/head
Eternal Reclaimer 9 months ago committed by GitHub
commit 24c709e804
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,6 +1,5 @@
---
# These are supported funding model platforms
github: [kyegomez]
# patreon: # Replace with a single Patreon username
# open_collective: # Replace with a single Open Collective username

60
.github/action.yml vendored

@ -1,37 +1,33 @@
---
name: "Init Environment"
description: "Initialize environment for tests"
runs:
using: "composite"
steps:
- name: Checkout actions
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with test --with dev --all-extras
shell: bash
- name: Activate venv
run: |
source .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
shell: bash
- name: Checkout actions
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with test --with dev --all-extras
shell: bash
- name: Activate venv
run: |
source .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
shell: bash

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

@ -1,14 +1,34 @@
---
# this is a config file for the github action labeler
# Add 'label1' to any changes within 'example' folder or any subfolders
example_change:
- example/**
# Add 'label2' to any file changes within 'example2' folder
example2_change: example2/*
# Add label3 to any change to .txt files within the entire repository.
# Quotation marks are required for the leading asterisk
text_files:
- '**/*.txt'
documentation:
- changed-files:
- any-glob-to-any-file: ["docs/**", "*.md"]
tests:
- changed-files:
- any-glob-to-any-file: "tests/**"
agents:
- changed-files:
- any-glob-to-any-file: "swarms/agents/**"
artifacts:
- changed-files:
- any-glob-to-any-file: "swarms/artifacts/**"
memory:
- changed-files:
- any-glob-to-any-file: "swarms/memory/**"
models:
- changed-files:
- any-glob-to-any-file: "swarms/models/**"
prompts:
- changed-files:
- any-glob-to-any-file: "swarms/prompts/**"
structs:
- changed-files:
- any-glob-to-any-file: "swarms/structs/**"
telemetry:
- changed-files:
- any-glob-to-any-file: "swarms/telemetry/**"
tools:
- changed-files:
- any-glob-to-any-file: "swarms/tools/**"
utils:
- changed-files:
- any-glob-to-any-file: "swarms/utils/**"

@ -1,5 +1,5 @@
---
name: release
on:
pull_request:
types:
@ -7,16 +7,14 @@ on:
branches:
- master
paths:
- 'pyproject.toml'
- "pyproject.toml"
env:
POETRY_VERSION: "1.4.2"
jobs:
if_release:
if: |
${{ github.event.pull_request.merged == true }}
&& ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
${{ github.event.pull_request.merged == true }}
&& ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -45,5 +43,5 @@ jobs:
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry publish
run: |-
poetry publish

@ -0,0 +1,25 @@
name: autofix.ci
on:
pull_request:
push:
branches: ["main"]
permissions:
contents: read
jobs:
autofix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- run: go install github.com/google/yamlfmt/cmd/yamlfmt@latest
- run: yamlfmt .
- uses: actions/setup-python@v5
- run: pip install ruff
- run: ruff format .
- run: ruff check --fix .
- uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc

@ -1,26 +1,12 @@
# 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 checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.
name: Codacy Security Scan
---
name: Codacy
on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
branches: ["master"]
schedule:
- cron: '18 23 * * 4'
- cron: "0 0 * * "
permissions:
contents: read
@ -34,15 +20,14 @@ jobs:
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v4
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@33d455949345bddfdb845fba76b57b70cc83754b
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# Check https://github.com/codacy/codacy-analysis-cli#project-token to
# get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
@ -53,7 +38,6 @@ jobs:
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3

@ -1,25 +1,13 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
---
name: "CodeQL"
on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
branches: ["master"]
schedule:
- cron: '33 12 * * 5'
- cron: "33 12 * * 5"
jobs:
analyze:
name: Analyze
@ -28,55 +16,26 @@ jobs:
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
language: ["python"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

@ -1,27 +0,0 @@
name: Run pytest
on:
schedule:
# This will run the job every day at a random minute past the hour
- cron: '0 0 * * *'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install swarms
- name: Run tests
run: pytest

@ -1,18 +1,16 @@
name: readthedocs/actions
name: Documentation Links
on:
pull_request_target:
types:
- opened
paths:
- "docs/**"
permissions:
pull-requests: write
jobs:
pull-request-links:
documentation-links:
runs-on: ubuntu-latest
steps:
- uses: readthedocs/actions/preview@v1
with:
project-slug: swarms
project-slug: "swarms"

@ -1,5 +1,5 @@
name: Docs WorkAgent
---
name: Documentation
on:
push:
branches:
@ -17,4 +17,4 @@ jobs:
- run: pip install mkdocs-material
- run: pip install mkdocs-glightbox
- run: pip install "mkdocstrings[python]"
- run: mkdocs gh-deploy --force
- run: mkdocs gh-deploy --force

@ -1,3 +1,4 @@
---
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
@ -7,16 +8,13 @@
name: Labeler
on: [pull_request_target]
jobs:
label:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

@ -1,27 +1,33 @@
---
name: Lint
on: [push, pull_request] # yamllint disable-line rule:truthy
on: [push, pull_request] # yamllint disable-line rule:truthy
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
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install yamllint
- run: yamllint .
flake8-lint:
runs-on: ubuntu-latest
name: flake8 Lint
steps:
- name: Check out source repository
uses: actions/checkout@v4
- name: Set up Python environment
uses: py-actions/flake8@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install flake8
- run: flake8 .
ruff-lint:
runs-on: ubuntu-latest
name: ruff Lint
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
- uses: actions/setup-python@v5
- run: pip install ruff
- run: ruff format .
- run: ruff check --fix .
pylint-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install pylint
- run: pylint swarms --recursive=y

@ -1,15 +0,0 @@
name: "PR Labeler"
on:
pull_request_target:
types: ["opened", "reopened", "ready_for_review"]
jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
if: ${{ github.event.pull_request.draft == false }}

@ -1,30 +0,0 @@
name: Pull Request Checks
on:
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install swarms
pip install pytest
- name: Run tests and checks
run: |
pytest
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@v5
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,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@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest swarms
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

@ -1,41 +0,0 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade swarms
python -m pip install flake8 pytest swarms
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

@ -1,31 +0,0 @@
name: Upload Python Package
on: # yamllint disable-line rule:truthy
release:
types: [published]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

@ -1,34 +0,0 @@
name: Run Examples Script
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# Runs at 3:00 AM UTC every day
- cron: '0 3 * * *'
jobs:
run-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
pip install -r requirements.txt
# Assuming your script might also need pytest and swarms
pip install pytest
pip install swarms
- name: Make Script Executable and Run
run: |
chmod +x ./swarms/scripts/run_examples.sh
./swarms/scripts/run_examples.sh

@ -1,27 +1,49 @@
---
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests
name: Stale
on:
schedule:
- cron: '26 12 * * *'
# Scheduled to run at 1.30 UTC everyday
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message'
stale-pr-message: 'Stale pull request message'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 14
days-before-issue-close: 14
stale-issue-label: "status:stale"
close-issue-reason: not_planned
any-of-labels: "status:awaiting user response,status:more data needed"
stale-issue-message: >
Marking this issue as stale since it has been open for 14 days with no
activity. This issue will be closed if no further activity occurs.
close-issue-message: >
This issue was closed because it has been inactive for 28 days. Please
post a new issue if you need further assistance. Thanks!
days-before-pr-stale: 14
days-before-pr-close: 14
stale-pr-label: "status:stale"
stale-pr-message: >
Marking this pull request as stale since it has been open for 14 days
with no activity. This PR will be closed if no further activity occurs.
close-pr-message: >
This pull request was closed because it has been inactive for 28 days.
Please open a new pull request if you need further assistance. Thanks!
# Label that can be assigned to issues to exclude them from being marked as stale
exempt-issue-labels: "override-stale"
# Label that can be assigned to PRs to exclude them from being marked as stale
exempt-pr-labels: "override-stale"

@ -1,49 +0,0 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests
on:
schedule:
# Scheduled to run at 1.30 UTC everyday
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 14
days-before-issue-close: 14
stale-issue-label: "status:stale"
close-issue-reason: not_planned
any-of-labels: "status:awaiting user response,status:more data needed"
stale-issue-message: >
Marking this issue as stale since it has been open for 14 days with no activity.
This issue will be closed if no further activity occurs.
close-issue-message: >
This issue was closed because it has been inactive for 28 days.
Please post a new issue if you need further assistance. Thanks!
days-before-pr-stale: 14
days-before-pr-close: 14
stale-pr-label: "status:stale"
stale-pr-message: >
Marking this pull request as stale since it has been open for 14 days with no activity.
This PR will be closed if no further activity occurs.
close-pr-message: >
This pull request was closed because it has been inactive for 28 days.
Please open a new pull request if you need further assistance. Thanks!
# Label that can be assigned to issues to exclude them from being marked as stale
exempt-issue-labels: 'override-stale'
# Label that can be assigned to PRs to exclude them from being marked as stale
exempt-pr-labels: "override-stale"

@ -1,110 +1,60 @@
name: test
name: Tests
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
env:
POETRY_VERSION: "1.4.2"
schedule:
- cron: "0 0 * * *"
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
- name: Install Python
uses: actions/setup-python@v4
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Setup a local virtual environment
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"
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment
file
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:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install
- name: Install OpenCV
run: sudo apt-get install python3-opencv
- name: Enter the virtual environment
run: source $VENV
- name: Run the tests
run: poetry run pytest --verbose
run-examples:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
test_type:
- "core"
- "extended"
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
- name: Install Python
uses: actions/setup-python@v4
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Setup a local virtual environment
run: |
if [ "${{ matrix.test_type }}" == "core" ]; then
make test
else
make extended_tests
fi
shell: bash
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment
file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install
- name: Install OpenCV
run: sudo apt-get install python3-opencv
- name: Enter the virtual environment
run: source $VENV
- name: Make Script Executable and Run
run: |-
chmod +x ./scripts/run_examples.sh
./scripts/run_examples.sh

@ -1,81 +0,0 @@
# Notebook-related checks
name: Presubmit checks
on:
# Relevant PRs
pull_request:
paths:
- "swarms/**"
- "tests/**"
# Allow manual runs
workflow_dispatch:
jobs:
test3_11:
name: Test Py3.11
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run tests
run: |
python --version
pip install .[dev]
python -m pytest
test3_10:
name: Test Py3.10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run tests
run: |
python --version
pip install -q .[dev]
python -m pytest
test3_9:
name: Test Py3.9
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Run tests
run: |
python --version
pip install .[dev]
python -m pytest
pytype3_10:
name: pytype 3.10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run pytype
run: |
python --version
pip install .[dev]
pip install -q gspread ipython
pytype
format:
name: Check format with black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Check format
run: |
python --version
pip install -q .
pip install -q black
black . --check

@ -1,27 +0,0 @@
name: Unit 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@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest
- name: Run unit tests
run: pytest

@ -1,36 +0,0 @@
name: build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest
pip install swarms
- name: Run Python unit tests
run: pytest
- name: Verify that the Docker image for the action builds
run: docker build . --file Dockerfile
- name: Verify integration test results
run: pytest

@ -1,11 +1,10 @@
name: Welcome WorkAgent
---
name: Welcome
on:
issues:
types: [opened]
pull_request_target:
types: [opened]
jobs:
build:
name: 👋 Welcome
@ -15,5 +14,9 @@ jobs:
- uses: actions/first-interaction@v1.3.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap."
pr-message: "Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap."
issue-message:
"Hello there, thank you for opening an Issue ! 🙏🏻 The team
was notified and they will get back to you asap."
pr-message:
"Hello there, thank you for opening an PR ! 🙏🏻 The team was
notified and they will get back to you asap."

@ -10,16 +10,23 @@ description = "Swarms - Pytorch"
license = "MIT"
authors = ["Kye Gomez <kye@apac.ai>"]
homepage = "https://github.com/kyegomez/swarms"
documentation = "https://swarms.apac.ai"
readme = "README.md"
documentation = "https://swarms.apac.ai"
readme = "README.md"
repository = "https://github.com/kyegomez/swarms"
keywords = ["artificial intelligence", "deep learning", "optimizers", "Prompt Engineering", "swarms", "agents"]
keywords = [
"artificial intelligence",
"deep learning",
"optimizers",
"Prompt Engineering",
"swarms",
"agents",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.10"
"Programming Language :: Python :: 3.10",
]
@ -46,25 +53,35 @@ psutil = "*"
sentry-sdk = "*"
python-dotenv = "*"
accelerate = "0.28.0"
[tool.poetry.dev-dependencies]
black = "23.3.0"
opencv-python = "^4.9.0.80"
[tool.poetry.group.lint.dependencies]
black = "^23.1.0"
ruff = ">=0.0.249,<0.3.5"
types-toml = "^0.10.8.1"
types-pytz = "^2023.3.0.0"
black = "^23.1.0"
types-chardet = "^5.0.4.6"
mypy-protobuf = "^3.0.0"
[tool.poetry.group.test.dependencies]
pytest = "^8.1.1"
termcolor = "^2.4.0"
pandas = "^2.2.2"
fastapi = "^0.110.1"
[tool.ruff]
line-length = 70
select = ["E4", "E7", "E9", "F"]
line-length = 128
[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP"]
ignore = []
fixable = ["ALL"]
unfixable = []
preview = true
[tool.ruff.lint.per-file-ignores]
"swarms/prompts/**.py" = ["E501"]
[tool.black]
line-length = 70

Loading…
Cancel
Save