Skip to content

Commit a1f9162

Browse files
authored
Merge pull request #7 from sampingantech/enhancement/migrate-to-poetry
enchancement: migrate to poetry and upgrade depedencies
2 parents d738f8f + a0b6b69 commit a1f9162

8 files changed

Lines changed: 581 additions & 11 deletions

File tree

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.9.13

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ This is an Adapter for [PyCasbin](https://github.com/casbin/pycasbin) that imple
44

55
## Commands
66

7-
* `make install` to install all required depedencies writtern in `requirements.txt` and `requirements-test.txt`
87
* `make check` to run mypy
98
* `make test` to run unit test that written using pytest

casbin_databases_adapter/adapter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def load_policy(self, model: Model):
2929
rows = await self.db.fetch_all(query)
3030
for row in rows:
3131
# convert row from tuple to csv format and removing the first column (id)
32-
line = [v for k, v in row.items() if k in self.cols and v is not None]
32+
line = [v for k, v in row._mapping.items() if k in self.cols and v is not None]
3333
persist.load_policy_line(", ".join(line), model)
3434

3535
async def save_policy(self, model: Model):
@@ -83,7 +83,7 @@ async def load_filtered_policy(self, model: Model, filter_: Filter) -> None:
8383
rows = await self.db.fetch_all(query)
8484
for row in rows:
8585
# convert row from tuple to csv format and removing the first column (id)
86-
line = [v for k, v in row.items() if k in self.cols and v is not None]
86+
line = [v for k, v in row._mapping.items() if k in self.cols and v is not None]
8787
persist.load_policy_line(", ".join(line), model)
8888

8989
def is_filtered(self):

poetry.lock

Lines changed: 549 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

poetry.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[virtualenvs]
2+
in-project = true
3+
prefer-active-python = true

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[tool.poetry]
2+
name = "databases-casbin-adapter"
3+
version = "0.1.0"
4+
description = "An adapter for PyCasbin that implemented by Databases library which support async process"
5+
authors = ["isasetiawan <10252610+isasetiawan@users.noreply.github.com>"]
6+
license = "MIT"
7+
readme = "README.md"
8+
packages = [{include = "databases_casbin_adapter"}]
9+
10+
[tool.poetry.dependencies]
11+
python = "^3.9"
12+
SQLAlchemy = "1.4.46"
13+
databases = "0.7.0"
14+
asynccasbin = "1.1.8"
15+
16+
17+
[tool.poetry.group.test.dependencies]
18+
pytest = "7.2.0"
19+
pytest-cov = "4.0.0"
20+
alt-pytest-asyncio = "0.6.0"
21+
aiosqlite = "0.18.0"
22+
mypy = "0.991"
23+
24+
[build-system]
25+
requires = ["poetry-core"]
26+
build-backend = "poetry.core.masonry.api"

requirements-test.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)