Skip to content

Commit 80a412d

Browse files
committed
Supports scalars, tensors, and histograms
1 parent 3cf23b6 commit 80a412d

36 files changed

+3130
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: build
2+
on:
3+
release:
4+
types: [published]
5+
# workflow_run:
6+
# workflows: ["tests"]
7+
# branches: [master]
8+
# types:
9+
# - completed
10+
jobs:
11+
build-and-publish:
12+
name: Build and publish Python 🐍 distributions 📦 to PyPI
13+
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
14+
runs-on: ${{ matrix.platform }}
15+
strategy:
16+
matrix:
17+
# https://help.github.com/articles/virtual-environments-for-github-actions
18+
platform:
19+
- ubuntu-latest # ubuntu-20.04
20+
python-version: [3.9]
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install pypa/build
28+
run: >-
29+
python -m
30+
pip install
31+
build
32+
--user
33+
- name: Build a binary wheel and a source tarball
34+
run: >-
35+
python -m
36+
build
37+
--sdist
38+
--wheel
39+
--outdir dist/
40+
.
41+
# - name: Publish distribution 📦 to Test PyPI
42+
# uses: pypa/gh-action-pypi-publish@master
43+
# with:
44+
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
45+
# repository_url: https://test.pypi.org/legacy/
46+
- name: Publish distribution 📦 to PyPI
47+
# if: startsWith(github.ref, 'refs/tags')
48+
uses: pypa/gh-action-pypi-publish@master
49+
with:
50+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/test-with-tox.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: tests
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
test-with-tox:
7+
name: Test with tox
8+
runs-on: ${{ matrix.platform }}
9+
strategy:
10+
matrix:
11+
# https://help.github.com/articles/virtual-environments-for-github-actions
12+
platform:
13+
- ubuntu-18.04
14+
- ubuntu-latest # ubuntu-20.04
15+
- macos-latest # macOS-10.15
16+
- windows-2016
17+
- windows-latest # windows-2019
18+
python-version: [3.7, 3.8, 3.9]
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install tox tox-gh-actions
29+
- name: Test with tox
30+
run: tox

.gitignore

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/
133+
134+
# pytype static type analyzer
135+
.pytype/
136+
137+
# Cython debug symbols
138+
cython_debug/
139+
140+
# Custom ignores
141+
tests/test_writer_torch/*.png
142+
tests/test_writer_tf/*.png
143+
tests/test_writer_tensorboardX/*.png

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# tbparse
2+
3+
[![tests](https://github.com/j3soon/tbparse/actions/workflows/test-with-tox.yaml/badge.svg?branch=master&event=push)](https://github.com/j3soon/tbparse/actions/workflows/test-with-tox.yaml)
4+
[![build](https://github.com/j3soon/tbparse/actions/workflows/publish-to-pypi.yaml/badge.svg?branch=master&event=push)](https://github.com/j3soon/tbparse/actions/workflows/publish-to-pypi.yaml)
5+
6+
Read, parse, and plot tensorboard event logs with ease!
7+
8+
tbparse is a simple parser for reading tensorboard logs. It supports logs generated by [TensorFlow / Keras](https://www.tensorflow.org/tensorboard), [PyTorch](https://pytorch.org/docs/stable/tensorboard.html), and [TensorboardX](https://github.com/lanpa/tensorboardX).
9+
10+
Currently, tbparse enables parsing native types (scalars, tensors, histograms, etc.) easily. More event types will be supported in future versions.
11+
12+
![preview](docs/images/preview.png)
13+
14+
## Installation
15+
16+
```sh
17+
pip install tbparse
18+
```
19+
20+
(Requires python >= 3.7)
21+
22+
## Usages
23+
24+
```py
25+
from tbparse import SummaryReader
26+
log_dir = "<PATH_TO_EVENT_FILE>"
27+
df = SummaryReader(log_dir).scalars
28+
print(df)
29+
```

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)

docs/conf.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
sys.path.insert(0, os.path.abspath('..'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'tbparse'
21+
copyright = '2021, Johnson'
22+
author = 'Johnson'
23+
24+
25+
# -- General configuration ---------------------------------------------------
26+
27+
# Add any Sphinx extension module names here, as strings. They can be
28+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29+
# ones.
30+
extensions = [
31+
'matplotlib.sphinxext.plot_directive',
32+
'sphinx.ext.viewcode',
33+
'sphinx.ext.autodoc',
34+
'sphinx.ext.doctest',
35+
'sphinx.ext.intersphinx',
36+
]
37+
38+
# Add any paths that contain templates here, relative to this directory.
39+
templates_path = ['_templates']
40+
41+
# List of patterns, relative to source directory, that match files and
42+
# directories to ignore when looking for source files.
43+
# This pattern also affects html_static_path and html_extra_path.
44+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
45+
46+
47+
# -- Options for HTML output -------------------------------------------------
48+
49+
# The theme to use for HTML and HTML Help pages. See the documentation for
50+
# a list of builtin themes.
51+
#
52+
html_theme = 'sphinx_rtd_theme'
53+
54+
# Add any paths that contain custom static files (such as style sheets) here,
55+
# relative to this directory. They are copied after the builtin static files,
56+
# so a file named "default.css" will overwrite the builtin "default.css".
57+
html_static_path = ['_static']
58+
59+
# -- Custom Options ----------------------------------------------------------
60+
61+
# To document __init__
62+
autoclass_content = 'both'
63+
64+
# Cross reference
65+
intersphinx_mapping = {
66+
'python': ('https://docs.python.org/dev', None),
67+
'matplotlib': ('https://matplotlib.org/', None),
68+
'seaborn': ('https://seaborn.pydata.org', None),
69+
'pandas': ('https://pandas.pydata.org/pandas-docs/dev', None),
70+
}
71+
72+
# matplotlib
73+
plot_include_source = True
74+
plot_html_show_source_link = False
75+
plot_html_show_formats = False

docs/images/preview.png

121 KB
Loading

docs/images/sphinx_histogram.png

19.9 KB
Loading
32 KB
Loading

docs/images/sphinx_scalar_y=2x+C.png

18.8 KB
Loading

0 commit comments

Comments
 (0)