Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@semantic-release/git",
{
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
"assets": ["CHANGELOG.md", "setup.py", "setup.cfg"]
"assets": ["CHANGELOG.md", "pyproject.toml"]
}
]
]
Expand Down
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"semantic-release": "^22.0.5",
"semantic-release-pypi": "^5.1.0"
}
}
45 changes: 44 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,45 @@
[project]
name = "casbin_async_sqlalchemy_adapter"
version = "1.12.0"
authors = [
{name = "Casbin", email = "admin@casbin.org"}
]
description = "Asynchronous SQLAlchemy Adapter for PyCasbin"
readme = "README.md"
keywords = [
"asynccasbin",
"SQLAlchemy",
"casbin-adapter",
"rbac",
"access control",
"abac",
"acl",
"permission"
]
dynamic = ["dependencies"]
requires-python = ">=3.7"
license = {text = "Apache-2.0"}
classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent"
]

[project.urls]
Home-page = "https://github.com/officialpycasbin/async-sqlalchemy-adapter"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
exclude = ["tests"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[tool.black]
line-length = 150
line-length = 150
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

62 changes: 0 additions & 62 deletions setup.py

This file was deleted.

16 changes: 3 additions & 13 deletions tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,25 +404,15 @@ async def test_add_policies_bulk_internal_session(self):
]
await adapter.add_policies("p", "p", rules)

async_session = async_sessionmaker(
engine, expire_on_commit=False, class_=AsyncSession
)
async_session = async_sessionmaker(engine, expire_on_commit=False, class_=AsyncSession)
async with async_session() as s:
# count inserted rows
from sqlalchemy import select, func

cnt = await s.execute(
select(func.count())
.select_from(CasbinRule)
.where(CasbinRule.ptype == "p")
)
cnt = await s.execute(select(func.count()).select_from(CasbinRule).where(CasbinRule.ptype == "p"))
assert cnt.scalar_one() == len(rules)

rows = (
(await s.execute(select(CasbinRule).order_by(CasbinRule.id)))
.scalars()
.all()
)
rows = (await s.execute(select(CasbinRule).order_by(CasbinRule.id))).scalars().all()
tuples = [(r.v0, r.v1, r.v2) for r in rows]
for r in rules:
assert r in tuples
Expand Down