From 979cca24e0e8f51e538a901411719360b9efc73f Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 18:14:52 -0700 Subject: [PATCH 01/19] bump checout actions to v4 --- .github/workflows/dependency-review.yml | 2 +- .github/workflows/generator-generic-ossf-slsa3-publish.yml | 2 +- .github/workflows/pyre.yml | 2 +- .github/workflows/pysa.yml | 2 +- .github/workflows/python-app.yml | 2 +- .github/workflows/python-package-conda.yml | 2 +- .github/workflows/python-package.yml | 6 +++--- .github/workflows/terraform.yml | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index b0dedc42..4e751977 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -15,6 +15,6 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Dependency Review' uses: actions/dependency-review-action@v3 diff --git a/.github/workflows/generator-generic-ossf-slsa3-publish.yml b/.github/workflows/generator-generic-ossf-slsa3-publish.yml index a36e782c..35c829b1 100644 --- a/.github/workflows/generator-generic-ossf-slsa3-publish.yml +++ b/.github/workflows/generator-generic-ossf-slsa3-publish.yml @@ -23,7 +23,7 @@ jobs: digests: ${{ steps.hash.outputs.digests }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # ======================================================== # diff --git a/.github/workflows/pyre.yml b/.github/workflows/pyre.yml index 5ff88856..2e4713d3 100644 --- a/.github/workflows/pyre.yml +++ b/.github/workflows/pyre.yml @@ -33,7 +33,7 @@ jobs: security-events: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true diff --git a/.github/workflows/pysa.yml b/.github/workflows/pysa.yml index 01f39f5b..c420e3cb 100644 --- a/.github/workflows/pysa.yml +++ b/.github/workflows/pysa.yml @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index e4262374..aa3edc3e 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.10 uses: actions/setup-python@v5 with: diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 20c2b2de..51c99bba 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -9,7 +9,7 @@ jobs: max-parallel: 5 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.10 uses: actions/setup-python@v5 with: diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index cf809820..8fd1faab 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -19,15 +19,15 @@ jobs: python-version: ["3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 + - 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 flake8 pytest + python -m pip install --no-cache-dir --upgrade pip + python -m pip install --no-cache-dir flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 73aabe31..2609d47a 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -66,7 +66,7 @@ jobs: steps: # Checkout the repository to the GitHub Actions runner - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token - name: Setup Terraform From 30cdf7fe458bdd02910518bfdb8fb417073d348a Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 18:17:28 -0700 Subject: [PATCH 02/19] permissions on welcome ction --- .github/workflows/welcome.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml index c328046a..51372fe2 100644 --- a/.github/workflows/welcome.yml +++ b/.github/workflows/welcome.yml @@ -10,6 +10,7 @@ jobs: build: name: 👋 Welcome runs-on: ubuntu-latest + permissions: write-all steps: - uses: actions/first-interaction@v1.3.0 with: From 553180cba67c6741d89b4d0a065dfc779d643138 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 18:20:50 -0700 Subject: [PATCH 03/19] Unit test action Dockerfile --- .github/workflows/unit-test.yml | 2 +- Dockerfile | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index aaf4a614..8fd36915 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -21,7 +21,7 @@ jobs: python-version: '3.10' - name: Install dependencies - run: pip install -r requirements.txt + run: pip install --no-cache-dir -r requirements.txt - name: Run Python unit tests run: python3 -m pytest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..6eba7647 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# ================================== +# Use an official Python runtime as a parent image +FROM python:3.10-slim +RUN apt-get update && apt-get -y install libgl1-mesa-dev libglib2.0-0 build-esse +ntial; apt-get clean +RUN pip install opencv-contrib-python-headless + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Set the working directory in the container +WORKDIR /usr/src/zeta + + +# Install Python dependencies +# COPY requirements.txt and pyproject.toml if you're using poetry for dependency + management +COPY requirements.txt . +RUN pip install --no-cache-dir --upgrade pip +RUN pip install --no-cache-dir -r requirements.txt + +RUN pip install --no-cache-dir zetascale + +# Copy the rest of the application +COPY . . + From ab32f539f9d3d665d2c845e06cb690c694a9ef36 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 18:24:03 -0700 Subject: [PATCH 04/19] aws action version bump --- .github/workflows/aws.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml index 750955d9..369aa43d 100644 --- a/.github/workflows/aws.yml +++ b/.github/workflows/aws.yml @@ -51,10 +51,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} From 1a9afed9a8bdc3b5fd574e6a717ac3ee4db30181 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:01:00 -0700 Subject: [PATCH 05/19] bump action checkout version --- .github/action.yml | 2 +- .github/workflows/bandit.yml | 2 +- .github/workflows/bearer.yml | 2 +- .github/workflows/codacy.yml | 2 +- .github/workflows/crda.yml | 2 +- .github/workflows/docs.yml | 8 ++++---- .github/workflows/publish.yml | 2 +- .github/workflows/pylint.yml | 4 ++-- .github/workflows/python-app.yml | 2 +- .github/workflows/python-publish.yml | 4 ++-- .github/workflows/super-linter.yml | 2 +- .github/workflows/test.yml | 1 - 12 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/action.yml b/.github/action.yml index f2f9016c..b3f35b13 100644 --- a/.github/action.yml +++ b/.github/action.yml @@ -4,7 +4,7 @@ runs: using: "composite" steps: - name: Checkout actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml index 850a3cd4..aeb83a65 100644 --- a/.github/workflows/bandit.yml +++ b/.github/workflows/bandit.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Bandit Scan uses: shundor/python-bandit-scan@9cc5aa4a006482b8a7f91134412df6772dbda22c with: # optional arguments diff --git a/.github/workflows/bearer.yml b/.github/workflows/bearer.yml index 1b81311d..a18c9332 100644 --- a/.github/workflows/bearer.yml +++ b/.github/workflows/bearer.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: # Checkout project source - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Scan code using Bearer CLI - name: Run Report id: report diff --git a/.github/workflows/codacy.yml b/.github/workflows/codacy.yml index 8e6936bc..5a66681e 100644 --- a/.github/workflows/codacy.yml +++ b/.github/workflows/codacy.yml @@ -36,7 +36,7 @@ jobs: steps: # Checkout the repository to the GitHub Actions runner - name: Checkout code - uses: actions/checkout@v3 + 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 diff --git a/.github/workflows/crda.yml b/.github/workflows/crda.yml index 5054e09a..e48aea48 100644 --- a/.github/workflows/crda.yml +++ b/.github/workflows/crda.yml @@ -81,7 +81,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # ******************************************************************* # Required: Instructions to setup project diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5ec5cfe8..a69556bd 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,8 +13,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: 3.x - - run: pip install mkdocs-material - - run: pip install "mkdocstrings[python]" - - run: pip install mkdocs-glightbox + python-version: '3.10' + - run: pip install --no-cache-dir mkdocs-material + - run: pip install --no-cache-dir "mkdocstrings[python]" + - run: pip install --no-cache-dir mkdocs-glightbox - run: mkdocs gh-deploy --force diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2a79688f..fb8f5879 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8] + python-version: [3.10] steps: - name: 🛎️ Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index d3f42fb1..f334972b 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.9", "3.10"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -16,7 +16,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --no-cache-dir --upgrade pip pip install pylint - name: Analysing the code with pylint run: | diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index aa3edc3e..1da8d6bd 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -22,7 +22,7 @@ jobs: - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index aef7b002..424e5e7d 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -18,10 +18,10 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: '3.10' - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --no-cache-dir --upgrade pip pip install build - name: Build package run: python -m build diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index acee01e2..28d6b416 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 65dc68d9..e2fb311a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,6 @@ jobs: strategy: matrix: python-version: - - "3.8" - "3.9" - "3.10" - "3.11" From 8cb4224c434bd4eb0d141c46571da86ef552bd6f Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:06:33 -0700 Subject: [PATCH 06/19] shellcheck pylint.yml --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index f334972b..08118940 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -20,4 +20,4 @@ jobs: pip install pylint - name: Analysing the code with pylint run: | - pylint $(git ls-files '*.py') + pylint "$(git ls-files '*.py')" From bad7ed753ecfa855f0aa743818492f14b48a8a39 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:08:27 -0700 Subject: [PATCH 07/19] typo --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 08118940..f3871749 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -20,4 +20,4 @@ jobs: pip install pylint - name: Analysing the code with pylint run: | - pylint "$(git ls-files '*.py')" + "$(git ls-files '*.py')" | xargs pylint From 2ec317119e432fb55467b584606f4c8d1818c5a8 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:12:57 -0700 Subject: [PATCH 08/19] fix my thinko pylint shellcheck --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index f3871749..f334972b 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -20,4 +20,4 @@ jobs: pip install pylint - name: Analysing the code with pylint run: | - "$(git ls-files '*.py')" | xargs pylint + pylint $(git ls-files '*.py') From d8ac8ef6cace3eed90b394b083b312710fa1937e Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:36:11 -0700 Subject: [PATCH 09/19] docstring example.py --- example.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/example.py b/example.py index 5436652d..6c3c1b5b 100644 --- a/example.py +++ b/example.py @@ -1,3 +1,7 @@ +""" +This script demonstrates the usage of the FlashAttentionmodule from zeta.nn as an example. +""" + import torch from zeta.nn import FlashAttention From f972ddbb2753c3ea9ab4fa90d84fabc9f470e0ee Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:38:00 -0700 Subject: [PATCH 10/19] typo in Dockerfile --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6eba7647..6f1039b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ # ================================== # Use an official Python runtime as a parent image FROM python:3.10-slim -RUN apt-get update && apt-get -y install libgl1-mesa-dev libglib2.0-0 build-esse -ntial; apt-get clean +RUN apt-get update && apt-get -y install libgl1-mesa-dev libglib2.0-0 build-essential; apt-get clean RUN pip install opencv-contrib-python-headless # Set environment variables From ab27c8caf4d1495a483031319eea9928becc0212 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:38:46 -0700 Subject: [PATCH 11/19] typo in Dockerfile --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6f1039b4..32050298 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,7 @@ WORKDIR /usr/src/zeta # Install Python dependencies -# COPY requirements.txt and pyproject.toml if you're using poetry for dependency - management +# COPY requirements.txt and pyproject.toml if you're using poetry for dependency management COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir -r requirements.txt From 864f570b5e04a8c9a88544a3fdf68e0177d2a57d Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:50:11 -0700 Subject: [PATCH 12/19] module docstring --- playground/cross_attend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/playground/cross_attend.py b/playground/cross_attend.py index dd73fc29..9ad4ab1e 100644 --- a/playground/cross_attend.py +++ b/playground/cross_attend.py @@ -1,3 +1,7 @@ +""" +Docstring for playground/cross_attend.py +""" + import torch from zeta.nn.attention.cross_attention import CrossAttend from zeta.structs.transformer import Encoder From ad1d63a888cf46238ba40713f817c6cb03f4e331 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:55:37 -0700 Subject: [PATCH 13/19] Delete mgqa/MGQA --- playground/example_mqqa.py | 26 -------------------------- zeta/nn/attention/__init__.py | 1 - 2 files changed, 27 deletions(-) delete mode 100644 playground/example_mqqa.py diff --git a/playground/example_mqqa.py b/playground/example_mqqa.py deleted file mode 100644 index 4a2a2476..00000000 --- a/playground/example_mqqa.py +++ /dev/null @@ -1,26 +0,0 @@ -import torch -from zeta.nn.attention.mgqa import MGQA - -# Initialize the MGQA model -model = MGQA( - dim=512, - n_layers=6, - head_dim=64, - hidden_dim=2048, - n_heads=8, - n_kv_heads=8, - sliding_window=512, - norm_eps=1e-5, - vocab_size=30522, - max_batch_size=0, - attn_dropout=0.1, - flash=True, -) - -# Create random inputs -x = torch.randn(10, 512) # batch size of 10, sequence length of 512 - -# Forward pass -output = model(x) - -print(output.shape) # should be the same shape as x diff --git a/zeta/nn/attention/__init__.py b/zeta/nn/attention/__init__.py index 613e265c..a2bc526c 100644 --- a/zeta/nn/attention/__init__.py +++ b/zeta/nn/attention/__init__.py @@ -9,7 +9,6 @@ from zeta.nn.attention.local_attention import LocalAttention from zeta.nn.attention.local_attention_mha import LocalMHA -# from zeta.nn.attention.mgqa import MGQA # from zeta.nn.attention.spatial_linear_attention import SpatialLinearAttention from zeta.nn.attention.mixture_attention import ( MixtureOfAttention, From 7fa7f4d47508e3a8df999aff673377dd57232157 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:57:25 -0700 Subject: [PATCH 14/19] docstring for flash_attention --- playground/flash_attention.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/playground/flash_attention.py b/playground/flash_attention.py index ecb1721e..61f248e6 100644 --- a/playground/flash_attention.py +++ b/playground/flash_attention.py @@ -1,3 +1,7 @@ +""" +Flash Attention example code +""" + import torch from zeta.nn.attention import FlashAttention From 19ab282e4e35d3d5f210ba225984553b627db9ac Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:58:33 -0700 Subject: [PATCH 15/19] token_monster docstring --- playground/token_monster.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/playground/token_monster.py b/playground/token_monster.py index 3575117d..98627d30 100644 --- a/playground/token_monster.py +++ b/playground/token_monster.py @@ -1,3 +1,7 @@ +""" +This is a playground for the TokenMonster tokenizer. +""" + import torch from zeta.tokenizers import TokenMonster From f3cdeeb866cab4f17daf005b3d4f24f1bd4bccf2 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 19:59:42 -0700 Subject: [PATCH 16/19] docstring playground transformer --- playground/transformer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/playground/transformer.py b/playground/transformer.py index 8b15e321..16c09eb3 100644 --- a/playground/transformer.py +++ b/playground/transformer.py @@ -1,3 +1,7 @@ +""" +This is a playground for the Transformer model. +""" + import torch from zeta.nn import Transformer, Decoder From f9779cefe50cce5416859d7c75f343dacd6ae509 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 20:02:09 -0700 Subject: [PATCH 17/19] docstring for delpycache --- scripts/delpycache.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/delpycache.py b/scripts/delpycache.py index f688d204..0ed4484d 100644 --- a/scripts/delpycache.py +++ b/scripts/delpycache.py @@ -1,3 +1,8 @@ +""" +Delete all __pycache__ directories in a given directory. +Usage: python delpycache.py +""" + import os import shutil import sys From f91cec0cb7423296982bdf9c81a19f067e3671f2 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 20:03:15 -0700 Subject: [PATCH 18/19] module docstring delpycache --- scripts/delpycache.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/delpycache.py b/scripts/delpycache.py index 0ed4484d..c17bcad4 100644 --- a/scripts/delpycache.py +++ b/scripts/delpycache.py @@ -9,6 +9,9 @@ def delete_pycache(directory): + """ + Delete all __pycache__ directories in a given directory. + """ for root, dirs, files in os.walk(directory): if "__pycache__" in dirs: shutil.rmtree(os.path.join(root, "__pycache__")) From cc8152be09bb250fc8f3c6bd60abc36d6aaaef13 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 20:06:58 -0700 Subject: [PATCH 19/19] docstrings, encoding get_pkg_reqs --- scripts/get_package_requirements.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/get_package_requirements.py b/scripts/get_package_requirements.py index 0d57c028..43324452 100644 --- a/scripts/get_package_requirements.py +++ b/scripts/get_package_requirements.py @@ -1,9 +1,17 @@ +""" +This script extracts the package names and versions from a requirements.txt file and writes them to a new file. +The new file can be used to install the same package versions on another machine. +""" + import pkg_resources def get_package_versions(requirements_path, output_path): + """ + Extract package names and versions from a requirements.txt file and write them to a new file. + """ try: - with open(requirements_path, "r") as file: + with open(requirements_path, "r", encoding="utf-8") as file: requirements = file.readlines() except FileNotFoundError: print(f"Error: The file '{requirements_path}' was not found.")