Code Monkey home page Code Monkey logo

lunchable's Introduction

juftin logo

Hey, I'm juftin (Justin Flannery)

I'm a software engineer and Python developer with a focus on data engineering and machine learning operations - based out of Denver, Colorado, USA.

My work with data has spanned from being on the front lines as an analyst and data scientist, building out data platforms, architecting machine learning recommendation systems, and working on scalable applications as a backend and platform engineer. Currently, I work as part of a software engineering team looking to make heart attacks a thing of the past using machine learning.

I’m very interested in machine learning operations (MLOps), big data engineering, distributed systems, large language models, and everything open source.

When I’m not coding you can find me camping with my partner and our two dogs, catching a bluebird day skiing in Colorado, or soaking up the sun at a bluegrass concert.

Now is better than never.

Although never is often better than right now.

– The Zen of Python

What I'm Working On

In my free time I try to build tools and software that spark joy ✨. Below are a few of my more public facing GitHub repositories and some details about the projects.

PyPI GitHub Repo stars PyPI - Python Version

camply, the campsite finder ⛺️, is a tool to help you book an online campground. Finding reservations at sold out campgrounds can be tough. That's where camply comes in. It searches the APIs of Booking Services like https://recreation.gov (which works on thousands of campgrounds across the USA) to continuously check for cancellations and availabilities to pop up. Once a campsite becomes available, camply sends you a notification to book your spot!

You can install camply easily via pipx install camply.

PyPI GitHub Repo stars PyPI - Python Version

browsr 🗂️ is a pleasant file explorer in your terminal. It's a command line TUI application that empowers you to browse the contents of local and remote directories with your keyboard or mouse. You can quickly navigate through directories and peek at files whether they're hosted locally, in AWS S3, Google Cloud Storage, or Azure Blob Storage. View code files with syntax highlighting, format JSON files, render images, convert CSV and Parquet files to datatables and more. Get going with all of browsr's superpowers with pipx install "browsr[all]".

PyPI GitHub Repo stars PyPI - Python Version

Welcome to llm-term 💬, a command line utility that allows you to chat with LLM models directly from the comfort of your command line - this includes OpenAI (ChatGPT), Anthropic, and more. This tool leverages Langchain and Rich to facilitate real-time conversations with LLM models in your terminal. It enhances the user experience by streaming responses as rich text, complete with code-formatting and syntax highlighting. Get started with pipx install llm-term and stay on the command line!

PyPI GitHub Repo stars PyPI - Python Version

hatch-pip-compile is the missing lockfile capability for the hatch Python project tool 🥚. It's a hatch plugin that connects your hatch-managed virtual environment to a lockfile managed with pip-compile. The plugin detects whether your environment or lockfile is out to date and automatically syncs them when needed - and it's fast! Get reproducible environments for your Python projects today with hatch-pip-compile

PyPI GitHub Repo stars PyPI - Python Version

Lunch Money is a "delightfully simple personal finance & budgeting app" - and my current tool of choice to manage my finances. lunchable 🍱 is a Python API Client for the Lunch Money Developer API. It’s built on top of pydantic, it offers an intuitive API, a simple CLI, complete coverage of all endpoints and plugins to other external services.

dotfiles 🌈 is a collection of my personal dotfiles for macOS, Linux, zsh, and everything else. It's a set of configuration files with an opinionated set of tools and configurations based on my personal preferences. dotfiles are a personal preference so if my files aren't for you, you'll enjoy the dev-setup 📔 documentation which helps you get up and running on your own macOS or Linux machine. dotfiles can be installed with curl -fsSL https://juftin.com/dotfiles/get | bash.

My personal cookiecutter template 🚀, might be your new secret weapon for Python projects. It's an all-in-one development toolkit that operates seamlessly in your coding environment. Imagine managing your project's virtual environment and development tools with hatch, effortlessly formatting and linting your masterpiece with ruff, and checking types using mypy. Literally all of the CI/CD details have been taken care of. Unleash the full potential of your Python project with juftin's personal cookiecutter template. Get started with cookiecutter gh:juftin/cookiecutter-python.

The zoo project 🦁🐼🐨, an asynchronous zoo API powered by FastAPI, SQLAlchemy 2.0, Pydantic v2, and Alembic. zoo is a simple yet robust API example that allows you to manage a zoo. It utilizes modern tools and practices, including a production-ready server (Uvicorn), modern SQL ORM (SQLAlchemy 2.0), data validation (Pydantic v2), and database migrations (Alembic). This project serves as an excellent starting point for building your own API, outlining the basic structure of an API project and providing examples of implementing common features.

