Skip to content

Commit 4ba4845

Browse files
authored
Merge pull request #53 from 20DM/yoda2_writer
YODA2 writer
2 parents 3f0330d + 61efe92 commit 4ba4845

32 files changed

+130961
-257
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Continuous Integration
33
on:
44
push:
55
pull_request:
6-
branches: [ master ]
6+
branches: [ main ]
77
release:
88
types: [ published ]
99

@@ -14,22 +14,21 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v2
18-
- name: Set up Python 3.8
19-
uses: actions/setup-python@v2
17+
- uses: actions/checkout@v4
18+
- name: Set up Python 3.10
19+
uses: actions/setup-python@v4
2020
with:
21-
python-version: 3.8
21+
python-version: '3.10'
2222
- name: Install pip dependencies
2323
run: |
2424
pip install --upgrade pip
25-
pip install --ignore-installed coveralls
25+
pip install coveralls
2626
- name: Run tests
2727
env:
28-
DOCKER_IMAGE: hepdata/hepdata-converter:0.2.0
28+
DOCKER_IMAGE: hepdata/hepdata-converter:latest
2929
run: |
3030
export CURRENT_PATH=`pwd`
31-
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && coverage run -m unittest discover hepdata_converter/testsuite 'test_*'"
32-
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && python3 setup.py install && hepdata-converter -v"
31+
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && pip install -e '.[tests]' && hepdata-converter -v && coverage run -m unittest discover hepdata_converter/testsuite 'test_*'"
3332
- name: Run coveralls
3433
env:
3534
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -42,14 +41,14 @@ jobs:
4241
if: github.event_name == 'release'
4342
runs-on: ubuntu-latest
4443
steps:
45-
- uses: actions/checkout@v2
44+
- uses: actions/checkout@v4
4645
- name: Build PyPI package
4746
env:
48-
DOCKER_IMAGE: hepdata/hepdata-converter:0.2.0
47+
DOCKER_IMAGE: hepdata/hepdata-converter:latest
4948
run: |
5049
export CURRENT_PATH=`pwd`
51-
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && pip3 install wheel"
52-
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && python3 setup.py sdist bdist_wheel"
50+
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && pip install wheel"
51+
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && python setup.py sdist bdist_wheel"
5352
- name: Publish distribution to PyPI
5453
uses: pypa/gh-action-pypi-publish@master
5554
with:

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,7 @@ README.html
5858
target/
5959

6060
.idea
61-
MANIFEST
61+
MANIFEST
62+
63+
# venv
64+
venv/

.readthedocs.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,27 @@
55
# Required
66
version: 2
77

8-
# Build documentation in the docs/ directory with Sphinx
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.10"
13+
14+
# Build documentation in the "docs/" directory with Sphinx
915
sphinx:
1016
configuration: docs/conf.py
17+
# Fail on all warnings to avoid broken references
18+
fail_on_warning: true
1119

1220
# Optionally build your docs in additional formats such as PDF and ePub
1321
formats: all
1422

15-
# Optionally set the version of Python and requirements required to build your docs
23+
# Optional but recommended, declare the Python requirements required
24+
# to build your documentation
25+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
1626
python:
17-
version: 3.7
1827
install:
19-
- method: pip
20-
path: .
21-
extra_requirements:
22-
- docs
28+
- method: pip
29+
path: .
30+
extra_requirements:
31+
- docs

README.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ HEPData Converter
33
=================
44

55

6-
.. image:: https://github.com/HEPData/hepdata-converter/workflows/Continuous%20Integration/badge.svg?branch=master
7-
:target: https://github.com/HEPData/hepdata-converter/actions?query=branch%3Amaster
6+
.. image:: https://github.com/HEPData/hepdata-converter/actions/workflows/ci.yml/badge.svg?branch=main
7+
:target: https://github.com/HEPData/hepdata-converter/actions?query=branch%3Amain
88
:alt: GitHub Actions Build Status
99

10-
.. image:: https://coveralls.io/repos/github/HEPData/hepdata-converter/badge.svg?branch=master
11-
:target: https://coveralls.io/github/HEPData/hepdata-converter?branch=master
10+
.. image:: https://coveralls.io/repos/github/HEPData/hepdata-converter/badge.svg?branch=main
11+
:target: https://coveralls.io/github/HEPData/hepdata-converter?branch=main
1212
:alt: Coveralls Status
1313

