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 # 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

60
.github/action.yml vendored

@ -1,37 +1,33 @@
---
name: "Init Environment" name: "Init Environment"
description: "Initialize environment for tests" description: "Initialize environment for tests"
runs: runs:
using: "composite" using: "composite"
steps: steps:
- name: Checkout actions - name: Checkout actions
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4
uses: actions/setup-python@v4 with:
with: python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python-version }} - name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Install and configure Poetry with:
uses: snok/install-poetry@v1 virtualenvs-create: true
with: virtualenvs-in-project: true
virtualenvs-create: true installer-parallel: true
virtualenvs-in-project: true - name: Load cached venv
installer-parallel: true id: cached-poetry-dependencies
uses: actions/cache@v3
- name: Load cached venv with:
id: cached-poetry-dependencies path: .venv
uses: actions/cache@v3 key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{hashFiles('**/poetry.lock') }}
with: - name: Install dependencies
path: .venv if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} run: poetry install --no-interaction --no-root --with test --with dev --all-extras
shell: bash
- name: Install dependencies - name: Activate venv
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: |
run: poetry install --no-interaction --no-root --with test --with dev --all-extras source .venv/bin/activate
shell: bash echo PATH=$PATH >> $GITHUB_ENV
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 # https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
version: 2 version: 2
updates: updates:
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
directory: "/" directory: "/"
schedule: schedule:
interval: "weekly" interval: "weekly"
- package-ecosystem: "pip" - package-ecosystem: "pip"
directory: "/" directory: "/"
schedule: schedule:

@ -1,14 +1,34 @@
--- ---
# this is a config file for the github action labeler documentation:
- changed-files:
# Add 'label1' to any changes within 'example' folder or any subfolders - any-glob-to-any-file: ["docs/**", "*.md"]
example_change: tests:
- example/** - changed-files:
- any-glob-to-any-file: "tests/**"
# Add 'label2' to any file changes within 'example2' folder agents:
example2_change: example2/* - changed-files:
- any-glob-to-any-file: "swarms/agents/**"
# Add label3 to any change to .txt files within the entire repository. artifacts:
# Quotation marks are required for the leading asterisk - changed-files:
text_files: - any-glob-to-any-file: "swarms/artifacts/**"
- '**/*.txt' 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 name: release
on: on:
pull_request: pull_request:
types: types:
@ -7,16 +7,14 @@ on:
branches: branches:
- master - master
paths: paths:
- 'pyproject.toml' - "pyproject.toml"
env: env:
POETRY_VERSION: "1.4.2" POETRY_VERSION: "1.4.2"
jobs: jobs:
if_release: if_release:
if: | if: |
${{ github.event.pull_request.merged == true }} ${{ github.event.pull_request.merged == true }}
&& ${{ contains(github.event.pull_request.labels.*.name, 'release') }} && ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -45,5 +43,5 @@ jobs:
- name: Publish to PyPI - name: Publish to PyPI
env: env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: | run: |-
poetry publish 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 name: Codacy
# 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
on: on:
push: push:
branches: [ "master" ] branches: ["master"]
pull_request: pull_request:
# The branches below must be a subset of the branches above branches: ["master"]
branches: [ "master" ]
schedule: schedule:
- cron: '18 23 * * 4' - cron: "0 0 * * "
permissions: permissions:
contents: read contents: read
@ -34,15 +20,14 @@ jobs:
name: Codacy Security Scan name: Codacy Security Scan
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI - name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@33d455949345bddfdb845fba76b57b70cc83754b uses: codacy/codacy-analysis-cli-action@33d455949345bddfdb845fba76b57b70cc83754b
with: 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 # You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true verbose: true
@ -53,7 +38,6 @@ jobs:
# Force 0 exit code to allow SARIF file generation # Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side # This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647 max-allowed-issues: 2147483647
# Upload the SARIF file generated in the previous step # Upload the SARIF file generated in the previous step
- name: Upload SARIF results file - name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3 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" name: "CodeQL"
on: on:
push: push:
branches: [ "master" ] branches: ["master"]
pull_request: pull_request:
# The branches below must be a subset of the branches above # The branches below must be a subset of the branches above
branches: [ "master" ] branches: ["master"]
schedule: schedule:
- cron: '33 12 * * 5' - cron: "33 12 * * 5"
jobs: jobs:
analyze: analyze:
name: Analyze name: Analyze
@ -28,55 +16,26 @@ jobs:
# - https://gh.io/supported-runners-and-hardware-resources # - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners # - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements. # Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} runs-on: ubuntu-latest
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} timeout-minutes: 360
permissions: permissions:
actions: read actions: read
contents: read contents: read
security-events: write security-events: write
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'python' ] 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
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Initialize CodeQL
# Initializes the CodeQL tools for scanning. uses: github/codeql-action/init@v3
- name: Initialize CodeQL with:
uses: github/codeql-action/init@v3 languages: ${{ matrix.language }}
with: - name: Autobuild
languages: ${{ matrix.language }} uses: github/codeql-action/autobuild@v3
# If you wish to specify custom queries, you can do so here or in a config file. - name: Perform CodeQL Analysis
# By default, queries listed here will override any specified in a config file. uses: github/codeql-action/analyze@v3
# Prefix the list here with "+" to use these queries and those in the config file. with:
category: "/language:${{matrix.language}}"
# 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}}"

