Skip to content

Commit 205c6a6

Browse files
committed
Initial implementation
0 parents  commit 205c6a6

21 files changed

+817
-0
lines changed

.editorconfig

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
charset = utf-8
11+
end_of_line = lf
12+
13+
[*.yml]
14+
indent_size = 2
15+
16+
[Makefile]
17+
indent_style = tab

.github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# These are supported funding model platforms
2+
custom: https://www.buymeacoffee.com/frankie567

.github/ISSUE_TEMPLATE/bug_report.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
## Describe the bug
11+
12+
A clear and concise description of what the bug is.
13+
14+
## To Reproduce
15+
16+
Steps to reproduce the behavior:
17+
1. Go to '...'
18+
2. Click on '....'
19+
3. Scroll down to '....'
20+
4. See error
21+
22+
## Expected behavior
23+
24+
A clear and concise description of what you expected to happen.
25+
26+
## Configuration
27+
- Python version :
28+
- FastAPI version :
29+
- FastAPI Users version :
30+
31+
### FastAPI Users configuration
32+
33+
```py
34+
# Please copy/paste your FastAPI Users configuration here.
35+
```
36+
37+
## Additional context
38+
39+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
contact_links:
2+
- name: I have a question 🤔
3+
url: https://github.com/fastapi-users/fastapi-users/discussions
4+
about: If you have any question about the usage of FastAPI Users that's not clearly a bug, please open a discussion first.

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "04:00"
8+
open-pull-requests-limit: 10
9+
reviewers:
10+
- frankie567

.github/stale.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 14
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 7
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- pinned
8+
- security
9+
- bug
10+
- enhancement
11+
- documentation
12+
# Label to use when marking an issue as stale
13+
staleLabel: stale
14+
# Comment to post when marking an issue as stale. Set to `false` to disable
15+
markComment: >
16+
This issue has been automatically marked as stale because it has not had
17+
recent activity. It will be closed if no further activity occurs. Thank you
18+
for your contributions.
19+
# Comment to post when closing a stale issue. Set to `false` to disable
20+
closeComment: false

.github/workflows/build.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
test:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python_version: [3.7, 3.8, 3.9]
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Set up Python
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: ${{ matrix.python_version }}
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements.dev.txt
23+
- name: Test with pytest
24+
env:
25+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
26+
run: |
27+
pytest --cov=fastapi_users_db_sqlmodel/
28+
codecov
29+
- name: Build and install it on system host
30+
run: |
31+
flit build
32+
flit install --python $(which python)
33+
python test_build.py
34+
35+
release:
36+
runs-on: ubuntu-latest
37+
needs: test
38+
if: startsWith(github.ref, 'refs/tags/')
39+
40+
steps:
41+
- uses: actions/checkout@v1
42+
- name: Set up Python
43+
uses: actions/setup-python@v1
44+
with:
45+
python-version: 3.7
46+
- name: Install dependencies
47+
run: |
48+
python -m pip install --upgrade pip
49+
pip install -r requirements.dev.txt
50+
- name: Release on PyPI
51+
env:
52+
FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }}
53+
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
54+
run: |
55+
flit publish

.gitignore

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
junit/
50+
junit.xml
51+
test*.db*
52+
53+
# Translations
54+
*.mo
55+
*.pot
56+
57+
# Django stuff:
58+
*.log
59+
local_settings.py
60+
61+
# Flask stuff:
62+
instance/
63+
.webassets-cache
64+
65+
# Scrapy stuff:
66+
.scrapy
67+
68+
# Sphinx documentation
69+
docs/_build/
70+
71+
# PyBuilder
72+
target/
73+
74+
# Jupyter Notebook
75+
.ipynb_checkpoints
76+
77+
# pyenv
78+
.python-version
79+
80+
# celery beat schedule file
81+
celerybeat-schedule
82+
83+
# SageMath parsed files
84+
*.sage.py
85+
86+
# dotenv
87+
.env
88+
89+
# virtualenv
90+
.venv
91+
venv/
92+
ENV/
93+
94+
# Spyder project settings
95+
.spyderproject
96+
.spyproject
97+
98+
# Rope project settings
99+
.ropeproject
100+
101+
# mkdocs documentation
102+
/site
103+
104+
# mypy
105+
.mypy_cache/
106+
107+
# .vscode
108+
.vscode/
109+
110+
# OS files
111+
.DS_Store
112+
113+
# .idea
114+
.idea/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 François Voron
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
isort:
2+
isort ./fastapi_users_db_sqlmodel ./tests
3+
4+
format: isort
5+
black .
6+
7+
test:
8+
pytest --cov=fastapi_users_db_sqlmodel/ --cov-report=term-missing --cov-fail-under=100
9+
10+
bumpversion-major:
11+
bumpversion major
12+
13+
bumpversion-minor:
14+
bumpversion minor
15+
16+
bumpversion-patch:
17+
bumpversion patch