1414
.. image:: https://img.shields.io/github/license/HEPData/hepdata-converter.svg
15-
:target: https://github.com/HEPData/hepdata-converter/blob/master/LICENSE.txt
15+
:target: https://github.com/HEPData/hepdata-converter/blob/main/LICENSE.txt
1616
:alt: License
1717

1818
.. image:: https://img.shields.io/github/release/hepdata/hepdata-converter.svg?maxAge=2592000
@@ -34,11 +34,11 @@ HEPData Converter
3434

3535
This Python 3 library provides support for converting:
3636

37-
* Old HepData input format (`sample <https://github.com/HEPData/hepdata-submission/blob/master/examples/oldhepdata/sample.oldhepdata>`_) to `YAML <https://github.com/HEPData/hepdata-submission>`_
37+
* Old HepData input format (`sample <https://github.com/HEPData/hepdata-submission/blob/main/examples/oldhepdata/sample.oldhepdata>`_) to `YAML <https://github.com/HEPData/hepdata-submission>`_
3838
* `YAML <https://github.com/HEPData/hepdata-submission>`_ to:
3939

40-
* `ROOT <https://root.cern.ch>`_ (tested with v6.22/02)
41-
* `YODA <https://yoda.hepforge.org>`_ (tested with v1.8.3)
40+
* `ROOT <https://root.cern.ch>`_ (tested with v6.28/04)
41+
* `YODA <https://yoda.hepforge.org>`_ (tested with v2.0.0alpha)
4242
* `CSV <https://en.wikipedia.org/wiki/Comma-separated_values>`_
4343

44-
Documentation: http://hepdata-converter.readthedocs.io
44+
Documentation: https://hepdata-converter.readthedocs.io

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33

44
# You can set these variables from the command line.
5-
SPHINXOPTS =
5+
SPHINXOPTS = -W --keep-going
66
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build

docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __getattr__(cls, name):
7474
master_doc = 'index'
7575

7676
# General information about the project.
77-
project = u''
77+
project = u'HEPData Converter'
7878
copyright = u'2016, CERN'
7979
author = u'CERN'
8080

@@ -98,7 +98,7 @@ def __getattr__(cls, name):
9898
#
9999
# This is also used if you do content translation via gettext catalogs.
100100
# Usually you set "language" from the command line for these cases.
101-
language = None
101+
language = 'en'
102102

103103
# There are two options for replacing |today|: either, you set today to some
104104
# non-false value, then it is used:
@@ -167,7 +167,7 @@ def __getattr__(cls, name):
167167

168168
# The name for this set of Sphinx documents. If None, it defaults to
169169
# "<project> v<release> documentation".
170-
#html_title = None
170+
html_title = f"{project} v{version} documentation"
171171

172172
# A shorter title for the navigation bar. Default is the same as html_title.
173173
#html_short_title = None
@@ -340,4 +340,4 @@ def __getattr__(cls, name):
340340

341341

342342
# Example configuration for intersphinx: refer to the Python standard library.
343-
intersphinx_mapping = {'https://docs.python.org/2/': None}
343+
intersphinx_mapping = {'python': ('https://docs.python.org/3/', None)}

docs/installation.rst

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ alternative output formats via the web interface.
3333

3434
To install this package locally, you first need to install `YODA <https://yoda.hepforge.org>`_ and
3535
`ROOT <https://root.cern.ch>`_ (including `PyROOT <https://root.cern/manual/python/>`_). Check that you can
36-
``import yoda`` and ``import ROOT`` from Python. You might want to install into a dedicated virtual
37-
environment:
36+
``import yoda`` and ``import ROOT`` from Python. You might want to install into a dedicated `virtual environment
37+
<https://docs.python.org/3/tutorial/venv.html>`_:
3838

3939
.. code-block:: console
4040
41-
$ mkvirtualenv hepdata-converter
41+
$ python3 -m venv hepdata-converter
42+
$ source hepdata-converter/bin/activate
4243
(hepdata-converter)$ pip install hepdata-converter
4344
4445
This will install the latest released version from `PyPI <https://pypi.python.org/pypi/hepdata-converter>`_.
@@ -52,17 +53,30 @@ Developers might want to instead install the project directly from
5253

