Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/actions/cache-4
Browse files Browse the repository at this point in the history
  • Loading branch information
yuval9313 authored Nov 15, 2024
2 parents 7c9b75c + c731617 commit 9352df5
Show file tree
Hide file tree
Showing 14 changed files with 1,136 additions and 1,107 deletions.
14 changes: 9 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "fastapi-37",
"image": "mcr.microsoft.com/devcontainers/python:3.12",
"name": "fastapi-38",
"image": "mcr.microsoft.com/devcontainers/python:1-3.8-bookworm",
"features": {
"ghcr.io/devcontainers/features/node:1": { "version": "latest" }
"ghcr.io/devcontainers/features/node:1": {
"version": "latest"
}
},
"postCreateCommand": "pipx install poetry && poetry install",
"forwardPorts": [2222]
}
"forwardPorts": [
2222
]
}
22 changes: 22 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- Semver-Major
- breaking-change
- title: Exciting New Features 🎉
labels:
- Semver-Minor
- enhancement
- title: Other Changes
labels:
- "*"
exclude:
labels:
- dependencies
- title: 👒 Dependencies
labels:
- dependencies
4 changes: 2 additions & 2 deletions .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', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand All @@ -23,7 +23,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Init python poetry action
uses: abatilo/actions-poetry@v2.3.0
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: 1.5.1
- uses: actions/cache@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
python-version: ${{ matrix.python-version }}
# Avoid caching to be 100% confident things are working properly
- name: Init python poetry action
uses: abatilo/actions-poetry@v2.3.0
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: 1.5.1

Expand All @@ -39,12 +39,12 @@ jobs:

# Publish docs to github pages
- name: Setup Pages
uses: actions/configure-pages@v4
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: './site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
python-version: ${{ matrix.python-version }}
# Avoid caching to be 100% confident things are working properly
- name: Init python poetry action
uses: abatilo/actions-poetry@v2.3.0
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: 1.5.1

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-pull-request
name: tests-pull-request

on:
pull_request:
Expand All @@ -11,7 +11,7 @@ jobs:
strategy:
max-parallel: 3
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand All @@ -21,7 +21,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Init Python Poetry Action
uses: abatilo/actions-poetry@v2.3.0
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: 1.5.1
- uses: actions/cache@v4
Expand Down
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ test:
format:
black $(all_src)
black -l 82 $(docs_src)
ruff --fix $(all_src)
ruff check --fix $(all_src)

.PHONY: lint
lint:
ruff $(all_src)
ruff check $(all_src)
black --check --diff $(all_src)
black -l 82 $(docs_src) --check --diff

Expand All @@ -47,11 +47,10 @@ testcov:
fi

.PHONY: ci-v1 ## Run all CI validation steps without making any changes to code in pydantic v1

ci-v1: install-v1 lint test


.PHONY: ci-v1 ## Run all CI validation steps without making any changes to code in pydantic v2
.PHONY: ci-v2 ## Run all CI validation steps without making any changes to code in pydantic v2
ci-v2: install-v2 lint mypy test


Expand Down Expand Up @@ -108,7 +107,7 @@ docs-build:

.PHONY: docs-format ## Format the python code that is part of the docs
docs-format:
ruff $(docs_src)
ruff check $(docs_src)
autoflake -r --remove-all-unused-imports --ignore-init-module-imports $(docs_src) -i
black -l 82 $(docs_src)

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
</p>
<p align="center">
<a href="https://github.com/dmontagu/fastapi-utils" target="_blank">
<img src="https://img.shields.io/github/last-commit/dmontagu/fastapi-utils.svg">
<img src="https://github.com/dmontagu/fastapi-utils/workflows/build/badge.svg" alt="Build CI">
<img src="https://img.shields.io/github/last-commit/dmontagu/fastapi-utils.svg">
<img src="https://github.com/dmontagu/fastapi-utils/workflows/build/badge.svg" alt="Build CI">
</a>
<a href="https://codecov.io/gh/dmontagu/fastapi-utils" target="_blank">
<img src="https://codecov.io/gh/dmontagu/fastapi-utils/branch/master/graph/badge.svg" alt="Coverage">
Expand All @@ -20,13 +20,13 @@
</p>

