diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f0a6bf4..da9aef1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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 ... ``` diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index d2284c6..7b726a4 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -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 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 4be39ef..09b3c8f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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 ... ``` diff --git a/.github/workflows/docker_cleanup.yml b/.github/workflows/docker_cleanup.yml index 29224b5..68822c3 100644 --- a/.github/workflows/docker_cleanup.yml +++ b/.github/workflows/docker_cleanup.yml @@ -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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3d8f8d1..f0d30cf 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 @@ -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: @@ -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 @@ -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 @@ -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 @@ -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. diff --git a/.gitignore b/.gitignore index 9e5161e..9372fbb 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ venv* htmlcov token .DS_Store + +client_secret*.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca242ec..1c1303e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,13 +36,13 @@ 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. @@ -50,7 +50,7 @@ This way, you don't have to "install" your local version to be able to test ever ### 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 diff --git a/Dockerfile b/Dockerfile index 84fc967..df526f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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} diff --git a/README.md b/README.md index e2af006..dc639e4 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/SECURITY.md b/SECURITY.md index 11cfd95..dbabd5e 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -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 diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index 5ba32a4..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,29 +0,0 @@ -x-logging: &default-logging - driver: loki - options: - loki-url: 'http://localhost:3100/api/prom/push' - loki-pipeline-stages: | - - multiline: - firstline: '^\d{4}-\d{2}-\d{2} \d{1,2}:\d{2}:\d{2}' - max_wait_time: 3s - - regex: - expression: '^(?P