5354
.. code-block:: console
5455
55-
$ workon hepdata-converter
56-
(hepdata-converter)$ git clone https://github.com/HEPData/hepdata-converter
57-
(hepdata-converter)$ cd hepdata-converter
58-
(hepdata-converter)$ pip install -e .
56+
$ git clone https://github.com/HEPData/hepdata-converter
57+
$ cd hepdata-converter
58+
$ python3 -m venv venv
59+
$ source venv/bin/activate
60+
(venv)$ pip install -e '.[tests]'
5961
6062
Developers can then run the tests with the following command:
6163

6264
.. code:: bash
6365
6466
python -m unittest discover hepdata_converter/testsuite 'test_*'
6567
68+
The documentation can be built locally in the virtual environment using Sphinx:
69+
70+
.. code:: console
71+
72+
(venv)$ pip install -e '.[docs]'
73+
(venv)$ cd docs
74+
(venv)$ make html
75+
76+
Then view the output by opening a web browser at ``_build/html/index.html``.
77+
Developers should also check that they can successfully build other formats using ``make latexpdf`` and ``make epub``.
78+
All three formats will be built by *Read the Docs* for the ``main`` branch on GitHub.
79+
6680

6781
Docker
6882
------
@@ -80,9 +94,9 @@ The ``hepdata-converter`` package can be installed inside the Docker container:
8094

8195
.. code-block:: console
8296
83-
root@617be04cbab5:/# pip3 install --ignore-installed hepdata-converter
97+
root@617be04cbab5:/# pip install hepdata-converter
8498
root@617be04cbab5:/# hepdata-converter -h
85-
root@617be04cbab5:/# python3 -c 'import hepdata_converter'
99+
root@617be04cbab5:/# python -c 'import hepdata_converter'
86100
87101
Note that the Docker container will be automatically removed when it exits (if running with the ``--rm`` option). The
88102
Python module or CLI can then be used as described in :doc:`Usage <usage>`. Input and output files can be moved
@@ -105,7 +119,7 @@ mount the current directory of the local filesystem when running the Docker cont
105119
$ git clone https://github.com/HEPData/hepdata-converter
106120
$ cd hepdata-converter
107121
$ docker run -v $PWD:$PWD -w $PWD --rm -it hepdata/hepdata-converter /bin/bash
108-
root@2c22e88402d2:/hepdata-converter# python3 -m unittest discover hepdata_converter/testsuite 'test_*'
109-
root@2c22e88402d2:/hepdata-converter# pip3 install -e .
122+
root@2c22e88402d2:/hepdata-converter# pip install -e '.[tests]'
110123
root@2c22e88402d2:/hepdata-converter# hepdata-converter -h
111-
root@2c22e88402d2:/hepdata-converter# python3 -c 'import hepdata_converter'
124+
root@2c22e88402d2:/hepdata-converter# python -c 'import hepdata_converter'
125+
root@2c22e88402d2:/hepdata-converter# python -m unittest discover hepdata_converter/testsuite 'test_*'

docs/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Usage
2626
=====
2727

2828
The library exposes a single function ``convert`` which enables conversion from different input formats
29-
(``oldhepdata``, ``yaml``) to different output formats (``csv``, ``root``, ``yaml``, ``yoda``), by using a simple in-memory
29+
(``oldhepdata``, ``yaml``) to different output formats (``csv``, ``root``, ``yaml``, ``yoda``, ``yoda1``), by using a simple in-memory
3030
intermediary format.
3131

3232

hepdata_converter/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
def convert(input, output=None, options={}):
1111
"""Converts a supported ``input_format`` (*oldhepdata*, *yaml*)
12-
to a supported ``output_format`` (*csv*, *root*, *yaml*, *yoda*).
12+
to a supported ``output_format`` (*csv*, *root*, *yaml*, *yoda*, *yoda1*).
1313
1414
:param input: location of input file for *oldhepdata* format or input directory for *yaml* format
1515
:param output: location of output directory to which converted files will be written

0 commit comments

Comments
 (0)