Skip to content

Commit 97d3153

Browse files
committed
Fix errors.
1 parent c5aa47a commit 97d3153

12 files changed

Lines changed: 86 additions & 80 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,38 +47,38 @@ jobs:
4747
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
4848

4949
steps:
50-
- name: Checkout repository
51-
uses: actions/checkout@v4
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
5252

53-
# Initializes the CodeQL tools for scanning.
54-
- name: Initialize CodeQL
55-
uses: github/codeql-action/init@v3
56-
with:
57-
languages: ${{ matrix.language }}
58-
# If you wish to specify custom queries, you can do so here or in a config file.
59-
# By default, queries listed here will override any specified in a config file.
60-
# Prefix the list here with "+" to use these queries and those in the config file.
53+
# Initializes the CodeQL tools for scanning.
54+
- name: Initialize CodeQL
55+
uses: github/codeql-action/init@v3
56+
with:
57+
languages: ${{ matrix.language }}
58+
# If you wish to specify custom queries, you can do so here or in a config file.
59+
# By default, queries listed here will override any specified in a config file.
60+
# Prefix the list here with "+" to use these queries and those in the config file.
6161

62-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
63-
# queries: security-extended,security-and-quality
62+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
63+
# queries: security-extended,security-and-quality
6464

6565

66-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
67-
# If this step fails, then you should remove it and run the build manually (see below)
68-
- name: Autobuild
69-
uses: github/codeql-action/autobuild@v3
66+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
67+
# If this step fails, then you should remove it and run the build manually (see below)
68+
- name: Autobuild
69+
uses: github/codeql-action/autobuild@v3
7070

71-
# ℹ️ Command-line programs to run using the OS shell.
72-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
71+
# ℹ️ Command-line programs to run using the OS shell.
72+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
7373

74-
# If the Autobuild fails above, remove it and uncomment the following three lines.
75-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
74+
# If the Autobuild fails above, remove it and uncomment the following three lines.
75+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
7676

77-
# - run: |
78-
# echo "Run, Build Application using script"
79-
# ./location_of_script_within_repo/buildscript.sh
77+
# - run: |
78+
# echo "Run, Build Application using script"
79+
# ./location_of_script_within_repo/buildscript.sh
8080

81-
- name: Perform CodeQL Analysis
82-
uses: github/codeql-action/analyze@v3
83-
with:
84-
category: "/language:${{matrix.language}}"
81+
- name: Perform CodeQL Analysis
82+
uses: github/codeql-action/analyze@v3
83+
with:
84+
category: "/language:${{matrix.language}}"

.github/workflows/docker-image.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
17-
- name: Docker Login
18-
run: docker login -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }}
16+
- uses: actions/checkout@v3
17+
- name: Docker Login
18+
run: docker login -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }}
1919

2020

21-
- name: Docker Build
22-
run: docker build . -t index.docker.io/maxiplux/fastapidevops
23-
- name: Docker Push
24-
run: docker push index.docker.io/maxiplux/fastapidevops
21+
- name: Docker Build
22+
run: docker build . -t index.docker.io/maxiplux/fastapidevops
23+
- name: Docker Push
24+
run: docker push index.docker.io/maxiplux/fastapidevops

.github/workflows/pylint.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
name: Pylint
22

3-
on: [push]
3+
on: [ push ]
44

55
jobs:
66
build:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: ["3.12","3.10"]
10+
python-version: [ "3.12","3.10" ]
1111
steps:
12-
- uses: actions/checkout@v3
13-
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v3
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
- name: Install dependencies
18-
run: |
19-
python -m pip install --upgrade pip
20-
pip install pylint
21-
- name: Analysing the code with pylint
22-
run: |
23-
pylint $(git ls-files '*.py')
12+
- uses: actions/checkout@v3
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v3
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install pylint
21+
- name: Analysing the code with pylint
22+
run: |
23+
pylint $(git ls-files '*.py')

.idea/.gitignore

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@ DevOps FastAPI Project
66
Overview
77
--------
88

9-
This project is a foundational FastAPI application for experimenting with DevOps tools and practices. It's aimed at facilitating the integration of DevOps methodologies in a Python environment, serving as a learning and testing base for DevOps enthusiasts and professionals.
9+
This project is a foundational FastAPI application for experimenting with DevOps tools and practices. It's aimed at
10+
facilitating the integration of DevOps methodologies in a Python environment, serving as a learning and testing base for
11+
DevOps enthusiasts and professionals.
1012

1113
Goals
1214
-----
1315

14-
* Establish a base for DevOps project testing.
15-
* Integrate various DevOps tools and practices.
16-
* Foster learning in DevOps within a Python setting.
16+
* Establish a base for DevOps project testing.
17+
* Integrate various DevOps tools and practices.
18+
* Foster learning in DevOps within a Python setting.
1719

1820
Getting Started
1921
---------------
2022

2123
### Prerequisites
2224

23-
* Python 3.x
24-
* Docker (for containerization)
25+
* Python 3.x
26+
* Docker (for containerization)
2527

2628
### Installation
2729

@@ -43,8 +45,6 @@ Using Docker:
4345

4446
docker build -t fastapi-devops .
4547
docker run -p 8000:8000 -e DB_USERNAME=your_username -e DB_PASSWORD=your_password -e DB_HOST=your_host -e DB_NAME=your_db_name fastapi-devops
46-
47-
4848

4949
Contributing
5050
------------

call_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ def get_db():
66
try:
77
yield db
88
finally:
9-
db.close()
9+
db.close()

config/database.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import os
2+
13
from sqlalchemy import create_engine
4+
from sqlalchemy.engine import URL
25
from sqlalchemy.ext.declarative import declarative_base
36
from sqlalchemy.orm import sessionmaker
4-
from sqlalchemy.engine import URL
5-
import os
6-
77

8-
#SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app2.db"
8+
# SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app2.db"
99

1010

1111
url = URL.create(
@@ -21,4 +21,4 @@
2121
Session = sessionmaker(bind=engine)
2222
session = Session()
2323

24-
Base = declarative_base()
24+
Base = declarative_base()

main.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
from fastapi import Depends, FastAPI
2-
3-
4-
5-
1+
from fastapi import FastAPI
62

73
from routers import items
8-
from services import item_services
94

105
app = FastAPI()
116

127

13-
148
@app.get("/")
159
async def root():
1610
return {"message": "Hello World"}
1711

1812

19-
2013
app.include_router(items.router)
21-

models/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
2-
from sqlalchemy.orm import relationship
3-
from config.database import Base, engine
4-
1+
from sqlalchemy import Column, Integer, String
52

3+
from config.database import Base, engine
64

75

86
class Item(Base):
@@ -11,4 +9,6 @@ class Item(Base):
119
id = Column(Integer, primary_key=True)
1210
title = Column(String, index=True)
1311
description = Column(String, index=True)
12+
13+
1414
Base.metadata.create_all(engine)

models/schemas.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ class ItemCreate(ItemBase):
1313
class Item(ItemBase):
1414
id: int
1515

16-
1716
class Config:
1817
orm_mode = True

0 commit comments

Comments
 (0)