PY-SIL Development Environment
This section outlines instructions for a minimal installation.
External Packages Needed by PY-SIL
There are several components needed in the YumaPro PY-SIL software development environment:
YumaPro Tools development environment Development Environment
Python with pip
Python, with a minimum version of 3.8.10, is needed for the PY-SIL environment.
pip, the package installer for Python, is included by default with Python installations.
Detailed instructions for installing Python can be found in the Python documentation.
Python libraries
The following external python libraries are needed by PY-SIL:
wheel
pyang
The following shared libraries needed for PY-SIL to operate:
libyumapro_ncx.so.
libyumapro_agt.so.
libyumapro_ycontrol.so.
libcurl.so
libssl.so
Building the Server to Support PY-SIL Libraries
To enable PY-SIL support on the server, it should be built with the WITH_PY_SIL option.
WITH_PY_SIL=1: build the netconfd-pro server with PY-SIL library support.
If provided, the PY-SIL Python libraries will be installed within the virtual environment. Otherwise, it will be installed globally.
See Creating and Using a Python Virtual Environment if you want install PY-SIL into virtual environment.
Example build command.
mydir> make DEBUG=1 DEBUG2=1 USE_WERROR=1 EVERYTHING=1 WITH_PY_SIL=1
- Installed Programs:
/usr/bin/py-sil-app.py
- Installed pyang plugin:
py-sil-gen.py
- Installed Python Libraries:
pysilcommonlibrary
pycontrollibrary
pyncxlibrary
pysillibrary
This feature is not enabled with the EVERYTHING make flag.
Using PY-SIL Libraries with Netconfd-pro
Static Configuration
At startup, py-sil-app.py will retrieve the server configuration and attempt to load the PY-SIL libraries specified by the --module or --bundle parameters to the server.
Dynamic Configuration
Libraries for a single module are loaded at run-time into the server with the <load> operation and removed with the <unload> operation.
PY-SIL Code Generation with 'py-sil-gen.py' Plugin
The 'py-sil-gen.py' plugin for pyang can be used to generate PY-SIL code stub files for a single or multiple YANG modules.
Refer to PY-SIL Code Generation for more details
Creating and Using a Python Virtual Environment
This is an optional step.
Creating a virtual environment in Python is a straightforward process. Here's a step-by-step example using the venv module, which is included in Python 3 and higher:
Navigate to Your Project Directory: Open a terminal or command prompt and navigate to the directory where you want to create the virtual environment.
Create the Virtual Environment: Run the following command to create a virtual environment named myenv:
python3 -m venv myenv
If you're using Windows and your default Python interpreter is Python 3, you might use python instead of python3.
Activate the Virtual Environment:
On macOS and Linux:
source myenv/bin/activate
After activation, you'll see (myenv) in your command prompt, indicating that the virtual environment is active.
Install Packages: Once the virtual environment is activated, you can build server. All PY-SIL packages will be installed locally within the virtual environment.
Deactivate the Virtual Environment: To deactivate the virtual environment and return to your global Python environment, simply run:
deactivate
That's it! You've created a virtual environment, installed packages, and activated and deactivated it as needed. This approach helps isolate dependencies for different projects.