GithubHelp home page GithubHelp logo

volfpeter / motorhead Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 1.0 861 KB

Async MongoDB with vanilla Pydantic v2+ - made easy.

Home Page: https://volfpeter.github.io/motorhead/

License: MIT License

Python 100.00%
api async fastapi mongodb odm pydantic python query-builder rest typed

motorhead's Introduction

Hi,

Iโ€™m Peter Volf, SW engineer for many years now with a master's degree in computer science, located in Hungary.

My main professional interest has been Python ever since I first started using it around ~2008. I really enjoy working with React and TypeScript, and doing full-stack application development as well. I'm also interested in Linux and the open-source world in general. At university, I specialized in network/graph analysis and machine learning -- it was a long time ago, it would be great to have the time to pick these up again.

I work mostly on greenfield web projects. When my time allows -- unfortunately not nearly as often as I'd like these days -- I like to do some open-source work.

Some of my more interesting hobby projects are:

  • localclustering is a local graph clustering algorithm with a graphscraper backend (JOSS publication, analysis).
  • motorhead is an async almost-ODM for MongoDB with vanilla Pydantic v2.
  • fasthx is an HTMX utility for FastAPI.
  • graphscraper is an SQL graph database with an in-memory cache and a built-in, on-demand web scraper.
  • mastodon-social-graph is a graphscraper implementation that loads the social graph of a Mastodon instance.
  • uspto-patent-citation-graph is a graphscraper implementation that loads the citation graph from USPTO's API.
  • markyp is an XML templating engine and parser tool.
  • markyp-html is an HTML implementation based on markyp that lets you write static webpages 100% in Python (i.e., without Jinja-like templating).
  • markyp-bootstrap4 is a full Bootstrap4 implementation based on markyp-html.

My recent professional projects:

  • Currently I work on AI-assisted digital healthcare services AIP Clinic and AIP Derm, on the LNGx platform, and on various internal business tools.
  • Horizon Planner, an enterprise resource planning and project management application (tech lead/principal engineer, 2019-2023).

I also tutor engineers, from juniors to seniors, primarily focusing on Python and system architecture/design.

I'm available for consulting and contract work, you can find me on:

motorhead's People

Contributors

volfpeter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

juliengioux

motorhead's Issues

How to ? Update(PUT) a field with default_factory=datetime.now ?

Hi,

Maybe someone could help...
I want to update a field "last_update" with "datetime.now" each time a PUT request is validate, and to store this key as Date type in mongodb

The only solution I've found is to add the key:value directly in the dict in my "_convert_for_update" function... But i'm not really satisfied with this solution. Maybe there is a better and proper way to do that ?

Here is my basic UserUpdate class:

class UserUpdate(BaseDocument):
    """
    User update model
    """
    name: str | None = None
    surname: str | None = None
    email: EmailStr | None = None
    nickname: str | None = None
    last_update: UTCDatetime = Field(default_factory=datetime.now)

and here my "_convert_for_update" function:

    async def _convert_for_update(self, data: UserUpdate) -> UpdateObject:
        result_dict = {**(await super()._convert_for_update(data))}
        result_dict['$set'].update({'last_update': data.last_update})
        return result_dict

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.