diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index e3733b98..17d44f5d 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -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 diff --git a/.github/action.yml b/.github/action.yml index f2f9016c..4158bc81 100644 --- a/.github/action.yml +++ b/.github/action.yml @@ -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 \ No newline at end of file + - 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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b523994a..3b365943 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -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: diff --git a/.github/labeler.yml b/.github/labeler.yml index 1fb9d7ec..99dd5c25 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -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/**" diff --git a/.github/workflows/RELEASE.yml b/.github/workflows/RELEASE.yml index b219bb77..059ec93e 100644 --- a/.github/workflows/RELEASE.yml +++ b/.github/workflows/RELEASE.yml @@ -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 \ No newline at end of file + run: |- + poetry publish diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 00000000..d5e2c3fa --- /dev/null +++ b/.github/workflows/autofix.yml @@ -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 diff --git a/.github/workflows/codacy.yml b/.github/workflows/codacy.yml index 5f58b11d..46688a7c 100644 --- a/.github/workflows/codacy.yml +++ b/.github/workflows/codacy.yml @@ -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 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 56930314..b93db343 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -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}}" diff --git a/.github/workflows/cron_job_tests.yml b/.github/workflows/cron_job_tests.yml deleted file mode 100644 index 60bd98d3..00000000 --- a/.github/workflows/cron_job_tests.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/.github/workflows/pull-request-links.yml b/.github/workflows/docs-preview.yml similarity index 64% rename from .github/workflows/pull-request-links.yml rename to .github/workflows/docs-preview.yml index 4cb674d8..037fd35e 100644 --- a/.github/workflows/pull-request-links.yml +++ b/.github/workflows/docs-preview.yml @@ -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 \ No newline at end of file + project-slug: "swarms" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0b830b9f..de94af36 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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 \ No newline at end of file + - run: mkdocs gh-deploy --force diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index d23c4d40..d8ab919c 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -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 }}" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b38491c2..f2295d07 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.github/workflows/pr_labeler.yml b/.github/workflows/pr_labeler.yml deleted file mode 100644 index 7745d717..00000000 --- a/.github/workflows/pr_labeler.yml +++ /dev/null @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/pr_request_checks.yml b/.github/workflows/pr_request_checks.yml deleted file mode 100644 index cfc01afb..00000000 --- a/.github/workflows/pr_request_checks.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml deleted file mode 100644 index d3f42fb1..00000000 --- a/.github/workflows/pylint.yml +++ /dev/null @@ -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') diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml deleted file mode 100644 index adc0c5ef..00000000 --- a/.github/workflows/python-app.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index 31cdfb93..00000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index e055b770..00000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -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 }} diff --git a/.github/workflows/run_examples.yml b/.github/workflows/run_examples.yml deleted file mode 100644 index ea07b0f3..00000000 --- a/.github/workflows/run_examples.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 3aa6410b..a1ab3b31 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -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' \ No newline at end of file + - 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" diff --git a/.github/workflows/stale_isseue.yml b/.github/workflows/stale_isseue.yml deleted file mode 100644 index c5fe2648..00000000 --- a/.github/workflows/stale_isseue.yml +++ /dev/null @@ -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" - \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index baaadfc8..a57b7d22 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 \ No newline at end of file + 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 diff --git a/.github/workflows/test_pr.yml b/.github/workflows/test_pr.yml deleted file mode 100644 index 8da3bd0a..00000000 --- a/.github/workflows/test_pr.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml deleted file mode 100644 index c858b5fe..00000000 --- a/.github/workflows/testing.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml deleted file mode 100644 index a858dae4..00000000 --- a/.github/workflows/unit-test.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml index 3dcd5bb1..dd16f9c3 100644 --- a/.github/workflows/welcome.yml +++ b/.github/workflows/welcome.yml @@ -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." \ No newline at end of file + 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." diff --git a/pyproject.toml b/pyproject.toml index 9e4551e9..5e58c2e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,16 +10,23 @@ description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] 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