Add a pure-python management module

Juan M Cruz-Martinez requested to merge scarlehoff/lhapdf:master into main

Note: I've moved the management scripts to https://github.com/scarlehoff/lhapdf_management

@agbuckley, as discussed in issue #4, it would be interesting for some projects to have access to the more basic features of LHAPDF (set management, maybe parsing .info file to know what's in there) in a pure-python package (for instance, if I don't need the interpolation features) which can be uploaded to pypi so no gcc management needed, system agnostic, etc.

I put a (at the moment separated) small module in a python_management folder.

At the moment it doesn't have all the features from the lhapdf script but only exactly the features I needed at this particular point. Once it is fully compatible with the lhapdf python script I guess it would make sense for the script and this package to become one and the same.

Here's a readme file with the currently supported features: https://gitlab.com/scarlehoff/lhapdf/-/blob/master/python_management/readme.md

I've also added a pyPI file so it can be easily used

    pip install lhapdf-management

It installs a script lhapdf_management which basically does the same as the lhapdf at Leading Order (and even Next to Leading order). There are a few features from the lhpadf script that I haven't implemented or I have done it a bit differently but it seems to do most of the stuff (that I often do).

Some technical notes and caveats:

  • The module is not doing anything magical, most of it is basically what was inside the lhapdf script with changes whenever the lhapdf interface was imported
  • I removed some/most python2 hiccups (now that debian stable is python3 I feel no need to keep old compatibility, I understand if this is a requirement though)
  • I don't currently have access to any cern cluster and I realise that's an important use case (and there are some parts of the script probably dedicated to dealing with it). I'll try to keep it working "by eye" but obviously can't truly test it.
  • It is currently separated from the installation of lhapdf but it should be easily done if necessary if people actually like it

Feature comparison with LHAPDF command line script [WIP]

The checked items are both done and checked that they produce the same result as the lhapdf script via a test in the regression_testing folder.

list (ls)

  • Filter by glob-like pattern
  • -installed
  • --outdated
  • --codes

show

  • Filter by glob-like pattern

update

  • Updates the list of available PDFs

install (get)

  • Install by pattern
  • --dryrun Do not download
  • --upgrade Force reinstall
  • --keep Keep the downloaded tarball
upgrade

This is basically install + --upgrade

Edited by Juan M Cruz-Martinez

Merge request reports