ExamplesΒΆ
Create a setup from installed packages
This packages pandas into a wheel from the installed sources. Location of the sources can be specified too.
from pymyinstall.setuphelper import create_folder_setup
create_folder_setup('pandas', fLOG=print, output_path='.')
(original entry : setup_creation.py:docstring of pymyinstall.setuphelper.setup_creation.create_folder_setup, line 10)
Create a virtual environment
The following example creates a virtual environment. Packages can be added by specifying the parameter package.
from pyquickhelper.pycode import create_virtual_env
fold = "my_env"
if not os.path.exists(fold):
os.mkdir(fold)
create_virtual_env(fold)
(original entry : install_venv_helper.py:docstring of pymyinstall.installhelper.install_venv_helper.create_virtual_env, line 17)
Installation from GitHub
ModuleInstall("pyquickhelper", "github",
"sdpython").install(temp_folder="temp")
(original entry : module_install.py:docstring of pymyinstall.installhelper.module_install.ModuleInstall, line 3)
Prepare a standalone distribution
The function downloads everything. The installation of tools is still manual. Package installation is automated.
from pymyinstall import win_python_setup
from pymyinstall.packaged import ensae_fullset
list_modules = ensae_fullset()
win_python_setup(module_list=list_modules,
verbose=False,
download_only=False)
This works only for Windows.
(original entry : win_setup_main.py:docstring of pymyinstall.win_installer.win_setup_main.win_python_setup, line 106)
Run a program using the command line
from pyquickhelper.loghelper import run_cmd
out,err = run_cmd( "python setup.py install", wait=True)
(original entry : run_cmd.py:docstring of pymyinstall.installhelper.run_cmd.run_cmd_private, line 31)
Setup a machine
The following code tries to download many tools and packages to prepare a machine for a datascientist on Windows:
from pymyinstall.startup import windows_startup
windows_startup(r"d:\datascientist", r"d:\temp\datascientist", fLOG=print)
(original entry : windows.py:docstring of pymyinstall.startup.windows.windows_startup, line 15)
install SciTE
The function downloads the latest version of SciTE. It also changes some settings for Python (no tabs, Courier New as a police).
install_scite("my_folder_for_scite")
(original entry : install_custom_scite.py:docstring of pymyinstall.installcustom.install_custom_scite.install_scite, line 10)