![]() ![]() However, it is often assumed that while a package is a collection of modules, a library is a collection of packages. In practice, this term is often used interchangeably with “python package” because packages can also contain modules and other packages (sub-packages). Usually, a python library is a collection of both modules and packages. Whilst modules and packages have specific definitions, a library is an umbrella term referring to a reusable chunk of code. Modular programming: The process of breaking down a large programming task into small, separate, manageable chunks or modules. Typically accessed with import statement, in the current directory. A module can define functions, classes, and variables. Modules: A file consisting of Python code. ![]() It's possible to put several modules into a single package. Packages: A directory with python files (modules) and a file with the name _init_.py. Just like we organise our files and documents on our computer into folders and subfolders, we can organize our modules into packages. Modules allow us to be well organised, grouping related code saved in a file with the extension “.py”. Packages and Modules are two mechanisms that facilitate modular programming in python. When a module from an external package is required in a program, that package can be imported and its modules can be used. Modules that are related to each other are mainly put in the same package. This post will summarise the key terms in working with packages, how conda and pip can work (and not work) together.Ī python package is a collection of modules. It allows you to install and manage additional packages that are not part of the Python Package Index ( PyPI). Pip is the standard package manager for python, meaning you can use it both inside and outside of Anaconda. In introductory data science and python courses, you will often work with Jupyter, loaded through Anaconda Navigator ( Check out this post for a visual explanation of how these fit together).īuilt into Anaconda, conda is a powerful package manager and environment manager that you use with command-line in the Anaconda Prompt for Windows, or in a terminal window for macOS or Linux. When getting started with programming it can be difficult to understand how we install and work with packages using the multiple tools at our disposal. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |