Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/deploy-main-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,20 @@ jobs:
- uses: actions/checkout@v4
- name: Set environment variable
run: echo "GITHUB_ACTIONS_UNITTEST_FLAG=1" >> $GITHUB_ENV
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
uv sync
- name: Test with unittest
run: |
python -m unittest discover ./generator/unittests/utilities
python -m unittest discover ./generator/unittests/objects
python -m unittest discover ./generator/unittests/app
uv run python -m unittest discover ./generator/unittests/utilities
uv run python -m unittest discover ./generator/unittests/objects
uv run python -m unittest discover ./generator/unittests/app

dockerhub-image-push:
needs: [trivy-fs-scan, python-unittests]
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/dev-pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ jobs:
- uses: actions/checkout@v4
- name: Set environment variable
run: echo "GITHUB_ACTIONS_UNITTEST_FLAG=1" >> $GITHUB_ENV
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
uv sync
- name: Test with unittest
run: |
python -m unittest discover ./generator/unittests/utilities
python -m unittest discover ./generator/unittests/objects
python -m unittest discover ./generator/unittests/app
uv run python -m unittest discover ./generator/unittests/utilities
uv run python -m unittest discover ./generator/unittests/objects
uv run python -m unittest discover ./generator/unittests/app
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ENV PYTHON_VERSION=${PYTHON_VERSION}
# install required software and programmes for development environment
RUN apt-get update
RUN apt-get install -y apt-utils vim curl wget unzip tree htop adduser
RUN apt-get install -y imagemagick=8:7.1.1.43+dfsg1-1+deb13u5 libssl-dev=3.5.4-1~deb13u2

# set up home environment
RUN adduser ${user}
Expand All @@ -19,11 +20,12 @@ RUN mkdir -p /home/${user} && chown -R ${user}: /home/${user}
# copy repo
COPY . /home/${user}/RandomTelecomPayments

# install required python packages
RUN python -m pip install -v -r /home/${user}/RandomTelecomPayments/requirements.txt

# set working directory for random telecom payments app
WORKDIR /home/${user}/RandomTelecomPayments

# install required python packages
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN uv sync

EXPOSE 8000
ENTRYPOINT ["python", "generator/main.py"]
ENTRYPOINT ["uv", "run", "generator/main.py"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ docker cp rtp:/home/user/RandomTelecomPayments/data/RandomTelecomPayments.csv %u
Alternatively, a FastApi interface has been configured within the docker image to allow for interaction with the Random Telecom Payments app via REST API calls. The FastApi interface can be accessed by publishing port 8000 when running the docker image as follows:

```
docker run --name rtp --publish 8000:8000 --entrypoint fastapi --rm oislen/randomtelecompayments:latest run generator/api.py
docker run --name rtp --publish 8000:8000 --entrypoint uv --rm oislen/randomtelecompayments:latest run fastapi run generator/api.py
```

Once the web endpoint is running, navigate to localhost:8000/docs in your preferred browser to access the FastApi interface documentation and test the available API calls.
Expand Down
2 changes: 1 addition & 1 deletion aws/exeRunEC2.cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
call python prg_run_ec2_instance.py --launch --terminate --describe --isFleet
call uv run prg_run_ec2_instance.py --launch --terminate --describe --isFleet
File renamed without changes.
2 changes: 2 additions & 0 deletions config/uv/RandomTelecomPayments.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:: call powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
call uv add -r requirements.txt --link-mode=copy
2 changes: 1 addition & 1 deletion generator/exeApi.cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
call fastapi run api.py
call uv run fastapi run api.py
2 changes: 1 addition & 1 deletion generator/exeApi.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fastapi run api.py
uv run fastapi run api.py
2 changes: 1 addition & 1 deletion generator/exeGenNames.cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
call python -m pdb utilities\gen_user_names_file.py
call uv run utilities\gen_user_names_file.py
4 changes: 2 additions & 2 deletions generator/exeMain.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
call python -m pdb main.py --n_users 100 --use_random_seed 1 --n_itr 1
:: call python -m pdb main.py --n_users 13000 --use_random_seed 1 --n_itr 2
call uv run main.py --n_users 100 --use_random_seed 1 --n_itr 1
:: call uv run main.py --n_users 13000 --use_random_seed 1 --n_itr 2
4 changes: 2 additions & 2 deletions generator/exeMain.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
python3 -m pdb main.py --n_users 100 --use_random_seed 1 --n_itr 1
# python3 -m pdb main.py --n_users 13000 --use_random_seed 1 --n_itr 2
uv run main.py --n_users 100 --use_random_seed 1 --n_itr 1
# uv run main.py --n_users 13000 --use_random_seed 1 --n_itr 2
6 changes: 3 additions & 3 deletions generator/exeUnittests.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
call cd ..
call python -m unittest discover generator\unittests\utilities
call python -m unittest discover generator\unittests\objects
call python -m unittest discover generator\unittests\app
call uv run python -m unittest discover generator\unittests\utilities
call uv run python -m unittest discover generator\unittests\objects
call uv run python -m unittest discover generator\unittests\app
call cd generator
6 changes: 3 additions & 3 deletions generator/exeUnittests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cd ..
python3 -m unittest discover unittests/utilities
python3 -m unittest discover unittests/objects
python3 -m unittest discover unittests/app
uv run python3 -m unittest discover unittests/utilities
uv run python3 -m unittest discover unittests/objects
uv run python3 -m unittest discover unittests/app
cd generator
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[project]
name = "randomtelecompayments"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"beartype==0.19.0",
"boto3==1.36.12",
"fastapi[standard]==0.128.0",
"fastparquet==2024.11.0",
"ipykernel==6.29.5",
"networkx==3.4.2",
"numpy==2.0.2",
"pandas==2.2.3",
"pyarrow==18.1.0",
"scikit-learn==1.6.1",
"scipy==1.15.1",
"seaborn==0.13.2",
"shap==0.46.0",
"unidecode==1.3.8",
]
Loading