Skip to content

Commit

Permalink
Merge pull request #109 from NNPDF/ekoversion
Browse files Browse the repository at this point in the history
Write down the versions for both eko and pineko
  • Loading branch information
scarlehoff authored Jul 21, 2023
2 parents 3310f43 + 11501be commit cd14829
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry]
name = "pineko"
Expand Down
1 change: 1 addition & 0 deletions src/pineko/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""pineko = PineAPPL + EKO."""
from .cli import command
from .version import __version__
8 changes: 8 additions & 0 deletions src/pineko/evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import os
import pathlib
from importlib import metadata

import eko
import eko.basis_rotation as br
Expand Down Expand Up @@ -136,6 +137,11 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard):
operators_card["configs"]["interpolation_polynomial_degree"] = 1
operators_card["xgrid"] = x_grid.tolist()

# Add the version of eko and pineko to the operator card
# using importlib.metadata.version to get the correct tag in editable mode
operators_card["eko_version"] = metadata.version("eko")
pineko_version = metadata.version("pineko")

# Some safety checks
if (
operators_card["configs"]["evolution_method"] == "truncated"
Expand All @@ -147,6 +153,8 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard):

with open(card_path, "w", encoding="UTF-8") as f:
yaml.safe_dump(operators_card, f)
f.write(f"# {pineko_version=}")

return operators_card["xgrid"], q2_grid


Expand Down

0 comments on commit cd14829

Please sign in to comment.