Python recommended development environment 2022 version
I'm Manabu Terada, a director of the Python Engineer Development Promotion Association (hereinafter referred to as the Association).I am in a position to formulate the exam questions and work together.Until now, we have focused on various methods in the development environment and Python learning method, but after all, we will try to prepare an easy -to -use environment and deploy the programs that we have actually created.It is important to try to move it.The programming itself can be moved by writing in a text editor, but as a whole, it is important to develop it in Python as a whole.
So, this time, I would like to introduce the recent Python development environment at Pycon KYUSHU 2022 Kumamoto held on January 22, 2022.
Although there is no significant change in the development environment in 5 years ...
Actually, I talked about the development environment around 2017, and I was quite surprised, "Well, that's right!?"First, let's compare the environment that I recommend in 2017 and now.
2017年 | 2022年 | |
---|---|---|
1.implementation | CPython | CPython |
2.Pythonバージョン | 3.6 | 3.9 |
3.How to install | 公式installer | 公式installer |
4.Virtual environment | venv | venv |
5.パッケージインストール | pip | pip |
6.editor | PyCharm | VS Code |
As you can see from this, there is no big difference since then.Still, in the past five years, it has changed a little.From here, I would like to explain 1 to 6 in order.
How to choose an environment
1.implementation
In the first place, what does the word "implementation" mean? First of all, I think that the first thing to imagine is "to use the function you created", but in fact it is not one in Python.
First, the "CPython" in the table is a standard one developed by PSF (Python Software Foundation) and is written in C language.On the other hand, Pypy, which is rarely used in the development site, has a Python implemented in Python, and other JYTHON that works in Java..There are also IRONPYThon that runs on the net, and the speed -up Cython.
What is used in the implementation of Python is most of "CPython".Pypy can be moved at high speed depending on the thing.Sometimes I think it's convenient for use, but I rarely use it."Micropython" has begun to attract attention recently.This is a limited Python, and the standard library and documentation are omitted to run on small memory of IoT.It is used for the purpose of making it smaller, so it is used when you want to move Python on a micro computer.This is increasingly used in IoT.
Nevertheless, unless you have a special reason, most of the cases are selected in "CPython", and most of them implemented as "Python" are for "CPython".
2.Version selection
Python had previously released a new version every 18 months, but released in 2020.After 9, it is decided to be autumn every year.Therefore, the next version is 3.The 11 release will be around the fall of October 2022.What functions are installed in Python will be determined which PEP is imported from the PEP on the PSF official website (Example: 3: 3)..10 Pep).3.There are 11 pages, but at this time the schedule is still draft.When the content is determined, the release manager is in the form of adding it.
The question is which version of Python should be used, but I've been using it about six months after the latest version appeared.The library and the environment are not necessary to raise the version because the latest versions are available.
I think that Docker, which is increasing in recent years, can be used without any problems, but if you want to move it on EC2 or Windows, you do not need to increase the version.The maintenance period of Python is 5 years, and since it is basically backward compatibility, it rarely stops working unless it is Python2 and Python3.However, 3.There are rare cases where the number of reservations is increasing in 7, so it does not move because of that.Nevertheless, in most cases, the location of the library changes or has been remodeled, so it will work with a little modification.If you want to use a new feature or change the library response status, it is better to change it early, but unless you are not, let's upgrade within 5 years.
By the way, it may be misunderstood that multiple versions cannot be put on the same OS.In fact, the micro version is not mixed, but the official installer can coexist the minor version.Example) Version 3.9.8: 3 = major, 9 = minor, 8 = Micro
3.How to install
The official installer provided by PSF is available.Other than that, there are people who use the official version by using source compiling, those who use the OS package manager (APT, DNF, Brew), and install various packages at anaconda.I recommend the official installer.In the case of Linux, we use source compilation, but some people use APTs, and sometimes use package managers.
As of 2017, ANACONDA was easy to install because the science and technology calculation package was bundled, so it was easy to do a science and technology calculation system in a Windows environment.However, five years later, it is now possible to install with the official version and PIP without using Anaconda in Windows environment.On the other hand, it is important to note that Anaconda is charged when used in large companies, and the license form has become complicated.In addition, unlike the official version that is easy to support the community, the hurdle is high because there are many points.
4.Virtual environment
A story limited to the virtual environment of the Python layer, the virtualization and container of the OS can be different, but you can create multiple Python environments on one OS, and you can classify the Python library to be used, and on the OS.Most of the time, the global Python environment can be maintained cleanly, so in recent years, each project and for each task you want to do, it is almost always a virtual environment.
5.installer
When introducing a third -party package, use the pip command included with Python.Downloading packages such as Pillow for image processing, Flask for Web framework, and Pandas for data analysis is often done from Pypi.I install it after activating the virtual environment, so I enable the virtual environment, then driven the command to install the necessary packages to prepare the environment.
・Wheelで楽になった環境構築Wheelはバイナリパッケージを1ファイルにするもので、ビルド済みの配布用パッケージを準備してくれます。PyPIからpipコマンドでインストールする場合、ファイルを落とし、展開し、自分でインストールするのが一般的でしたが、Wheelでアップロードされていればインストールを楽に終えることができます。たとえば、Pillowは依存関係が難しいのですが、依存関係で必要なものをすべて取りそろえた形でパッケージ化して保存してくれているのがWheelです。Windows用、macOS用、Linux用とそれぞれのパッケージに必要な環境が取り揃えられており、どのような環境でも構築が容易になりました。pipコマンドは自身の環境を見て必要なものを落としてきてくれるので普段は意識する必要はありませんが、Wheelのことを知らない方が意外と多いようでした。
6.editor
Please refer to the editor in the previous column.There are no particular restrictions, but I think it is better to use an integrated environment at first.Try it and choose something that is easy to use.If you get lost, you may want to use a vs code or a paid version of Pycharm.
bonus
As an extra information, I will also introduce the environment I usually use.I usually handle Mac and Linux, and I have multiple versions.Please try to reference.
Windows | macOS | Linux | |
---|---|---|---|
1.implementation | CPython | CPython | CPython |
2.Pythonバージョン | 3.9 | 3.8、3.9、3.10 | 3.6、3.7、3.8、3.9 |
3.How to install | 公式installer | 公式installer | ソースビルド/opt |
4.Virtual environment | venv | venv | venv |
5.パッケージインストール | pip | pip | pip |
6.editor | VS Code | VS Code | VS Code |
This story is also published as a material.If you are interested, please check here.
当協会の最新情報は公式サイトか、公式Facebookページでご覧いただけます。FacebookページではPythonに関連したニュースもお知らせしていますので、ぜひフォローしてみてください。また、YouTubeチャンネル「Pythonエンジニア認定試験」では、私が試験概要や学習のコツをお話ししたものや、合格した方のコメント動画を公開しています。こちらもぜひご覧ください。[PR] Provided: Python Engineer Training Promotion Association