Skip to content

Commit dd3415d

Browse files
committed
global: changes for YODA1 format and other updates
* Changes needed to work with hepdata-converter v0.3.0 release. * Upgrade actions to their latest versions and switch to Python 3.10. * Rename 'master' branch to 'main'. * Switch to PyPI's trusted publishing. * Remove dependence on 'distlib' and unpin 'flask' and 'sentry-sdk'. * Use file extension .yoda for both YODA1 and YODA2 formats. * Bump version to 0.3.0 for new release.
1 parent cff1377 commit dd3415d

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 15 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:
2828
DOCKER_IMAGE: hepdata/hepdata-converter
2929
run: |
3030
export CURRENT_PATH=`pwd`
31-
docker run -v $CURRENT_PATH:$CURRENT_PATH hepdata/hepdata-converter /bin/bash -c "cd $CURRENT_PATH && pip3 install -I -e .[tests] && coverage run -m unittest discover hepdata_converter_ws/testsuite 'test_*'"
32-
docker run -v $CURRENT_PATH:$CURRENT_PATH hepdata/hepdata-converter /bin/bash -c "cd $CURRENT_PATH && pip3 install -I -e . && hepdata-converter-ws -v"
31+
docker run -v $CURRENT_PATH:$CURRENT_PATH hepdata/hepdata-converter /bin/bash -c "cd $CURRENT_PATH && pip install -e '.[tests]' && hepdata-converter-ws -v && coverage run -m unittest discover hepdata_converter_ws/testsuite 'test_*'"
3332
- name: Run coveralls
3433
env:
3534
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -41,17 +40,18 @@ jobs:
4140
needs: test
4241
if: github.event_name == 'release'
4342
runs-on: ubuntu-latest
43+
environment:
44+
name: pypi
45+
url: https://pypi.org/p/hepdata-converter-ws
46+
permissions:
47+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
4448
steps:
45-
- uses: actions/checkout@v2
49+
- uses: actions/checkout@v4
4650
- name: Build PyPI package
4751
env:
4852
DOCKER_IMAGE: hepdata/hepdata-converter
4953
run: |
5054
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"
55+
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && pip install wheel && python setup.py sdist bdist_wheel"
5356
- name: Publish distribution to PyPI
54-
uses: pypa/gh-action-pypi-publish@master
55-
with:
56-
user: __token__
57-
password: ${{ secrets.PYPI_PASSWORD }}
57+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[![GitHub Actions Status](https://github.com/HEPData/hepdata-converter-ws/workflows/Continuous%20Integration/badge.svg?branch=master)](https://github.com/HEPData/hepdata-converter-ws/actions?query=branch%3Amaster)
2-
[![Coveralls Status](https://coveralls.io/repos/github/HEPData/hepdata-converter-ws/badge.svg?branch=master)](https://coveralls.io/github/HEPData/hepdata-converter-ws?branch=master)
3-
[![License](https://img.shields.io/github/license/HEPData/hepdata-converter-ws.svg)](https://github.com/HEPData/hepdata-converter-ws/blob/master/LICENSE.txt)
1+
[![GitHub Actions Status](https://github.com/HEPData/hepdata-converter-ws/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/HEPData/hepdata-converter-ws/actions?query=branch%3Amain)
2+
[![Coveralls Status](https://coveralls.io/repos/github/HEPData/hepdata-converter-ws/badge.svg?branch=main)](https://coveralls.io/github/HEPData/hepdata-converter-ws?branch=main)
3+
[![License](https://img.shields.io/github/license/HEPData/hepdata-converter-ws.svg)](https://github.com/HEPData/hepdata-converter-ws/blob/main/LICENSE.txt)
44
[![GitHub Releases](https://img.shields.io/github/release/hepdata/hepdata-converter-ws.svg?maxAge=2592000)](https://github.com/HEPData/hepdata-converter-ws/releases)
55
[![PyPI Version](https://img.shields.io/pypi/v/hepdata-converter-ws)](https://pypi.org/project/hepdata-converter-ws/)
66
[![GitHub Issues](https://img.shields.io/github/issues/hepdata/hepdata-converter-ws.svg?maxAge=2592000)](https://github.com/HEPData/hepdata-converter-ws/issues)
@@ -30,7 +30,7 @@ input: Base64 encoded tar.gz file containing hepdata-converter-ws-data entry (di
3030
id: str used for caching purposes (same input files have to have same ID), not implemented?
3131
options: dictionary with options accepted by hepdata_converter.convert function. The most important are:
3232
input_format: (input format identifier e.g. yaml, oldhepdata, etc.)
33-
output_format: (output format identifier e.g. yaml, root, yoda, csv, etc.)
33+
output_format: (output format identifier e.g. yaml, root, yoda, yoda1, csv, etc.)
3434
other options are dependent on the input / output format and are documented in their respective parsers / readers
3535
in https://github.com/HEPData/hepdata-converter
3636
}
@@ -40,7 +40,7 @@ options: dictionary with options accepted by hepdata_converter.convert function.
4040

4141
The response has MIME type `application/x-gzip` and is a tar.gz file
4242
containing the hepdata-converter-ws-data directory with the
43-
requested file / files.
43+
requested file/files.
4444

4545

4646
## API Usage

hepdata_converter_ws/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
__author__ = 'Michał Szostak'
1515

16-
SINGLEFILE_FORMATS = ['root', 'yoda']
16+
SINGLEFILE_FORMATS = ['root', 'yoda', 'yoda1']
1717

1818

1919
@api.route('/debug-sentry')
@@ -60,6 +60,7 @@ def convert():
6060
kwargs.get('options', {}))
6161

6262
if not os.path.isdir(conversion_output):
63+
output_format = output_format[:-1] if output_format == 'yoda1' else output_format
6364
archive_name = archive_name + '.' + output_format
6465

6566
with tarfile.open(mode='w:gz', fileobj=output) as tar:

hepdata_converter_ws/testsuite/test_server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- encoding: utf-8 -*-
22
from io import BytesIO
3-
from distlib._backport import tarfile
43
import os
54
import tarfile
65
from flask import jsonify, json

hepdata_converter_ws/version.py

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

33
# this file ideally should only contain __version__ declaration, as anything else
44
# may break setup.py and PyPI uploads
5-
__version__ = '0.2.0'
5+
__version__ = '0.3.0'

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import re
44

55
test_requirements = [
6-
'distlib',
6+
'coverage',
77
]
88

99
extras_require = {
@@ -29,9 +29,9 @@ def get_version():
2929
name='hepdata-converter-ws',
3030
version=get_version(),
3131
install_requires=[
32-
'hepdata-converter>=0.2',
33-
'flask>=1.1.1,<2',
34-
'sentry-sdk[flask]==0.15.1'
32+
'hepdata-converter>=0.3',
33+
'flask',
34+
'sentry-sdk[flask]',
3535
],
3636
extras_require=extras_require,
3737
tests_require=test_requirements,

0 commit comments

Comments
 (0)