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
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[flake8]
ignore = E261
# Notes:
# W503: https://peps.python.org/pep-0008/#should-a-line-break-before-or-after-a-binary-operator
ignore = E261, W293, W503
max-line-length = 200
exclude = .git,.github,__pycache__,.pytest_cache,.venv,.venv_test,.vscode
max-complexity = 10
5 changes: 4 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ jobs:
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --ignore=E261 --show-source --statistics
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install stat-log-db package (dev)
run: |
python -m pip install -e ./stat_log_db[dev]
- name: Test with pytest
run: |
pytest
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,6 @@ cython_debug/
marimo/_static/
marimo/_lsp/
__marimo__/

# sqlite
*.sqlite
5 changes: 3 additions & 2 deletions stat_log_db/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ name = "stat-log-db"
version = "0.0.1"
description = ""
readme = "README.md"
requires-python = "==3.12.10"
requires-python = ">=3.12.10"
dependencies = [
]

[project.optional-dependencies]
dev = [
"pytest==8.4.1",
"pytest-cov==6.2.1"
"pytest-cov==6.2.1",
"flake8==7.3.0"
]

[project.scripts]
Expand Down
1 change: 1 addition & 0 deletions stat_log_db/src/stat_log_db/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import exceptions
from . import parser
from . import db
from . import cli
37 changes: 27 additions & 10 deletions stat_log_db/src/stat_log_db/cli.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
import os
import sys
# import sys

from .parser import create_parser
# from .parser import create_parser
from .db import MemDB # , FileDB, Database, BaseConnection


def main():
"""Main CLI entry point."""

# TODO: Read info from pyproject.toml?
parser = create_parser({
"prog": "sldb",
"description": "My CLI tool",
}, "0.0.1")

args = parser.parse_args()

print(f"{args=}")
# parser = create_parser({
# "prog": "sldb",
# "description": "My CLI tool",
# }, "0.0.1")

# args = parser.parse_args()

# print(f"{args=}")

sl_db = MemDB({
"is_mem": True,
"fkey_constraint": True
})
con = sl_db.init_db(True)
con.create_table("test", [('notes', 'TEXT')], False, True)
con.execute("INSERT INTO test (notes) VALUES (?);", ("Hello world!",))
con.commit()
con.execute("SELECT * FROM test;")
sql_logs = con.fetchall()
print(sql_logs)
con.drop_table("test", True)
sl_db.close_db()
if sl_db.is_file:
os.remove(sl_db.file_name)


if __name__ == "__main__":
Expand Down
Loading