Commit graph

590 commits

Author SHA1 Message Date
dd35ed25c2
doc: Document installation into a virtualenv. 2022-02-04 19:27:58 +11:00
9c69d656a3
Add typing dependencies for requests, dateutil, setuptools and yaml.
Without these, mypy complains that "Library stubs are not installed".
2022-02-04 19:24:02 +11:00
088713060a
reconcile: Add dependency "thefuzz" for fuzzy match of payee text. 2022-02-04 19:15:12 +11:00
ed0bc469ce
reconcile: Add type checking information to new prototype reconcilers. 2022-02-04 19:15:11 +11:00
43548a1ac9
config: Fix mypy error for git.exc.
Error was:

  conservancy_beancount/config.py:142: error: Trying to read deleted variable "exc"

Not entirely sure what's causing this, but since GitPython also imports the
exceptions at the root of the package with "from git.exc import *", we can
import them from there instead, which seems to appease mypy.
2022-02-04 19:13:54 +11:00
7783f7ad10
reports: Fix mypy errors.
Errors were:

  conservancy_beancount/reports/core.py:923: error: Generator has incompatible
  item type "Optional[str]"; expected "str"

  conservancy_beancount/reports/core.py:929: error: Item "None" of
  "Optional[str]" has no attribute "lower"

  conservancy_beancount/reports/ledger.py:534: error: Item "None" of
  "Optional[str]" has no attribute "partition"

  conservancy_beancount/reports/ledger.py:729: error: Item "None" of
  "Optional[str]" has no attribute "lower"

  conservancy_beancount/reports/rewrite.py:563: error: Argument 2 to
  "_iter_yaml" of "RewriteRuleset" has incompatible type "Union[Any, str,
  None]"; expected "str"
2022-02-04 19:11:59 +11:00
0342c5b83e
tests: Replace skipUnless with skipif.
The function skipUnless is available in `unittest`, but not `pytest`.
2022-02-04 19:11:54 +11:00
f3e824f68b
reconcile: Add prototype AMEX statement/books reconciler. 2022-02-01 17:34:15 +11:00
9e6b5b408a
reconcile: Align "N/A" with numbers. 2022-01-28 10:18:02 +11:00
dbe8d02b78
reconcile: Update helper to show N/A when no results, similar to Perl.
Also clarified that a full account name should be passed. This aligns with the
Perl behaviour.
2022-01-28 10:11:48 +11:00
970fea86fd
reconcile: Convert Perl reconciliation helper to Python.
This is a Python version of bc-reconcile-helper.plx.
2022-01-21 18:53:17 +11:00
03533e15e6
reports: Prototype Canadian payroll report. 2022-01-21 18:53:12 +11:00
Bradley M. Kuhn
cedbdcff3a expense-type auto assignment — Expenses:Occupancy
"Expenses:Occupancy" is rarely a program expense, and is almost
always management expense, even when done for a project.
Automatically assign it as such.
2022-01-10 06:25:53 -08:00
Bradley M. Kuhn
64aaeb7573 Expenses:Payroll:Benefits:Other — payroll-type of US:403b:Other
Certain adjustments to 403(b) accounts that benefit the employee
should be classified with this account and the `payroll_type` added
herein.
2021-12-29 22:49:52 -08:00
Bradley M. Kuhn
c3511bad11 meta_payroll_type — CA:PTO — distinguish between Earned and Taken
Metadata `payroll-type` will go on `Liabilities:Payable:Vacation` and
`Expenses:Payroll:Salary`, but we need to distinguish as to whether
the Payroll was earned or taken.

Implement the `CA:` version of the `US:` ones already done.
2021-12-13 20:00:14 -08:00
Bradley M. Kuhn
83e6e80bb8 meta_payroll_type — US:PTO — distinguish between Earned and Taken
Metadata `payroll-type` will go on `Liabilities:Payable:Vacation` and
`Expenses:Payroll:Salary`, but we need to distinguish as to whether
the Payroll was earned or taken.

