Package Distribution

PanDA packages are automatically built using hatch, and gz source distribution files (sdist files) are published to PyPI by GitHub actions when new release versions are tagged. Sdist is distributed instead of wheel for most PanDA packages since they need to generate configuration files and/or executables based on client’s environment. On the other hand, installation of those packages are still done thrugh the legacy setup.py inteface of pip by default to work with old Python or pip missing PEP 517 support. Internally pip invokes “python setup.py install” in this case. This is the reason why PanDA package repositories have the following structure:

root_dir
├── package
│   ├── hatch_build.py
│   └── pyproject.toml
├── setup.cfg
├── setup.py
└── ...

pyproject.toml will move to the root directly and setup.* will retire once all clients migrate to Python 3.7 or higher, so that pip will directly use hatching to install packages.



Installation

Installation with pip from PyPI

All PanDA packages are available on PyPI. It is generally enough to install PanDA packages using pip

pip install <package_name>

Installation with hatch from source tarball

Source tarballs are available in the Code Repositories.

hatch_build.py is included in the package directory implementing the build hooks to generate configuration files and/or executables according to client’s environment, and add them into wheel. Eventually pip uses wheel to install the package. Currently most PanDA end-users and system components are running with Python 3.6, so pyproject.toml is not placed in the root direct of the package to prevent pip from using hatch. Github actions use hatch to build and publish packages since higher version of Python is available there.

If you are using newer Python, download and extract a tarball, then

cd root_dir/package
pip install .

Installation with setup.py from source tarball

Although setup.py is becoming obsolete it is still supported and should be used with old Python.

cd root_dir
python setup.py install

or

cd root_dir
pip install .


panda-client

The panda-client package is special in terms of supported Python versions. It needs to support both Python 2.7 and 3.6 for a long period as they are the system Python versions on Scientific Linux CERN 6 and CentOS 7. Also, it is distributed as a full panda-client sdist and a lightweight panda-client-light wheel. The former is used for end-users and contains configuration files and executables in addition to package modules, while the latter is used for system components and contains only package modules. The repository has the following structure:

panda-client
├── packages
│   ├── hatch_build.py
│   ├── full
│   │   └── pyproject.toml
│   └── light
│       └── pyproject.toml
├── setup.cfg
├── setup.py
└── ...

./packages/full/pyproject.toml is used by a github action to build and publish sdist files for panda-client, and will move to the root dir once all end-users migrate to Python 3.7. To install panda-client from local sources, for old Python 3.6

python setup.py install

or for newer Python 3.7

cd packages/full
pip install .

On the other hand, green:./packages/light/pyproject.toml is used by the same github action to build and publish wheel files for panda-client-light. So it is enough to do

pip install panda-client-light