Skip to content

Commit 00999dd

Browse files
authored
Merge pull request #208 from FullStackWithLawrence/next
lint
2 parents e16ef84 + 6b15242 commit 00999dd

File tree

12 files changed

+37
-56
lines changed

12 files changed

+37
-56
lines changed

.flake8

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
[flake8]
2-
max-line-length = 120
2+
ignore = D205,D413,D400,D401
3+
max-line-length =120
4+
max-complexity = 10
5+
exclude = "api/terraform/python/layer_genai/venv"
6+
extend-exclude = "*__init__.py,*__version__.py,venv,lambda_dist_pkg"
7+
select = "C101"

.pylintrc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
[MASTER]
2-
ignore-paths =
3-
api/terraform/python/lambda_openai_v2/lambda_dist_pkg,
4-
api/terraform/python/lambda_openai/lambda_dist_pkg,
5-
api/terraform/python/lambda_langchain/lambda_dist_pkg
62
ignore =
73
__version__.py
84

CHANGELOG.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
# [0.7.0](https://github.com/FullStackWithLawrence/aws-openai/compare/v0.6.5...v0.7.0) (2023-12-18)
22

3-
43
### Bug Fixes
54

6-
* version writer was skipping first two lines ([5be9cf2](https://github.com/FullStackWithLawrence/aws-openai/commit/5be9cf2f313de60b4d5dfd64fcbd080194cff03c))
7-
5+
- version writer was skipping first two lines ([5be9cf2](https://github.com/FullStackWithLawrence/aws-openai/commit/5be9cf2f313de60b4d5dfd64fcbd080194cff03c))
86

97
### Features
108

11-
* add lists of .env and terraform.tfvars variables in use for settings ([ed64c74](https://github.com/FullStackWithLawrence/aws-openai/commit/ed64c74bfd7fdd7a99f684b5a22c65c1c1fc7a58))
12-
* add openai and langchain parameters to unit tests ([d19af9f](https://github.com/FullStackWithLawrence/aws-openai/commit/d19af9fa108df885f091e23057f38e15f1df9552))
13-
* add properties to report whether .env and/or terraform.tfvars files are in use ([5e3bea6](https://github.com/FullStackWithLawrence/aws-openai/commit/5e3bea603af3a9e96bb35ec601924edbe8e7d305))
14-
* add Settings class and refactor ([b9f0286](https://github.com/FullStackWithLawrence/aws-openai/commit/b9f028632622c5a81eeee7bc8b5fe920d72a5bed))
15-
* add unit test for langchain ([9a2b00d](https://github.com/FullStackWithLawrence/aws-openai/commit/9a2b00d903a8a6b097b52364b3fe4dd449cb165c))
16-
* add unit tests for common ([cf3ac81](https://github.com/FullStackWithLawrence/aws-openai/commit/cf3ac81e2c2db889f2bcaaa43365af92e0437ca6))
17-
* add unit tests for lambda_langchain ([4d94a87](https://github.com/FullStackWithLawrence/aws-openai/commit/4d94a875ea968dff85c48f6316fcd6ace5b31033))
18-
* add unit tests for lambda_openai_v2 ([1b1a2c9](https://github.com/FullStackWithLawrence/aws-openai/commit/1b1a2c9d24d834e06d2d747845d1562b826437e5))
19-
* refactor for OpenAI API v1 ([7fb6809](https://github.com/FullStackWithLawrence/aws-openai/commit/7fb6809a627eb8451af0054f24bd51bf3b52e07f))
20-
* run Python unit tests on all pushes ([4957f63](https://github.com/FullStackWithLawrence/aws-openai/commit/4957f63028058504c11249b1c01a6ca28dd2bce1))
9+
- add lists of .env and terraform.tfvars variables in use for settings ([ed64c74](https://github.com/FullStackWithLawrence/aws-openai/commit/ed64c74bfd7fdd7a99f684b5a22c65c1c1fc7a58))
10+
- add openai and langchain parameters to unit tests ([d19af9f](https://github.com/FullStackWithLawrence/aws-openai/commit/d19af9fa108df885f091e23057f38e15f1df9552))
11+
- add properties to report whether .env and/or terraform.tfvars files are in use ([5e3bea6](https://github.com/FullStackWithLawrence/aws-openai/commit/5e3bea603af3a9e96bb35ec601924edbe8e7d305))
12+
- add Settings class and refactor ([b9f0286](https://github.com/FullStackWithLawrence/aws-openai/commit/b9f028632622c5a81eeee7bc8b5fe920d72a5bed))
13+
- add unit test for langchain ([9a2b00d](https://github.com/FullStackWithLawrence/aws-openai/commit/9a2b00d903a8a6b097b52364b3fe4dd449cb165c))
14+
- add unit tests for common ([cf3ac81](https://github.com/FullStackWithLawrence/aws-openai/commit/cf3ac81e2c2db889f2bcaaa43365af92e0437ca6))
15+
- add unit tests for lambda_langchain ([4d94a87](https://github.com/FullStackWithLawrence/aws-openai/commit/4d94a875ea968dff85c48f6316fcd6ace5b31033))
16+
- add unit tests for lambda_openai_v2 ([1b1a2c9](https://github.com/FullStackWithLawrence/aws-openai/commit/1b1a2c9d24d834e06d2d747845d1562b826437e5))
17+
- refactor for OpenAI API v1 ([7fb6809](https://github.com/FullStackWithLawrence/aws-openai/commit/7fb6809a627eb8451af0054f24bd51bf3b52e07f))
18+
- run Python unit tests on all pushes ([4957f63](https://github.com/FullStackWithLawrence/aws-openai/commit/4957f63028058504c11249b1c01a6ca28dd2bce1))
2119

2220
# Change Log
2321

Makefile

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ pre-commit:
2727
pre-commit autoupdate
2828
pre-commit run --all-files
2929

30-
######################
31-
# AWS API Gateway + Lambda + OpenAI
32-
######################
30+
# ---------------------------------------------------------
31+
# create python virtual environments for dev as well
32+
# as for the Lambda layer.
33+
# ---------------------------------------------------------
3334
api-init:
34-
# ---------------------------------------------------------
35-
# create python virtual environments for dev as well
36-
# as for the Lambda layer.
37-
# ---------------------------------------------------------
35+
make api-clean
3836
npm install && \
3937
python3.11 -m venv venv && \
4038
source venv/bin/activate && \
@@ -49,20 +47,22 @@ api-init:
4947
deactivate && \
5048
pre-commit install
5149

52-
api-activate:
53-
. venv/bin/activate && \
54-
pip install -r requirements.txt
55-
5650
api-test:
5751
python -m unittest discover -s api/terraform/python/openai_api/
5852

5953
api-lint:
6054
terraform fmt -recursive
6155
pre-commit run --all-files
6256
black ./api/terraform/python/
57+
flake8 api/terraform/python/
58+
pylint api/terraform/python/openai_api/**/*.py
6359

6460
api-clean:
6561
rm -rf venv
62+
rm -rf ./api/terraform/python/layer_genai/venv
63+
rm -rf ./api/terraform/build/
64+
mkdir -p ./api/terraform/build/
65+
find ./api/terraform/python/ -name __pycache__ -type d -exec rm -rf {} +
6666

6767
######################
6868
# React app
@@ -123,7 +123,6 @@ help:
123123
@echo 'release - force a new release'
124124
@echo '-- AWS API Gateway + Lambda --'
125125
@echo 'api-init - create a Python virtual environment and install dependencies'
126-
@echo 'api-activate - activate the Python virtual environment'
127126
@echo 'api-test - run Python unit tests'
128127
@echo 'api-lint - run Python linting'
129128
@echo 'api-clean - destroy the Python virtual environment'

api/terraform/python/layer_genai/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ FROM --platform=linux/amd64 public.ecr.aws/lambda/python:3.11
88
WORKDIR /var/task
99

1010
COPY requirements.txt .
11-
COPY openai_utils ./openai_utils
1211

1312
RUN yum install -y zip
1413
RUN pip install -r requirements.txt --target python/lib/python3.11/site-packages
15-
RUN cp -R openai_utils python/lib/python3.11/site-packages
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# AWS Lambda Layer for OpenAI/Langchain Lambdas
22

3-
This layer contains the combined pip requirements for both lambda_langchain and lambda_openai.
3+
This layer contains the combined pip requirements for both lambda_langchain and lambda_openai_v2.

api/terraform/python/layer_genai/create_container.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
#------------------------------------------------------------------------------
1414
cd $SOURCE_CODE_PATH
1515

16-
# we have to phyically copy the python module(s) to the dist venv site-packages folder
17-
# because we're installing this package as an executate and pip therefore won't
18-
# copy the module(s) to the site-packages folder for us.
19-
cp -R $PARENT_DIRECTORY/openai_utils/ $SOURCE_CODE_PATH/venv/lib/python3.11/site-packages/
20-
cp -rf SOURCE_CODE_PATH/venv/lib/python3.11/site-packages/openai_utils/__pycache__
21-
cp -rf SOURCE_CODE_PATH/venv/lib/python3.11/site-packages/openai_utils/openai_utils.egg-info
22-
cp -rf SOURCE_CODE_PATH/venv/lib/python3.11/openai_utils/tests
2316

2417
docker build -t $CONTAINER_NAME .
2518
docker rm $CONTAINER_NAME

api/terraform/python/layer_genai/requirements.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# -----------------------------------------------------------------------------
1010
python-dotenv==1.0.0
1111
openai==1.5.0
12-
langchain==0.0.350
13-
langchain-experimental==0.0.47
12+
langchain
13+
langchain-experimental
1414
pinecone-client==2.2.4
15+
pydantic==2.5.2
16+
pydantic-settings==2.1.0
17+
python-dotenv==1.0.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22
# DO NOT EDIT.
33
# Managed via automated CI/CD in .github/workflows/semanticVersionBump.yml.
4-
__version__ = "0.7.0"
4+
__version__ = "0.7.1"

api/terraform/terraform.tfvars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ tags = {
1616
"project" = "OpenAI Code Samples"
1717
"contact" = "YOUR CONTACT INFORMATION GOES HERE."
1818
}
19-
aws_region = "us-east-1"
19+
aws_region = "us-east-1"
2020
# aws_profile = "default"
2121

2222
###############################################################################

pyproject.toml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[build-system]
2-
requires = ["flake8", "gitlint", "bump2version"]
3-
41
[tool.isort]
52
profile = "black"
63
lines_after_imports = 2
@@ -25,11 +22,3 @@ exclude = '''
2522
| lambda_dist_pkg
2623
)/
2724
'''
28-
29-
[tool.flake8]
30-
ignore = "D205,D413,D400,D401"
31-
max-line-length =120
32-
max-complexity = 10
33-
exclude = "api/terraform/python/lambda_openai/venv, api/terraform/python/lambda_openai/lambda_dist_pkg, api/terraform/python/lambda_openai_v2/lambda_dist_pkg, api/terraform/python/lambda_langchain/lambda_dist_pkg"
34-
extend-exclude = "*__init__.py,*__version__.py,venv,lambda_dist_pkg"
35-
select = "C101"

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ skip_missing_interpreters = true
66

77
[tool.isort]
88
profile = "black"
9-
skip =venv,node_modules,api/terraform/python/lambda_openai/lambda_dist_pkg,api/terraform/python/lambda_openai/venv
9+
skip =venv,node_modules,api/terraform/python/layer_genai/venv
1010

1111
[gh-actions]
1212
python =

0 commit comments

Comments
 (0)