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...

How to Keep Ubuntu 24.04 Laptop Running with Lid Closed

laptop lid closed and suspend

By default, Ubuntu suspends your laptop when you close the lid. However, in some use cases, such as downloading files overnight, using external displays, or running services, you may want your laptop to stay awake. Here’s how to configure your system so it continues running even with the lid closed.

Step 1: Edit the logind.conf File

Open a terminal and run the following command to edit the systemd logind configuration file:

sudo vi /etc/systemd/logind.conf

Find the following lines (they may be commented out) and modify them as shown below:

HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

If any of these lines are commented out with #, be sure to remove the comment symbol.

  • HandleLidSwitch=ignore: Prevents the system from suspending when the laptop lid is closed, regardless of whether it's on battery or AC power.
  • HandleLidSwitchExternalPower=ignore: Specifically ensures the system does not suspend when the lid is closed and the laptop is plugged into AC power.
  • HandleLidSwitchDocked=ignore: Prevents suspend when the laptop is docked (e.g., connected to an external display or docking station).

Step 2: Restart the Logind Service

After saving the file, apply the changes by restarting the systemd-logind service:

sudo systemctl restart systemd-logind

That’s it!

Your Ubuntu laptop will now keep running even when the lid is closed. Just be cautious about heat buildup if you leave your laptop running in a closed space like a backpack.

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)