Open dudung opened 2 months ago
Melinda Alberta - 10222066
Explain the differences in previous slide. The difference lies in the environment in which it is executed. It can be seen in the first image that it is not run in a virtual environment, whereas in the second image, it is run within an environment (butiran 0.0.9).
Why the differences can exist? Explain in brief. The difference is due to the environment itself. A virtual environment is an environment that is distinguished from the global environment, where the virtual environment has its own separate packages.
What is the name of virtual environment? Butiran
Is the name free to choose? yes
How many virtual environment are allowed in a computer? You can create as many virtual environments as you need
What is the purpose of pip freeze command?
The pip freeze
command utilizes pip
, the Python package manager, to display all installed packages along with their corresponding versions. This command generates a structured output of the packages, making it simple to save and reference for future use.
What is the purpose of > requirements.txt after pip freeze?
'> requirements.txt': This is a shell redirection operator that instructs the system to save the output of the pip freeze
command into a file named requirements.txt. If the file does not exist, it will be created. If it does exist, its current contents will be replaced.
Can other name instead of requirements.txt be used? Yes, you can use other names if you specify them accordingly in your project setup.
Why is that a process of cloning a virtual environment? The code shows a command to install Python dependencies using pip install -r requirements.txt. Cloning is more about duplicating an existing virtual environment with all its packages, which could be done by copying the environment folder or using tools like pip freeze > requirements.txt to save dependencies, and then recreating them in a new environment by running pip install -r requirements.txt.
Explain the differences in previous slide! The code in the previous slide does have differences. The first one tells the command prompt to list all of the pip installed in the system. The second one tells the command prompt to list all of the pip installed in the environment.
Why the differences can exist? Explain in brief! The differences could exist because of Python virtual environment. Python virtual environment will isolate Python associated pip packages. This will allow us to install and manage our own set of packages that are independent of those provided by the system or used by other projects.
What is the name of virtual environment? The name of virtual environment used in the slides is "Butiran".
Is the name free to choose? Yes, we can freely choose any name for the virtual environment.
How many virtual environment are allowed in a computer? There is no limit to the number of virtual environment allowed in a computer. We can have as many as we want.
What is the purpose of pip list command? pip list is a command that we can write to list all of the python packages installed in an environment.
What is the purpose of pip freeze command? Pip freeze is a command in Python that allows us to save packages that were installed using pip in the virtual environment.
What is the purpose of > requirements.txt after pip freeze? The purpose of > requirements.txt is to records the environment current packages list into a txt file named requirements.
Can other name instead of requirements.txt be used? Yes, we can use other name instead of requirements.txt.
Why is that a process of cloning a virtual environment? We call that a process of cloning a virtual environment because the code will clone all of the python packages installed in other virtual environment, stored in the requirements.txt file, into a new virtual environment.
NURUL IZZATI_10223042
Perintah pip list pada bagian atas menampilkan package yang terinstal secara global di seluruh sistem Python, dengan output hanya menunjukkan package default, yaitu pip. Sementara itu, bagian bawah menggunakan perintah yang sama untuk menampilkan package dalam lingkungan virtual, di mana outputnya hanya mencakup package yang spesifik untuk lingkungan tersebut, termasuk pip yang terinstal secara default.
Perbedaan tersebut ada karena masing-masing memiliki keunggulan yang sesuai dengan kebutuhan proyek. Lingkungan global ideal untuk proyek kecil yang tidak memerlukan versi package berbeda dan memungkinkan instalasi yang cepat dan sederhana. Sementara itu, lingkungan virtual lebih tepat untuk proyek profesional atau proyek besar dengan banyak dependensi, karena dapat mencegah konflik versi package dan menjaga konsistensi lingkungan pengembangan
Lingkungan virtual adalah alat yang digunakan untuk menciptakan lingkungan kerja terisolasi bagi proyek Python. Dengan ini, setiap proyek dapat memiliki dependensi sendiri tanpa bercampur dengan pustaka Python global yang mungkin digunakan oleh proyek lain. Ini sangat berguna untuk memastikan setiap proyek memiliki konfigurasi yang tepat dan terhindar dari konflik versi paket.
Ya. Pemilihan nama untuk lingkungan virtual dibebaskan.
Tidak ada batasan mutlak dari Python atau sistem operasi tentang jumlah lingkungan virtual yang diizinkan pada sebuah komputer.
Perintah pip list digunakan untuk menampilkan daftar paket Python yang telah diinstal di lingkungan Pyhton atau virtual environment yang sedang aktif. Selain itu, pip list akan memberikan rincian dari versi paket yang terdaftar.
Perintah pip freeze digunakan untuk menampilkan daftar package yang terinstal berserta versinya dan hasilnya biasanya lebih sederhana karena cocok untuk disimpan dalam file seperti requirements.txt.
Requirements.txt dibuat setelah menjalankan pip freeze bertujuan untuk mendokumentasikan seluruh package beserta versi yang digunakan dalam suatu proyek dan memastikan konsistensi lingkungan Python saat proyek dijalankan di komputer lain. Selain itu, file tersebut dapat mempermudah instalasi ulang dependensi proyek di masa mendatang.
Tentu. Bisa menggunakan nama lain selain requirements.txt untuk penggunaan yang sama.
Kloning lingkungan virtual diperlukan untuk menciptakan salinan identik dari lingkungan pengembangan yang sedang digunakan, termasuk semua paket dan dependensinya. Hal ini mempermudah pengelolaan proyek yang membutuhkan pengaturan serupa atau menduplikasi lingkungan pengembangan tanpa harus menginstal semua dependensi dari awal.
Ashma Nisa S.A (10222091)
*akun github yang lama keblokir pak/kak (tugas yang sudah disubmit hilang), jadi submit ulang menggunakan akun github baru
Nashwan Chakap Nanggala (10222036)
Efra Feyza 10223088
Ikbar Fauzul Mubin Ruhimat 10223083 Izin mengirimkan ulang pak karena saya sempat ganti akun github karena entah kenapa tugas yang sudah di input sebelumnya tidak terbaca. Bukti:
Explain the differences in previous slide The difference is that in the image above there is only one package installed (without a virtual environment) and it shows the command prompts running in the global environment, whereas in the image below there are two packages installed and the command prompts run in a virtual environment called "butiran".
Why the differences can exist? Explain in brief There is a difference because in the picture above the command runs in a global environment. In the second image the user installs another environment, namely “butiran” which allows the user to install and manage Python packages separately from the global system.
What is the name of virtual environment? The virtual environment is called "butiran"
Is the name free to choose? Yes, it depends on what the user wants to name it
How many virtual environments are allowed in a computer? Unlimited, depending on how much storage the user has
What is the purpose of pip list command? The pip list command in Python is used to display a list of all installed Python packages in the current environment, along with their versions
What is the purpose of pip freeze command? The pip freeze command in Python is used to display a list of all installed Python packages in your environment along with their respective versions, the different between pip list and pip freeze is lie in their output format and intended use
What is the purpose of > requirements.txt after pip freeze? The purpose of using > requirements.txt after the pip freeze command is to save the output of the pip freeze command (i.e., the list of installed packages and their versions) into a file named by the user
Can other name instead of requirements.txt be used? Yes, other names can be used as long as you use the .txt format at the end of the name to be displayed
Why is that a process of cloning a virtual environment? Its main purpose is to replicate or copy an existing Python development environment, including all its packages and versions, to another environment. This is of course very useful for moving the environment on one device to another device.
Total time is about 4 hours.