Skip to content
This repository was archived by the owner on Nov 10, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "fastapi-37",
"image": "mcr.microsoft.com/devcontainers/python:3.12",
"features": {
"ghcr.io/devcontainers/features/node:1": { "version": "latest" }
},
"postCreateCommand": "pipx install poetry && poetry install",
"forwardPorts": [2222]
}
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ If applicable, add screenshots to help explain your problem.

**Environment:**
- OS: [e.g. Linux / Windows / macOS]
- FastAPI RESTful, FastAPI, and Pydantic versions [e.g. `0.3.0`], get them with:
- FastAPI Utils, FastAPI, and Pydantic versions [e.g. `0.3.0`], get them with:

```Python
import fastapi_restful
import fastapi_utils
import fastapi
import pydantic.utils
print(fastapi_restful.__version__)
print(fastapi_utils.__version__)
print(fastapi.__version__)
print(pydantic.utils.version_info())
```
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
max-parallel: 3
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"python.analysis.typeCheckingMode": "strict",
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"cSpell.words": [
"fastapi"
]
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Latest changes

* Merge with [fastapi-utils](https://github.com/dmontagu/fastapi-utils)

## 0.6.0

* Fix bug where `Request.url_for` is not working as intended [[yuval9313/FastApi-RESTful#90](https://github.com/yuval9313/FastApi-RESTful/issues/90)]
* Update multiple dependencies using @dependebot
* Fix `repeat_every` is only running once [#142](https://github.com/yuval9313/FastApi-RESTful/pull/142)
Expand Down
270 changes: 135 additions & 135 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,135 +1,135 @@
First, you might want to see the basic ways to [help and get help](help-fastapi-restful.md){.internal-link target=_blank}.
## Developing
Once you've cloned the repository, here are some guidelines to set up your environment:
### Set up the development environment
After cloning the repository, you can use `poetry` to create a virtual environment:
```console
$ make develop
```
Behind the scenes, this checks that you have python3 and poetry installed,
then creates a virtual environment and installs the dependencies. At the end, it will print out
the path to the executable in case you want to add it to your IDE.
### Activate the environment
Once the virtual environment is created, you can activate it with:
```console
$ poetry shell
```
To check if this worked, try running:
```console
$ which python
some/directory/fastapi-restful-SOMETHING-py3.X/bin/python
```
If the output of this command shows the `python` binary in a path containing `fastapi-restful` somewhere in the name
(as above), then it worked! 🎉
!!! tip
Every time you install a new package with `pip` under that environment, activate the environment again.
This makes sure that if you use a terminal program installed by that package (like `mypy`),
you use the one from your local environment and not any other that could be installed globally.
### Static Code Checks
This project makes use of `black`, `autoflake8`, and `isort` for formatting,
`flake8` for linting, and `mypy` for static type checking.
To auto-format your code, just run:
```console
$ make format
```
It will also auto-sort all your imports, and attempt to remove any unused imports.
You can run flake8 with:
```console
$ make lint
```
and you can run mypy with:
```console
$ make mypy
```
There are a number of other useful makefile recipes; you can see basic documentation of these by calling plain `make`:
```console
$ make
```
## Docs
The documentation uses <a href="https://www.mkdocs.org/" class="external-link" target="_blank">MkDocs</a>.
All the documentation is in Markdown format in the directory `./docs`.
Many of the sections in the User Guide have blocks of code.
In fact, those blocks of code are not written inside the Markdown, they are Python files in the `./docs/src/` directory.
And those Python files are included/injected in the documentation when generating the site.
### Docs for tests
Most of the tests actually run against the example source files in the documentation.
This helps making sure that:
* The documentation is up to date.
* The documentation examples can be run as is.
* Most of the features are covered by the documentation, ensured by test coverage.
During local development, there is a script that builds the site and checks for any changes, live-reloading:
```console
$ bash scripts/docs-live.sh
```
It will serve the documentation on `http://0.0.0.0:8008`.
That way, you can edit the documentation/source files and see the changes live.
## Tests
You can run all tests via:
```console
$ make test
```
You can also generate a coverage report with:
```console
make testcov
```
On MacOS, if the tests all pass, the coverage report will be opened directly in a browser; on other operating systems
a link will be printed to the local HTML containing the coverage report.
### Tests in your editor
If you want to use the integrated tests in your editor add `./docs/src` to your `PYTHONPATH` variable.
For example, in VS Code you can create a file `.env` with:
```env
PYTHONPATH=./docs/src
```
First, you might want to see the basic ways to [help and get help](help-fastapi-utils.md){.internal-link target=_blank}.

## Developing

Once you've cloned the repository, here are some guidelines to set up your environment:

### Set up the development evironment

After cloning the repository, you can use `poetry` to create a virtual environment:

```console
$ make develop
```

Behind the scenes, this checks that you have python3 and poetry installed,
then creates a virtual environment and installs the dependencies. At the end, it will print out
the path to the executable in case you want to add it to your IDE.


### Activate the environment

Once the virtual environment is created, you can activate it with:

```console
$ poetry shell
```

To check if this worked, try running:

```console
$ which python

some/directory/fastapi-utils-SOMETHING-py3.X/bin/python
```

If the output of this command shows the `python` binary in a path containing `fastapi-utils` somewhere in the name
(as above), then it worked! 🎉

!!! tip
Every time you install a new package with `pip` under that environment, activate the environment again.

This makes sure that if you use a terminal program installed by that package (like `mypy`),
you use the one from your local environment and not any other that could be installed globally.

### Static Code Checks

This project makes use of `black`, `autoflake8`, and `isort` for formatting,
`flake8` for linting, and `mypy` for static type checking.


To auto-format your code, just run:

```console
$ make format
```

It will also auto-sort all your imports, and attempt to remove any unused imports.

You can run flake8 with:

```console
$ make lint
```

and you can run mypy with:

```console
$ make mypy
```

There are a number of other useful makefile recipes; you can see basic documentation of these by calling plain `make`:

```console
$ make
```


## Docs

The documentation uses <a href="https://www.mkdocs.org/" class="external-link" target="_blank">MkDocs</a>.

All the documentation is in Markdown format in the directory `./docs`.

Many of the sections in the User Guide have blocks of code.

In fact, those blocks of code are not written inside the Markdown, they are Python files in the `./docs/src/` directory.

And those Python files are included/injected in the documentation when generating the site.

### Docs for tests

Most of the tests actually run against the example source files in the documentation.

This helps making sure that:

* The documentation is up to date.
* The documentation examples can be run as is.
* Most of the features are covered by the documentation, ensured by test coverage.

During local development, there is a script that builds the site and checks for any changes, live-reloading:

```console
$ bash scripts/docs-live.sh
```

It will serve the documentation on `http://0.0.0.0:8008`.

That way, you can edit the documentation/source files and see the changes live.

## Tests

You can run all tests via:

```console
$ make test
```

You can also generate a coverage report with:

```console
make testcov
```

On MacOS, if the tests all pass, the coverage report will be opened directly in a browser; on other operating systems
a link will be printed to the local HTML containing the coverage report.

### Tests in your editor

If you want to use the integrated tests in your editor add `./docs/src` to your `PYTHONPATH` variable.

For example, in VS Code you can create a file `.env` with:

```env
PYTHONPATH=./docs/src
```
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Yuval Levi
Copyright (c) 2024 David Montague, Yuval Levi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL := /bin/bash
.DEFAULT_GOAL := help

pkg_src = fastapi_restful
pkg_src = fastapi_utils
tests_src = tests
docs_src = docs/src
all_src = $(pkg_src) $(tests_src)
Expand Down Expand Up @@ -103,6 +103,7 @@ docs-build:
cp ./README.md ./docs/index.md
cp ./CONTRIBUTING.md ./docs/contributing.md
cp ./CHANGELOG.md ./docs/release-notes.md
pip install mkdocs mkdocs-material markdown-include
python -m mkdocs build

.PHONY: docs-format ## Format the python code that is part of the docs
Expand Down
Loading