-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
277 additions
and
1,439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
# Project Structure | ||
|
||
This project is structured as a Python package. The tree structure is as | ||
follows (with some files omitted for brevity): | ||
|
||
```text | ||
├── Dockerfile | ||
├── alembic.ini | ||
├── docker-compose.yaml | ||
├── migrations | ||
│ ├── env.py | ||
│ ├── script.py.mako | ||
│ └── versions | ||
│ └── 2023_08_20_1729-e5fccc3522ce_initial_migration.py | ||
├── pyproject.toml | ||
├── requirements.txt | ||
├── tests | ||
│ ├── api | ||
│ │ └── test_animals_api.py | ||
│ └── conftest.py | ||
└── zoo | ||
├── __init__.py | ||
├── __main__.py | ||
├── _version.py | ||
├── api | ||
│ ├── __init__.py | ||
│ └── animals.py | ||
├── app.py | ||
├── config.py | ||
├── db.py | ||
├── models | ||
│ ├── __init__.py | ||
│ └── animals.py | ||
└── schemas | ||
├── __init__.p | ||
└── animals.py | ||
``` | ||
|
||
## Project Files | ||
|
||
- ??? abstract ":ship: Dockerfile" | ||
```dockerfile | ||
--8<-- "Dockerfile" | ||
``` | ||
|
||
- Dockerfile for building the Docker image. | ||
|
||
- ??? abstract ":gear: alembic.ini" | ||
```ini | ||
--8<-- "alembic.ini" | ||
``` | ||
|
||
- Configuration file for Alembic project. | ||
|
||
- ??? abstract ":whale: docker-compose.yaml" | ||
```yaml | ||
--8<-- "docker-compose.yaml" | ||
``` | ||
|
||
- Docker Compose configuration file for running the application. | ||
|
||
- ??? abstract ":snake: migrations/env.py" | ||
```python | ||
--8<-- "migrations/env.py" | ||
``` | ||
|
||
- Configuration file for Alembic migrations to interface with the application | ||
database. | ||
|
||
- ??? abstract ":page_facing_up: migrations/script.py.mako" | ||
```python | ||
--8<-- "migrations/script.py.mako" | ||
``` | ||
|
||
- Template file for Alembic migrations. | ||
|
||
- ??? abstract ":snake: migrations/versions/2023_08_20_1729-e5fccc3522ce_initial_migration.py" | ||
```python | ||
--8<-- "migrations/versions/2023_08_20_1729-e5fccc3522ce_initial_migration.py" | ||
``` | ||
|
||
- Initial migration script generated by Alembic. This is an example of what | ||
a migration script looks like - containing an `upgrade` and `downgrade` | ||
function. | ||
|
||
- ??? abstract ":gear: pyproject.toml" | ||
```toml | ||
--8<-- "pyproject.toml" | ||
``` | ||
|
||
- Configuration file for Python Package and Tooling. | ||
|
||
- ??? abstract ":gear: requirements.txt" | ||
```requirements.txt | ||
--8<-- "requirements.txt" | ||
``` | ||
|
||
- Python dependencies for the application. This file is created and managed | ||
using [pip-tools](https://pip-tools.readthedocs.io/en/latest/). | ||
|
||
- ??? abstract ":test_tube: tests/api/test_animals_api.py" | ||
```python | ||
--8<-- "tests/api/test_animals_api.py" | ||
``` | ||
|
||
- Unit tests for the API endpoints. | ||
|
||
- ??? abstract ":test_tube: tests/conftest.py" | ||
```python | ||
--8<-- "tests/conftest.py" | ||
``` | ||
|
||
- Configuration file for pytest. This contains fixtures that are used by the | ||
unit tests. This includes a special `client` fixture that is used to | ||
perform requests against the application with an ephemeral migrated database. | ||
|
||
- ??? abstract ":snake: zoo/**main**.py" | ||
```python | ||
--8<-- "zoo/__main__.py" | ||
``` | ||
|
||
- Command-line entrypoint for the application, built with | ||
[click](https://click.palletsprojects.com/). This is | ||
used to run the application using `python -m zoo`. | ||
|
||
- ??? abstract ":snake: zoo/\_version.py" | ||
```python | ||
--8<-- "zoo/_version.py" | ||
``` | ||
|
||
- Version file for the application. This is used by hatch to | ||
set the version of the application. | ||
|
||
- ??? abstract ":snake: zoo/api/animals.py" | ||
```python | ||
--8<-- "zoo/api/animals.py" | ||
``` | ||
|
||
- The `api` module contains the API endpoints for the application. This | ||
includes the `animals` module, which contains the endpoints for the | ||
`/animals` API. These `api` modules contain the relevant FastAPI | ||
endpoints, as well as any supporting functions. | ||
|
||
- ??? abstract ":snake: zoo/app.py" | ||
```python | ||
--8<-- "zoo/app.py" | ||
``` | ||
|
||
- The `app` module contains the FastAPI application instance. This is | ||
where the FastAPI application is created, and where the application | ||
dependencies are configured. | ||
|
||
- ??? abstract ":snake: zoo/config.py" | ||
```python | ||
--8<-- "zoo/config.py" | ||
``` | ||
|
||
- The `config` module contains the application configuration. This | ||
includes the `Settings` class, which is used to configure the | ||
application using environment variables. | ||
|
||
- ??? abstract ":snake: zoo/db.py" | ||
```python | ||
--8<-- "zoo/db.py" | ||
``` | ||
|
||
- The `db` module contains the database configuration. This includes | ||
the `SessionLocal` class, which is used to create a SQLAlchemy | ||
session for the application. | ||
|
||
- ??? abstract ":snake: zoo/models/animals.py" | ||
```python | ||
--8<-- "zoo/models/animals.py" | ||
``` | ||
|
||
- The `models` module contains the SQLAlchemy models for the application. | ||
|
||
- ??? abstract ":snake: zoo/schemas/animals.py" | ||
```python | ||
--8<-- "zoo/schemas/animals.py" | ||
``` | ||
|
||
- The `schemas` module contains the Pydantic schemas for the application. | ||
These schemas are used to validate the request and response data for the | ||
API endpoints. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.