I've always been a big TV and Movies nerd. On the weekends you can find me searching RottenTomatoes for the latest certified fresh 🍅 pick. homelab is a multi-container docker-compose application that supports every aspect of hosting your own media server at home. homelab includes everything you needto host a website for your friends and family to request new content be downloaded, services to find and securely download the latest movies and shows, and underneath it all a Plex media server to support playback of the content anywhere and on any device.



juftin logo

juftin logo

lunchable's People

Contributors

chachan avatar ebroder avatar ericzinnikas avatar github-actions[bot] avatar juftin avatar justin-pierce avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lunchable's Issues

Error "Unexpected token" when attempting to create a transaction

  • lunchable version: 1.0.0
  • Python version: 3.10
  • Operating System: Debian GNU/Linux 12

Description:

I'm getting
{"name":"SyntaxError","message":"Unexpected token \'t\', \\"transactio\\"... is not valid JSON"}
when trying to create a transaction, this is what I do:

211 B->	            result = self.lunch_money.insert_transactions(
212  	                transactions=transaction_insert,
213  	                apply_rules=True,
214  	                skip_duplicates=False,
215  	                debit_as_negative=ScotiabankCreditCard._debit_as_negative(transaction),
216  	                skip_balance_update=False,
217  	            )
(Pdb) transaction_insert
TransactionInsertObject(date=datetime.date(2023, 11, 17), amount=9585.0, category_id=None, payee='', currency='crc', asset_id=12345, recurring_id=None, notes='some notes', status=None, external_id='some-id-123', tags=None)
(Pdb) ScotiabankCreditCard._debit_as_negative(transaction)
False

This is what happens:

319  	        response = self.request(
320  	            method=method,
321  	            url=url,
322  	            params=json_safe_params,
323  	            data=json_safe_payload,
324  	            **kwargs,
325  	        )
326 B->	        data = self.process_response(response=response)
327  	        return data
(Pdb) method
'POST'
(Pdb) url
'https://dev.lunchmoney.app/v1/transactions'
(Pdb) json_safe_params
(Pdb) json_safe_payload
{'transactions': [{'date': '2023-11-17', 'amount': 9585.0, 'payee': '', 'currency': 'crc', 'asset_id': 12345, 'notes': 'some notes', 'external_id': 'some-id-123'}], 'apply_rules': True, 'skip_duplicates': False, 'check_for_recurring': False, 'debit_as_negative': False, 'skip_balance_update': False}
(Pdb) pp kwargs
{}
(Pdb) n
Client error '400 Bad Request' for url 'https://dev.lunchmoney.app/v1/transactions'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
Traceback (most recent call last):
  File "/home/__/.cache/pypoetry/virtualenvs/lunchcr-UnUZhfHU-py3.10/lib/python3.10/site-packages/lunchable/models/_core.py", line 263, in process_response
    response.raise_for_status()
  File "/home/__/.cache/pypoetry/virtualenvs/lunchcr-UnUZhfHU-py3.10/lib/python3.10/site-packages/httpx/_models.py", line 758, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://dev.lunchmoney.app/v1/transactions'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
{"name":"SyntaxError","message":"Unexpected token 't', \"transactio\"... is not valid JSON"}
lunchable.exceptions.LunchMoneyHTTPError: {"name":"SyntaxError","message":"Unexpected token 't', \"transactio\"... is not valid JSON"}
> /home/__/.cache/pypoetry/virtualenvs/lunchcr-UnUZhfHU-py3.10/lib/python3.10/site-packages/lunchable/models/_core.py(326)make_request()
-> data = self.process_response(response=response)
(Pdb) response.content
b'{"name":"SyntaxError","message":"Unexpected token \'t\', \\"transactio\\"... is not valid JSON"}'
(Pdb) response.status_code
400

Can you publish this to conda-forge in addition to PyPI?

  • Python version: conda 3.9
  • Operating System: Mac zsh

Description

I'm interested in using your library as I migrate some of the projects I've created based on Mint to LunchMoney.

I use conda instead of pip for my python virtual environments.

Could you publish your package to conda-forge as well? This document describes why and how: https://www.pyopensci.org/python-package-guide/package-structure-code/publish-python-package-pypi-conda.html

With your permission I could fork and publish, but I think the ideal would be for you to publish so the packages stay in sync.

Escaped API response causes pydantic max_length validation to fail

  • lunchable version: 0.9.0
  • Python version: 3.11

Description

Lunchmoney API (/v1/categories/group/{category_id}/add in this case) sometimes seems to send back some escaped characters (eg. / instead of /), which results in pydantic max_length validations to sometimes fail as string length is not counted correctly.

image

Imo this is probably a bug on the lunchmoney API side though

What I Did

  1. Create a new category that is of 40 characters long and add it to a category group
  2. Add a new category in same category group with insert_into_category_group method
  3. Error will be raised as the children[] will fail instantiation due to having a length > 40 characters.

mkdocs

Replace nasty old sphinx with mkdocs

