Skip to content

Commit

Permalink
update zenodo
Browse files Browse the repository at this point in the history
  • Loading branch information
jackaraz committed Jan 26, 2024
1 parent 1801781 commit e2dca41
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 14 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,8 @@ dmypy.json

# sphinx documentation
docs/_build
docs/_generated
docs/_generated
_old/*
notebooks/*
bin/*
docs/ZENODO.rst
41 changes: 41 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"description": "smooth inference for reinterpretation studies",
"license": "MIT",
"title": "SpeysideHEP/spey: v0.1.5",
"version": "v0.1.5",
"upload_type": "software",
"creators": [
{
"affiliation": "Thomas Jefferson National Accelerator Facility",
"name": "Araz, Jack Y.",
"orcid": "0000-0001-8721-8042"
}
],
"access_right": "open",
"keywords": [
"physics",
"bsm",
"statistics",
"fitting",
"scipy",
"auto-differentiation"
],
"related_identifiers": [
{
"scheme": "url",
"identifier": "https://github.com/SpeysideHEP/spey/tree/v0.1.5",
"relation": "isSupplementTo"
},
{
"scheme": "url",
"identifier": "https://spey.readthedocs.io/",
"relation": "isDocumentedBy"
},
{
"scheme": "doi",
"identifier": "10.48550/arXiv.2307.06996",
"relation": "isDocumentedBy",
"resource_type": "publication-article"
}
]
}
13 changes: 2 additions & 11 deletions docs/citations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Citation

The BibTeX entry for citing ``spey`` including latest zenodo archive:

.. code-block:: BibTeX
.. code-block:: bibtex
@article{Araz:2023bwx,
author = "Araz, Jack Y.",
Expand All @@ -19,16 +19,7 @@ The BibTeX entry for citing ``spey`` including latest zenodo archive:
year = "2023"
}
@software{spey_zenodo,
author = {Jack Y. Araz},
title = {SpeysideHEP/spey: v0.1.5},
month = jan,
year = 2024,
publisher = {Zenodo},
version = {v0.1.5},
doi = {10.5281/zenodo.10569099},
url = {https://doi.org/10.5281/zenodo.10569099}
}
.. include:: ZENODO.rst

Use in Publications
-------------------
Expand Down
34 changes: 32 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

from pathlib import Path
import re
import sys
import warnings
from pathlib import Path

from pkg_resources import get_distribution

sys.path.insert(0, str(Path("./ext").resolve()))
Expand Down Expand Up @@ -43,7 +46,7 @@
"sphinx_togglebutton",
"xref",
# "myst_parser",
"sphinx_rtd_size",
# "sphinx_rtd_size",
"myst_nb",
]
nb_execution_mode = "off"
Expand Down Expand Up @@ -176,3 +179,30 @@
"manual",
)
]

# adapted from https://astrodata.nyc/posts/2021-04-23-zenodo-sphinx/
zenodo_path = Path("ZENODO.rst")
if not zenodo_path.exists():
import textwrap

try:
import requests

headers = {"accept": "application/x-bibtex"}
response = requests.get(
"https://zenodo.org/api/records/10156353", headers=headers, timeout=5
)
response.encoding = "utf-8"

txt = response.text
linker = re.search("@software{(.+?),\n", txt).group(1)
txt = txt.replace(linker, "spey_zenodo")
zenodo_record = ".. code-block:: bibtex\n\n" + textwrap.indent(txt, " " * 4)
except Exception as e:
warnings.warn("Failed to retrieve Zenodo record for Spey: " f"{str(e)}")
zenodo_record = (
"`Retrieve the Zenodo record here. <https://zenodo.org/record/10156353>`_"
)

with open(zenodo_path, "w", encoding="utf-8") as f:
f.write(zenodo_record)
2 changes: 2 additions & 0 deletions docs/outreach.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Talks

* - Date
- Event
* - February 15, 2024
- `Electroweak and Beyond the Standard Model Physics at the EIC <https://www.int.washington.edu/program/schedule/24-87W>`_
* - December 5, 2023
- `pyhf Users and Developers Workshop 2023 <https://indico.cern.ch/event/1294577/contributions/5685097/>`_
* - October 12, 2023
Expand Down

0 comments on commit e2dca41

Please sign in to comment.