Skip to content

Commit 27adbf6

Browse files
authored
Merge pull request #17 from ssl-hep/main
Update branch from main
2 parents 9b55e7f + fdf347c commit 27adbf6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+6488
-7
lines changed

.github/workflows/pypi.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Publish package to PyPi
2+
3+
on:
4+
release:
5+
types: [released, prereleased]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Set up Python 3.12
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.12'
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v5
23+
24+
- name: Install python-build and twine
25+
run: |
26+
uv pip install --system build twine
27+
uv pip list --system
28+
29+
- name: Set env
30+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
31+
32+
- name: Update Version
33+
run: |
34+
sed -i 's/^version\s*=\s*".*"/version = "${{ env.RELEASE_VERSION }}"/' pyproject.toml
35+
sed -i '/__version__/ s/__version__\s*=.*/__version__ = "${{ env.RELEASE_VERSION }}"/' servicex_analysis_utils/__init__.py
36+
37+
38+
- name: Build a sdist and wheel
39+
run: |
40+
python -m build .
41+
42+
- name: Check dist
43+
run: twine check --strict dist/*
44+
45+
- name: List contents of sdist
46+
run: python -m tarfile --list dist/servicex_analysis_utils-*.tar.gz
47+
48+
- name: List contents of wheel
49+
run: python -m zipfile --list dist/servicex_analysis_utils-*.whl
50+
51+
- name: Upload an artifact of dist
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: dist-gha-artifact
55+
path: dist
56+
57+
publish:
58+
needs: build
59+
runs-on: ubuntu-latest
60+
61+
permissions:
62+
id-token: write # required to push with trusted-pypi-token
63+
64+
steps:
65+
- name: Set up Python 3.12
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: '3.12'
69+
70+
- name: Download artifact
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: dist-gha-artifact
74+
path: dist
75+
76+
- name: Publish distribution
77+
uses: pypa/gh-action-pypi-publish@v1.12.3
78+
with:
79+
print-hash: true
80+
81+
commit-version-bump:
82+
needs:
83+
- build
84+
- publish
85+
runs-on: ubuntu-latest
86+
permissions:
87+
contents: write # required to push with GITHUB_TOKEN
88+
89+
steps:
90+
- name: Checkout main branch
91+
uses: actions/checkout@v4
92+
with:
93+
ref: main
94+
95+
- name: Set up Python 3.12
96+
uses: actions/setup-python@v5
97+
with:
98+
python-version: '3.12'
99+
100+
- name: Set env
101+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
102+
103+
- name: Update version to commit
104+
run: |
105+
sed -i 's/^version\s*=\s*".*"/version = "${{ env.RELEASE_VERSION }}"/' pyproject.toml
106+
sed -i '/__version__/ s/__version__\s*=.*/__version__ = "${{ env.RELEASE_VERSION }}"/' servicex_analysis_utils/__init__.py
107+
108+
109+
- name: Commit version change
110+
run: |
111+
git config --local user.name "github-actions[bot]"
112+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
113+
git add ./pyproject.toml servicex_analysis_utils/__init__.py
114+
115+
# Check if there are changes to commit
116+
if ! git diff --cached --quiet; then
117+
echo "Changes detected, committing..."
118+
git commit -m "Update version to ${{ env.RELEASE_VERSION }}" --no-verify
119+
else
120+
echo "No changes to commit"
121+
fi
122+
123+
- name: Push commit to main
124+
# GITHUB_TOKEN is automatically provided
125+
run: |
126+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
127+
git push origin main

.readthedocs.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.12"
12+
13+
# Build documentation in the "docs/" directory with Sphinx
14+
sphinx:
15+
configuration: docs/conf.py
16+
# # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
17+
builder: html
18+
# Fail on all warnings to avoid broken references
19+
# fail_on_warning: true
20+
21+
# Optionally build your docs in additional formats such as PDF and ePub
22+
formats:
23+
- pdf
24+
25+
# Optional but recommended, declare the Python requirements required
26+
# to build your documentation
27+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
28+
python:
29+
install:
30+
- method: pip
31+
path: .
32+
extra_requirements:
33+
- docs

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# ServiceX analysis utils
2-
This repository provides analysis tools to be used with the [ServiceX Client](https://github.com/ssl-hep/ServiceX_frontend/tree/master)
2+
This repository hosts tools that depend on the [ServiceX Client](https://github.com/ssl-hep/ServiceX_frontend/tree/master). These tools facilitate `ServiceX`'s general usage and offer specific features that replace parts of an analyser workflow.
33

44
### To install
55
```
66
pip install servicex-analysis-utils
77
```
8+
#### Requirements
9+
This package depends requires a `servicex.yml` configuration file granting access to one endpoint with a deployed ServiceX backend.
810

9-
##### This package contains the to_awk() function:
11+
### This package contains:
12+
#### `to_awk()`:
1013
```
1114
Load an awkward array from the deliver() output with uproot or uproot.dask.
1215
@@ -22,5 +25,24 @@ Returns:
2225
dict: keys are sample names and values are awkward arrays, uproot generator objects or dask-awkward arrays.
2326
```
2427

28+
29+
#### `get-structure()`:
30+
31+
```
32+
Creates and sends the ServiceX request from user inputed datasets to retrieve file stucture.
33+
Calls print_structure_from_str() to dump the structure in a user-friendly format
34+
35+
Parameters:
36+
datasets (dict,str,[str]): The datasets from which to print the file structures.
37+
A name can be given as the key of each dataset in a dictionary
38+
kwargs : Arguments to be propagated to print_structure_from_str, e.g filter_branch
39+
```
40+
41+
Function can be called from the command line, e.g:
42+
43+
```
44+
$ servicex-get-structure "mc23_13TeV:some-dataset-rucio-id" --filter_branch "truth"
45+
```
46+
2547
## Documentation
26-
The different functions are documented in TBD
48+
The different functions are documented in [readthedcos](https://servicex-analysis-utils.readthedocs.io/en/latest/file_introspecting.html)

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
33.3 KB
Binary file not shown.
24.7 KB
Binary file not shown.

docs/_build/doctrees/index.doctree

8.3 KB
Binary file not shown.
8.11 KB
Binary file not shown.
21.5 KB
Binary file not shown.

docs/_build/html/.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: ca3626de684797951ef03443c45ac66f
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

0 commit comments

Comments
 (0)