Skip to content

da-tubi/pants-minimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal template project for Python projects using Pants

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.

How to install Python

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

How to run?

pants run hello.py

Dependency Management

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

VSCode/PyCharm Integration

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published