added product service functionality in python, modified load_catalog.py #457
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
In this pull request, I have introduced a Python version of the existing Product Service, which was originally written in Go. By switching to Python, we hope to simplify maintenance and allow more people to contribute effectively.
Here is a summary of the main changes:
Added new Python scripts replicating the functionality of the Product Service, which was originally written in Go. These scripts include src/products/src/products-service/app.py, src/products/src/products-service/aws.py, src/products/src/products-service/requirements.txt, src/products/src/products-service/routes.py, src/products/src/products-service/server.py, src/products/src/products-service/services.py
Updated the Dockerfile to use a Python 3.11 slim image instead of the Golang image and use python scripts. The Python packages required by the new scripts are installed via the requirements.txt file
Original dockerfile for Go container is now src/carts/Dockerfile-go
Modified src/products/load_catalog.py to allow setting local dynamodb endpoint as argument and create tables if not created yet
The Dockerfiles and Python scripts have been placed in the same locations as their Go counterparts to keep the structure of the service consistent.
Description of testing performed to validate your changes (required if pull request includes CloudFormation or source code changes):
I validated the changes using the available integration tests, ensuring that the Python scripts correctly mimic the functionality of the original Go code. I also deployed the retail demo store with the changes in my own AWS account to confirm that the service works as expected in a live environment. All tests passed, and the deployment was successful.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.