This is a minimal template project using Pants:
- No subproject
- Only one fixed set of python dependencies
- With IDE support
For demo project with multiple subprojects and dependencies sets, see pants-pyspark.
Please use apt or homebrew to install Python on Linux or macOS.
When the specific Python version is not available, you can always install Python via xmake:
xmake config --yes
xmake install python
pants run hello.py
In this template project, there is only one resolve (a set of python dependencies) called python-default
.
And we add pandas==2.0.0
as an example dependency in BUILD.pants
Do not forgot to generate the lockfile (3rdparty/python/default.lock) for you own projects.
bin/lock
pants export ::
The specific python version might be 3.10.1
or others.
Wrote virtualenv for the resolve 'python-default' (using Python 3.10.6) to dist/export/python/virtualenvs/python-default
Here is the Python interpreter generated by the above export command:
dist/export/python/virtualenvs/python-default/3.10.6/bin/python
For VSCode, a sample .vscode/settings.json with Python 3.10.6
is prepared for you.
For PyCharm, please click PyCharm -> Preferences... -> Project: pants-minimal -> Python Interpreter
to add the existing Virtualenv Environment
and then select it.