---
**Documentation**: <a href="https://fastapi-utils.davidmontague.xyz" target="_blank">https://fastapi-utils.davidmontague.xyz</a>
**Documentation**: <a href="https://fastapiutils.github.io/fastapi-utils/" target="_blank">https://fastapiutils.github.io/fastapi-utils/</a>

**Source Code**: <a href="https://github.com/dmontagu/fastapi-utils" target="_blank">https://github.com/dmontagu/fastapi-utils</a>

---

<a href="https://fastapi.tiangolo.com">FastAPI</a> is a modern, fast web framework for building APIs with Python 3.7+.
<a href="https://fastapi.tiangolo.com">FastAPI</a> is a modern, fast web framework for building APIs with Python 3.8+.

But if you're here, you probably already knew that!

Expand All @@ -53,11 +53,11 @@ It also adds a variety of more basic utilities that are useful across a wide var
* **CamelCase Conversions**: Convenience functions for converting strings from `snake_case` to `camelCase` or `PascalCase` and back
* **GUID Type**: The provided GUID type makes it easy to use UUIDs as the primary keys for your database tables

See the [docs](https://fastapi-utils.davidmontague.xyz/) for more details and examples.
See the [docs](https://fastapiutils.github.io/fastapi-utils//) for more details and examples.

## Requirements

This package is intended for use with any recent version of FastAPI (depending on `pydantic>=1.0`), and Python 3.7+.
This package is intended for use with any recent version of FastAPI (depending on `pydantic>=1.0`), and Python 3.8+.

## Installation

Expand Down
18 changes: 9 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
</p>
<p align="center">
<a href="https://github.com/dmontagu/fastapi-utils" target="_blank">
<img src="https://img.shields.io/github/last-commit/dmontagu/fastapi-utils.svg">
<img src="https://github.com/dmontagu/fastapi-utils/workflows/build/badge.svg" alt="Build CI">
<img src="https://img.shields.io/github/last-commit/dmontagu/fastapi-utils.svg">
<img src="https://github.com/dmontagu/fastapi-utils/workflows/build/badge.svg" alt="Build CI">
</a>
<a href="https://codecov.io/gh/dmontagu/fastapi-utils" target="_blank">
<img src="https://codecov.io/gh/dmontagu/fastapi-utils/branch/master/graph/badge.svg" alt="Coverage">
Expand All @@ -20,13 +20,13 @@
</p>

---
**Documentation**: <a href="https://fastapi-utils.davidmontague.xyz" target="_blank">https://fastapi-utils.davidmontague.xyz</a>
**Documentation**: <a href="https://fastapiutils.github.io/fastapi-utils/" target="_blank">https://fastapiutils.github.io/fastapi-utils/</a>

**Source Code**: <a href="https://github.com/dmontagu/fastapi-utils" target="_blank">https://github.com/dmontagu/fastapi-utils</a>

---

<a href="https://fastapi.tiangolo.com">FastAPI</a> is a modern, fast web framework for building APIs with Python 3.7+.
<a href="https://fastapi.tiangolo.com">FastAPI</a> is a modern, fast web framework for building APIs with Python 3.8+.

But if you're here, you probably already knew that!

Expand All @@ -53,20 +53,20 @@ It also adds a variety of more basic utilities that are useful across a wide var
* **CamelCase Conversions**: Convenience functions for converting strings from `snake_case` to `camelCase` or `PascalCase` and back
* **GUID Type**: The provided GUID type makes it easy to use UUIDs as the primary keys for your database tables

See the [docs](https://https://fastapi-utils.davidmontague.xyz/) for more details and examples.
See the [docs](https://https://fastapiutils.github.io/fastapi-utils//) for more details and examples.

## Requirements

This package is intended for use with any recent version of FastAPI (depending on `pydantic>=1.0`), and Python 3.7+.
This package is intended for use with any recent version of FastAPI (depending on `pydantic>=1.0`), and Python 3.8+.

## Installation

```bash
pip install fastapi-restful # For basic slim package :)
pip install fastapi-utils # For basic slim package :)

pip install fastapi-restful[session] # To add sqlalchemy session maker
pip install fastapi-utils[session] # To add sqlalchemy session maker

pip install fastapi-restful[all] # For all the packages
pip install fastapi-utils[all] # For all the packages
```

## License
Expand Down
26 changes: 7 additions & 19 deletions fastapi_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
import sys
import importlib.metadata
import warnings

from .cbv_base import Api, Resource, set_responses, take_init_parameters

if sys.version_info.minor < 8:
import pkg_resources

try:
__version__ = pkg_resources.get_distribution(__name__).version
except pkg_resources.DistributionNotFound as e:
warnings.warn(f"Could not determine version of {__name__}", stacklevel=1)
warnings.warn(str(e), stacklevel=1)
__version__ = "unknown"
else:
import importlib.metadata

try:
__version__ = importlib.metadata.version(__name__)
except importlib.metadata.PackageNotFoundError as e:
warnings.warn(f"Could not determine version of {__name__}", stacklevel=1)
warnings.warn(str(e), stacklevel=1)
__version__ = "unknown"
try:
__version__ = "0.8.0"
except importlib.metadata.PackageNotFoundError as e:
warnings.warn(f"Could not determine version of {__name__}", stacklevel=1)
warnings.warn(str(e), stacklevel=1)
__version__ = "0.8.0"


__all__ = [
Expand Down
48 changes: 24 additions & 24 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
site_name: FastAPI Utilities
site_description: FastAPI utilities
site_url: https://fastapi-utils.davidmontague.xyz/
site_url: https://fastapiutils.github.io/fastapi-utils//

theme:
name: 'material'
name: "material"
palette:
primary: 'green'
accent: 'orange'
logo: 'img/icon-white.svg'
favicon: 'img/favicon.png'
primary: "green"
accent: "orange"
logo: "img/icon-white.svg"
favicon: "img/favicon.png"

repo_name: dmontagu/fastapi-utils
repo_url: https://github.com/dmontagu/fastapi-utils

nav:
- FastAPI Utilities: 'index.md'
- FastAPI Utilities: "index.md"
- User Guide:
- Class Resource: 'user-guide/class-resource.md'
- Class Based Views: 'user-guide/class-based-views.md'
- Repeated Tasks: 'user-guide/repeated-tasks.md'
- Timing Middleware: 'user-guide/timing-middleware.md'
- SQLAlchemy Sessions: 'user-guide/session.md'
- OpenAPI Spec Simplification: 'user-guide/openapi.md'
- Class Resource: "user-guide/class-resource.md"
- Class Based Views: "user-guide/class-based-views.md"
- Repeated Tasks: "user-guide/repeated-tasks.md"
- Timing Middleware: "user-guide/timing-middleware.md"
- SQLAlchemy Sessions: "user-guide/session.md"
- OpenAPI Spec Simplification: "user-guide/openapi.md"
- Other Utilities:
- APIModel: 'user-guide/basics/api-model.md'
- APISettings: 'user-guide/basics/api-settings.md'
- String-Valued Enums: 'user-guide/basics/enums.md'
- CamelCase Conversion: 'user-guide/basics/camelcase.md'
- GUID Type: 'user-guide/basics/guid-type.md'
- Get Help: 'help-fastapi-utils.md'
- Development - Contributing: 'contributing.md'
- Release Notes: 'release-notes.md'
- APIModel: "user-guide/basics/api-model.md"
- APISettings: "user-guide/basics/api-settings.md"
- String-Valued Enums: "user-guide/basics/enums.md"
- CamelCase Conversion: "user-guide/basics/camelcase.md"
- GUID Type: "user-guide/basics/guid-type.md"
- Get Help: "help-fastapi-utils.md"
- Development - Contributing: "contributing.md"
- Release Notes: "release-notes.md"

markdown_extensions:
- toc:
Expand All @@ -47,8 +47,8 @@ markdown_extensions:

extra:
social:
- icon: 'fontawesome/brands/github-alt'
link: 'https://github.com/dmontagu/fastapi-utils'
- icon: "fontawesome/brands/github-alt"
link: "https://github.com/dmontagu/fastapi-utils"

extra_css:
- 'css/custom.css'
- "css/custom.css"
Loading

0 comments on commit 9352df5

Please sign in to comment.