Python wrangling (My first time using python)

Python wrangling (My first time using python)

In a 20+ years of programming I have never used Python. Recently we needed to solve a problem and for some reason in the security space there are a lot of libraries that do this in the Python. After much hunting around trying to find something in the NodeJS space I conceded and thought well let’s use Python then.

First solution was to use a python script and run that in our NestJS backend. This worked well until we wanted to release it into the Azure environment. When you use the built-in webapp they only support one stack at a time, so you can have NestJS or Python but not both. We spent a good week on this and finally logged a ticket with Microsoft only to confirm what we concluded.

So next we decided to build a python standalone solution this way we could use the Azure webapp python stack and have its own release pipeline. I searched around and settled on a solution call FastAPI https://fastapi.tiangolo.com/. This seemed very similar to NestJS and came with many similar solutions to problems of threading and callback etc.

It took me 4 days as much googling to find the syntax I needed to do things I knew instinctively in Node/TS, but I build a full API with some basic authorisation, background threading for my long running tasks and callbacks to send out the data when finished.

Some things about Python I did find annoying was the syntax spacing(tabs) being an issue, it is also hard to see when things end because no brackets a few times the tabs got me like in loops. Modules took me a while to understand adding a __init__.py file in every folder just seemed odd to me. I well say the language does have a lot of built-in features that don’t require 3rd party libraries, json and dates being a few I noticed.

I’m sure there are features and things I could do better if I spent more time learning the language but over all for lines of code it does a lot for very little. And now we can use many other python libraries we have found that solve specific problems in our domain.

要查看或添加评论,请登录

Daniel Kelder的更多文章

  • Resistance is futile - AI in existing projects

    Resistance is futile - AI in existing projects

    Like most good developers, I was initially skeptical of the next big thing—AI was no exception. I went through all the…

  • AI to replace your programming?

    AI to replace your programming?

    A lot of retric around the rise of AI replacing programmers, is this true? Right now in simple terms No. Currently most…

    1 条评论
  • From an idea to Production

    From an idea to Production

    My colleague Rhiannon Williams and I have been working for the last year on a product from the ground up. This product…

    2 条评论

社区洞察

其他会员也浏览了