- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
Distribute CLI in a Python package #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If taken directly from the environment, it will lose all the additions made by the Nix packages Accessing the value from the configuration will always improve self-consistency
Just run a shell export command right before entering the shell
| 
 It is possible to obtain the same results on MacOS and Windows (or it should be), but we have to do it "manually", i.e. by using different projects: | 
| Ok, now the problem is fully clear: 
 After confirming the  The executable issueThe path that is patched by  The problem results from a "quirk" of the wheel installation. While the content of the wheel is mostly just unpacked in  | 
| The patch mentioned is very simple, and it's just the following: | 
It ensures that the tools are available on every platform, since the script only makes use of Python standard library. Otherwise it was not even possible to rely on `wget` or `realpath`...
Apparently not available, t least with the given container.
| 
 Whether it's a cool is kind of debatable, the CI implementation (the runner) is proprietary and apparently convoluted (and hardly maintainable). But this is GitHub's business... 
 👌 
 Indeed, something like that. The action is pretty straightforward. 
 Thanks for your effort. I'd also like to see it, it'd be the perfect distribution for PineAPPL. 
 I'm pretty sure you can not, or not in the sense you have in mind. I believe the standard is drifting towards document CLIs through  | 
| OK, building the CLI works now both on Linux and macOS with all features. If you like to give it a try, @alecandido, download the artifacts from this page: https://github.com/NNPDF/pineappl/actions/runs/9713856339, called  | 
| I didn't benchmark the results, but other than that it worked out of the box! 🎉 🎊 On my MacOS laptop (Apple Silicon)❯ : pip install pineappl_cli-0.7.4-cp311-cp311-macosx_11_0_arm64.whl
Processing ./pineappl_cli-0.7.4-cp311-cp311-macosx_11_0_arm64.whl
Installing collected packages: pineappl-cli
Successfully installed pineappl-cli-0.7.4
[notice] A new release of pip is available: 24.0 -> 24.1
[notice] To update, run: pip install --upgrade pip
donaldville in qibolab/pine on  propagate-serialization [?] via 🐍 v3.11.9 (qibolab-py3.11) via ❄  impu
re (devenv-shell-env)
❯ : pineappl
Read, write, and query PineAPPL grids
Usage: pineappl [OPTIONS] <COMMAND>
Commands:
  analyze   Perform various analyses with grids
  channels  Shows the contribution for each partonic channel
  convolve  Convolutes a PineAPPL grid with a PDF set
  diff      Compares the numerical content of two grids with each other
  evolve    Evolve a grid with an evolution kernel operator to an FK table
  export    Converts PineAPPL grids to APPLgrid files
  help      Display a manpage for selected subcommands
  import    Converts APPLgrid/fastNLO/FastKernel files to PineAPPL grids
  merge     Merges one or more PineAPPL grids together
  orders    Shows the predictions for all bin for each order separately
  plot      Creates a matplotlib script plotting the contents of the grid
  pull      Calculates the pull between two different PDF sets
  read      Read out information of a grid
  subgrids  Print information about the internal subgrid types
  uncert    Calculate scale and convolution function uncertainties
  write     Write a grid modified by various operations
Options:
      --lhapdf-banner          Allow LHAPDF to print banners
      --force-positive         Forces negative PDF values to zero
      --allow-extrapolation    Allow extrapolation of PDFs outside their region of validity
      --use-alphas-from <IDX>  Choose the PDF/FF set for the strong coupling [default: 0]
  -h, --help                   Print help
  -V, --version                Print version
                                                                                                        
donaldville in qibolab/pine on  propagate-serialization [?] via 🐍 v3.11.9 (qibolab-py3.11) via ❄  impu
re (devenv-shell-env)
❯ : wget https://github.com/NNPDF/pineapplgrids/raw/master/LHCB_DY_7TEV.pineappl.lz4
--2024-06-29 00:03:24--  https://github.com/NNPDF/pineapplgrids/raw/master/LHCB_DY_7TEV.pineappl.lz4
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://media.githubusercontent.com/media/NNPDF/pineapplgrids/master/LHCB_DY_7TEV.pineappl.lz4 [following]
--2024-06-29 00:03:24--  https://media.githubusercontent.com/media/NNPDF/pineapplgrids/master/LHCB_DY_7TEV.pineappl.lz4
Resolving media.githubusercontent.com (media.githubusercontent.com)... 2606:50c0:8002::154, 2606:50c0:8000::154, 2606:50c0:8001::154, ...
Connecting to media.githubusercontent.com (media.githubusercontent.com)|2606:50c0:8002::154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2651929 (2,5M) [application/octet-stream]
Saving to: ‘LHCB_DY_7TEV.pineappl.lz4’
LHCB_DY_7TEV.pineappl.lz4 100%[=====================================>]   2,53M  --.-KB/s    in 0,1s
2024-06-29 00:03:25 (19,8 MB/s) - ‘LHCB_DY_7TEV.pineappl.lz4’ saved [2651929/2651929]
                                                                                                        
donaldville in qibolab/pine on  propagate-serialization [?] via 🐍 v3.11.9 (qibolab-py3.11) via ❄  impu
re (devenv-shell-env)
❯ : pineappl convolve LHCB_DY_7TEV.pineappl.lz4 CT10
b      yll      dsig/dyll
       []          [pb]
--+-----+-----+------------
 0     2 2.125  6.8161988e0
 1 2.125  2.25  1.9686682e1
 2  2.25 2.375  3.1367695e1
 3 2.375   2.5  4.1805491e1
 4   2.5 2.625  5.0276912e1
 5 2.625  2.75  5.6466578e1
 6  2.75 2.875  6.0112492e1
 7 2.875     3  6.0884635e1
 8     3 3.125  5.8721908e1
 9 3.125  3.25  5.3426156e1
10  3.25 3.375  4.4304837e1
11 3.375   3.5  3.2921399e1
12   3.5 3.625  2.2220291e1
13 3.625  3.75  1.3296498e1
14  3.75 3.875  6.8639432e0
15 3.875     4  2.8308688e0
16     4  4.25 5.3394142e-1 | 
| OK, ideally commit e408b2b takes care of the publishing. @alecandido, do you think this will work? I wonder if two things are correct: 
 I could merge this PR and make prelease to test it, but I wonder whether there's a better idea. The Windows wheels have lower priority as its not quite clear if that works at all, but I kept the workflow file as  | 
| Concerning 1. I'm definitely surprised, it's the first time I hear something like the platform asking for the workflow name. To the best of my understanding, the only thing that should have an impact is the scope of the token you're using, and, in case it's not "Entire account (all projects)" which projects you selected. Regarding 2., maybe there would be no problem, because  Moreover, I'd consider using the PyPA action. Maturin is a great project, used by many people, and well-maintained (mainly by only two people, but for the time being definitely reliable). However, I believe that  
 Unfortunately, the alternatives are unsatisfactory: you could manually trigger, but commenting all the filters for release events. Or locally test, attempting to reproduce the actions. Or use https://github.com/nektos/act, possibly making an effort to make it work (and possibly failing). | 
| It works: https://pypi.org/project/pineappl-cli/0.8.0a4/! I'm merging this now. | 

Supersedes #179
Unfortunately, it is definitely not possible to use the provided
maturin-action, because of missing libraries.I will try to use
maturinin the CI, making use of thepineappl-cicontainer, and the relatedscript.shfor the builds that should happen on the host.However, I should first solve the problem of dispatching libraries in the wheel. It seemed it was happening automatically before, or I forgot some steps...