update to latest docs definitions

There was an update on the lunchmoney docs that's uncovered: lunch-money/developers@ad87916

The latest docs changes should be present in lunchable. CI/CD to periodically check for detect unknown fields might be useful too - this would be an integration test with access to real data.

Assets Validation Error on Nulls in 'balance_as_of' field in Assets

  • lunchable version: 1.1.1
  • Python version: 3.8.18
  • Operating System: Windows 11

Description

Describe what you were trying to get done.
Trying to execute the lunch.get_assets command

Tell us what happened, what went wrong, and what you expected to happen.

Received an error shown below:

ValidationError: 1 validation error for AssetsObject
balance_as_of
Input should be a valid datetime [type=datetime_type, input_value=None, input_type=NoneType]
For further information visit https://errors.pydantic.dev/2.5/v/datetime_type

It appears the issue is LunchMoney allows assets to have NULLs in the balance_as_of field for manually created assets, but when Lunchable calls them it doesn't like it.

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Trying to insert a duplicated transaction causes JSONDecodeError

  • lunchable version: 0.9.0
  • Python version: 3.10
  • Operating System: Debian GNU/Linux 12

Description

I insert transactions to LM manually since my bank does not provide any API. I weekly download last 30 days transaction list in CSV format file and process it using custom scripts. Most of transactions are duplicated and I'm ok with that since I ensure transaction IDs are unique.

What I Did

When trying to insert duplicated transaction it seems like API is now responding with empty content and 204 status code, since lunchable expects JSON content then it is breaking with error:
JSONDecodeError('Expecting value: line 1 column 1 (char 0)') in

returned_data = loads(response.content)

Unable to use lunchable as CLI

  • lunchable version: 1.1.0
  • Python version: 3.12.1
  • Operating System: MacOS

Description

I tried to install and use Lunchable as a CLI without trying it as a package. The steps I expected to be enough for making it work were:

  1. Having the LUNCHMONEY_ACCESS_TOKEN variable available;
  2. Executing any lunchable command in a shell with the package installed.

In all trials (detailed below) I got a ModuleNotFoundError: No module named 'numpy'. As a hypothesis, I believe it can have to do with the combination of the ways I installed it and the fact that pandas (and therefore numpy) is a optional dependency in pyproject.toml.
I eventually made it work by manually running poetry add pandas to my project.

I expected to be able to use Lunchable's CLI directly from the installation methods I chose, which are analogous to pip install.

What I Did

Trial 1

pipx install lunchable
lunchable --version

Trial 2 (in a poetry project)

poetry add lunchable
poetry install
poetry run lunchable --version

In both trials, the env variable LUNCHMONEY_ACCESS_TOKEN was available, and both returned the ModuleNotFoundError.

Budgets Endpoint Timing Out on Every Call

  • lunchable version: 1.3.1
  • Python version: 3.8.18
  • Operating System: Windows 11

Description

The budgets endpoint is timing out on every run, I get a 'The read operation timed out' response when trying to run the simple Python code below.

This call works fine on the LunchMoney native API (although it is historically slower than other calls).

What I Did

import pandas as pd
from lunchable import LunchMoney

lunch = LunchMoney(access_token="")

budgets = lunch.get_budgets(start_date='2024-02-01', end_date='2024-02-29')

print(budgets)

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

timeout Traceback (most recent call last)
File c:\Users\Jon Crosby.conda\envs\lunchmoneyEnv\lib\site-packages\httpcore_exceptions.py:10, in map_exceptions(map)
9 try:
---> 10 yield
11 except Exception as exc: # noqa: PIE786

File c:\Users\Jon Crosby.conda\envs\lunchmoneyEnv\lib\site-packages\httpcore_backends\sync.py:126, in SyncStream.read(self, max_bytes, timeout)
125 self._sock.settimeout(timeout)
--> 126 return self._sock.recv(max_bytes)

File c:\Users\Jon Crosby.conda\envs\lunchmoneyEnv\lib\ssl.py:1259, in SSLSocket.recv(self, buflen, flags)
1256 raise ValueError(
1257 "non-zero flags not allowed in calls to recv() on %s" %
1258 self.class)
-> 1259 return self.read(buflen)
1260 else:

File c:\Users\Jon Crosby.conda\envs\lunchmoneyEnv\lib\ssl.py:1134, in SSLSocket.read(self, len, buffer)
1133 else:
-> 1134 return self._sslobj.read(len)
1135 except SSLError as x:

timeout: The read operation timed out
...
81 raise
83 message = str(exc)
---> 84 raise mapped_exc(message) from exc

ReadTimeout: The read operation timed out

Testing

Testing is currently difficult because it requires assets to exist in an account. The tests were created before separate budgets were created so I now have access to a sandbox where the snapshots can be more easily generated

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.