cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
712
Views
2
Helpful
0
Replies

This Week In Tech: Poetry, FastAPI, BlendOS and Python in Excel

npetrele
Cisco Employee
Cisco Employee

Remember Poetry?

Try using Poetry to test out FastAPI. FastAPI is a speedster of a way to get web services up and running via Python. 

In case you don't recall, Poetry is a project management tool for Python. Here's a post I made about Poetry.  Below are some sample commands to get started with FastAPI, a companion library you'll need (uvicorn) using Poetry. Poetry handles its own virtual environments. It does so automatically but I'm the paranoid type, so you'll see me enter a Poetry shell in the commands below. This changes the prompt so I know for a fact I'm using a Poetry virtual environment because the prompt tells me so.

 

$ poetry new FAPI
$ cd FAPI
$ poetry shell
(fapi-py3.11) PS $ pip install fastapi
(fapi-py3.11) PS $ pip install uvicorn

 

 

Now you're ready to put together a web service. For example, enter this in a file "main.py":

 

 

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def root():
    return {"hello":"Hello world"}

 

 

Now run it with uvicorn:

 

 

(fapi-py3.11) PS C:\FAPI> uvicorn main:app
INFO:     Started server process [36188]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

 

 

Set your browser to localhost:8000 and you'll get the response:

 

 

{"hello":"Hello world"}

 

 

Read up on FastAPI, it's quite a cool library for quickly creating web services.

Python In Excel

There's already a paid project app and add-in that lets you use Python with Excel. But Microsoft is adding the capability free. You can get it if you have a Microsoft Office 365 insider account for now, but they'll add it later for everyone. I have the insider account, but my Office 365 hasn't updated with the capability yet. In the future, you go to Functions in Excel and choose to Insert Python. 

BlendOS

There's a Linux distribution out of India called BlendOS. This version of Linux is based on Arch Linux, but the cool thing about it is that you can add other distributions to run in Docker containers. So you start with BlendOS, then add other distros like Ubuntu, Debian, Fedora, etc. This basically gives you multiple Linux distributions all running in their separate containers. One click takes you to a command shell for any distribution you've added, from which you can add that distro's packages and run them. You can even assign commands to a specific distribution. So if you only want to run Gimp from Fedora, you tell BlendOS that when you run Gimp, it does it from the Fedora container. 

It's easy to install and use. Just check it out here. Two words of warning: Use balenaEtcher to burn the ISO to a thumb drive (don't use rufus which is what I normally use to burn an ISO to a thumb drive). And although BlendOS gives you the option, don't install Android on it. It works fine, but it's funky and there's no easy way to get rid of it. 

0 Replies 0