reckon 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b0141e2c8428b74039967461cb7db1b06fd4acd63edb2db8921ec2c9a2895ec
4
- data.tar.gz: 82c6d558f8e030988114db22d9ad59f580c7275a10a019b68c02355ea6639c71
3
+ metadata.gz: 23eeb4d40884fa3721807faa2580467427e2ce2a9a2a1c32174e1e58101ccee7
4
+ data.tar.gz: 9d0552619bd84b4e77bd4779cfd35b1d5d4cabbde6a555c5e762363da7ebd7f2
5
5
  SHA512:
6
- metadata.gz: ec2519c7bd438012ae498b4e3a9517d6c63ae3de71bf7237043bdbeb60c589a88180a9171f0bcb5b25f1e7dda35c7f6eb9d99173d6c9905e2bc0913fe244cca6
7
- data.tar.gz: 8f3ea58e38dc864cdcbb10b8ecb50f214f0dfa903eef6029b9c48057807d6910de3928b61c7bc4e14051dd9052f01fafcefab9bffca8dc107d516f17e5e4a427
6
+ metadata.gz: 22d0d738f1bff3445a7c7676d9a59506dbf59351ac28afb116ec51638147150accc5ff9f1c9085c8cb3a12c15a42df1164d85708fcd8d85473f4199f01ec6707
7
+ data.tar.gz: b324e37f568b19c2e12844c8892f250782707cb087469f8d61154c9e83dc1ba9f5c844c9cef3cf844fadb87622d93c35d3d05defffdbb11c16c542275f1e5931
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.11.1](https://github.com/cantino/reckon/tree/v0.11.1) (2025-03-05)
4
+
5
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.11.0...v0.11.1)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Ledger output should support comma separated values [\#39](https://github.com/cantino/reckon/issues/39)
10
+
11
+ **Closed issues:**
12
+
13
+ - Missing dependency erb [\#132](https://github.com/cantino/reckon/issues/132)
14
+ - Feature request: relabeling existing ledger [\#125](https://github.com/cantino/reckon/issues/125)
15
+
16
+ ## [v0.11.0](https://github.com/cantino/reckon/tree/v0.11.0) (2025-03-04)
17
+
18
+ [Full Changelog](https://github.com/cantino/reckon/compare/v0.10.0...v0.11.0)
19
+
20
+ **Closed issues:**
21
+
22
+ - Feature request: confidence score [\#134](https://github.com/cantino/reckon/issues/134)
23
+ - feature request [\#133](https://github.com/cantino/reckon/issues/133)
24
+
3
25
  ## [v0.10.0](https://github.com/cantino/reckon/tree/v0.10.0) (2024-11-27)
4
26
 
5
27
  [Full Changelog](https://github.com/cantino/reckon/compare/v0.9.6...v0.10.0)
data/Gemfile.lock CHANGED
@@ -1,40 +1,44 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reckon (0.10.0)
4
+ reckon (0.11.1)
5
+ abbrev (> 0.1)
5
6
  chronic (>= 0.3.0)
7
+ csv (> 0.1)
6
8
  highline (~> 2.0)
7
9
  matrix (>= 0.4.2)
8
- rchardet (>= 1.8.0)
10
+ rchardet (= 1.8.0)
9
11
 
10
12
  GEM
11
13
  remote: http://rubygems.org/
12
14
  specs:
15
+ abbrev (0.1.2)
13
16
  chronic (0.10.2)
14
17
  coderay (1.1.3)
15
- diff-lcs (1.5.0)
18
+ csv (3.3.2)
19
+ diff-lcs (1.6.0)
16
20
  highline (2.1.0)
17
21
  matrix (0.4.2)
18
- method_source (1.0.0)
19
- pry (0.14.2)
22
+ method_source (1.1.0)
23
+ pry (0.15.2)
20
24
  coderay (~> 1.1)
21
25
  method_source (~> 1.0)
22
- rake (13.0.6)
26
+ rake (13.2.1)
23
27
  rantly (1.2.0)
24
28
  rchardet (1.8.0)
25
- rspec (3.12.0)
26
- rspec-core (~> 3.12.0)
27
- rspec-expectations (~> 3.12.0)
28
- rspec-mocks (~> 3.12.0)
29
- rspec-core (3.12.1)
30
- rspec-support (~> 3.12.0)
31
- rspec-expectations (3.12.2)
29
+ rspec (3.13.0)
30
+ rspec-core (~> 3.13.0)
31
+ rspec-expectations (~> 3.13.0)
32
+ rspec-mocks (~> 3.13.0)
33
+ rspec-core (3.13.3)
34
+ rspec-support (~> 3.13.0)
35
+ rspec-expectations (3.13.3)
32
36
  diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.12.0)
34
- rspec-mocks (3.12.3)
37
+ rspec-support (~> 3.13.0)
38
+ rspec-mocks (3.13.2)
35
39
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.12.0)
37
- rspec-support (3.12.0)
40
+ rspec-support (~> 3.13.0)
41
+ rspec-support (3.13.2)
38
42
 
39
43
  PLATFORMS
40
44
  ruby
data/README.md CHANGED
@@ -108,6 +108,9 @@ Would tokenize to 'ING', 'Direct' and 'Deposit'. The matcher would then suggest
108
108
  Here's an example of `tokens.yaml`:
109
109
 
110
110
  ```
111
+ config:
112
+ similarity_threshold: 2 # range 0-10
113
+
111
114
  Income:
112
115
  Salary:
113
116
  - 'LÖN'
@@ -126,6 +129,8 @@ Expenses:
126
129
 
127
130
  Reckon will use `Income:Unknown` or `Expenses:Unknown` if it can't match a transaction to an account.
128
131
 
132
+ The config key is a special key used to set configuration when running in unattended mode. The only config variable is similarity_threshold (currently).
133
+
129
134
  You can override these names with the `--default_outof_account` and `--default_into_account` options.
130
135
 
131
136
  ### Substring Match
data/lib/reckon/app.rb CHANGED
@@ -3,6 +3,8 @@
3
3
  require 'yaml'
4
4
  require 'stringio'
5
5
 
6
+ UnattendedConfig = Struct.new(:similarity_threshold)
7
+
6
8
  module Reckon
7
9
  # The main app
8
10
  class App
@@ -42,7 +44,11 @@ module Reckon
42
44
 
43
45
  raise "#{filename} doesn't exist!" unless File.exist?(filename)
44
46
 
45
- extract_account_tokens(YAML.load_file(filename)).each do |account, tokens|
47
+ tokens = YAML.load_file(filename)
48
+ cfg = build_unattended_config(tokens.delete('config'))
49
+ @options[:similarity_threshold] = cfg.similarity_threshold if cfg
50
+
51
+ extract_account_tokens(tokens).each do |account, tokens|
46
52
  tokens.each do |t|
47
53
  if t.start_with?('/')
48
54
  add_regexp(account, t)
@@ -53,6 +59,13 @@ module Reckon
53
59
  end
54
60
  end
55
61
 
62
+ def build_unattended_config(cfg)
63
+ return unless cfg
64
+ invalid = cfg.keys - UnattendedConfig.members.map(&:to_s)
65
+ raise "Invalid keys in config: #{invalid}" if invalid.any?
66
+ return UnattendedConfig.new(*cfg.values_at(*UnattendedConfig.members.map(&:to_s)))
67
+ end
68
+
56
69
  def learn_from_ledger_file(ledger_file)
57
70
  return unless ledger_file
58
71
 
@@ -287,7 +300,10 @@ module Reckon
287
300
 
288
301
  def suggest(row)
289
302
  most_specific_regexp_match(row) +
290
- @matcher.find_similar(row[:description]).map { |n| n[:account] }
303
+ @matcher.find_similar(row[:description]).filter do |n|
304
+ !@options[:similarity_threshold] ||
305
+ n.fetch(:simliarity, 0) * 10 >= @options[:similarity_threshold]
306
+ end.map { |n| n[:account] }
291
307
  end
292
308
 
293
309
  def output(ledger_line)
@@ -1,3 +1,3 @@
1
1
  module Reckon
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.1"
3
3
  end
data/reckon.gemspec CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = %q{Reckon automagically converts CSV files for use with the command-line accounting tool Ledger. It also helps you to select the correct accounts associated with the CSV data using Bayesian machine learning.}
11
11
  s.summary = %q{Utility for interactively converting and labeling CSV files for the Ledger accounting tool.}
12
12
  s.licenses = ['MIT']
13
+ s.required_ruby_version = ">= 2.6"
13
14
 
14
15
  s.files = `git ls-files`.split("\n")
15
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -20,7 +21,9 @@ Gem::Specification.new do |s|
20
21
  s.add_development_dependency "pry", ">= 0.12.2"
21
22
  s.add_development_dependency "rantly", "= 1.2.0"
22
23
  s.add_runtime_dependency "chronic", ">= 0.3.0"
23
- s.add_runtime_dependency "highline", "~> 2.0" # 3.0 replaces readline with reline and breaks reckon
24
- s.add_runtime_dependency "rchardet", ">= 1.8.0"
24
+ s.add_runtime_dependency "highline", "~> 2.0" # 3.0 replaces readline with reline and breaks reckon
25
+ s.add_runtime_dependency "rchardet", "= 1.8.0"
25
26
  s.add_runtime_dependency "matrix", ">= 0.4.2"
27
+ s.add_runtime_dependency "csv", "> 0.1"
28
+ s.add_runtime_dependency "abbrev", "> 0.1"
26
29
  end
@@ -112,11 +112,11 @@ compare_output_for () {
112
112
  EXPECTED_FILE=$(mktemp)
113
113
  ACTUAL_FILE=$(mktemp)
114
114
 
115
- EXPECTED_CMD="$LEDGER -f output.ledger r >$EXPECTED_FILE"
115
+ EXPECTED_CMD="$LEDGER -f output.ledger reg >$EXPECTED_FILE"
116
116
  echo "$EXPECTED_CMD"
117
117
  eval "$EXPECTED_CMD" || return 1
118
118
 
119
- ACTUAL_CMD="$LEDGER -f \"$OUTPUT_FILE\" r"
119
+ ACTUAL_CMD="$LEDGER -f \"$OUTPUT_FILE\" reg"
120
120
  echo "running $ACTUAL_CMD"
121
121
  eval $ACTUAL_CMD >$ACTUAL_FILE || return 1
122
122
 
@@ -0,0 +1,9 @@
1
+ DEBIT,20091224120000[0:GMT],"HOST 037196321563 MO 12/22SLICEHOST",-85.00
2
+ CHECK,20091224120000[0:GMT],"Book Store",-20.00
3
+ DEBIT,20091224120000[0:GMT],"GITHUB 041287430274 CA 12/22GITHUB 04",-7.00
4
+ CREDIT,20091223120000[0:GMT],"Some Company vendorpymt PPD ID: 59728JSL20",3520.00
5
+ CREDIT,20091223120000[0:GMT],"Blarg BLARG REVENUE PPD ID: 00jah78563",1558.52
6
+ DEBIT,20091221120000[0:GMT],"WEBSITE-BALANCE-17DEC09 12 12/17WEBSITE-BAL",-12.23
7
+ DEBIT,20091214120000[0:GMT],"WEBSITE-BALANCE-10DEC09 12 12/10WEBSITE-BAL",-20.96
8
+ CREDIT,20091211120000[0:GMT],"PAYPAL TRANSFER PPD ID: PAYPALSDSL",-116.22
9
+ CREDIT,20091210120000[0:GMT],"Some Company vendorpymt PPD ID: 5KL3832735",2105.00
@@ -0,0 +1,36 @@
1
+ 2009-12-10 CREDIT; Some Company vendorpymt PPD ID: 5KL3832735
2
+ Assets:Bank:Checking $2,105.00
3
+ Income:Unknown
4
+
5
+ 2009-12-11 CREDIT; PAYPAL TRANSFER PPD ID: PAYPALSDSL
6
+ Expenses:Unknown
7
+ Assets:Bank:Checking -$116.22
8
+
9
+ 2009-12-14 DEBIT; WEBSITE-BALANCE-10DEC09 12 12/10WEBSITE-BAL
10
+ Expenses:Websites
11
+ Assets:Bank:Checking -$20.96
12
+
13
+ 2009-12-21 DEBIT; WEBSITE-BALANCE-17DEC09 12 12/17WEBSITE-BAL
14
+ Expenses:Websites
15
+ Assets:Bank:Checking -$12.23
16
+
17
+ 2009-12-23 CREDIT; Some Company vendorpymt PPD ID: 59728JSL20
18
+ Assets:Bank:Checking $3,520.00
19
+ Income:Unknown
20
+
21
+ 2009-12-23 CREDIT; Blarg BLARG REVENUE PPD ID: 00jah78563
22
+ Assets:Bank:Checking $1,558.52
23
+ Income:Unknown
24
+
25
+ 2009-12-24 DEBIT; GITHUB 041287430274 CA 12/22GITHUB 04
26
+ Expenses:Unknown
27
+ Assets:Bank:Checking -$7.00
28
+
29
+ 2009-12-24 CHECK; Book Store
30
+ Expenses:Unknown
31
+ Assets:Bank:Checking -$20.00
32
+
33
+ 2009-12-24 DEBIT; HOST 037196321563 MO 12/22SLICEHOST
34
+ Expenses:Unknown
35
+ Assets:Bank:Checking -$85.00
36
+
@@ -0,0 +1,2 @@
1
+ -f input.csv --unattended --account 'Assets:Bank:Checking' \
2
+ --account-tokens tokens.yml
@@ -0,0 +1,19 @@
1
+ config:
2
+ similarity_threshold: 6
3
+
4
+ Income:
5
+ Salary:
6
+ - 'LÖN'
7
+ - 'Salary'
8
+ Expenses:
9
+ Bank:
10
+ - 'Comission'
11
+ - /mastercard/i
12
+ Rent:
13
+ - '0011223344' # Landlord bank number
14
+ Websites:
15
+ - /web/i
16
+ Books:
17
+ - 'Book'
18
+ '[Internal:Transfer]': # Virtual account
19
+ - '4433221100' # Your own account number
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reckon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Cantino
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-11-27 00:00:00.000000000 Z
13
+ date: 2025-03-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -86,14 +86,14 @@ dependencies:
86
86
  name: rchardet
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ">="
89
+ - - '='
90
90
  - !ruby/object:Gem::Version
91
91
  version: 1.8.0
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ">="
96
+ - - '='
97
97
  - !ruby/object:Gem::Version
98
98
  version: 1.8.0
99
99
  - !ruby/object:Gem::Dependency
@@ -110,6 +110,34 @@ dependencies:
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: 0.4.2
113
+ - !ruby/object:Gem::Dependency
114
+ name: csv
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">"
118
+ - !ruby/object:Gem::Version
119
+ version: '0.1'
120
+ type: :runtime
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">"
125
+ - !ruby/object:Gem::Version
126
+ version: '0.1'
127
+ - !ruby/object:Gem::Dependency
128
+ name: abbrev
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">"
132
+ - !ruby/object:Gem::Version
133
+ version: '0.1'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">"
139
+ - !ruby/object:Gem::Version
140
+ version: '0.1'
113
141
  description: Reckon automagically converts CSV files for use with the command-line
114
142
  accounting tool Ledger. It also helps you to select the correct accounts associated
115
143
  with the CSV data using Bayesian machine learning.
@@ -274,6 +302,10 @@ files:
274
302
  - spec/integration/two_money_columns_manual/input.csv
275
303
  - spec/integration/two_money_columns_manual/output.ledger
276
304
  - spec/integration/two_money_columns_manual/test_args
305
+ - spec/integration/unattended_config/input.csv
306
+ - spec/integration/unattended_config/output.ledger
307
+ - spec/integration/unattended_config/test_args
308
+ - spec/integration/unattended_config/tokens.yml
277
309
  - spec/integration/yyyymmdd_date_example/input.csv
278
310
  - spec/integration/yyyymmdd_date_example/output.ledger
279
311
  - spec/integration/yyyymmdd_date_example/test_args
@@ -298,7 +330,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
330
  requirements:
299
331
  - - ">="
300
332
  - !ruby/object:Gem::Version
301
- version: '0'
333
+ version: '2.6'
302
334
  required_rubygems_version: !ruby/object:Gem::Requirement
303
335
  requirements:
304
336
  - - ">="