Package Management
Package management is the process of handling the many and varied dependencies and artifacts for your servers, applications, and developers. These are the archives, binaries, libraries, tools, scripts, modules, snippets, metadata, assets and even datasets that power your processes, products, and solutions.
A binary package manager centralizes these dependencies and artifacts, acting as a glue layer within the DevOps toolchain to provide easier interaction between development, operations, build, and release.
Package management reduces the friction between different functions within DevOps, and the process of delivering from developer to customer is accelerated.
PIP
At this point you understand why we need a package manager.
For python we havepip
— a command-line Package Installer for Python, as the “official” package manager (there are other options to pip
though). It simplifies the process of downloading and installing packages from PyPI and other repositories — ok, in the end is like a fancy-smart-automated copy and paste.
Libraries installed with pip
or other package managers will be available to import
their packages/subpackages/modules.
Usually pip comes pre-installed along with Python’s installation.
Install Packages
Install particular version
Upgrade Packages
Uninstall Package
Managing Dependencies
When you install libraries using pip
, the library’s code itself is placed next to your python interpreter in the file system. Consequently, we can keep the dependencies apart from our source code.
In the virtual environment we can install our dependencies and we can use requirement files to easily install everything we need.
Requirement files are text files where we have the dependencies of the project declared with their respective versions and sources.
We can generate a requirement file by running pip freeze
command and writing its output in a text file.
whenever we share the project or we have to setup it again, we can easily install the dependencies from the requirements file with pip install -r requirements_file.
Testing
One of the most popular Python-based testing frameworks is Pytest, an open-source testing framework. Unit testing, functional testing, and API testing are all supported by pytest.
NPM
NPM stands for Node Package Manager and is one of the multiple package managers (others include Yarn, Bower, etc.) available for the JavaScript programming language. Furthermore, it’s the default package manager for Node.js.
NPM has a command-line client, which is generally how you install packages. What seems magical is how NPM knows what to download.
All you do is give the name of the package you’d like, and NPM knows where to get it from. This is because NPM has an online database of public and paid-for private packages called the NPM registry.
Basics of NPM commands
Below are the basic commands that you can use to get started with NPM.
This command will create a package.json
file in your project. You can manually add packages to this file, or you can use the npm install
command.
This command will look into your package.json
file and install all the packages that are listed in the package.json
file.
Check your code test files, execute and given a test result.
Generate a production ready build package.
Running our application using start command.
Last updated