Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I actually lost that there was also a back-end support. Thanks @scarlehoff!


[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=}")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was not what you wanted to write, but:

Suggested change
f.write(f"# {pineko_version=}")
f.write(f"# pineko_version={pineko_version}")

(mainly because of the =, that makes little sense without : and a width)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{pineko_version=} is shorthand for pineko_version={pineko_version}

But I can do pineko_version: {pineko_version} instead if you prefer the : (it's a comment so it doesn't really matter how is it written)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, great. I forgot about this option.

The reference to the : was only because = can be used as a format specifier, but the specifiers should be separated by the identifier with the :.

It is fine as it is.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, it was new in py3.8, that by now it is perfectly fine (py3.7 officially died one month ago).
https://docs.python.org/3/whatsnew/3.8.html#bpo-36817-whatsnew


return operators_card["xgrid"], q2_grid


Expand Down