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

Disable Wi-Fi Power Saving on Ubuntu for fast access to SSH, Telnet, and FTP

If you've noticed that SSH connections become very slow or unresponsive after your Ubuntu laptop has been idle for a while. This often happens because your Wi-Fi card enters power-saving mode, reducing network activity until it's manually "woken up."

Here's how to check and disable Wi-Fi power management to ensure fast access to services like SSH, Telnet, and FTP.

Step 1: Identify Your Network Interface

Run the following command to find your WiFi network interface:

$ iw dev
phy#0
        Interface wlp3s0
                ifindex 3
                wdev 0x1
                addr d4:d2:52:96:ff:6e
                ssid ABCD1234

Here, wlp3s0 is your Wi-Fi interface name. You'll use this in the following steps.

Step 2: Check Power Management Status

Use iwconfig to check if power saving is enabled:

$ iwconfig wlp3s0
wlp3s0     IEEE 802.11  ESSID:"ABCD1234"
Mode:Managed  Frequency:5.26 GHz  Access Point: 38:06:E6:28:76:75
Tx-Power=22 dBm
Retry short limit:7   RTS thr:off   Fragment thr:off
Power Management:on
Link Quality=65/70  Signal level=-45 dBm
Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
Tx excessive retries:7  Invalid misc:2548  Missed beacon:0

If you see `Power Management: on`, then your Wi-Fi card is going to sleep when idle and it causes the SSH delay.


Step 3: Disable Power Management Temporarily

To turn off power-saving mode immediately (for the current session), execute the following command.

$ sudo iwconfig wlp3s0 power off


Step 4: Disable Power Management Permanently

When using NetworkManager as a renderer

1. Edit NetworkManager's default-wifi-powersave-off.conf

$ sudo vim /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
[connection]
wifi.powersave = 2
Value Identifier Description Use Case
0 NM_SETTING_WIFI_POWERSAVE_DEFAULT Default setting (depends on internal policy or driver) When you don't want to customize the setting
1 NM_SETTING_WIFI_POWERSAVE_ENABLED Enable power saving mode When saving power is important (e.g., on laptops)
2 NM_SETTING_WIFI_POWERSAVE_DISABLED Disable power saving mode When connection stability is important (e.g., avoid SSH timeouts)
3 NM_SETTING_WIFI_POWERSAVE_IGNORE Ignore this setting and follow system defaults When you prefer to rely on system defaults

2. Restart NetworkManager

$ sudo systemctl restart NetworkManager

Step 5: Check Power Management Status after Reboot

$ iwconfig wlp3s0
wlp3s0     IEEE 802.11  ESSID:"ABCD1234"
Mode:Managed  Frequency:5.26 GHz  Access Point: 38:06:E6:28:76:75
Tx-Power=22 dBm
Retry short limit:7   RTS thr:off   Fragment thr:off
Power Management:off (*) 

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)