From 15ba4b699d045f9ae8045a257331d829c3fa40e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:33:45 +0000 Subject: [PATCH 1/2] chore: bump django in /app in the pip group across 1 directory Bumps the pip group with 1 update in the /app directory: [django](https://github.com/django/django). Updates `django` from 4.2.16 to 4.2.17 - [Commits](https://github.com/django/django/compare/4.2.16...4.2.17) --- updated-dependencies: - dependency-name: django dependency-type: direct:production dependency-group: pip ... Signed-off-by: dependabot[bot] --- app/requirements.in | 2 +- app/requirements.txt | 34 +++++++++++++++++++++------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/app/requirements.in b/app/requirements.in index de318866..0235a3a4 100644 --- a/app/requirements.in +++ b/app/requirements.in @@ -1,4 +1,4 @@ -django~=4.2.0 +django~=4.2.17 django-extensions django-linear-migrations django-phonenumber-field[phonenumbers] diff --git a/app/requirements.txt b/app/requirements.txt index 03078097..b9032803 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -6,12 +6,13 @@ attrs==24.2.0 # referencing cffi==1.17.1 # via cryptography -coverage==7.6.8 +coverage[toml]==7.6.8 # via pytest-cov cryptography==44.0.0 # via pyjwt -django==4.2.16 +django==4.2.17 # via + # -r requirements.in # django-extensions # django-linear-migrations # django-phonenumber-field @@ -20,17 +21,22 @@ django==4.2.16 # drf-jwt # drf-spectacular django-extensions==3.2.3 + # via -r requirements.in django-linear-migrations==2.16.0 -django-phonenumber-field==8.0.0 + # via -r requirements.in +django-phonenumber-field[phonenumbers]==8.0.0 + # via -r requirements.in django-timezone-field==7.0 + # via -r requirements.in djangorestframework==3.15.2 # via + # -r requirements.in # drf-jwt # drf-spectacular drf-jwt==1.19.2 + # via -r requirements.in drf-spectacular==0.28.0 -exceptiongroup==1.2.2 - # via pytest + # via -r requirements.in execnet==2.1.1 # via pytest-xdist inflection==0.5.1 @@ -42,6 +48,7 @@ jsonschema==4.23.0 jsonschema-specifications==2024.10.1 # via jsonschema markdown==3.7 + # via -r requirements.in packaging==24.2 # via pytest phonenumbers==8.13.51 @@ -49,18 +56,24 @@ phonenumbers==8.13.51 pluggy==1.5.0 # via pytest psycopg2-binary==2.9.10 + # via -r requirements.in pycparser==2.22 # via cffi -pyjwt==2.10.1 - # via drf-jwt +pyjwt[crypto]==2.10.1 + # via + # drf-jwt + # pyjwt pytest==8.3.4 # via # pytest-cov # pytest-django # pytest-xdist pytest-cov==6.0.0 + # via -r requirements.in pytest-django==4.9.0 + # via -r requirements.in pytest-xdist==3.6.1 + # via -r requirements.in pyyaml==6.0.2 # via drf-spectacular referencing==0.35.1 @@ -73,12 +86,7 @@ rpds-py==0.22.1 # referencing sqlparse==0.5.2 # via django -tomli==2.2.1 - # via - # coverage - # pytest -typing-extensions==4.12.2 - # via asgiref tzdata==2024.2 + # via -r requirements.in uritemplate==4.1.1 # via drf-spectacular From 25a19e46b4dda82aea1b41b0de863a6d85bcab8a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:34:23 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/contributing/dev_environment.md | 5 +++++ .../howto/add-model-and-api-endpoints.md | 13 +++++++++++++ docs/contributing/team.md | 1 + docs/contributing/tools/docker.md | 3 +++ docs/contributing/tools/mkdocs.md | 15 +++++++++++++++ 5 files changed, 37 insertions(+) diff --git a/docs/contributing/dev_environment.md b/docs/contributing/dev_environment.md index 4e12ac25..aca1e376 100644 --- a/docs/contributing/dev_environment.md +++ b/docs/contributing/dev_environment.md @@ -19,6 +19,7 @@ Set up two-factor authentication on your account by following this [guide](https Before cloning your forked repository to your local machine, you must have Git installed. You can find instructions for installing Git for your operating system [**here**](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). === "Windows" + - we recommend [installing Windows Subsystem for Linux (WSL)](https://code.visualstudio.com/docs/remote/wsl). WSL provides a Linux-compatible environment that can prevent common errors during script execution. - After setting up WSL, install Git directly from the Linux terminal. This method can help avoid complications that sometimes arise when using Git Bash on Windows. @@ -32,6 +33,7 @@ Before cloning your forked repository to your local machine, you must have Git i !!! tip "Feel free to reach out in the [Hack for LA Slack channel](https://hackforla.slack.com/messages/people-depot/) if you encounter any errors while running scripts on Windows" === "Mac" + Please note that if you have a Mac the page offers several options (see other option, if you need to conserve hard drive space) including: - an “easiest” option (this version is fine for our use): This option would take just over 4GB. @@ -61,6 +63,7 @@ You can fork the hackforla/peopledepot repository by clicking `https://github.com//peopledepot`" + !!! example "For example -> `https://github.com/octocat/peopledepot`" !!! info "What you have created is a forked copy in a remote version on GitHub. It is not on your local machine yet" @@ -132,6 +135,7 @@ upstream https://github.com/hackforla/peopledepot.git (push) 1. Make sure the Docker service is running === "Docker (Engine)" + ```bash sudo systemctl status docker ``` @@ -139,6 +143,7 @@ upstream https://github.com/hackforla/peopledepot.git (push) It will show `Active: active (running)` if it's running. === "Docker Desktop" + 1. Start Docker Desktop 1. Run `docker container ls` to verify Docker Desktop is running. If it is not running you will get the message: `Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?` diff --git a/docs/contributing/howto/add-model-and-api-endpoints.md b/docs/contributing/howto/add-model-and-api-endpoints.md index 30872138..02a04458 100644 --- a/docs/contributing/howto/add-model-and-api-endpoints.md +++ b/docs/contributing/howto/add-model-and-api-endpoints.md @@ -3,6 +3,7 @@ This guide aims to enable developers with little or no django experience to add django models and API endpoints to the project. Most code examples are followed by detailed explanations. ??? note "The developer will have exposure to the following in this document" + - python - django - django rest framework @@ -22,6 +23,7 @@ Let's start! ## Data model ??? note "TDD test" + 1. Write the test We would like the model to store these data, and to return the name property in the str function. @@ -117,6 +119,7 @@ class RecurringEvent(AbstractBaseModel): # (1)! 1. Always override the `__str__` function to output something more meaningful than the default. It lets us do a quick test of the model by calling `str([model])`. It's also useful for the admin site model list view. ??? note "Updating models.py for many-to-many relationships" + For adding many-to-many relationships with additional fields, such as `ended_on`, we can add ```python title="app/core/models.py" linenums="1" @@ -165,6 +168,7 @@ This generates the database migration files ``` ??? note "Test" + Since we overrode the `__str__` function, we need to write a test for it. 1. Add a fixture for the model @@ -212,6 +216,7 @@ This generates the database migration files ``` ??? note "Check and commit" + This is a good place to pause, check, and commit progress. 1. Run pre-commit checks @@ -274,11 +279,13 @@ Check that everything's working and there are no issues, which should be the cas 1. Having a misconfigured or buggy custom field could cause the admin site to crash and the developer will need to look at the debug message and resolve it. ??? note "Test" + 1. Feel free to write tests for the admin. There's no example for it yet. 1. The reason there's no tests is that the admin site is independent of the API functionality, and we're mainly interested in the API part. 1. When the time comes that we depend on the admin interface, we will need to have tests for the needed functionalities. ??? note "Check and commit" + This is a good place to pause, check, and commit progress. 1. Run pre-commit checks @@ -305,6 +312,7 @@ This is code that serializes objects into strings for the API endpoints, and des In `app/core/api/serializers.py` ??? note "Updating serializers.py for many-to-many relationships" + Following the many-to-many relationship between project and recurring event from above, Update the existing serializer classes @@ -458,6 +466,7 @@ In `app/core/api/views.py` 1. It doesn't control permissions the way we want, but we will fix it later. ??? note "Extended example: Query Params" + This example shows how to add a filter params. It's done for the [user model](https://github.com/hackforla/peopledepot/issues/15) as a [requirement](https://github.com/hackforla/peopledepot/issues/10) from VRMS. 1. Here's a more complex API doc example (this example is using the User model's ViewSet) @@ -565,6 +574,7 @@ In `app/core/api/urls.py` - `reverse("recurring-event-list")` would return `http://localhost:8000/api/v1/recuring-events/` ??? note "Test" + For the CRUD operations, since we're using `ModelViewSet` where all the actions are provided by `rest_framework` and well-tested, it's not necessary to have test cases for them. But here's an example of one. In `app/core/tests/test_api.py` @@ -610,6 +620,7 @@ In `app/core/api/urls.py` ``` ??? note "Test many-to-many relationships" + In `app/core/tests/test_api.py` 1. Import API URL @@ -649,6 +660,7 @@ In `app/core/api/urls.py` ``` ??? note "Check and commit" + This is a good place to pause, check, and commit progress. 1. Run pre-commit checks @@ -665,4 +677,5 @@ In `app/core/api/urls.py` ``` ??? note "Push the code and start a PR" + Refer to the [Issues page section on "Push to upstream origin"](issues.md#push-to-upstream-origin-aka-your-fork) onward. diff --git a/docs/contributing/team.md b/docs/contributing/team.md index 8d8c087a..d8633277 100644 --- a/docs/contributing/team.md +++ b/docs/contributing/team.md @@ -5,4 +5,5 @@ This step is optional if this is your first time fixing an issue and you want to In the [People-depot Slack channel](https://hackforla.slack.com/messages/people-depot/), send an introductory message with your GitHub `handle/username` asking to be added to the Hack for LA peopledepot GitHub repository, have access to the Google Docs Drive, and Figma. !!! note "Please do the following once you have accepted the GitHub invite (comes via email or in your GitHub notifications)" + Make your own Hack for LA GitHub organization membership public by following this [guide](https://help.github.com/en/articles/publicizing-or-hiding-organization-membership#changing-the-visibility-of-your-organization-membership). diff --git a/docs/contributing/tools/docker.md b/docs/contributing/tools/docker.md index d7b3f479..6df3db24 100644 --- a/docs/contributing/tools/docker.md +++ b/docs/contributing/tools/docker.md @@ -28,11 +28,13 @@ To restore a database to its original state and remove any data manually added, From Docker: === "Terminal" + ```bash docker-compose down -v ``` === "Docker Desktop" + 1. Open Containers section 1. Delete people-db-1 container 1. Open Images Tab @@ -57,6 +59,7 @@ For apk, the cache directory is `/var/cache/apk/`. [APK wiki on local cache](htt For apt, the cache directory is `/var/cache/apt/`. ??? info "References" + - [buildkit mount the cache](https://vsupalov.com/buildkit-cache-mount-dockerfile/) - [proper usage of mount cache](https://dev.doroshev.com/blog/docker-mount-type-cache/) - [mount cache reference](https://docs.docker.com/engine/reference/builder/#run---mounttypecache) diff --git a/docs/contributing/tools/mkdocs.md b/docs/contributing/tools/mkdocs.md index f420a53a..eaff9e85 100644 --- a/docs/contributing/tools/mkdocs.md +++ b/docs/contributing/tools/mkdocs.md @@ -33,6 +33,7 @@ Here's a list of commonly used MkDocs syntax for quick reference. ### [Code Blocks](https://squidfunk.github.io/mkdocs-material/reference/code-blocks/) === "Example" + ```python title="Code Block" @admin.register(RecurringEvent) class RecurringEventAdmin(admin.ModelAdmin): @@ -64,6 +65,7 @@ Here's a list of commonly used MkDocs syntax for quick reference. ``` === "Code" + ```` ```python title="Code Block" @admin.register(RecurringEvent) @@ -99,6 +101,7 @@ Here's a list of commonly used MkDocs syntax for quick reference. ### [Code Annotations](https://squidfunk.github.io/mkdocs-material/reference/annotations/) === "Example" + ```bash Click the plus sign --> # (1)! ``` @@ -106,6 +109,7 @@ Here's a list of commonly used MkDocs syntax for quick reference. 1. This is an explanation text === "Code" + ```` ``` bash Click the plus sign --> # (1)! @@ -117,18 +121,23 @@ Here's a list of commonly used MkDocs syntax for quick reference. ### [Text blocks](https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/details/) === "Example" + !!! example "Simple Block" !!! example + Content Block Text ??? example "Expandable Block" + Content ???+ example "Opened Expandable Block" + Content === "Code" + ``` !!! example "Simple Block" @@ -145,13 +154,17 @@ Here's a list of commonly used MkDocs syntax for quick reference. ### [Tabbed content](https://facelessuser.github.io/pymdown-extensions/extensions/tabbed/) === "Example" + === "Linux" + linux-specific content === "Mac" + mac-specific content === "Code" + ``` === "Linux" @@ -165,9 +178,11 @@ Here's a list of commonly used MkDocs syntax for quick reference. ### [Buttons](https://squidfunk.github.io/mkdocs-material/reference/buttons/) === "Example" + 1. ++ctrl+c++ to quit the local server and stop the container === "Code" + ``` 1. ++ctrl+c++ to quit the local server and stop the container ```