Code Monkey home page Code Monkey logo

lunchable-splitlunch's Introduction

lunchable-splitlunch

LunchMoney + Splitwise Integration

PyPI PyPI - Python Version docs Hatch project Ruff pre-commit semantic-release Gitmoji

lunchable lunchable

Run via the Lunchable CLI

You can install lunchable with pip or pipx. Make sure to use the lunchable[splitlunch] extra to install the SplitLunch plugin. You can also use the lunchable[plugins] extra to install all the known plugins.

pipx install "lunchable[splitlunch]"
pip install "lunchable[splitlunch]"

Integrations

This plugin supports different operations, and some of those operations have prerequisites:

Auto Importer

It supports the auto-importing of Splitwise expenses into Lunch Money transactions. This requires a manual asset exist in your Lunch Money account with "Splitwise" in the Name. Expenses that have been deleted or which don't impact you (i.e. are only between other users in your group) are skipped. By default, payments and expenses for which you are recorded as the payer are skipped as well, but these can be overridden by the --allow-payments and --allow-self-paid CLI flags, respectively.

Prerequisites

  • Accounts:
    • Splitwise must be in the account name

LunchMoney -> Splitwise

It supports the creation of Splitwise transactions directly from synced Lunch Money accounts. This syncing requires you create a tag called SplitLunchImport. Transactions with this tag will be created in Splitwise with your "financial partner". Once transactions are created in Splitwise they will be split in half in Lunch Money. Half of the split will be marked in the Reimbursement category which must be created.

Prerequisites

  • Financial Partners:
    • If you only have one friend in Splitwise, this is your Financial Partner
    • Financial Partners can be individual users or groups and transactions will be split accordingly
    • Financial Partners must be specified by their Splitwise Group ID, Splitwise User ID, or Email Address
  • Tags:
    • SplitLunchImport
  • Categories:
    • Reimbursement

SplitLunch

It supports a workflow where you mark transactions as split (identical to Lunch Money -> Splitwise) without importing them into Splitwise. This syncing requires you create a tag called SplitLunch and a category named Reimbursement

Prerequisites

  • Tags:
    • SplitLunch
  • Categories:
    • Reimbursement

LunchMoney -> Splitwise (without splitting)

It supports the creation of Splitwise transactions directly from synced Lunch Money accounts. This syncing requires you create a tag called SplitLunchDirectImport. Transactions with this tag will be created in Splitwise with the total completely owed by your "financial partner". The entire transaction wil then be categorized as Reimbursement without being split.

Prerequisites

  • Financial Partners:
    • If you only have one friend in Splitwise, this is your Financial Partner
    • Financial Partners can be individual users or groups and transactions will be split accordingly
    • Financial Partners must be specified by their Splitwise Group ID, Splitwise User ID, or Email Address
  • Tags:
    • SplitLunchDirectImport
  • Categories:
    • Reimbursement

Note: Some of the above scenarios allow for tagging of a Splitwise tag on updated transactions. This tag must be created for this functionality to work.

Installation

pip install lunchable[splitlunch]

Run the SplitLunch plugin for the Lunchable CLI

lunchable plugins splitlunch --help

Run the SplitLunch plugin for the Lunchable CLI via Docker

docker pull juftin/lunchable
docker run \
    --env LUNCHMONEY_ACCESS_TOKEN=${LUNCHMONEY_ACCESS_TOKEN} \
    --env SPLITWISE_CONSUMER_KEY=${SPLITWISE_CONSUMER_KEY} \
    --env SPLITWISE_CONSUMER_SECRET=${SPLITWISE_CONSUMER_SECRET} \
    --env SPLITWISE_API_KEY=${SPLITWISE_API_KEY} \
    juftin/lunchable:latest \
    lunchable plugins splitlunch --help

lunchable-splitlunch's People

Contributors

github-actions[bot] avatar juftin avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

lunchable-splitlunch's Issues

Error when handling deleted expenses

Splitlunch is throwing an error when handling deleted expenses.

> splitlunch expenses

[
  {
    "splitwise_id": 2975110000,
    "original_amount": 10.0,
    "self_paid": false,
    "financial_impact": 5.0,
    "description": "testing",
    "category": "General",
    "details": null,
    "payment": false,
    "date": "2024-02-26T23:04:06Z",
    "users": [
      84931234,
      1851234
    ],
    "created_at": "2024-02-26T23:04:22Z",
    "updated_at": "2024-02-27T00:50:57Z",
    "deleted_at": "2024-02-27T00:50:57Z",
    "deleted": true
  }
]

Output:

> splitlunch refresh --dated-after 2022-01-01

Traceback (most recent call last):
  File "/.local/bin/splitlunch", line 10, in <module>
    sys.exit(splitlunch())
             ^^^^^^^^^^^^
  File "/Library/Application Support/pipx/venvs/lunchable-splitlunch/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Application Support/pipx/venvs/lunchable-splitlunch/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Library/Application Support/pipx/venvs/lunchable-splitlunch/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Application Support/pipx/venvs/lunchable-splitlunch/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Application Support/pipx/venvs/lunchable-splitlunch/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Application Support/pipx/venvs/lunchable-splitlunch/lib/python3.12/site-packages/lunchable_splitlunch/cli.py", line 204, in refresh_splitwise_transactions
    response = splitlunch.refresh_splitwise_transactions(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Application Support/pipx/venvs/lunchable-splitlunch/lib/python3.12/site-packages/lunchable_splitlunch/lunchmoney_splitwise.py", line 1178, in refresh_splitwise_transactions
    self.handle_deleted_transactions(deleted_transactions=deleted_transactions)
  File "/Library/Application Support/pipx/venvs/lunchable-splitlunch/lib/python3.12/site-packages/lunchable_splitlunch/lunchmoney_splitwise.py", line 1202, in handle_deleted_transactions
    notes = " || ".join(
            ^^^^^^^^^^^^
TypeError: sequence item 1: expected str instance, float found

lunchable_splitlunch Validation Error

[created via private email]

Unfortunately, importing transactions through the refresh command is not working for me and I was wondering if it is something you are aware of.

I created a splitwise account for testing with one transactiom, here’s the output of the expenses command:

When I run the refresh command, I receive the following error (see attached file for the stack trace):
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.