latte is a command-line tool designed to help Python developers analyze their code quickly and easily. It provides several useful commands for code inspection and package management.
- Ensure you have Python 3 installed on your system.
- Clone the repository or download the
latte_main.py
file. - (Optional) Create an alias for easy access:
- Open your shell configuration file (
.zshrc
or.bashrc
):nano ~/.zshrc # For zsh # or nano ~/.bashrc # For bash
- Add this line at the end of the file:
alias latte='python3 /path/to/your/latte_main.py'
- Save the file and reload your shell configuration:
source ~/.zshrc # For zsh # or source ~/.bashrc # For bash
- Open your shell configuration file (
- Open a terminal and navigate to the directory containing
latte_main.py
. - Run the script:
(Or simply type
python3 latte_main.py
latte
if you've set up the alias) - When prompted, enter the full path to the Python file you want to analyze.
- Use the available commands to analyze your code.
ln
: Returns the number of lines of code in the filexn
: Returns the number of variables in the codepi
: Installs all the packages imported in the filefn
: Returns the number of functions in the filehelp
: Displays the list of available commandsexit
: Exits the program
This command counts and displays the total number of lines in your Python file.
Example:
latte> ln
Number of lines: 50
This command counts and displays the number of variables defined in your Python file.
Example:
latte> xn
Number of variables: 10
This command identifies all the packages imported in your Python file and attempts to install them using pip.
Example:
latte> pi
Installed 3 packages.
This command counts and displays the number of functions defined in your Python file.
Example:
latte> fn
Number of functions: 5
Displays the list of available commands and their brief descriptions.
Exits the Latte tool.
Welcome to Latte!
Enter the name of the Python file you're editing: /path/to/your/script.py
Type 'help' for a list of commands.
latte> ln
Number of lines: 100
latte> xn
Number of variables: 15
latte> fn
Number of functions: 7
latte> pi
Installed 2 packages.
latte> exit
- Ensure you have the necessary permissions to install packages when using the
pi
command. - The tool currently analyzes one file at a time. To analyze a different file, you need to restart the tool.
- Make sure to provide the full path to the Python file you want to analyze when prompted.