Skip to content

Commit

Permalink
Merge pull request #27 from airtai/dev
Browse files Browse the repository at this point in the history
Completed repo setup
  • Loading branch information
kumaranvpl committed Jun 25, 2024
2 parents 2e59fc8 + b332a04 commit b332ac0
Show file tree
Hide file tree
Showing 30 changed files with 642 additions and 257 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Provide a clear and concise description of the bug.
Include source code:

```python
from weatherapi.app import app
from google_sheets.app import app
...
```

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ contact_links:
about: Please report security vulnerabilities to info@airt.ai
- name: Question or Problem
about: Ask a question or ask about a problem in GitHub Discussions.
url: https://github.com/airtai/weatherapi/discussions/categories/questions
url: https://github.com/airtai/google-sheets/discussions/categories/questions
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Provide a clear and concise description of the problem you've encountered. For e
Clearly and concisely describe the desired outcome or solution.

**Feature code example**
To help others understand the proposed feature, illustrate it with a **weatherapi** code example:
To help others understand the proposed feature, illustrate it with a **google-sheets** code example:

```python
from weatherapi.app import app
from google_sheets.app import app
...
```

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
# NOTE: at now only orgs is supported
owner: airtai
name: weatherapi
name: google-sheets

token: ${{ secrets.GITHUB_TOKEN }}
# Keep latest N untagged images
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
pip install -e ".[docs,lint]"
- name: Run mypy
shell: bash
run: mypy weatherapi tests
run: mypy google_sheets tests

- name: Run bandit
shell: bash
run: bandit -c pyproject.toml -r weatherapi
run: bandit -c pyproject.toml -r google_sheets

- name: Run Semgrep
shell: bash
Expand Down Expand Up @@ -70,7 +70,10 @@ jobs:
if: matrix.pydantic-version == 'pydantic-v2'
run: pip install --pre "pydantic>=2,<3"
- run: mkdir coverage

- name: Create client secrets file
run: echo '{"web":{"client_id":"dummy.apps.googleusercontent.com","project_id":"dummy-id","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"dummy-secret","redirect_uris":["http://localhost:9000/login/callback"]}}' > client_secret.json
- name: Prisma generate
run: prisma generate
- name: Test
run: bash scripts/test.sh
env:
Expand Down Expand Up @@ -98,6 +101,10 @@ jobs:
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[docs,testing]
- name: Create client secrets file
run: echo '{"web":{"client_id":"dummy.apps.googleusercontent.com","project_id":"dummy-id","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"dummy-secret","redirect_uris":["http://localhost:9000/login/callback"]}}' > client_secret.json
- name: Prisma generate
run: prisma generate
- name: Test
run: bash scripts/test.sh

Expand All @@ -116,6 +123,10 @@ jobs:
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[docs,testing]
- name: Create client secrets file
run: echo '{"web":{"client_id":"dummy.apps.googleusercontent.com","project_id":"dummy-id","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"dummy-secret","redirect_uris":["http://localhost:9000/login/callback"]}}' > client_secret.json
- name: Prisma generate
run: prisma generate
- name: Test
run: bash scripts/test.sh

Expand Down Expand Up @@ -146,7 +157,7 @@ jobs:
- run: ls -la coverage
- run: coverage combine coverage
- run: coverage report
- run: coverage html --show-contexts --title "weatherapi coverage for ${{ github.sha }}"
- run: coverage html --show-contexts --title "google-sheets coverage for ${{ github.sha }}"

