Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose request to model events #660

Merged

Conversation

plsholdmybeer
Copy link
Contributor

it's useful to access request on say on_model_change, primarily for session data. By accessing a session token set in AuthenticationBackend, you can easily implement multitenancy for example.

@plsholdmybeer
Copy link
Contributor Author

I'd like to finish checks and tests but can someone help me with hatch / "poetry install" not working, it says
[tool.poetry] section not found in ...
and hatch just can't find lint and check, which I can see inside pyproject.toml but it won't install via poetry

@aminalaee
Copy link
Owner

Thank you for the PR, you can check here: https://github.com/aminalaee/sqladmin/blob/main/CONTRIBUTING.md
The project uses hatch not poetry.

@plsholdmybeer
Copy link
Contributor Author

plsholdmybeer commented Nov 1, 2023

I'm sorry can you please take a look at this, what am I missing? it just won't find lint @aminalaee

(.venv) C:\Users\#\Desktop\sqladmin>git show --summary
commit 297b954c9c9501bb807860f6de1ccf52c33c19af (HEAD -> expose-request-to-model-events, origin/expose-request-to-model-events)
Author: holdmybeer1min <#>
Date:   Tue Oct 31 22:05:36 2023 +0100

    use starlette request instead of fastapi


(.venv) C:\Users\#\Desktop\sqladmin>which hatch
/c/Users/#/Desktop/sqladmin/.venv/Scripts/hatch

(.venv) C:\Users\#\Desktop\sqladmin>which python
/c/Users/#/Desktop/sqladmin/.venv/Scripts/python

(.venv) C:\Users\#\Desktop\sqladmin>which pip
/c/Users/#/Desktop/sqladmin/.venv/Scripts/pip

(.venv) C:\Users\#\Desktop\sqladmin>hatch run lint
'lint' is not recognized as an internal or external command,
operable program or batch file.

(.venv) C:\Users\#\Desktop\sqladmin>hatch env show
                          Standalone
┌─────────┬─────────┬──────────────────────────────┬─────────┐
│ Name    │ Type    │ Dependencies                 │ Scripts │
├─────────┼─────────┼──────────────────────────────┼─────────┤
│ default │ virtual │                              │         │
├─────────┼─────────┼──────────────────────────────┼─────────┤
│ lint    │ virtual │ black==23.1.0                │ check   │
│         │         │ mypy==1.1.1                  │ format  │
│         │         │ ruff==0.0.256                │         │
│         │         │ sqlalchemy~=1.4              │         │
├─────────┼─────────┼──────────────────────────────┼─────────┤
│ docs    │ virtual │ mkdocs-material==9.1.3       │ build   │
│         │         │ mkdocs==1.4.2                │ deploy  │
│         │         │ mkdocstrings[python]==0.20.0 │ serve   │
└─────────┴─────────┴──────────────────────────────┴─────────┘
                              Matrices
┌──────┬─────────┬────────────┬──────────────────────────┬─────────┐
│ Name │ Type    │ Envs       │ Dependencies             │ Scripts │
├──────┼─────────┼────────────┼──────────────────────────┼─────────┤
│ test │ virtual │ test.py38  │ aiosqlite==0.18.0        │ cov     │
│      │         │ test.py39  │ arrow==1.2.3             │ test    │
│      │         │ test.py310 │ asyncpg==0.27.0          │         │
│      │         │ test.py311 │ babel==2.12.1            │         │
│      │         │ test.1.4   │ build==0.9.0             │         │
│      │         │ test.2.0   │ colour==0.1.5            │         │
│      │         │            │ coverage==7.2.2          │         │
│      │         │            │ email-validator==1.3.1   │         │
│      │         │            │ fastapi-storages==0.1.0  │         │
│      │         │            │ greenlet==2.0.2          │         │
│      │         │            │ httpx==0.23.3            │         │
│      │         │            │ itsdangerous==2.1.2      │         │
│      │         │            │ phonenumbers==8.13.7     │         │
│      │         │            │ pillow==9.5.0            │         │
│      │         │            │ psycopg2-binary==2.9.5   │         │
│      │         │            │ pytest==7.2.2            │         │
│      │         │            │ python-dateutil==2.8.2   │         │
│      │         │            │ sqlalchemy-utils==0.40.0 │         │
└──────┴─────────┴────────────┴──────────────────────────┴─────────┘

(.venv) C:\Users\#\Desktop\sqladmin>hatch env run lint
'lint' is not recognized as an internal or external command,
operable program or batch file.

(.venv) C:\Users\#\Desktop\sqladmin>

(.venv) C:\Users\#\Desktop\sqladmin>hatch status
[Project] - sqladmin (current directory)
[Location] - C:\Users\#\Desktop\sqladmin
[Config] - C:\Users\#\AppData\Local\hatch\config.toml



# even this doesn't work
(.venv) C:\Users\#\Desktop\sqladmin>hatch --config pyproject.toml run lint
'lint' is not recognized as an internal or external command,
operable program or batch file.

@aminalaee aminalaee force-pushed the expose-request-to-model-events branch from 69c1040 to 3b5c122 Compare November 5, 2023 10:14
Copy link
Owner

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 👍

@aminalaee aminalaee merged commit 51427f1 into aminalaee:main Nov 6, 2023
6 checks passed
@aminalaee aminalaee mentioned this pull request Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants