With r/python out for the next 48 hours, here’s a post to promote continuing discussion a language we all love. Python.

  • csm10495M
    link
    fedilink
    English
    arrow-up
    11
    ·
    2 years ago

    I just made a PR to fix an issue with yt-dlp where Chrome now locks its Cookies file while running.

    Learned about a thing called “Shadow Copies”. Basically Windows allows you to sort-of snapshot files in a volume even while in use.

  • kakes
    link
    fedilink
    English
    arrow-up
    10
    ·
    2 years ago

    I’ve been having fun making Discord bots that use ChatGPT to generate various things. Stuff like giving tarot readings, creating custom MtG cards and whatnot. Nothing too crazy, but it’s been fun to play around with.

    • brian
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 years ago

      What wrapper are you using for your bot? I dabbled with discord.py for a while, but the slash-command drama sorta killed my motivation.

      • kakes
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 years ago

        That’s the one I use - I wasn’t aware of any drama.

        • brian
          link
          fedilink
          English
          arrow-up
          3
          ·
          2 years ago

          Well I suppose that’s good then. It was effectively killing the project last I read about it.

    • dirtyrig@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      I was thinking about using something like this to supplement an Information Desk at an in-person conference. In case the desk had to be left unstaffed. I’m not sure how well the target population would respond to the technology though.

      • kakes
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 years ago

        I would be very hesitant about giving people any reason to believe the information given by a GPT algorithm is accurate, unfortunately. Even with the best prompting and few-shot-priming, a lot of what they say will be simply made up.

  • neomis
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    2 years ago

    Switched jobs recently. So I’m building templates before I get bogged down. I took the opportunity to switch to poetry and pyproject.toml instead of setup.py which I’m liking. I got my file loader ETL template complete. Right now I’m trying to get a fastapi webbackend template. I’m used to nodejs & express for this and I’m finding fastapi is pretty similar. I got oauth2 working with the companies LDAP but right now I’m struggling to find good documentation for jwt with refresh tokens.

    • thiccdiccnicc
      link
      fedilink
      English
      arrow-up
      4
      ·
      2 years ago

      Wicked, I’m gonna try it out! Just now restoring my old nook

  • zeldis
    link
    fedilink
    English
    arrow-up
    8
    ·
    2 years ago

    I’ve been working on a telegram bot that lets me talk to ChatGPT

    • RamenEater
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      That’s cool, I’ve actually been working on a discord bot that also talks to ChatGPT.

      I’ve never used telegram but it sounds similarly useful.

    • blogorg
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      What’s the cost for chatgpt’s API? I’d love to make my own chatgpt bot

      • zeldis
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 years ago

        Very low if you’re just using it yourself and if you’re just chatting with it. You’re charged per token (roughly a word). They just decreased the prices a bit as well. I haven’t paid more than like $5 in a month, usually less than $2. If you use things like autogpt and whatnot that automate and repeatedly call chatgpt, you can use up a lot of tokens though.

  • x2Zero7
    link
    fedilink
    English
    arrow-up
    8
    ·
    2 years ago

    I’ve been making a simple 8-bit game with the pygamer board from adafruit/digikey and CircuitPython. It’s incredible to be able to run python on microcontrollers and it’s a really simple workflow, though customizing your environment can be a little difficult when working on a constrained platform.

  • Word of Mouth@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    8
    ·
    2 years ago

    Lots and lots at work…

    But my only real side project right now is a scheduler and supervisor… “If cron and supervisord had a super-powered love child”.

    I’m very close to releasing v1 so I’m not gonna jinx it by revealing too much, but it’s already in production use by two companies, one of which is enterprise-level, using it to process MASSIVE data somewhere in the entertainment industry… and yes, it’s gonna be FOSS, with MIT license.

    It emphasizes a declarative approach to reproducing clusters of orchestrated job-runners on low-cost cloud infrastructure. Makes it easy to scale and even map-reduce.

    Includes 3 interfaces: CLI (for everything), API (for most things), and UI (for most things).

    It’s gonna be sick heheh. I’ll be sure to come back here once you can pip install it.

    • yasuocidal@kbin.social
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      ah yes, i have been trying to configure my crons and supervisord the right way and its such a pain in the butt. I would be EXTREMELY interested in trying/using it out. Also if you need any help let me know : )

  • frostprophet@infosec.pub
    link
    fedilink
    English
    arrow-up
    6
    ·
    2 years ago

    I’m doing a python introduction course, I’ve made a hangman game and caeser cypher builder so far. It’s just started getting into dictionaries so it would probably have something to do with that

    • Clay_pidgin
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      Dictionaries are awesome! There are also Collections.defaultDict that you need to import specifically, but lets you assign values before the keys exist. Quite handy.

  • sugar_in_your_tea
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    2 years ago

    I use it at work doing work stuff, but I’ve been meaning to dig into pygame to make stuff with my kids. I might already try a QT app for desktop, IDK.

    I mostly use it at home for one off scripts, so nothing really complex enough to discuss.

  • izzel@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    ·
    2 years ago

    A desktop music player. My goal is for it to work with all kinds of sources like youtube, spotify, and soundcloud.

    • atkion
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      Dang, I had an idea much like this but kept getting turned off by the GUI design and lost interest. I would be very interested in this if you’re ever up for sharing it.

  • 0jcis
    link
    fedilink
    English
    arrow-up
    6
    ·
    2 years ago

    I’m building a back-end for my website without a framework.

    • Googleproof
      link
      fedilink
      English
      arrow-up
      4
      ·
      2 years ago

      Out of interest, why are you avoiding using a framework? I use Django literally every day for web dev, so I’m curious as to what your site requirements are like.

      • 0jcis
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 years ago

        I tried Django at the beginning, it is very nice and I will most likely use it if I need to build a professional website, I wanted to understand and learn better how it all works and for my personal not serious website it was a perfect opportunity, so I started messing around and testing without a framework. Coding my own back-end is very fun for me and I’m learning a ton this way. Currently I am making an authentication system where if a client is not authenticated, it will get redirected to a login page where a code is displayed and a user has to send that code to my server’s whatsapp. Once the server validates the matching code from whatsapp, it will authorise the client and redirect back to the original requested page. This system will be perfect for me and my friends to access my website!

        • Googleproof
          link
          fedilink
          English
          arrow-up
          3
          ·
          2 years ago

          Ah, cool, that makes good sense. Yeah, it’ll be a good learning process, as Django does handle so many of those things basically like magic and you never really need to learn what’s going on under the hood. Good luck!

      • 0jcis
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        2 years ago

        Python of course! I am using hypercorn ASGI server, it supports HTTPS/3.

        • zeldis
          link
          fedilink
          English
          arrow-up
          3
          ·
          2 years ago

          Oh of course lol, I didn’t even realize where I was. And right on, sounds like a fun experience. I haven’t messed with async python too much myself but it seems like a powerful way to run a webserver

          • 0jcis
            link
            fedilink
            English
            arrow-up
            3
            ·
            2 years ago

            Yes! Coding it is a blast! I started it just to better understand how all the HTTP communications work and I love customising my own personalised back-end, implementing new features and improving. I’m so hooked I can’t even sleep at nights, thinking about it.

  • TheDudeOPA
    link
    fedilink
    English
    arrow-up
    5
    ·
    2 years ago

    Throughout my IT career when it came to troubleshooting mail delivery problems I typically always started with this website over the years some of the servers stopped working for me which lead me to start looking to create something similar but with python (and potentially incorporate it pyscript). I’ve only gotten about 25% done and now always I don’t seem to have as much time to wire in and continue working on it but eventually I’m hoping to get something like this going again and potentially host it for the world to use.

  • bngo
    link
    fedilink
    English
    arrow-up
    5
    ·
    2 years ago

    I’ve been using scanpy in my biomedical engineering research! Basically allows me to analyze the RNA expressed in single cells and see things like what functional phenotype these cells can be, how they have developed, in addition to spatial information on their arrangement.

  • Michelle
    link
    fedilink
    English
    arrow-up
    5
    ·
    2 years ago

    I’ve made a small python script to copy over blog posts I write from Obsidian to Hugo, and change the hyperlinks from the markdown format to the Hugo format.

    I really love working on small projects in python, such a great language.

    • TheDudeOPA
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      This is really cool! Do you have you code on github? How are you handling pictures? I noticed that the way obsidian and hugo do it are different (obsidian adds it in the same working folder while hugo has a specific folder to store images)

        • imperator
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 years ago

          Would be really interesting to do something similar with Lemmy links so you stay within your own instance. Not sure if that is something that could be done server side or if it’s front end development.

    • SleepyHarry
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      2 years ago

      While I love Python, it’s not the easiest language to do high freq low latency work on as I imagine algotrading would demand.

      How have you worked around this, if at all?

      I can’t find a way to word this that doesn’t sound really aggressive, the question is in good faith!

      • Bluetreefrog@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        2 years ago

        Liberal use of libraries written in c (e.g. pandas, pytorch, numpy), some use of cython (not in the current version, but I have done so), and relying on time frames and strategies which have some tolerance for latency. If you trade five minutes after the start of a 1 day candle on the basis of where you expect it to be at close, it’s not such a big problem.

        It’s a losing game to try and out-pace the big end of town.

    • imperator
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      I’d be interested in the github repo. I don’t even know where to start with algo trading. I know there were some specific subreddits dedicated to it, but understanding the best strategy would be cool. Would be interesting to dissect what you’re doing.

      Have you used it in a live environment?

      • Bluetreefrog@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 years ago

        Yes, I’ve used it live. I ended up coming to the conclusion that Binance was rigged and that they were forward trading me.

        If you want to learn a bit about algo-trading, a good place to start is John Ehler’s books. Caveat: You’ll need to have a decent foundation of maths under your belt, or be prepared to learn it.

        There are a few repo’s that are more mature than mine. Jesse and SuperAlgos spring to mind. Also, peruse https://github.com/topics/trading-algorithms

        I’m in the process of documenting mine, and cleaning up the code so that it’s more generic and neat. It’s at https://github.com/noenfugler/algo-weaver