Skip to content

Commit

Permalink
Merge pull request #48 from FullStackWithLawrence/next
Browse files Browse the repository at this point in the history
chore: fix path to python requirements
  • Loading branch information
lpm0073 authored Dec 6, 2023
2 parents 026f65e + db71300 commit 3f182a7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 71 deletions.
37 changes: 4 additions & 33 deletions .github/actions/tests/python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,10 @@ inputs:
description: "The version of Python to use, such as 3.11.0"
required: true
type: string
openai-api-organization:
description: "The OpenAI API organization"
required: true
type: string
openai-api-key:
description: "The OpenAI API key"
required: true
type: string
pinecone-api-key:
description: "The Pinecone API key"
required: true
type: string
pinecone-environment:
description: "The Pinecone environment"
required: true
type: string
pinecone-index-name:
description: "The Pinecone index name"
required: true
type: string


env:
REQUIREMENTS_PATH: "api/terraform/python/layer_genai/requirements.txt"
REQUIREMENTS_PATH: "requirements/local.txt"

runs:
using: "composite"
Expand All @@ -46,7 +27,7 @@ runs:
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/local.txt') }}
restore-keys: |
${{ runner.os }}-pip
Expand All @@ -68,25 +49,15 @@ runs:
- name: Install dependencies
shell: bash
run: |
pip install -r ./requirements.txt
pip install -r ./requirements/local.txt
env:
SITE_PACKAGES_PATH: ${{ env.SITE_PACKAGES_PATH }}

- name: Create .env
shell: bash
run: |
touch ./.env
echo "OPENAI_API_ORGANIZATION=${{ env.OPENAI_API_ORGANIZATION }}" >> ./.env
echo "OPENAI_API_KEY=${{ env.OPENAI_API_KEY }}" >> ./.env
echo "PINECONE_API_KEY=${{ env.PINECONE_API_KEY }}" >> ./.env
echo "PINECONE_ENVIRONMENT=${{ env.PINECONE_ENVIRONMENT }}" >> ./.env
echo "PINECONE_INDEX_NAME=${{ env.PINECONE_INDEX_NAME }}" >> ./.env
env:
OPENAI_API_ORGANIZATION: ${{ inputs.openai-api-organization }}
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
PINECONE_API_KEY: ${{ inputs.pinecone-api-key }}
PINECONE_ENVIRONMENT: ${{ inputs.pinecone-environment }}
PINECONE_INDEX_NAME: ${{ inputs.pinecone-index-name }}

- name: Run Tests
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/precommitVersionBumps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('**local.txt') }}
restore-keys: |
${{ runner.os }}-pip
Expand All @@ -66,7 +66,7 @@ jobs:
- name: Install dependencies
shell: bash
run: |
pip install -r ./requirements.txt
pip install -r ./local.txt
env:
SITE_PACKAGES_PATH: ${{ env.SITE_PACKAGES_PATH }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pullRequestController.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ on:
types: [opened, synchronize]
paths:
- "**.py"
- "**.requirements.txt"
- "**.local.txt"
- "**.package.json"
- "./secure_logger/**"

Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
id: file_changes
run: |
echo "::set-output name=files_changed::$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '\.py$' || true)"
echo "::set-output name=requirements_changed::$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep 'requirements.txt$' || true)"
echo "::set-output name=requirements_changed::$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep 'local.txt$' || true)"
- name: Run Python tests
if: steps.file_changes.outputs.files_changed != '' || steps.file_changes.outputs.requirements_changed != ''
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/runTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ jobs:
uses: ./.github/actions/tests/python
with:
python-version: "${{ env.python-version}}"
openai-api-organization: "${{ secrets.OPENAI_API_ORGANIZATION }}"
openai-api-key: "${{ secrets.OPENAI_API_KEY }}"
pinecone-api-key: "${{ secrets.PINECONE_API_KEY }}"
pinecone-environment: "${{ secrets.PINECONE_ENVIRONMENT }}"
pinecone-index-name: "${{ secrets.PINECONE_INDEX_NAME }}"
30 changes: 1 addition & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Tests](https://github.com/FullStackWithLawrence/secure-logger/actions/workflows/tests.yml/badge.svg)](https://github.com/FullStackWithLawrence/secure-logger/actions)
![GHA pushMain Status](https://img.shields.io/github/actions/workflow/status/FullStackWithLawrence/secure-logger/pushMain.yml?branch=main)
[![Source
code](https://img.shields.io/static/v1?logo=github&label=Git&style=flat-square&color=brightgreen&message=Source%20code)](https://github.com/FullStackWithLawrence/secure-logger)
code](https://img.shields.io/static/v1?logo=github&label=Git&style=flat-square&color=orange&message=Source%20code)](https://github.com/FullStackWithLawrence/secure-logger)
[![Release Notes](https://img.shields.io/github/release/FullStackWithLawrence/secure-logger)](https://github.com/FullStackWithLawrence/secure-logger/releases)
[![PyPI
releases](https://img.shields.io/pypi/v/secure-logger?logo=python&logoColor=white)](https://pypi.org/project/secure-logger)
Expand Down Expand Up @@ -135,31 +135,3 @@ DEFAULT_SENSITIVE_KEYS = [

Pull requests are welcome, and you can also contact [Lawrence
McDaniel](https://lawrencemcdaniel.com/contact) directly.

### Getting Started With Local development

- Use the same virtual environment that you use for edx-platform
- Ensure that your Python interpreter to 3.11
- install black: <https://pypi.org/project/black/>
- install flake8: <https://flake8.pycqa.org/en/latest/>
- install flake8-coding: <https://pypi.org/project/flake8-coding/>

``` bash
# Run these from within your edx-platform virtual environment
python3 -m venv venv
source venv/bin/activate

pip install -r requirements/local.txt
pip install pre-commit black flake8
pre-commit install
```

#### Local development good practices

- run `black` on modified code before committing.
- run
`flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics`
- run
`flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics`
- run `pre-commit run --all-files` before pushing. see:
<https://pre-commit.com/>

0 comments on commit 3f182a7

Please sign in to comment.