Managing Magento Configurations with PyGento: A Powerful Python CLI Tool for Developers
Magento 2 is a robust eCommerce platform, widely used for building online stores. However, managing its core configurations through the admin panel and silly bin/magento PHP CLI is slow and outdated, especially when dealing with large datasets, frequent updates, or debugging tasks.
That's why I wrote Python CLI to manage configuration. By integrating Python with Magento’s MySQL database, we can create a fast, efficient, and automated way to manage Magento’s configurations, products, orders etc., directly from the terminal using the most powerful programming language — Python.
This Package is powered by PyGento library architecture:
The best open-source Python library to build e-commerce Magento 2!
Mage Config Tool, a Python-based CLI tool that simplifies Magento configuration management by allowing users to search, view, and edit settings from the core_config_data
table with ease.
What is Mage Config Tool?
Mage Config Tool is a terminal-based utility written in Python that enables developers to:
- Search for configurations by
path
(e.g.,web/secure/use_in_frontend
). - View all stored configurations with pagination support.
- Edit any configuration value without accessing the Magento admin panel.
- Retrieve database settings directly from
app/etc/env.php
.
This tool is particularly useful for Magento developers, DevOps engineers, and store owners who frequently work with Magento configurations.
Why Use PyGento for Magento Database Management?
Python provides a clean, efficient, and scalable approach to handling Magento’s MySQL database. Here’s why Python is a better alternative to PHP CLi:
1. Faster Access & Search
Instead of logging into Magento Admin and navigating through multiple settings, Python allows you to search, filter, and modify configurations in seconds using SQLAlchemy.
2. Secure & Direct Database Interaction
Python’s ORM (Object-Relational Mapping) tools like SQLAlchemy with PyGento ensure safe interactions with the database vs outdated Zend1_Select PHP MySQL component from magento.
3. Automates Repetitive Tasks
Need to update multiple configurations? Instead of clicking through the Magento UI, use a simple Python script to apply changes instantly.
4. Works with Any Magento Installation
Since the tool reads Magento’s env.php
file, it automatically connects to the correct database without requiring manual credentials.
How Mage Config Tool Works
Installation
You can install Mage Config Tool using pip
:
pip3 install mage-conf
No deployments, magento’s PHP compilation and composer are needed.
Or install it from the source:sh
git clone https://github.com/genaker/magento-config-tool.git
cd magento-config-tool
pip3 install --editable .
Running the CLI
After installation, simply run:
mage-conf
You will see a menu-driven terminal UI where you can choose different options.
Core Features of Mage Config Tool
Search for a Configuration by Path
Instead of manually looking for settings in the Magento admin panel, use the tool to search by path:
mage-conf
Select Search by Path
.
Enter a configuration path.
View results in a formatted table.
Select Show All Records
in the menu
Scroll through the paginated list of settings. 6 from 593 pages. number if pages depends on the screen size.
✏ Edit a Configuration Value
Modify configurations directly from the terminal:
Select Edit Record by ID
.
Enter the config ID you want to modify.
Input the new value.
Confirm, and the change is applied instantly!
⚙View Database Configuration
Need to check Magento’s database credentials?
Select View Database Configuration
.
The tool reads Magento’s env.php
and displays the credentials securely.
Technical Overview: How It Works
Mage Config Tool is built with:
- Python + Curses → To provide an interactive terminal UI.
- SQLAlchemy → To securely interact with MySQL.
- Tabulate → For displaying structured data tables.
- Magento’s
env.php
→ To fetch database credentials automatically.
Project Structure:
magento-config-tool/
│── magento_config_tool/ # Package directory
│ ├── __init__.py
│ ├── magento_config_tool.py # Main CLI logic
│── setup.py # Setup script
│── README.md # Documentation
│── LICENSE # License file
Python’s power in database management makes it an excellent choice for handling Magento configurations. With Mage Config Tool, developers can quickly search, modify, and automate Magento settings without logging into the admin panel.
How to Install and Run
Just 2 simple commands
pip3 install mage-conf
mage-conf