Ephes Blog

Miscellaneous things. Not sure what to put here, yet.

Date -

Weeknotes 2021-10-25

, Jochen

I predicted fastdeploy to be done in two weeks, but it's not. Seems I have to spend a few more days on that. But all major obstacles are resolved, so I'm still pleased with the progress.

Fastdeploy Backend

Worked on getting database tests running with FastAPI and SQLModel and it was not that easy. What I would have liked to have is that after each test the database is rolled back into the same state it had before the test ran. This is the default behaviour when using pytest-django. But I couldn't get it to work. I ended up dropping and recreating the database after each test (which is not bad as it sounds, because my test database is only a small sqlite file), but this is not an elegant solution, to say the least.


Fastdeploy Frontend

I had to find out, you cannot use an "authorization" hader with an JWT payload for websocket authentication, because you can't set custom headers for websocket connections.  Then I played a little bit around with list transitions in Vue.js and this was quite fun :). Used a vue plugin to make the http client awailable in my vue components. Struggled a little bit with async methods on the client (`this`was available in sync methods but not in async, wtf?). Used a navigation guard from vue router to redirect users to the login component when not authenticated.
 

Things I Looked at Last Week


Weeknotes 2021-10-18

, Jochen

Started a small new project to be able to automatically deploy my podcast hosting infrastructure called fastdeploy. It's a little bit different because I want to be able to try hot and experimental stuff in this project. Therefore I didn't use good old boring django but fastAPI as the backend web framework and Vue.js / Vite for the frontend. I also switched my IDE for this from PyCharm to Visual Studio Code to be able to use it for both python and typescript. For backend dependency management I switched from poetry to pip-tools. So lots of new stuff :).

One of the reasons I chose fastAPI for this project was that it has builtin support for async and websockets. And getting Vue.js and fastAPI to communicate over websockets was easier then expected. Getting vue components to communicate via props and events was a little bit more difficult especially when using <script setup> and typescript, but now it works quite nice.

Adding authentication capabilities to fastAPI was more difficult then expected. Had to refactor the fastdeploy project structure a bit (settings, router) and I feel more comfortable with it.

Things I Looked at Last Week


Weeknotes 2021-10-11

, Jochen

Implemented a naive bayes spamfilter from scratch in one stream on monday. Learned some details about testing with PyCharm (right click on project root, set as test root for example) which made it work much better. Integrated the new spamfilter model into django-cast and added an "retrain"-button to the admin frontend. Tried to use Python 3.10 for django-cast and submitted a PR for l18n. Got a little bit frustrated about my current combination of pyenvvirtualfish and poetry making it difficult to upgrade to 3.10 (especially poetry, ugh). Then I finally cleaned up the django-cast project structure so that I don't need those ugly symlinks to make things work. 

Recorded a new python podcast episode about the latest Python 3.10 release and other stuff :).

Things I Looked at Last Week


Naive Bayes Implementation

, Jochen
Naive Bayes is great. It's fast, it's super simple, scales well and you can implement it without any dependencies in only about 50 lines of pure Python. Which I did in this stream from monday. I had to put in a little bit more effort for this than the usual stream. Was it worth it? I would really appreciate some feedback about whether this is more or less interesting than the usual stuff.


Weeknotes 2021-10-04

, Jochen

Did some yanitor work for django-cast like testing wether it would be compatible with django 4.0 etc.. Started working on the spamfilter feature for automoderation of comments (the comment spammers got too annoying to do this manually). Had to catch up a bit about how all this comment moderation stuff works. Didn't listened to as many podcast episodes as usual because migrating to a new phone ate up big chunks of my free time (also: no phone, no podcasts..).

Things I Looked at Last Week