Brett Smith
8d3816a8fd
config: Add Config.rt_credentials method.
...
This loads settings from the same environment variables and ~/.rtrc
file as the rt CLI.
Note that it does *not* support RTCONFIG and the config file
searching, because right now that seems like more work for more
trouble to me.
2020-03-23 15:19:15 -04:00
Brett Smith
5140ca64f6
tests: Clean the environment before running tests.
...
As we start reading more sensitive user configuration (like RT credentials),
this fixture makes it simpler to ensure that the tests never read the user's
real configuration, which could lead to problems like passwords in tracebacks.
2020-03-23 12:01:02 -04:00
Brett Smith
d845332c7e
meta_entity: Clean unused imports.
2020-03-21 13:55:42 -04:00
Brett Smith
ad268f049d
meta_entity: Start hook.
2020-03-21 13:53:33 -04:00
Brett Smith
5c6043311b
meta_repo_links: Start hook.
2020-03-20 16:47:06 -04:00
Brett Smith
1500d2d9d8
meta_project: Start hook.
2020-03-20 12:08:10 -04:00
Brett Smith
0d370c445b
plugin: User configuration is passed to hooks on initialization.
2020-03-19 17:23:27 -04:00
Brett Smith
84d8adb7f6
plugin: Move hook initialization from HookRegistry to run().
...
Makes more sense here so run can report errors in hook configuration.
2020-03-19 16:42:13 -04:00
Brett Smith
e424173216
test_plugin: Restore negative assert to test_registry_group_by_directive.
2020-03-19 16:11:29 -04:00
Brett Smith
484c47a680
test_plugin: Parametrize HookRegistry.group_by_directive tests.
2020-03-19 16:00:22 -04:00
Brett Smith
d4d9bd6554
tests: Test HookRegistry using test instance, not real one.
...
This is better testing praxis and more prep for hooks-get-config.
2020-03-19 15:49:56 -04:00
Brett Smith
501bd251cb
tests: Turn tested hooks into fixtures.
...
This is in preparation for passing configuration to hooks.
That'll be a big change already, so I wanted this to be a
boring diff first.
2020-03-19 15:04:53 -04:00
Brett Smith
71531913d5
config: Start module.
...
Ultimately all values that come from user configuration will be generated
here.
2020-03-19 14:31:21 -04:00
Brett Smith
a78db2ed36
data: Add docstrings.
2020-03-19 12:19:34 -04:00
Brett Smith
4fee91ad48
data.Account: Use multi-arg is_under in is_real_asset.
2020-03-19 10:43:20 -04:00
Brett Smith
7cd569be7b
data.Account: Add is_income method.
2020-03-19 10:23:55 -04:00
Brett Smith
b7089f5ddf
plugin: Add meta_income_type validator.
2020-03-19 09:52:43 -04:00
Brett Smith
9b8563f3f0
data.Account: is_under accepts multiple arguments.
2020-03-19 09:47:10 -04:00
Brett Smith
f1c115de49
testutil: Improve check_post_meta error reporting.
...
This version makes it easier to get diffs between the expected
and actual metadata.
2020-03-19 09:32:06 -04:00
Brett Smith
cbd94d9b75
core: Make MetadataEnum aliases optional.
2020-03-18 18:23:42 -04:00
Brett Smith
7bc0ded9c6
tests: Check Account.is_under works on account boundaries.
2020-03-18 16:26:56 -04:00
Brett Smith
89aaae821b
data.Account: Exclude PrepaidVacation from "real" assets.
...
Same rationale as PrepaidExpenses.
2020-03-18 16:25:37 -04:00
Brett Smith
f8ea5ce62c
README: Initial commit.
2020-03-18 16:21:06 -04:00
Brett Smith
3f9e67de3a
meta_tax_implication: Don't enforce on Assets:PrepaidExpenses.
2020-03-18 09:00:47 -04:00
Brett Smith
28238643a3
data.Account: Add is_real_asset method.
2020-03-18 08:59:03 -04:00
Brett Smith
661fe676e1
Document known typecheck failures.
2020-03-18 08:24:07 -04:00
Brett Smith
1caeb9a1a6
setup: Introduce typecheck alias.
2020-03-18 08:20:45 -04:00
Brett Smith
b2ef561c85
data: Introduce Posting class.
...
Our version of Posting is interface-compatible with Beancount's,
but makes stronger guarantees about the data types for our
higher-level code to rely on.
2020-03-18 07:48:08 -04:00
Brett Smith
163ecbc7d3
data: iter_postings uses Account.
2020-03-17 18:06:43 -04:00
Brett Smith
6c0f23b2fa
data: Start Account class.
2020-03-17 18:05:24 -04:00
Brett Smith
8dd611c669
tests: Remove unused import.
2020-03-17 17:47:23 -04:00
Brett Smith
e9096b9500
tests: Test metadata deletion through iter_postings.
2020-03-17 17:47:00 -04:00
Brett Smith
3a73bc2239
data: Start iter_postings function.
2020-03-17 17:08:47 -04:00
Brett Smith
f4978046b8
data: Start module with PostingMeta class.
...
As I'm pushing to reimplement payment-report/income-report, I see query and
reporting tools will want easy access to these kinds of views, so here it
starts.
2020-03-17 17:08:05 -04:00
Brett Smith
e7720b8fb8
tests: Add check_post_meta.
...
This makes it simple to conveniently check all posting metadata in tests.
2020-03-16 10:15:31 -04:00
Brett Smith
3fbc14d377
Improve organization between modules.
...
* Rename _typing to beancount_types to better reflect what it is.
* LessComparable isn't a Beancount type, so move that to
plugin.core with its dependent helper classes.
* Errors are a core Beancount concept, so move that module to the
top level and have it include appropriate type definitions.
2020-03-15 16:03:57 -04:00
Brett Smith
a41feb94b3
plugin: Transform posting hooks into transaction hooks.
...
I feel like posting hooks a case of premature optimization in early
development. This approach reduces the number of special cases in
the code and allows us to more strongly reason about hooks in the
type system.
2020-03-15 15:50:14 -04:00
Brett Smith
c9ff4ab746
plugin: Settle on words-with-dashes metadata keys.
2020-03-15 10:36:49 -04:00
Brett Smith
d8afb209f7
gitignore: Add .mypy_cache.
2020-03-15 10:25:10 -04:00
Brett Smith
ee038d7b7d
plugin.core: Add type hints.
2020-03-08 18:24:51 -04:00
Brett Smith
547ae65780
plugin.core: _meta_set properly handles when post.meta is None.
...
post is a NamedTuple, so attribute assignment is not allowed.
Instead we have to construct a whole new Posting.
2020-03-08 11:32:03 -04:00
Brett Smith
c3c19b0ad2
plugin.core: Document base classes.
...
Since so much other code is built on these, I wanted to make sure I
wrote this while it was all fresh in my head.
2020-03-06 10:37:54 -05:00
Brett Smith
6e0c31f0ab
plugin.core: Add missing import.
2020-03-06 09:24:15 -05:00
Brett Smith
d34db71542
plugin: Introduce HookRegistry.
...
This is the layer that keeps track of the different groups of hooks and
can filter them before runtime. The idea here is that you'll be able
to do things like skip hooks that require network access when you don't
have it, or skip CPU-intensive hooks when you don't need them, etc.
2020-03-06 09:22:55 -05:00
Brett Smith
d145e22734
test_plugin_run: Simplify testing strategy.
...
Avoid keeping state in the hook classes/instances.
2020-03-05 19:31:07 -05:00
Brett Smith
e9e2bb9b00
plugin: Rename the main method of hooks from check
to run
.
...
This will be more appropriate when we have hooks that do more than
check metadata.
2020-03-05 17:48:59 -05:00
Brett Smith
53329c7a23
plugin: Start entry point.
...
This doesn't integrate with existing hooks but at least sketches out the
main loop.
2020-03-05 17:41:58 -05:00
Brett Smith
dbe9362987
meta_tax_implication: Initial module and tests.
2020-03-05 15:48:10 -05:00
Brett Smith
5849b562d0
expenseAllocation: Switch to own MetadataEnum class.
...
Python's own enum works fine for the simple values that expenseAllocation
uses, but it won't work as well for metadata like taxImplication where
many of the values aren't legal Python identifiers. Introduce our own
MetadataEnum class with the necessary functionality, and switch to that.
2020-03-05 15:33:27 -05:00
Brett Smith
16c47c64b2
expenseAllocation: Date-limit the transactions we work on.
...
This prevents the plugin from giving meaning to postings that
might not really be there.
2020-03-05 14:37:47 -05:00