Managing FastAPI Projects with Poetry: A Step-by-Step Guide

Image
This guide will walk you through how to use Poetry to manage dependencies and structure your project in FastAPI . It includes detailed explanations of Poetry's core concepts and commands to help prevent issues that can arise during team collaboration and deployment. 1. What is Poetry? Poetry is a dependency management and packaging tool for Python. It goes beyond simply installing libraries by allowing you to clearly declare the dependencies your project needs and ensuring that all developers on the project have the same library versions. Clarity in Dependency Management : Explicitly manage your project's basic information and required libraries through the pyproject.toml file. Reproducible Builds : By locking all dependency versions in the poetry.lock file, it fundamentally prevents "it works on my machine" problems. Integrated Development Environment : It automatically creates and manages isolated virtual environments for each project and handles mo...

Keeping Your Ubuntu 22.04 Laptop Powered On with the Lid Closed

If you're using a laptop with Ubuntu 22.04 and you want to keep it running even when the lid is closed, you'll need to modify a system configuration file.

This is particularly useful if you're running long processes or using the laptop as a server. Here's a step-by-step guide on how to do it.

Step 1: Modify the logind.conf File

You'll need to edit the /etc/systemd/logind.conf file with superuser privileges.

This file controls how the system responds to various events, including the lid being closed. Here's how to modify it:

sudo vi /etc/systemd/logind.conf

In the logind.conf file, find the line that says #HandleLidSwitch=suspend.

Change it to HandleLidSwitch=ignore. This tells the system to ignore the lid being closed and keep running.

[Login]
#NAutoVTs=6
#ReserveVT=6
...
HandleLidSwitch=ignore
...

Step 2: Apply the Changes

After saving the file, you need to apply the changes. You can either reboot your laptop or restart the systemd-logind.service. To restart the service, use the following command in the terminal:

sudo systemctl restart systemd-logind.service

Conclusion:

With these changes, your Ubuntu 22.04 laptop will continue to run even when the lid is closed. This is extremely useful for various scenarios, including server use, downloading files, or running processes that take a long time.

Comments

Popular posts from this blog

Resolving Key Exchange Failure When Connecting with SecureCRT to OpenSSH

SecureCRT] How to Back Up and Restore SecureCRT Settings on Windows

How to Set Up Vaultwarden (Bitwarden) on Synology NAS (Best Free Alternative to LastPass)