- name: Store coverage html
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -224,10 +235,13 @@ jobs:
needs: [check]
if: github.ref_name == 'main' || github.ref_name == 'dev'
env:
CLIENT_SECRET: ${{ github.ref_name == 'main' && secrets.PROD_CLIENT_SECRET || secrets.STAGING_CLIENT_SECRET }}
DATABASE_URL: ${{ github.ref_name == 'main' && secrets.PROD_DATABASE_URL || secrets.STAGING_DATABASE_URL }}
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DEVELOPER_TOKEN: ${{ secrets.DEVELOPER_TOKEN }}
# DEVELOPER_TOKEN: ${{ secrets.DEVELOPER_TOKEN }}
DOMAIN: ${{ github.ref_name == 'main' && vars.PROD_DOMAIN || vars.STAGING_DOMAIN }}
REDIRECT_DOMAIN: ${{ github.ref_name == 'main' && vars.PROD_REDIRECT_DOMAIN || vars.STAGING_REDIRECT_DOMAIN }}
SSH_KEY: ${{ github.ref_name == 'main' && secrets.PROD_SSH_KEY || secrets.STAGING_SSH_KEY }}
steps:
- uses: actions/checkout@v3 # Don't change it to cheackout@v4. V4 is not working with container image.
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ venv*
htmlcov
token
.DS_Store

client_secret*.json
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ After activating the virtual environment as described above, run:
pip install -e ".[dev]"
```

This will install all the dependencies and your local **WeatherAPI** in your virtual environment.
This will install all the dependencies and your local **GoogleSheetsAPI** in your virtual environment.

### Using Your local **WeatherAPI**
### Using Your local **GoogleSheetsAPI**

If you create a Python file that imports and uses **WeatherAPI**, and run it with the Python from your local environment, it will use your local **WeatherAPI** source code.
If you create a Python file that imports and uses **GoogleSheetsAPI**, and run it with the Python from your local environment, it will use your local **GoogleSheetsAPI** source code.

Whenever you update your local **WeatherAPI** source code, it will automatically use the latest version when you run your Python file again. This is because it is installed with `-e`.
Whenever you update your local **GoogleSheetsAPI** source code, it will automatically use the latest version when you run your Python file again. This is because it is installed with `-e`.

This way, you don't have to "install" your local version to be able to test every change.

## Running Tests

### Pytest

To run tests with your current **WeatherAPI** application and Python environment, use:
To run tests with your current **GoogleSheetsAPI** application and Python environment, use:

```bash
pytest tests
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1

RUN python3 -m pip install --upgrade pip

COPY weatherapi ./weatherapi
COPY scripts/* pyproject.toml README.md ./
COPY google_sheets ./google_sheets
COPY migrations ./migrations
COPY scripts/* schema.prisma pyproject.toml README.md ./
RUN pip install -e ".[dev]"

EXPOSE ${PORT}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Weather API
A simple weather API made for usage with FastAgency
# Google Sheets API
A simple Google Sheets API made for usage with FastAgency
6 changes: 3 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Security Policy

Security and stability are paramount for WeatherAPI.
Security and stability are paramount for google-sheets.

Learn more below. 👇

## Versions

The latest version of WeatherAPI is actively supported.
The latest version of google-sheets is actively supported.

We strongly encourage you to write tests for your application and regularly update your WeatherAPI version after confirming that your tests pass. This ensures you benefit from the latest features, bug fixes, and **security updates**.
We strongly encourage you to write tests for your application and regularly update your google-sheets version after confirming that your tests pass. This ensures you benefit from the latest features, bug fixes, and **security updates**.

## Reporting a Vulnerability

Expand Down
29 changes: 0 additions & 29 deletions docker-compose.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions google-sheets-docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.4"

name: google-sheets
services:
fastapi-app: # nosemgrep
image: ghcr.io/${GITHUB_REPOSITORY}:${TAG}
container_name: ${container_name}
ports:
- "8001:8000"
environment:
- DOMAIN=${DOMAIN}
- REDIRECT_DOMAIN=${REDIRECT_DOMAIN}
- DATABASE_URL=${DATABASE_URL}
- CLIENT_SECRET=${CLIENT_SECRET}
networks:
- google-sheets

networks:
google-sheets:
name: google-sheets
3 changes: 3 additions & 0 deletions google_sheets/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""A simple Google Sheets API made for usage with FastAgency."""

__version__ = "0.1.0"
5 changes: 5 additions & 0 deletions google_sheets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""A simple Google Sheets API made for usage with FastAgency."""

from .__about__ import __version__

__all__ = ["__version__"]
Loading

0 comments on commit b332ac0

Please sign in to comment.