Later,  `Liabilities:Payable:Vacation` should require a
`payroll-type` metadata of either `US:PTO:Taken` or `US:PTO:Earned`,
and the `CA:` equivalents.
2021-12-06 10:43:32 -08:00
Brett Smith
b029a3cca8 doc: Add Development. 2021-05-03 14:14:25 -04:00
Brett Smith
af0fb50014 cliutil: Add docstrings throughout. 2021-04-29 11:49:46 -04:00
Brett Smith
323521344a books: Add docstrings throughout. 2021-04-29 11:35:47 -04:00
Brett Smith
e2dda7ae0c query: Let the user interrupt interactive queries.
This makes it easier to iterate on a query because you don't have to restart
the program and reload the books if something goes sideways.
2021-04-01 09:57:42 -04:00
Brett Smith
6109187286 setup: Switch to PEP 517 build system. 2021-03-31 16:42:29 -04:00
Brett Smith
789992afa1 typing: Add PEP 561 py.typed file 2021-03-31 16:41:32 -04:00
Brett Smith
ca94ecafb0 query: Add db_name column. 2021-03-18 16:22:30 -04:00
Brett Smith
0d01be68b3 query: Order address column results by recency. 2021-03-15 13:40:09 -04:00
Brett Smith
b880115774 query: Refactor DBColumn.
Avoid an issubclass check on every call, and make it easier for subclasses
to override part of the call implementation.
2021-03-15 13:40:09 -04:00
Brett Smith
6703d1af87 reports: BaseODS puts each line of strings in a P tag.
This seems to be the most straightforward way to get Calc to automatically
determine a nice row height for multi-line string cells. This has become a
lot more noticeable now that query-report supports putting postal addresses
in cells.
2021-03-15 13:19:03 -04:00
Brett Smith
fff211386f query: Clean unused code.
This moved into _EnvironmentMixin.with_config().
2021-03-15 10:03:06 -04:00
Brett Smith
69f3e4ee6e query: Add a hint for the TypeError unhashable type: 'set'. 2021-03-15 09:56:13 -04:00
Brett Smith
39a9d0d67e query: rt_ticket() supports looking up custom fields. 2021-03-12 17:16:46 -05:00
Brett Smith
5ac2e4a872 query: set() updates from most Iterables, not just Sequences.
This lets it work correctly on set columns.
2021-03-12 16:27:17 -05:00
Brett Smith
2e8e70cff3 query: Add database columns. 2021-03-12 16:11:17 -05:00
Brett Smith
f0a5116429 query: Add ContextMeta function.
Deduplicate metadata lookup code.
2021-03-12 14:58:14 -05:00
Brett Smith
ef03893bfe query: Convert query functions that return List to Set.
Beancount's built-in renderers expect this and are better equipped for it.
2021-03-12 10:56:43 -05:00
Brett Smith
25321a81b0 query: Add rt_ticket() query function. 2021-03-12 10:36:15 -05:00
Brett Smith
7335282e5a rtutil: Add RTDateTime class.
See comments for rationale.
2021-03-11 13:52:31 -05:00
Brett Smith
9e33b2795c config: Add RTCredentials.idstr() method.
Want to reuse this code for a query-report cache key.
2021-03-10 10:37:21 -05:00
Brett Smith
1c71d7c6e1 tests: Add tests for BaseODS.add_annotation(). 2021-03-10 10:25:19 -05:00
Brett Smith
bf09cebf73 query: Add overview docstring. 2021-03-09 16:32:41 -05:00
Brett Smith
c3e0cc869b query: Improve help text in interactive shell. 2021-03-09 16:17:30 -05:00
Brett Smith
741e662894 query: Add original query as a comment to ODS output.
This is generally helpful to keep for future reference, plus this
presentation can support multiple queries and is more discoverable than the
previous file property.
2021-03-09 15:48:30 -05:00
Brett Smith
ea10fb239f query: Add a user hint for query TypeErrors.
The error message that native bean-query provides when this happens
confuses many users. Add a hint to point them in the right direction.
2021-03-09 15:48:30 -05:00
Brett Smith
c5a2c2d39b query: Development cleanup.
Reorder classes for nicer readability. Put shorter classes higher up, keep
related classes together.

Add developer-facing comments.

Remove unused imports.
2021-03-09 15:48:12 -05:00
Brett Smith
5893d6a59a query: Add --calendar-year and --fiscal-year shortcuts. 2021-03-09 10:39:12 -05:00
Brett Smith
6fa1278966 query: Improve formatting of ODS output.
* Provide dedicated formatting for more Beancount types.
* Improve code to determine when we're looking up link metadata
  and should format output as links.
2021-03-09 10:39:12 -05:00
Brett Smith
8af45e5f8a query: Add BQL functions for dealing with link metadata.
query-report was heading to a place where it was going to bifurcate. You
could structure input with its own special input switches, and with ODS
output, it would have its own dedicated grouping logic and use that.

But those things shouldn't be tied together for users. Instead, add
functions to BQL to be able to do the kind of grouping we want. This commit
adds those. Next we'll extend the ODS output to detect and format these
groups correctly.
2021-03-09 10:01:13 -05:00
Brett Smith
0f58960b67 query: Add ODS output format. 2021-03-06 15:45:11 -05:00
Brett Smith
0b3175fe6b query: Add support for --numberify.
bean-query compatibility.
2021-03-06 15:43:04 -05:00
Brett Smith
a5ebc04f5d data: Metadata.human_name() treats _ like -. 2021-03-06 12:11:16 -05:00
Brett Smith
b599ddee5d query: Skip rewrite rule logic when none are loaded.
This saves a few seconds of load time for the user on each run and is easy
to implement, so it's worth it.
2021-03-06 09:33:10 -05:00
Brett Smith
9c943bc8a9 query: Override BQLShell.on_Select.
This is enough to continue passing the existing tests, while giving us a
clear hook to develop ODS output.
2021-03-05 17:36:19 -05:00