Skip to content

Commit

Permalink
Merge branch 'main' into pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
Patol75 authored Sep 24, 2024
2 parents f2b96e1 + fb44b02 commit ea3e4af
Show file tree
Hide file tree
Showing 13 changed files with 410 additions and 133 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ jobs:
python-version: '3.12'

- name: Build
uses: extractions/setup-just@v1
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install --upgrade pip
python3 -m venv .venv-gh-pages
source .venv-gh-pages/bin/activate
python3 -m pip install "$PWD"[doc,test]
make html
just html
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: ${{ startsWith(github.ref, 'refs/tags/') }}
Expand Down
39 changes: 0 additions & 39 deletions Makefile

This file was deleted.

26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@

#### Simulate crystallographic preferred orientation evolution in polycrystals

This repository contains a Python 3 reimplementation of the D-Rex model
PyDRex is a new Python 3 implementation of the D-Rex model
for the evolution of crystallographic preferred orientation in polycrystals.
The code is available for use under the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html) license.
Documentation is accessible via Python's REPL `help()` and also [online](https://seismic-anisotropy.github.io/PyDRex/).

## Installing

Check `requires-python` in `pyproject.toml` for the minimum required Python
version. The software is tested on Linux, MacOS and Windows, however large
simulations require substantial computational resources usually afforded by HPC
Linux clusters. Linux shell scripts for setting up a [Ray](https://www.ray.io/) cluster
Tagged package versions can be installed from [PyPi](https://pypi.org/project/pydrex/).
The minimum required Python version is displayed in the sidebar (search for `Requires: Python`).
PyDRex is tested on Linux, MacOS and Windows,
however large simulations require substantial computational resources
usually only afforded by HPC Linux clusters.
Linux shell scripts for setting up a [Ray](https://www.ray.io/) cluster
on distributed memory PBS systems are provided in the `tools` folder.

Optional mesh generation using [gmsh](https://pypi.org/project/gmsh/) is available,
however the `gmsh` module requires the [`glu`](https://gitlab.freedesktop.org/mesa/glu) library
(which may require manual installation on some systems).

Tagged package versions can be installed from [PyPi](https://pypi.org/project/pydrex/).
To install the latest version, execute:

pip install pydrex
Expand Down Expand Up @@ -56,13 +57,15 @@ They have their own README file as well.

## Building offline documentation

The documentation can be built offline from a git clone or source distribution.
The documentation can be built offline from a git clone or unpacked source distribution.
Install documentation builder dependencies with `pip install '.[doc]'`.
Developers are also recommended to download the [just](https://github.com/casey/just) command runner.
Otherwise, build commands can be found in the provided `justfile`.

Run `make html` from the terminal to generate PyDRex's documentation
Run `just html` from the terminal to generate PyDRex's documentation
(available in the `html` directory), including the API reference.
The homepage will be `html/index.html`.
Alternatively, run `make live_docs` to build and serve the documentation on a `localhost` port.
Alternatively, run `just live_docs` to build and serve the documentation on a `localhost` port.
Follow the displayed prompts to open the live documentation in a browser.
It should automatically reload after changes to the source code.

Expand All @@ -72,3 +75,8 @@ For a Linux or MacOS development environment, clone the [source code](https://gi
and execute the Bash script `tools/venv_install.sh`.
This will set up a local Python virtual environment with an [editable install](https://setuptools.pypa.io/en/latest/userguide/development_mode.html)
of PyDRex that can be activated/deactivated by following the displayed prompts.

For documentation contributions, please note that
only `h2` headings will be rendered within HTML anchor elements.
Avoid using markdown headings with 3 or more leading hashes in most cases,
as these will not appear in the documentation sidebar nor be linkable.
Binary file added docs/assets/cornerflow2d_simple_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 32 additions & 6 deletions docs/template/index.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

{% block nav %}
<img src="https://raw.githubusercontent.com/seismic-anisotropy/PyDRex/main/docs/assets/logo160.png" class="logo" alt="project logo"/>
<h4>{{ footer_text }}</h4>
<br>
<div>
<input type="search" placeholder="Search..." role="searchbox" aria-label="search" pattern=".+" required>
<br>
<h6>{{ footer_text }}</h6>
</div>
{% endblock %}

{% block content %}
Expand All @@ -15,13 +17,37 @@
{% filter to_html %}
# Welcome to PyDRex!

> This is the documentation website for [PyDRex](https://github.com/seismic-anisotropy/PyDRex),
> This is the documentation website for [PyDRex](https://pypi.org/project/pydrex/),
a Python implementation of the D-Rex model for kinematic texture simulations.
Use the links below to browse the API documentation or the tests and examples:
Click the buttons below to browse the documentation or read about the tests and examples.
{% endfilter %}

<br>

<blockquote>
<a href="pydrex.html"><button class="button">Documentation</button></a>
<a href="tests.html"><button class="button">Tests & Examples</button></a>
</blockquote>

<br>

{% filter to_html %}
> The `pydrex` package is published on PyPI (the Python Package Index).
The source code is hosted on GitHub, with an issue tracker and discussion page.
{% endfilter %}

<blockquote><a href="pydrex.html"><button class="button">API Documentation</button></a>
<a href="tests.html"><button class="button">Tests & Examples</button></a></blockquote>
<br>

<blockquote>
<a href="https://pypi.org/project/pydrex/"><button class="button">
Package&nbsp;
<img height="33px" src="https://pypi.org/static/images/logo-small.8998e9d1.svg" alt="PyPI logo"/>
</button></a>
<a href="https://github.com/seismic-anisotropy/PyDRex"><button class="button">
Source code&nbsp;
<img height="33px" src="https://github.githubassets.com/favicons/favicon.svg" alt="GitHub logo"/>
</button></a>
</blockquote>

</main>
{% include "search.html.jinja2" %}
Expand Down
14 changes: 12 additions & 2 deletions docs/template/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@
}
}

.homediv { padding-top: 56px; max-width: 1080px; }
/* Center search box and version number in nav bars. */
/* Then fix up internal div display with some margins. */
input { display: block; margin: auto; }
nav h6 { text-align: center; }
nav div { padding-right: 8%; }

/* Add padding for nav bar footer in case of long version numbers (dev docs). */
nav footer { padding-right: 5px; }

/* Styles for greeting page and buttons. */
.homediv { padding-top: 56px; max-width: 1080px; }
.button {
background-color: var(--muted);
color: var(--pdoc-background);
Expand All @@ -55,10 +64,11 @@
cursor: pointer;
width: 48%;
}

.button:hover {
background-color: var(--text);
color: var(--active);
}

/* Render display equations in horizontally scrollable box. */
/* Also tries to hide the scroll bar (sometimes it doesn't work). */
.katex-display { overflow: auto hidden }
Loading

0 comments on commit ea3e4af

Please sign in to comment.