Skip to content
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
20 changes: 15 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{
"python.testing.pytestArgs": [
"python_dycasbin"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
"python.analysis.autoImportCompletions": true,
"python.testing.pytestArgs": [
"."
],
"python.defaultInterpreterPath": ".venv/bin/python",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
}
},
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
DynamoDB adopter for casbin
# DynamoDB adopter for casbin

Installation
------------
Run `pip install python-dycasbin`
## Installation

### From Source

```bash
uv build
```

### From pypi

```bash
# with uv
uv add python-dycasbin
```

```bash
# with pip
pip install python-dycasbin
```

## Usage

Usage
-----
```python
import casbin
from python_dycasbin import adapter
Expand All @@ -22,8 +38,3 @@ if e.enforce(sub, obj, act):
else:
print("Deny")
```

Running tests
---------------
* Install [pytest](https://pypi.org/project/pytest/) and [pytest-mock](https://pypi.org/project/pytest-mock/)
* Run `pytest` from project root
79 changes: 79 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[project]
name = "python-dycasbin"
version = "0.3.2"
description = "DynamoDB adopter for casbin"
readme = "README.md"
authors = [
{ name = "Abdul Qadeer", email = "abqdr.is@gmail.com" },
{ name = "Dan Shirts", email = "dan@ecobattery.com" }
]
requires-python = ">=3.11"
dependencies = [
"boto3>=1.40.0,<2",
"cachetools>=6.2.0,<7",
"casbin==1.14.0,<2",
]

[dependency-groups]
dev = [
"pytest>=8.4.0",
"boto3-stubs>=1.40.0,<2",
"types-cachetools",
"pytest-cov>=7.0.0",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.mypy]
ignore_missing_imports = true

[tool.pytest.ini_options]
testpaths = "tests"

[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
".vscode",
".pytest_cache",
".build",
".mypy_cache",
".github"
]

[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
]
ignore = [ "E203", "E266", "E501", "W191", "C901"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"
Loading