% Created 2025-06-02 Mon 10:15
% Intended LaTeX compiler: pdflatex
\documentclass[usenames,dvipsnames,colorlinks,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{color}
\usepackage{listings}
\usepackage{pdfpages}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{xspace}
\usepackage{siunitx}
\usepackage{libertine}
\usepackage{fontawesome}
\mode<beamer>{\usetheme{Boadilla}}
\setbeamertemplate{navigation symbols}{}
\setbeamerfont{alerted text}{series=\bfseries}
\setbeamercolor{alerted text}{fg=blue}
\usecolortheme{default}
\usefonttheme{serif}
\usefonttheme{professionalfonts}
\lstloadlanguages{[ISO]C++}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.50,0,0.82}
\definecolor{codeorange}{rgb}{0.95,0.3,0.1}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
commentstyle=\color{codegreen},
keywordstyle=\color{codeorange},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
\usetheme{default}
\author{Brett Viren}
\date{\today}
\title{Wire-Cell Python}
\hypersetup{
 pdfauthor={Brett Viren},
 pdftitle={Wire-Cell Python},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 28.2 (Org mode 9.8-pre)},
 pdflang={English}}
\begin{document}

\maketitle
\begin{frame}[label={sec:orgfab26ea},fragile,shrink=10]{Overview of \texttt{wire-cell-python}}
 The \href{https://github.com/wirecell/wire-cell-python}{wire-cell-python} repo provides the Python package \texttt{wirecell} which includes
the module tree \texttt{wirecell.*} and main command line program \texttt{wcpy} (together: ``WCpy''). 
\begin{block}{Purpose}
Capture functions and workflows that support the Wire-Cell Toolkit (WCT) and the
broader ``WC ecosystem'' across space (experiments) and time (DUNE time scale).
\end{block}
\begin{block}{Contributing}
WCpy is friendly to contributions from many people and so is a bit ``rough around the edges''.
\begin{itemize}
\item A few coding rules to follow and some helping infrastructure is provided, o.w. ``hacks'' are welcome.
\end{itemize}
\end{block}
\begin{block}{Dependencies}
WCpy has a relatively short list of required dependencies with some big ones
(torch) made optional.
\begin{itemize}
\item Extending the dependency list should be done with care.
\item WCT and WCpy do not depend on each other at the code level.
\begin{itemize}
\item WCT has optional unit tests that can use WCpy CLI at runtime.
\item WCpy may call WCT's \texttt{wire-cell} command at runtime.
\end{itemize}
\end{itemize}
\end{block}
\end{frame}
\begin{frame}[label={sec:orgf33fa7d},fragile]{Sampling of major features}
 \begin{itemize}
\item Python modules and command line interface(s) (CLI).
\item Standard Python packaging, flexible installation and development.
\item Converters to produce WCT ``data'' configuration files.
\begin{itemize}
\item response, wires, noise, \ldots{}.
\end{itemize}
\item Visualize and summarize WCT inputs/outputs.
\begin{itemize}
\item Interoperate with the \href{https://www.phy.bnl.gov/twister/bee/}{Wire-Cell Bee} online event display.
\item Directly produce plots and images with \texttt{matplotlib}.
\item Generate Paraview and SVG files.
\end{itemize}
\item Train and evaluate Deep Neural Networks including DNNROI.
\item Provide CLI tools that may be used in WCT unit tests.
\item And more\ldots{}.
\end{itemize}
\end{frame}
\begin{frame}[label={sec:org71c62fd},fragile]{Packaging}
 \begin{block}{\texttt{wire-cell-python} provides ``standard'' Python packaging.}
\begin{itemize}
\item Use ``your favorite method'' to install/develop/use.

\item Virtual env, \texttt{pip}, \texttt{uv}, etc.
\end{itemize}
\end{block}
\begin{block}{Current recommendation: use \texttt{uv}}
\begin{itemize}
\item \texttt{uv} brings happiness to most tasks related to Python packaging!
\end{itemize}
\end{block}
\end{frame}
\begin{frame}[label={sec:org4be6f5b},fragile]{Aside: installing \texttt{uv} - several easy methods to pick}
 There are a few easy ways to install \texttt{uv}:
\begin{block}{Method recommended by \texttt{uv} project - installs to \texttt{\$HOME/.local/bin/}}
\begin{verbatim}
$ curl -LsSf https://astral.sh/uv/install.sh | sh
\end{verbatim}
\end{block}
\begin{block}{Or, manually do the same}
Download binary \texttt{tar} file from \url{https://github.com/astral-sh/uv/releases}, unpack, move executables to \texttt{\$PATH}.
\end{block}
\begin{block}{Or, if already working in a virtual environment}
\begin{verbatim}
$ pip install uv
\end{verbatim}
\end{block}
\begin{block}{Or, if on BNL WCWC computers}
Provided as \texttt{/usr/local/bin/uv}
\end{block}
\end{frame}
\begin{frame}[label={sec:orgf5fec4f},fragile,shrink=10]{Installing with \texttt{uv} - for end users}
 \begin{block}{No commitment one-shot running}
\begin{verbatim}
$ uv run --with git+https://github.com/wirecell/wire-cell-python wcpy
\end{verbatim}
\end{block}
\begin{block}{Install for easier reuse}
\begin{verbatim}
$ uv tool install git+https://github.com/wirecell/wire-cell-python
$ wcpy
\end{verbatim}

Later upgrade or removal

\begin{verbatim}
$ uv tool upgrade wirecell
$ uv tool uninstall wirecell
\end{verbatim}
\end{block}
\begin{block}{Optional dependencies}
Add ``\texttt{-{}-{}with torch}'' to ``\texttt{uv run}'' or ``\texttt{uv tool}''.

\begin{verbatim}
$ uv tool --with torch install git+https://github.com/wirecell/wire-cell-python
$ wcpy dnn
\end{verbatim}
\end{block}
\end{frame}
\begin{frame}[label={sec:org138d991},fragile]{Installing with \texttt{uv} - for developers}
 \begin{block}{Basic setup to directly run from source}
\begin{verbatim}
$ git clone git@github.com:WireCell/wire-cell-python.git
$ cd wire-cell-python
$ uv sync
$ uv run wcpy
\end{verbatim}
\end{block}
\begin{block}{Include optional dependencies (ie torch)}
\begin{verbatim}
$ uv sync --all-extras
\end{verbatim}
\end{block}
\begin{block}{Activiate the virtual env to avoid needing \texttt{uv run} command prefix}
\begin{verbatim}
$ source .venv/bin/activate
$ wcpy
\end{verbatim}
\end{block}
\end{frame}
\begin{frame}[label={sec:org9ed3186},fragile]{Command line interface(s)}
 By far the most common way WCpy is used is via its CLI(s)
\begin{block}{\texttt{wcpy}}
A \alert{singular} command line interface \texttt{wcpy} is recently provided.
\begin{itemize}
\item Each \texttt{wirecell.*} module may have a \texttt{\_\_main\_\_.py} to provide a sub-command.
\end{itemize}
\end{block}
\begin{block}{\texttt{wirecell-*}}
Previously, each \texttt{wirecell.*.\_\_main\_\_} results in its own \texttt{wirecell-*} CLI.
\begin{itemize}
\item These are still built, perhaps may be removed in the future.
\end{itemize}
\end{block}
\begin{block}{Differences}
Both give exactly same functionality just differently organized.
\end{block}
\end{frame}
\begin{frame}[label={sec:orgaaaf1d5},fragile,shrink=10]{Usage help}
 \begin{verbatim}
$ wcpy
Usage: wcpy [OPTIONS] COMMAND [ARGS]...

  Main wcpy

Options:
  --help  Show this message and exit.

Commands:
  aux       Commands for Wire-Cell Toolkit's "aux" package.
  bee       Wire Cell Bee helpers
  dnn       Wire Cell Deep Neural Network commands.
  gen       Wire Cell Signal Simulation Commands
  img       Wire-Cell Toolkit commands related to imaging.
  ls4gan    Wire Cell Toolkit Utility Commands
  pgraph    Wire Cell Signal Processing Features
  plot      wirecell-plot command line interface
  pytorch   wirecell-pytorch command line interface
  sigproc   Wire Cell Signal Processing
  test      Wire Cell Test Commands
  util      Wire Cell Toolkit Utility Commands
  validate  Wire Cell Validation
\end{verbatim}
\end{frame}
\end{document}