@ -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: on:
pull_request_target: pull_request_target:
types: types:
- opened - opened
paths:
- "docs/**"
permissions: permissions:
pull-requests: write pull-requests: write
jobs: jobs:
pull-request-links: documentation-links:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: readthedocs/actions/preview@v1 - uses: readthedocs/actions/preview@v1
with: with:
project-slug: swarms project-slug: "swarms"

@ -1,5 +1,5 @@
name: Docs WorkAgent ---
name: Documentation
on: on:
push: push:
branches: branches:
@ -17,4 +17,4 @@ jobs:
- run: pip install mkdocs-material - run: pip install mkdocs-material
- run: pip install mkdocs-glightbox - run: pip install mkdocs-glightbox
- run: pip install "mkdocstrings[python]" - 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 # This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request. # paths that are modified in the pull request.
# #
@ -7,16 +8,13 @@
name: Labeler name: Labeler
on: [pull_request_target] on: [pull_request_target]
jobs: jobs:
label: label:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
pull-requests: write pull-requests: write
steps: steps:
- uses: actions/labeler@v5 - uses: actions/labeler@v5
with: with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" repo-token: "${{ secrets.GITHUB_TOKEN }}"

@ -1,27 +1,33 @@
---
name: Lint name: Lint
on: [push, pull_request] # yamllint disable-line rule:truthy
on: [push, pull_request] # yamllint disable-line rule:truthy
jobs: jobs:
yaml-lint: yaml-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out source repository - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: actions/setup-python@v5
- name: yaml Lint - run: pip install yamllint
uses: ibiqlik/action-yamllint@v3 - run: yamllint .
flake8-lint: flake8-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: flake8 Lint
steps: steps:
- name: Check out source repository - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: actions/setup-python@v5
- name: Set up Python environment - run: pip install flake8
uses: py-actions/flake8@v2 - run: flake8 .
ruff-lint: ruff-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: ruff Lint
steps: steps:
- uses: actions/checkout@v4 - 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. # 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. # You can adjust the behavior by modifying this file.
# For more information, see: # For more information, see:
# https://github.com/actions/stale # https://github.com/actions/stale
name: Mark stale issues and pull requests name: Stale
on: on:
schedule: schedule:
- cron: '26 12 * * *' # Scheduled to run at 1.30 UTC everyday
- cron: "0 0 * * *"
jobs: jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
issues: write issues: write
pull-requests: write pull-requests: write
steps: steps:
- uses: actions/stale@v9 - uses: actions/stale@v9
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message' days-before-issue-stale: 14
stale-pr-message: 'Stale pull request message' days-before-issue-close: 14
stale-issue-label: 'no-issue-activity' stale-issue-label: "status:stale"
stale-pr-label: 'no-pr-activity' 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: on:
push: push:
branches: [master] schedule:
pull_request: - cron: "0 0 * * *"
workflow_dispatch:
env:
POETRY_VERSION: "1.4.2"
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
test_type:
- "core"
- "extended"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Install Python
uses: "snok/install-poetry@v1" uses: actions/setup-python@v4
with: - name: Install Poetry
python-version: ${{ matrix.python-version }} uses: snok/install-poetry@v1
poetry-version: "1.4.2" - name: Setup a local virtual environment
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: | run: |
if [ "${{ matrix.test_type }}" == "core" ]; then poetry config virtualenvs.create true --local
make test poetry config virtualenvs.in-project true --local
else - uses: actions/cache@v3
make extended_tests name: Define a cache for the virtual environment
fi file
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: with:
python-version: ${{ matrix.python-version }} path: ./.venv
poetry-version: "1.4.2" key: venv-${{ hashFiles('poetry.lock') }}
cache-key: ${{ matrix.test_type }} - name: Install the project dependencies
install-command: | run: poetry install
if [ "${{ matrix.test_type }}" == "core" ]; then - name: Install OpenCV
echo "Running core tests, installing dependencies with poetry..." run: sudo apt-get install python3-opencv
poetry install - name: Enter the virtual environment
else run: source $VENV
echo "Running extended tests, installing dependencies with poetry..." - name: Run the tests
poetry install -E extended_testing run: poetry run pytest --verbose
fi run-examples:
- name: Run ${{matrix.test_type}} tests
run: |
if [ "${{ matrix.test_type }}" == "core" ]; then
make test
else
make extended_tests
fi
shell: bash
build:
runs-on: ubuntu-latest 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: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Install Python
uses: "./.github/actions/poetry_setup" uses: actions/setup-python@v4
with: - name: Install Poetry
python-version: ${{ matrix.python-version }} uses: snok/install-poetry@v1
poetry-version: "1.4.2" - name: Setup a local virtual environment
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: | run: |
if [ "${{ matrix.test_type }}" == "core" ]; then poetry config virtualenvs.create true --local
make test poetry config virtualenvs.in-project true --local
else - uses: actions/cache@v3
make extended_tests name: Define a cache for the virtual environment
fi file
shell: bash 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: on:
issues: issues:
types: [opened] types: [opened]
pull_request_target: pull_request_target:
types: [opened] types: [opened]
jobs: jobs:
build: build:
name: 👋 Welcome name: 👋 Welcome
@ -15,5 +14,9 @@ jobs:
- uses: actions/first-interaction@v1.3.0 - uses: actions/first-interaction@v1.3.0
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} 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." issue-message:
pr-message: "Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap." "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" license = "MIT"
authors = ["Kye Gomez <kye@apac.ai>"] authors = ["Kye Gomez <kye@apac.ai>"]
homepage = "https://github.com/kyegomez/swarms" homepage = "https://github.com/kyegomez/swarms"
documentation = "https://swarms.apac.ai" documentation = "https://swarms.apac.ai"
readme = "README.md" readme = "README.md"
repository = "https://github.com/kyegomez/swarms" 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 = [ classifiers = [
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
"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.10" "Programming Language :: Python :: 3.10",
] ]
@ -46,25 +53,35 @@ psutil = "*"
sentry-sdk = "*" sentry-sdk = "*"
python-dotenv = "*" python-dotenv = "*"
accelerate = "0.28.0" accelerate = "0.28.0"
opencv-python = "^4.9.0.80"
[tool.poetry.dev-dependencies]
black = "23.3.0"
[tool.poetry.group.lint.dependencies] [tool.poetry.group.lint.dependencies]
black = "^23.1.0"
ruff = ">=0.0.249,<0.3.5" ruff = ">=0.0.249,<0.3.5"
types-toml = "^0.10.8.1" types-toml = "^0.10.8.1"
types-pytz = "^2023.3.0.0" types-pytz = "^2023.3.0.0"
black = "^23.1.0"
types-chardet = "^5.0.4.6" types-chardet = "^5.0.4.6"
mypy-protobuf = "^3.0.0" 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] [tool.ruff]
line-length = 70 line-length = 128
select = ["E4", "E7", "E9", "F"]
[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP"]
ignore = [] ignore = []
fixable = ["ALL"] fixable = ["ALL"]
unfixable = [] unfixable = []
preview = true
[tool.ruff.lint.per-file-ignores]
"swarms/prompts/**.py" = ["E501"]
[tool.black] [tool.black]
line-length = 70 line-length = 70

Loading…
Cancel
Save