Skip to content

Commit

Permalink
Merge pull request #54 from DeepLearnPhysics/docs
Browse files Browse the repository at this point in the history
Docs update
  • Loading branch information
coreyjadams committed Sep 14, 2022
2 parents 701e3ed + ebcde8f commit eac2abb
Show file tree
Hide file tree
Showing 52 changed files with 979 additions and 1,328 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine pytest
sudo apt-get install libhdf5-serial-dev
pip install -r requirements.txt
git submodule update --init
# - name: Build manylinux Python wheels
# uses: RalfG/python-wheels-manylinux-build@v0.5.0-manylinux2014_x86_64
# with:
# python-versions: 'cp36-cp36m'
# build-requirements: 'scikit-build numpy h5py cmake'
# system-packages: 'hdf5-devel'
# # pre-build-command: 'sh pre-build-script.sh'
# # package-path: 'my_project'
# # pip-wheel-args: '-w ./dist --no-deps'
- name: Build and publish Source Dist
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist
twine upload dist/*
32 changes: 32 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test Larcv

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine pytest
sudo apt-get install libhdf5-serial-dev
pip install -r requirements.txt
git submodule update --init
- name: Build and Install
run: |
python setup.py build -j 1
python setup.py install --user
- name: Test with pytest
run: |
pytest -m "not distributed_test" tests/
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions larcv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import os
from . _version import __version__

from . config_builder import ConfigBuilder

def get_includes():
return os.path.dirname(__file__) + "/include/"

Expand Down
2 changes: 1 addition & 1 deletion larcv/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.4.2"
__version__ = "3.4.2.2"
37 changes: 26 additions & 11 deletions larcv/config_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import uuid

class ConfigBuilder:
"""
Front-end to create configuration objects step by step.
"""


valid_datatypes = \
[ f"tensor{i+1}d" for i in range(4) ] + \
Expand All @@ -21,11 +25,18 @@ class ConfigBuilder:
def __init__(self):
self.config = larcv.QueueProcessor.default_config()

def get_config(self): return self.config
def get_config(self):
"""
Gets the configuration.
:returns: The configuration.
"""
return self.config

def set_parameter(self,value,*keys):
"""
Sets the parameter to value, walking into the config dictionare in the order of keys
Sets the parameter to value, walking into the config dictionary in the order of keys
:param value: The value
:type value: { type_description }
Expand All @@ -40,6 +51,10 @@ def set_parameter(self,value,*keys):
return

def print_config(self):
"""
Prints a configuration using json to format it.
"""
return json.dumps(self.config, indent=2)

def validate_datatype(self, datatype : str):
Expand Down Expand Up @@ -69,15 +84,15 @@ def add_preprocess(self, datatype : str, producer : str, process : str, name : s
"""
Adds a preprocess.
:param datatype: The datatype
:param datatype: The datatype of the input
:type datatype: str
:param producer: The producer
:param producer: The producer of the input
:type producer: str
:param process: The process
:param process: The process name
:type process: str
:param name: The name
:param name: The name of the process in the config (optional)
:type name: str
:param kwargs: The keywords arguments
:param kwargs: The keywords arguments to override and parameters in the preprocess
:type kwargs: dictionary
"""

Expand Down Expand Up @@ -148,13 +163,13 @@ def add_batch_filler(self, datatype : str, producer : str, name : str = "", **kw
"""
Adds a preprocess.
:param datatype: The datatype
:param datatype: The datatype to load into memory
:type datatype: str
:param producer: The producer
:param producer: The producer of the datatype
:type producer: str
:param name: The name
:param name: The name of the process in the config file (optional)
:type name: str
:param kwargs: The keywords arguments
:param kwargs: Any override arguments to the configuration
:type kwargs: dictionary
"""

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

[build-system]
requires = ["numpy", "scikit-build", "h5py", "cmake"]
14 changes: 5 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,15 @@
else:
pybind_value='ON'

if 'MAKE_DOCS' in os.environ and os.environ['MAKE_DOCS']:
docs_value='ON'
else:
docs_value='OFF'

# Speed up the build if not directly set:
if 'MAKEFLAGS' not in os.environ:
os.environ['MAKEFLAGS'] = "-j"
os.environ['MAKEFLAGS'] = "-j 1" # This lets builds on CI work better.

setup(
name="larcv",
version=verstr,
cmake_source_dir='src/',
use_scm_version=True,
include_package_data=True,
cmake_args=[
'-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9',
Expand All @@ -62,7 +57,6 @@
# '-DMPI_C_COMPILER={}'.format(mpicc),
'-DMPI:BOOL={}'.format(mpi_value),
'-DOPENMP:BOOL={}'.format(openmp_value),
'-DDOCS:BOOL={}'.format(docs_value),
f'-DCMAKE_PYVERSION={py_version}'
],
author=['Corey Adams', 'Kazuhiro Terao', 'Taritree Wongjirad', 'Marco del Tutto'],
Expand All @@ -77,8 +71,10 @@
scripts=['bin/merge_larcv3_files.py', 'bin/run_processor.py'],
packages=['larcv','src/pybind11'],
install_requires=[
'numpy',
'scikit-build',
"numpy",
"scikit-build",
"h5py",
"cmake",
],
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ include_directories(json/include)
if(CMAKE_PYTHON_BINDINGS)

# Many packages need python:
find_package(Python ${CMAKE_PYVERSION} EXACT REQUIRED COMPONENTS Interpreter Development)
find_package(Python ${CMAKE_PYVERSION} REQUIRED COMPONENTS Interpreter Development)
include_directories(${Python_INCLUDE_DIRS})

message("Adding pybind11")
Expand Down
73 changes: 0 additions & 73 deletions src/docs/CMakeLists.txt

This file was deleted.

4 changes: 0 additions & 4 deletions src/docs/Doxyfile.in

This file was deleted.

14 changes: 0 additions & 14 deletions src/docs/FindSphinx.cmake

This file was deleted.

7 changes: 0 additions & 7 deletions src/docs/conf.py

This file was deleted.

25 changes: 0 additions & 25 deletions src/docs/index.rst

This file was deleted.

Loading

0 comments on commit eac2abb

Please sign in to comment.