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: 2 additions & 2 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install -r requirements.txt wheel build
- run: python -m build --no-isolation
- run: pip install build
- run: python -m build
- run: python -m pip install dist/beanquery-*.whl
19 changes: 18 additions & 1 deletion beanquery/query_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ class Align(enum.Enum):
RIGHT = 1


class _CurrencyContext(display_context._CurrencyContext):
def __init__(self):
super().__init__()
# Since commit 10b6f5efd2385e3d0efe6715584d7f540e2e7abf
# beancount assumes the presence of a sign unconditionally ,
# changing the formatting of columns that do not contain
# negative numbers. Revert the change.
self.has_sign = False


class _DisplayContext(display_context.DisplayContext):
def __init__(self):
self.ccontexts = collections.defaultdict(_CurrencyContext)
self.ccontexts["__default__"] = _CurrencyContext()
self.commas = False


class RenderContext:
"""Hold the query rendering configuration."""

Expand Down Expand Up @@ -235,7 +252,7 @@ def __init__(self, ctx):
# determine the quantization of the column values.
self.quantize = ctx.dcontext.quantize
# Use column specific display context for formatting.
self.dcontext = display_context.DisplayContext()
self.dcontext = _DisplayContext()
# Maximum width of the commodity symbol.
self.curwidth = 0

Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[build-system]
requires = ['setuptools']
requires = ['setuptools >= 77.0.3']
build-backend = 'setuptools.build_meta'

[project]
name = 'beanquery'
version = '0.3.0.dev0'
description = 'Customizable lightweight SQL query tool'
license = { file = 'LICENSE' }
license = 'GPL-2.0-only'
license-files = ['LICENSE']
readme = 'README.rst'
authors = [
{ name = 'Martin Blais', email = 'blais@furius.ca' },
Expand All @@ -19,7 +20,6 @@ keywords = [
'accounting', 'ledger', 'beancount', 'SQL', 'BQL'
]
classifiers = [
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
Expand Down Expand Up @@ -67,6 +67,7 @@ line-length = 128
target-version = 'py38'

[tool.ruff.lint]
pyupgrade.keep-runtime-typing = true
select = ['E', 'F', 'W', 'UP', 'B', 'C4', 'PL', 'RUF']
ignore = [
'B007',
Expand All @@ -79,6 +80,7 @@ ignore = [
'PLR0915',
'PLR1714',
'PLR2004',
'PLW1641', # eq-without-hash
'PLW2901',
'RUF012',
'RUF023', # unsorted-dunder-slots
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
beancount >=2.3.4
click >7.0
python-dateutil >=2.6.0
tatsu >=5.7.4, <5.8.0
tatsu-lts