From 991969ec3404e0c07a2076c0a8b800f337e79185 Mon Sep 17 00:00:00 2001 From: Davor Runje Date: Wed, 12 Jun 2024 08:53:49 +0200 Subject: [PATCH 1/2] Fix readme (#10) * Update README.md * Rename weatherman to weatherapi --------- Co-authored-by: Kumaran Rajendhiran --- .devcontainer/python-3.10/devcontainer.json | 2 +- .devcontainer/python-3.10/docker-compose.yml | 10 +++---- .devcontainer/python-3.11/devcontainer.json | 2 +- .devcontainer/python-3.11/docker-compose.yml | 10 +++---- .devcontainer/python-3.12/devcontainer.json | 2 +- .devcontainer/python-3.12/docker-compose.yml | 10 +++---- .devcontainer/python-3.9/devcontainer.json | 2 +- .devcontainer/python-3.9/docker-compose.yml | 10 +++---- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 4 +-- .github/workflows/docker_cleanup.yml | 2 +- .github/workflows/test.yaml | 6 ++--- CONTRIBUTING.md | 10 +++---- Dockerfile | 2 +- README.md | 4 +-- SECURITY.md | 6 ++--- docker-compose.yaml | 8 +++--- pyproject.toml | 28 ++++++++++---------- scripts/deploy.sh | 2 +- scripts/lint-pre-commit.sh | 2 +- scripts/lint.sh | 4 +-- scripts/run_server.sh | 2 +- scripts/static-analysis.sh | 2 +- scripts/static-pre-commit.sh | 2 +- tests/app/test_app.py | 2 +- weatherapi/__about__.py | 3 +++ weatherapi/__init__.py | 3 +++ {weatherman => weatherapi}/app.py | 0 weatherman/__about__.py | 3 --- weatherman/__init__.py | 3 --- 31 files changed, 75 insertions(+), 75 deletions(-) create mode 100644 weatherapi/__about__.py create mode 100644 weatherapi/__init__.py rename {weatherman => weatherapi}/app.py (100%) delete mode 100644 weatherman/__about__.py delete mode 100644 weatherman/__init__.py diff --git a/.devcontainer/python-3.10/devcontainer.json b/.devcontainer/python-3.10/devcontainer.json index 0b23638..ac55f7a 100644 --- a/.devcontainer/python-3.10/devcontainer.json +++ b/.devcontainer/python-3.10/devcontainer.json @@ -6,7 +6,7 @@ "service": "python-3.10", "forwardPorts": [], "shutdownAction": "stopCompose", - "workspaceFolder": "/workspaces/weatherman", + "workspaceFolder": "/workspaces/weatherapi", "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/.devcontainer/python-3.10/docker-compose.yml b/.devcontainer/python-3.10/docker-compose.yml index 52d6c6e..e5e1ca1 100644 --- a/.devcontainer/python-3.10/docker-compose.yml +++ b/.devcontainer/python-3.10/docker-compose.yml @@ -3,16 +3,16 @@ version: '3' services: python-3.10: # nosemgrep image: mcr.microsoft.com/devcontainers/python:3.10 - container_name: $USER-python-3.10-weatherman + container_name: $USER-python-3.10-weatherapi volumes: - - ../../:/workspaces/weatherman:cached + - ../../:/workspaces/weatherapi:cached command: sleep infinity env_file: - ../devcontainer.env platform: linux/amd64 networks: - - weatherman-network + - weatherapi-network networks: - weatherman-network: - name: "${USER}-weatherman-network" + weatherapi-network: + name: "${USER}-weatherapi-network" diff --git a/.devcontainer/python-3.11/devcontainer.json b/.devcontainer/python-3.11/devcontainer.json index ba5d3c8..519a4f7 100644 --- a/.devcontainer/python-3.11/devcontainer.json +++ b/.devcontainer/python-3.11/devcontainer.json @@ -6,7 +6,7 @@ "service": "python-3.11", "forwardPorts": [], "shutdownAction": "stopCompose", - "workspaceFolder": "/workspaces/weatherman", + "workspaceFolder": "/workspaces/weatherapi", "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/.devcontainer/python-3.11/docker-compose.yml b/.devcontainer/python-3.11/docker-compose.yml index ab720e9..b375830 100644 --- a/.devcontainer/python-3.11/docker-compose.yml +++ b/.devcontainer/python-3.11/docker-compose.yml @@ -3,16 +3,16 @@ version: '3' services: python-3.11: # nosemgrep image: mcr.microsoft.com/devcontainers/python:3.11 - container_name: $USER-python-3.11-weatherman + container_name: $USER-python-3.11-weatherapi volumes: - - ../../:/workspaces/weatherman:cached + - ../../:/workspaces/weatherapi:cached command: sleep infinity env_file: - ../devcontainer.env platform: linux/amd64 networks: - - weatherman-network + - weatherapi-network networks: - weatherman-network: - name: "${USER}-weatherman-network" + weatherapi-network: + name: "${USER}-weatherapi-network" diff --git a/.devcontainer/python-3.12/devcontainer.json b/.devcontainer/python-3.12/devcontainer.json index d07c388..12b50b8 100644 --- a/.devcontainer/python-3.12/devcontainer.json +++ b/.devcontainer/python-3.12/devcontainer.json @@ -6,7 +6,7 @@ "service": "python-3.12", "forwardPorts": [], "shutdownAction": "stopCompose", - "workspaceFolder": "/workspaces/weatherman", + "workspaceFolder": "/workspaces/weatherapi", "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/.devcontainer/python-3.12/docker-compose.yml b/.devcontainer/python-3.12/docker-compose.yml index b82388c..9474dc0 100644 --- a/.devcontainer/python-3.12/docker-compose.yml +++ b/.devcontainer/python-3.12/docker-compose.yml @@ -3,16 +3,16 @@ version: '3' services: python-3.12: # nosemgrep image: mcr.microsoft.com/devcontainers/python:3.12 - container_name: $USER-python-3.12-weatherman + container_name: $USER-python-3.12-weatherapi volumes: - - ../../:/workspaces/weatherman:cached + - ../../:/workspaces/weatherapi:cached command: sleep infinity env_file: - ../devcontainer.env platform: linux/amd64 networks: - - weatherman-network + - weatherapi-network networks: - weatherman-network: - name: "${USER}-weatherman-network" + weatherapi-network: + name: "${USER}-weatherapi-network" diff --git a/.devcontainer/python-3.9/devcontainer.json b/.devcontainer/python-3.9/devcontainer.json index 79c6aff..95a2907 100644 --- a/.devcontainer/python-3.9/devcontainer.json +++ b/.devcontainer/python-3.9/devcontainer.json @@ -6,7 +6,7 @@ "service": "python-3.9", "forwardPorts": [], "shutdownAction": "stopCompose", - "workspaceFolder": "/workspaces/weatherman", + "workspaceFolder": "/workspaces/weatherapi", "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/.devcontainer/python-3.9/docker-compose.yml b/.devcontainer/python-3.9/docker-compose.yml index 74a54e8..f6f605b 100644 --- a/.devcontainer/python-3.9/docker-compose.yml +++ b/.devcontainer/python-3.9/docker-compose.yml @@ -3,16 +3,16 @@ version: '3' services: python-3.9: # nosemgrep image: mcr.microsoft.com/devcontainers/python:3.9 - container_name: $USER-python-3.9-weatherman + container_name: $USER-python-3.9-weatherapi volumes: - - ../../:/workspaces/weatherman:cached + - ../../:/workspaces/weatherapi:cached command: sleep infinity env_file: - ../devcontainer.env platform: linux/amd64 networks: - - weatherman-network + - weatherapi-network networks: - weatherman-network: - name: "${USER}-weatherman-network" + weatherapi-network: + name: "${USER}-weatherapi-network" diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ad43208..f0a6bf4 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 weatherman.app import app +from weatherapi.app import app ... ``` diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index afae071..d2284c6 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/weatherman/discussions/categories/questions + url: https://github.com/airtai/weatherapi/discussions/categories/questions diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index b584045..4be39ef 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 **weatherman** code example: +To help others understand the proposed feature, illustrate it with a **weatherapi** code example: ```python -from weatherman.app import app +from weatherapi.app import app ... ``` diff --git a/.github/workflows/docker_cleanup.yml b/.github/workflows/docker_cleanup.yml index 551e411..29224b5 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: weatherman + name: weatherapi token: ${{ secrets.GITHUB_TOKEN }} # Keep latest N untagged images diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e631123..3d8f8d1 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 weatherman tests + run: mypy weatherapi tests - name: Run bandit shell: bash - run: bandit -c pyproject.toml -r weatherman + run: bandit -c pyproject.toml -r weatherapi - name: Run Semgrep shell: bash @@ -146,7 +146,7 @@ jobs: - run: ls -la coverage - run: coverage combine coverage - run: coverage report - - run: coverage html --show-contexts --title "weatherman coverage for ${{ github.sha }}" + - run: coverage html --show-contexts --title "weatherapi coverage for ${{ github.sha }}" - name: Store coverage html uses: actions/upload-artifact@v4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8889088..ca242ec 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 **WeatherMan** in your virtual environment. +This will install all the dependencies and your local **WeatherAPI** in your virtual environment. -### Using Your local **WeatherMan** +### Using Your local **WeatherAPI** -If you create a Python file that imports and uses **WeatherMan**, and run it with the Python from your local environment, it will use your local **WeatherMan** source code. +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. -Whenever you update your local **WeatherMan** 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 **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`. 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 **WeatherMan** application and Python environment, use: +To run tests with your current **WeatherAPI** application and Python environment, use: ```bash pytest tests diff --git a/Dockerfile b/Dockerfile index b084515..84fc967 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 RUN python3 -m pip install --upgrade pip -COPY weatherman ./weatherman +COPY weatherapi ./weatherapi COPY scripts/* pyproject.toml README.md ./ RUN pip install -e ".[dev]" diff --git a/README.md b/README.md index ec7752d..e2af006 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# weatherman -A weatherman api to be used with FastAgency +# Weather API +A simple weather API made for usage with FastAgency diff --git a/SECURITY.md b/SECURITY.md index b246179..11cfd95 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,14 +1,14 @@ # Security Policy -Security and stability are paramount for WeatherMan. +Security and stability are paramount for WeatherAPI. Learn more below. 👇 ## Versions -The latest version of WeatherMan is actively supported. +The latest version of WeatherAPI is actively supported. -We strongly encourage you to write tests for your application and regularly update your WeatherMan 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 WeatherAPI 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 index 1e53a13..5ba32a4 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -11,7 +11,7 @@ x-logging: &default-logging version: "3.4" -name: weatherman +name: weatherapi services: fastapi-app: # nosemgrep image: ghcr.io/${GITHUB_REPOSITORY}:${TAG} @@ -22,8 +22,8 @@ services: - DOMAIN=${DOMAIN} logging: *default-logging networks: - - weatherman + - weatherapi networks: - weatherman: - name: weatherman + weatherapi: + name: weatherapi diff --git a/pyproject.toml b/pyproject.toml index a5f7e49..76cf60f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,8 +3,8 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "weatherman" -description = "WeatherMan: an API to use with FastAgency" +name = "weatherapi" +description = "WeatherAPI: A simple weather API made for usage with FastAgency" readme = "README.md" authors = [ { name = "airt", email = "info@airt.ai" }, @@ -78,26 +78,26 @@ test-core = [ ] testing = [ - "weatherman[test-core]", - "weatherman[server]", # Uvicorn is needed for testing + "weatherapi[test-core]", + "weatherapi[server]", # Uvicorn is needed for testing ] dev = [ - "weatherman[server,lint,testing]", + "weatherapi[server,lint,testing]", "pre-commit==3.7.1", "detect-secrets==1.5.0", ] [project.urls] -Tracker = "https://github.com/airtai/weatherman/issues" -Source = "https://github.com/airtai/weatherman" +Tracker = "https://github.com/airtai/weatherapi/issues" +Source = "https://github.com/airtai/weatherapi" Discord = "https://discord.gg/qFm6aSqq59" [project.scripts] -# weatherman = "weatherman.__main__:cli" +# weatherapi = "weatherapi.__main__:cli" [tool.hatch.version] -path = "weatherman/__about__.py" +path = "weatherapi/__about__.py" [tool.hatch.build] skip-excluded-dirs = true @@ -110,15 +110,15 @@ exclude = [ allow-direct-references = true [tool.hatch.build.targets.wheel] -only-include = ["weatherman"] +only-include = ["weatherapi"] [tool.hatch.build.targets.wheel.sources] "src" = "" -# "scripts" = "weatherman/templates" +# "scripts" = "weatherapi/templates" [tool.mypy] -files = ["weatherman", "tests"] +files = ["weatherapi", "tests"] strict = true python_version = "3.9" @@ -145,7 +145,7 @@ disallow_any_unimported = false fix = true line-length = 88 # target-version = 'py39' -include = ["weatherman/**/*.py", "weatherman/**/*.pyi", "tests/**/*.py", "pyproject.toml"] +include = ["weatherapi/**/*.py", "weatherapi/**/*.pyi", "tests/**/*.py", "pyproject.toml"] exclude = ["docs/docs_src"] [tool.ruff.lint] @@ -206,7 +206,7 @@ concurrency = [ "thread" ] source = [ - "weatherman", + "weatherapi", # "tests", ] context = '${CONTEXT}' diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 4f0fdf9..8fd8bc7 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -22,7 +22,7 @@ fi ssh_command="ssh -o StrictHostKeyChecking=no -i key.pem azureuser@$DOMAIN" -container_name="weatherman" +container_name="weatherapi" log_file="${container_name}.log" echo "INFO: Capturing docker container logs" diff --git a/scripts/lint-pre-commit.sh b/scripts/lint-pre-commit.sh index b3f8917..e8d2f45 100755 --- a/scripts/lint-pre-commit.sh +++ b/scripts/lint-pre-commit.sh @@ -28,5 +28,5 @@ pip install --editable ".[dev]" \ # and specify the package to run on explicitly. # Note that we do not use --ignore-missing-imports, # as this can give us false confidence in our results. -# mypy weatherman +# mypy weatherapi ./scripts/lint.sh diff --git a/scripts/lint.sh b/scripts/lint.sh index 1353d7e..114d2e1 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash echo "Running pyup_dirs..." -pyup_dirs --py38-plus --recursive weatherman tests +pyup_dirs --py38-plus --recursive weatherapi tests echo "Running ruff linter (isort, flake, pyupgrade, etc. replacement)..." ruff check @@ -10,4 +10,4 @@ echo "Running ruff formater (black replacement)..." ruff format # echo "Running black..." -# black weatherman examples tests docs +# black weatherapi examples tests docs diff --git a/scripts/run_server.sh b/scripts/run_server.sh index b8ae53a..d0ac6d2 100755 --- a/scripts/run_server.sh +++ b/scripts/run_server.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -uvicorn weatherman.app:app --workers 2 --host 0.0.0.0 --proxy-headers +uvicorn weatherapi.app:app --workers 2 --host 0.0.0.0 --proxy-headers diff --git a/scripts/static-analysis.sh b/scripts/static-analysis.sh index 75d002f..8fd829b 100755 --- a/scripts/static-analysis.sh +++ b/scripts/static-analysis.sh @@ -6,7 +6,7 @@ echo "Running mypy..." mypy echo "Running bandit..." -bandit -c pyproject.toml -r weatherman +bandit -c pyproject.toml -r weatherapi echo "Running semgrep..." semgrep scan --config auto --error diff --git a/scripts/static-pre-commit.sh b/scripts/static-pre-commit.sh index 9620f75..06ae1e7 100755 --- a/scripts/static-pre-commit.sh +++ b/scripts/static-pre-commit.sh @@ -28,5 +28,5 @@ pip install --editable ".[dev]" \ # and specify the package to run on explicitly. # Note that we do not use --ignore-missing-imports, # as this can give us false confidence in our results. -# mypy weatherman +# mypy weatherapi ./scripts/static-analysis.sh diff --git a/tests/app/test_app.py b/tests/app/test_app.py index 2b7dc26..405fce7 100644 --- a/tests/app/test_app.py +++ b/tests/app/test_app.py @@ -2,7 +2,7 @@ from fastapi.testclient import TestClient -from weatherman.app import app +from weatherapi.app import app client = TestClient(app) diff --git a/weatherapi/__about__.py b/weatherapi/__about__.py new file mode 100644 index 0000000..2045314 --- /dev/null +++ b/weatherapi/__about__.py @@ -0,0 +1,3 @@ +"""A simple weather API made for usage with FastAgency.""" + +__version__ = "0.0.0dev0" diff --git a/weatherapi/__init__.py b/weatherapi/__init__.py new file mode 100644 index 0000000..d2200ae --- /dev/null +++ b/weatherapi/__init__.py @@ -0,0 +1,3 @@ +"""A simple weather API made for usage with FastAgency.""" + +from .__about__ import __version__ # noqa: F401 diff --git a/weatherman/app.py b/weatherapi/app.py similarity index 100% rename from weatherman/app.py rename to weatherapi/app.py diff --git a/weatherman/__about__.py b/weatherman/__about__.py deleted file mode 100644 index be2181d..0000000 --- a/weatherman/__about__.py +++ /dev/null @@ -1,3 +0,0 @@ -"""An API to use with FastAgency.""" - -__version__ = "0.0.0dev0" diff --git a/weatherman/__init__.py b/weatherman/__init__.py deleted file mode 100644 index 4d69251..0000000 --- a/weatherman/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -"""An API to use with FastAgency.""" - -from .__about__ import __version__ # noqa: F401 From 1daeaf43014d211da9accaf3cd7be0cd2197ea91 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Wed, 12 Jun 2024 12:51:12 +0530 Subject: [PATCH 2/2] Update dependency versions (#11) --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 76cf60f..9aa9d84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,17 +64,17 @@ lint = [ "types-Pygments", "types-docutils", "mypy==1.10.0", - "ruff==0.4.7", + "ruff==0.4.8", "pyupgrade-directories==0.3.0", "bandit==1.7.8", - "semgrep==1.71.0", + "semgrep==1.75.0", "pytest-mypy-plugins==3.1.2", ] test-core = [ "coverage[toml]==7.5.3", - "pytest==8.2.1", - "pytest-asyncio==0.23.6", + "pytest==8.2.2", + "pytest-asyncio==0.23.7", ] testing = [