Skip to content

Commit

Permalink
Completed
Browse files Browse the repository at this point in the history
Completed
  • Loading branch information
AkkilMG authored Oct 3, 2024
2 parents 3c64945 + 88af075 commit b439ea3
Show file tree
Hide file tree
Showing 15 changed files with 996 additions and 148 deletions.
3 changes: 3 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

email = ""
password = ""
134 changes: 132 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,133 @@
/test
__pycache__
/files
/files
/myenv

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# Cerificate
# Cerificate



```
------------------------------------------------------------------
Your code has been rated at 9.41/10 (previous run: 9.30/10, +0.11)
```
13 changes: 11 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
"""
This module handles the configuration settings for the Certify project.
It loads environment variables from a .env file and sets up email credentials
and template configurations.
"""
import os
from dotenv import load_dotenv

load_dotenv()


Template = {
1: "test" # file name without extension (Add template to './templates')
}

EMAIL = ""
PASS = ""

# Mail
email = os.getenv("email")
password = os.getenv("password")
29 changes: 19 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
# (c) 2022-2023, Akkil M G (https://github.com/HeimanPictures)
# License: GNU General Public License v3.0

"""
main.py
This module initializes the FastAPI application for the 'certify' service,
which generates and stores certificates for SOSC events.
"""

import uvicorn
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from fastapi.middleware.cors import CORSMiddleware

from config import *
import router.api_router as api_router
from router import api_router

app = FastAPI(
title="Cerify",
description="This is an application as a service to store certificate for SOSC Events.",
title="certify",
description=(
"This is an application as a service to generate and store "
"certificate for SOSC Events."
),
version="0.0.2",
contact={
"name": "Akkil M G",
"url": "http://github.com/HeimanPictures",
"url": "http://github.com/AkkilMG",
},
license_info={
"name": "GNU GENERAL PUBLIC License v3.0",
Expand All @@ -34,17 +41,19 @@
allow_headers=["*"],
)

app.get("/")
@app.get("/")
async def home():
return JSONResponse({ "success": True })
"""Return a JSON response indicating the server is running successfully."""
return JSONResponse({"success": True})

app.include_router(api_router.router, prefix="/api/v1")


if __name__ == "__main__":
try:
print('------------------- Initalizing Web Server -------------------')
print('------------------- Initializing Web Server -------------------')
print('----------------------- Service Started -----------------------')
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
except KeyboardInterrupt:
print('----------------------- Service Stopped -----------------------')
print('----------------------- Service Stopped -----------------------')

# No pointless strings should remain here
23 changes: 23 additions & 0 deletions quality.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Install required packages (make sure pip is installed)
pip install pylint black pytest pytest-cov

# If the reports directory does not exist, create it
if (!(Test-Path -Path "./reports")) {
New-Item -ItemType Directory -Path "./reports"
}

# Lint all Python files in the current directory and specific subfolders (utils and router)
pylint .\*.py .\utils\*.py .\router\*.py > ./reports/pylint_report.txt
Write-Host "Pylint report generated in reports/pylint_report.txt"

# Format all Python files in the current directory and specific subfolders (utils and router) with black (optional)
black .\*.py .\utils\*.py .\router\*.py
Write-Host "Code formatted with Black"

# Run tests with pytest (assuming your tests are in a 'tests' directory)
pytest tests > ./reports/pytest_report.txt
Write-Host "Pytest report generated in reports/pytest_report.txt"

# Check for code coverage (optional)
pytest --cov=. tests > ./reports/coverage_report.txt
Write-Host "Coverage report generated in reports/coverage_report.txt"
6 changes: 1 addition & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ sniffio==1.3.0
starlette==0.25.0
typing_extensions==4.5.0
uvicorn==0.20.0
uvloop==0.17.0
watchfiles==0.18.1
websockets==10.4
# Mains
python-pptx==0.6.22
Spire.Presentation==8.9.0
Spire==0.4.2
pandas
Spire==0.4.2
Loading

0 comments on commit b439ea3

Please sign in to comment.