Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c8903d1
Initial commit
max-models Nov 11, 2024
8fd8ad9
Wrote some basic python setup.
max-models Nov 12, 2024
7136724
Update to README.md
max-models Nov 12, 2024
11f5994
Add src/*.egg-info/ to .gitignore
max-models Nov 12, 2024
8e518b8
Update to gitignore
max-models Nov 17, 2024
3109612
Added CI
max-models Nov 17, 2024
2ebc6d3
Bugfixes in CI
max-models Nov 17, 2024
2389e39
Formatting
max-models Nov 17, 2024
b849d81
Added pytest to pyproject.toml reqs
max-models Nov 17, 2024
0e16d32
formatting
max-models Nov 17, 2024
bf5a16d
added isort
max-models Nov 17, 2024
fd205a4
Small rename in CI
max-models Nov 17, 2024
b8d0c1b
Lint in separate job
max-models Feb 11, 2025
96dedf5
Added .gitattributes
max-models Mar 9, 2025
dc74d99
Added .gitlab-ci.yml
max-models Apr 16, 2025
2299cc0
Updated optional dependencies
max-models Apr 18, 2025
387c611
Extended the static analysis in job in the CI
max-models Apr 18, 2025
475c02c
Install with .[test] in the CI
max-models Apr 18, 2025
d405a6b
Added some docstrings
max-models Apr 18, 2025
3081894
Added docs dependencies
max-models Apr 20, 2025
326fba4
Added docs
max-models Apr 20, 2025
867379e
Test building docs in CI
max-models Apr 20, 2025
45b42f8
Formatting
max-models Apr 20, 2025
e955c12
Removed docs stage from ci
max-models Apr 20, 2025
bbfb3a7
Merge pull request #1 from max-models/extend-the-ci
max-models Apr 20, 2025
2d65610
Create jekyll-gh-pages.yml
max-models Apr 20, 2025
bc99be5
Merge pull request #3 from max-models/max-models-patch-1
max-models Apr 20, 2025
cbeed71
Set paths
max-models Apr 20, 2025
c0df1bb
docs testsing
max-models Apr 20, 2025
58561ba
Cleaned up testing
max-models Jun 22, 2025
07ce7f0
Moved static analysis to .github/workflows/static_analysis.yml
max-models Jun 22, 2025
8d2e8ff
Added docs workflow
max-models Jun 22, 2025
dcc64fe
Added .pre-commit-config.yaml
max-models Jun 22, 2025
0b41400
Added deps
max-models Jun 22, 2025
6147869
Formatted pyproject.toml with pyproject-fmt
max-models Jun 22, 2025
6d29a05
Added tutorial
max-models Jun 22, 2025
c8d5039
Removed .github/workflows/jekyll-gh-pages.yml
max-models Jun 22, 2025
6ed5c54
Install with dev in the ci
max-models Jun 22, 2025
bebacc8
build --> _build
max-models Jun 22, 2025
6e11d01
build tutorial in ci
max-models Jun 22, 2025
8c6eea8
Don't allow failure of black and isort
max-models Jun 22, 2025
480d8d1
Install black[jupyter] and format tutorial
max-models Jun 22, 2025
e362b66
removed docs
max-models Jun 22, 2025
37dc5fd
Updated docs
max-models Jun 22, 2025
6ea58a5
elongated underline
max-models Jun 22, 2025
c87769a
Added pandoc to docs
max-models Jun 22, 2025
fb31632
Install pandoc with apt-get
max-models Jun 22, 2025
2f333a4
_build --> build
max-models Jun 22, 2025
7db4b8a
Added link to documentation
max-models Jun 22, 2025
adf588c
Merge pull request #4 from max-models/2-publish-pages-on-merge-with-d…
max-models Jun 22, 2025
dccc029
Only build docs on push to devel/main (#5)
max-models Jun 22, 2025
89d3f0d
Split the linting in the CI into multiple jobs (#6)
max-models Sep 13, 2025
78f5e47
Added || true to mypy, prospector, pylint, and ruff (#7)
max-models Sep 13, 2025
7d3ae79
Change sphinx theme (#8)
max-models Sep 14, 2025
bf5ee12
Merge remote-tracking branch 'template/devel' into update-docs-again
max-models Sep 14, 2025
2a06a65
Removed source/index.rst
max-models Sep 14, 2025
a00d458
formatting and bugfix
max-models Sep 14, 2025
b600cb1
bugfix
max-models Sep 14, 2025
0405cb1
Fixed bug for 2d plots
max-models Sep 14, 2025
3fea189
Formattign
max-models Sep 14, 2025
a7bf28a
Removed test_app.py
max-models Sep 14, 2025
19d1be9
Removed .github/workflows/testing.yml
max-models Sep 14, 2025
7fa2960
Removed tutorials/example_tutorial.ipynb
max-models Sep 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ instance/

# Sphinx documentation
docs/build/
docs/_build/
docs/source/tutorials/*.ipynb
docs/source/tutorials/

# PyBuilder
.pybuilder/
Expand Down Expand Up @@ -173,7 +175,6 @@ cython_debug/
# Unit test output
junit/


# LaTeX files
*.aux
*.pdf
Expand Down
6 changes: 6 additions & 0 deletions docs/source/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# API

Description of the API

```{toctree}
:maxdepth: 1
92 changes: 90 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import os
import shutil

# At the top.
import sphinx_bootstrap_theme


def copy_tutorials(app):
src = os.path.abspath("../tutorials")
Expand All @@ -20,6 +23,8 @@ def copy_tutorials(app):

def setup(app):
app.connect("builder-inited", copy_tutorials)
# app.add_stylesheet("my-styles.css")
app.add_css_file("custom.css")


# -- Project information -----------------------------------------------------
Expand All @@ -36,14 +41,97 @@ def setup(app):
"nbsphinx",
"sphinx.ext.mathjax",
"sphinx.ext.autodoc",
"myst_parser", # enable Markdown support
]

templates_path = ["_templates"]
exclude_patterns = []

# Recognize both .rst and .md
source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
# html_theme = "furo"
# conf.py
# ...

# Activate the theme.
html_theme = "bootstrap"
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()

# (Optional) Logo. Should be small enough to fit the navbar (ideally 24x24).
# Path should be relative to the ``_static`` files directory.
# html_logo = "my_logo.png"

# Theme options are theme-specific and customize the look and feel of a
# theme further.
html_theme_options = {
# Navigation bar title. (Default: ``project`` value)
"navbar_title": "python-template",
# Tab name for entire site. (Default: "Site")
"navbar_site_name": "Site",
# A list of tuples containing pages or urls to link to.
# Valid tuples should be in the following forms:
# (name, page) # a link to a page
# (name, "/aa/bb", 1) # a link to an arbitrary relative url
# (name, "http://example.com", True) # arbitrary absolute url
# Note the "1" or "True" value above as the third argument to indicate
# an arbitrary url.
"navbar_links": [
("Quickstart", "quickstart"),
("Tutorials", "tutorials"),
("API", "api"),
# ("Link", "http://example.com", True),
],
# Render the next and previous page links in navbar. (Default: true)
"navbar_sidebarrel": False,
# Render the current pages TOC in the navbar. (Default: true)
"navbar_pagenav": False,
# Tab name for the current pages TOC. (Default: "Page")
"navbar_pagenav_name": "Page",
# Global TOC depth for "site" navbar tab. (Default: 1)
# Switching to -1 shows all levels.
"globaltoc_depth": 2,
# Include hidden TOCs in Site navbar?
#
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
# non-hidden ``toctree`` directives in the same page, or else the build
# will break.
#
# Values: "true" (default) or "false"
"globaltoc_includehidden": "true",
# HTML navbar class (Default: "navbar") to attach to <div> element.
# For black navbar, do "navbar navbar-inverse"
"navbar_class": "navbar inverse",
# Fix navigation bar to top of page?
# Values: "true" (default) or "false"
"navbar_fixed_top": "true",
# Location of link to source.
# Options are "nav" (default), "footer" or anything else to exclude.
"source_link_position": "footer",
# Bootswatch (http://bootswatch.com/) theme.
#
# Options are nothing (default) or the name of a valid theme
# such as "cosmo" or "sandstone".
#
# The set of valid themes depend on the version of Bootstrap
# that's used (the next config option).
#
# Currently, the supported themes are:
# - Bootstrap 2: https://bootswatch.com/2
# - Bootstrap 3: https://bootswatch.com/3
"bootswatch_theme": "flatly",
# Choose Bootstrap version.
# Values: "3" (default) or "2" (in quotes)
"bootstrap_version": "3",
}

html_static_path = ["_static"]
templates_path = ["_templates"]


html_sidebars = {"**": []}
11 changes: 11 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Welcome

Write the documentation of your python package here

```{toctree}
:maxdepth: 2
:caption: Contents

quickstart.md
tutorials.md
api.md
16 changes: 0 additions & 16 deletions docs/source/index.rst

This file was deleted.

32 changes: 32 additions & 0 deletions docs/source/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Quickstart

Clone the repo

```
git clone ...
```

Create and activate python environment

```
python -m venv env
source env/bin/activate
pip install --upgrade pip
```

Install the code and requirements with pip

```
pip install -e .
```

# Build docs

```
make html
cd ../
open docs/_build/html/index.html
```

```{toctree}
:maxdepth: 1
9 changes: 9 additions & 0 deletions docs/source/tutorials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tutorials

Here are a few tutorials to help you get started.

```{toctree}
:maxdepth: 1
:glob:

tutorials/*
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ docs = [
"pre-commit",
"pyproject-fmt",
"sphinx",
"sphinx-rtd-theme",
"sphinx_bootstrap_theme",
"scipy",
]

Expand Down
27 changes: 17 additions & 10 deletions src/maxtikzlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class TikzFigure:
def __init__(self, **kwargs):
def __init__(self, ndim=2, **kwargs):
"""
Initialize the TikzFigure class for creating TikZ figures.

Expand All @@ -44,6 +44,7 @@ def __init__(self, **kwargs):
self.nodes = []
self.paths = []
self.layers = {}
self._ndim = ndim

# Counter for unnamed nodes
self._node_counter = 0
Expand Down Expand Up @@ -369,14 +370,15 @@ def generate_tikz(self):
- tikz_script (str): The TikZ script as a string.
"""
tikz_script = "\\begin{tikzpicture}\n"
tikz_script += "\\begin{axis}[\n"
tikz_script += "view={20}{30},\n"
tikz_script += "axis lines=center,\n"
tikz_script += "xlabel={$x$},\n"
tikz_script += "ylabel={$y$},\n"
tikz_script += "zlabel={$z$},\n"
tikz_script += "grid=major\n"
tikz_script += " ]\n"
if self.ndim == 3:
tikz_script += "\\begin{axis}[\n"
tikz_script += "view={20}{30},\n"
tikz_script += "axis lines=center,\n"
tikz_script += "xlabel={$x$},\n"
tikz_script += "ylabel={$y$},\n"
tikz_script += "zlabel={$z$},\n"
tikz_script += "grid=major\n"
tikz_script += " ]\n"

if self._figure_setup:
tikz_script += f"[{self._figure_setup}]"
Expand Down Expand Up @@ -422,7 +424,8 @@ def generate_tikz(self):
for layer in ordered_layers:
tikz_script += layer.generate_tikz()

tikz_script += "\\end{axis}\n"
if self.ndim == 3:
tikz_script += "\\end{axis}\n"
tikz_script += "\\end{tikzpicture}"

# Wrap in figure environment if necessary
Expand Down Expand Up @@ -675,6 +678,10 @@ def plot_matplotlib(self, ax):
ax.set_ylim(min(all_y) - padding, max(all_y) + padding)
ax.set_aspect("equal", adjustable="datalim")

@property
def ndim(self):
return self._ndim


# class TikzFigure3D

Expand Down
Empty file added tests/unit/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions tutorials/tutorial_01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "env_maxtikzlib",
"language": "python",
"name": "python3"
},
Expand All @@ -248,7 +248,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.13.3"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions tutorials/tutorial_05.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"zvec = states[:, 2]\n",
"\n",
"# Plot the lorenz system\n",
"fig = TikzFigure()\n",
"fig = TikzFigure(ndim=3)\n",
"options = [\"color=black\", \"thick\"]\n",
"\n",
"fig.add_plot3d(xvec, yvec, zvec, options=options, layer=0)\n",
Expand Down Expand Up @@ -117,7 +117,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.12"
"version": "3.13.3"
}
},
"nbformat": 4,
Expand Down