Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #26

Closed
wants to merge 28 commits into from
Closed

Dev #26

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7e23ec6
Rename weatherapi to google-sheets
rjambrecic Jun 18, 2024
af57314
wip
rjambrecic Jun 18, 2024
a594971
wip
rjambrecic Jun 18, 2024
ab48c7f
wip
rjambrecic Jun 18, 2024
2b9374e
wip
rjambrecic Jun 18, 2024
51569cc
Renaming done
rjambrecic Jun 18, 2024
f904f3b
Fix ci
rjambrecic Jun 18, 2024
ebecf53
Fix tests
rjambrecic Jun 18, 2024
fba1a5d
Fix Dockerfile
rjambrecic Jun 18, 2024
65c0352
Merge pull request #4 from airtai/renaming
rjambrecic Jun 18, 2024
57d2dba
Implement first endpoint
rjambrecic Jun 18, 2024
94e6328
wip
rjambrecic Jun 18, 2024
529a3b9
Fix ci
rjambrecic Jun 19, 2024
a871e61
Cleanup
rjambrecic Jun 19, 2024
50aeb37
Refactoring
rjambrecic Jun 19, 2024
f33e07c
wip
rjambrecic Jun 19, 2024
7b59089
wip
rjambrecic Jun 19, 2024
9414b1e
Return error message ig the user hasn't logged in yet
rjambrecic Jun 19, 2024
b14d692
Refactoring and tests added
rjambrecic Jun 19, 2024
313123e
Merge pull request #9 from airtai/first-sheet-endpoint
rjambrecic Jun 19, 2024
eb68004
Update deploy pipeline (#12)
rjambrecic Jun 20, 2024
9b1fc2a
Use a service specific docker compose file name (#13)
kumaranvpl Jun 20, 2024
44bb79c
Add prisma generate command (#14)
kumaranvpl Jun 20, 2024
6f02a07
Include prisma schema in docker (#15)
kumaranvpl Jun 20, 2024
583a2a5
Pass necessary env vars to docker container (#16)
kumaranvpl Jun 20, 2024
b723ece
Use separate db and google credentials (#19)
rjambrecic Jun 24, 2024
97caf17
Copy migrations within the Dockerfile (#20)
rjambrecic Jun 24, 2024
b332a04
Remove connection to the captn wasp db (#21)
rjambrecic Jun 24, 2024
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
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
Loading