__init__.py
- file in Python serves a crucial role when building local packages or modules. Its primary function is to designate a directory as a Python package, allowing its contents (other modules and sub-packages) to be imported and utilized within your project.
utils.py
- this file usually you setting up the classes for the local module / packages. This can be more different files and classes defines it. In order the class is included to the local module / package, you need to import it in the
__init__.pyfile.
my_script.py
- You can now use it in your scripts by importing the package in your python file.
- There's an easy way to install all the packages / modules you need all in one.
- You need to set it up by creating a
requrements.txt
# What's inside of requirements.txt?
matplotlib
numpy==1.15.4
pycodestyle>=2.4.0Note: you can just put the name of the packages / modules you want to installed, you can specified the exact version or you can just put nothing and it's all depends on your required module / package to use. After listing all the modules / packages, you can just go in terminal and type:
pip install -r requirements.txt
Warning: make sure that your terminal is located where the
requirements.txtis.
my_directory/
├── my_package/
│ ├── __init__.py
│ └── utils.py
│
├── __init__.py
├── my_script.py