README.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# FastAPI Users - Database adapter for SQLModel
2+
3+
<p align="center">
4+
<img src="https://raw.githubusercontent.com/frankie567/fastapi-users/master/logo.svg?sanitize=true" alt="FastAPI Users">
5+
</p>
6+
7+
<p align="center">
8+
<em>Ready-to-use and customizable users management for FastAPI</em>
9+
</p>
10+
11+
[![build](https://github.com/fastapi-users/fastapi-users-db-sqlmodel/workflows/Build/badge.svg)](https://github.com/fastapi-users/fastapi-users/actions)
12+
[![codecov](https://codecov.io/gh/fastapi-users/fastapi-users-db-sqlmodel/branch/master/graph/badge.svg)](https://codecov.io/gh/fastapi-users/fastapi-users-db-sqlmodel)
13+
[![PyPI version](https://badge.fury.io/py/fastapi-users-db-sqlmodel.svg)](https://badge.fury.io/py/fastapi-users-db-sqlmodel)
14+
[![Downloads](https://pepy.tech/badge/fastapi-users-db-sqlmodel)](https://pepy.tech/project/fastapi-users-db-sqlmodel)
15+
<p align="center">
16+
<a href="https://www.buymeacoffee.com/frankie567"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=frankie567&button_colour=FF5F5F&font_colour=ffffff&font_family=Lato&outline_colour=000000&coffee_colour=FFDD00"></a>
17+
</p>
18+
19+
---
20+
21+
**Documentation**: <a href="https://fastapi-users.github.io/fastapi-users/" target="_blank">https://fastapi-users.github.io/fastapi-users/</a>
22+
23+
**Source Code**: <a href="https://github.com/fastapi-users/fastapi-users" target="_blank">https://github.com/fastapi-users/fastapi-users</a>
24+
25+
---
26+
27+
Add quickly a registration and authentication system to your [FastAPI](https://fastapi.tiangolo.com/) project. **FastAPI Users** is designed to be as customizable and adaptable as possible.
28+
29+
**Sub-package for SQLModel support in FastAPI Users.**
30+
31+
## Development
32+
33+
### Setup environment
34+
35+
You should create a virtual environment and activate it:
36+
37+
```bash
38+
python -m venv venv/
39+
```
40+
41+
```bash
42+
source venv/bin/activate
43+
```
44+
45+
And then install the development dependencies:
46+
47+
```bash
48+
pip install -r requirements.dev.txt
49+
```
50+
51+
### Run unit tests
52+
53+
You can run all the tests with:
54+
55+
```bash
56+
make test
57+
```
58+
59+
Alternatively, you can run `pytest` yourself:
60+
61+
```bash
62+
pytest
63+
```
64+
65+
There are quite a few unit tests, so you might run into ulimit issues where there are too many open file descriptors. You may be able to set a new, higher limit temporarily with:
66+
67+
```bash
68+
ulimit -n 2048
69+
```
70+
71+
### Format the code
72+
73+
Execute the following command to apply `isort` and `black` formatting:
74+
75+
```bash
76+
make format
77+
```
78+
79+
## License
80+
81+
This project is licensed under the terms of the MIT license.

0 commit comments

Comments
 (0)