Skip to content

Commit

Permalink
deploy: d124f89
Browse files Browse the repository at this point in the history
  • Loading branch information
alchem0x2A committed Nov 20, 2024
1 parent dd3b141 commit dc3e34d
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 2a8e3e4803752bd2a3e4a40ef372ebaa
config: bec23d0b148e6747481ecf90a46d7224
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added _images/coverage_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 23 additions & 1 deletion _sources/contribute.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ environment variables are set (may subject to changes):
- Setting up correct SPARC command (e.g. via `ASE_SPARC_COMMAND`)
- Having socket-compatible SPARC binary

### Checking test coverage

You could use the `coverage` package to generate a coverage report for
the test codes. The current coverage report for the master branch of
SPARC-X-API can be accessed [here](test_coverage.md).

If running locally, please use the following commands:
```bash
# Set up proper environment variables first
# Run the code at the repo root
coverage run -a -m pytest -svv tests/
coverage html --omit="tests/*.py"
```

which will generate a folder `htmlcov` under the repo root. Open
`htmlcov/index.html` in a browser to see the coverage broken down to
files and lines, as shown in the following screenshot:
```{figure} img/screenshots/coverage_example.png
:figwidth: 80 %
:align: center
```

### Editing documentation

Source files for documentation are placed under `doc/` directory,
Expand Down Expand Up @@ -115,7 +137,7 @@ that are important for demonstrating the functionalities of
`SPARC-X-API` while the calculations can be finished using moderate
computating power (e.g. a few minutes with 4 CPU cores).

The examples can have the name in the format `ex[Number]-[purpose].py`.
<!-- The examples can have the name in the format `ex[Number]-[purpose].py`. -->

## Notes for repo maintainers

Expand Down
3 changes: 1 addition & 2 deletions _sources/index.md.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
```{include} ../README.md
:language: md
:relative-docs: docs/
:relative-docs: doc/
:relative-images:
```

Expand Down
23 changes: 23 additions & 0 deletions _sources/test_coverage.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Test Coverage Report

The following coverage test was generated by the [`coverage` package](https://coverage.readthedocs.io/en/7.6.7/other.html):

```{raw} html
<iframe id="coverage-iframe"
src="_static/htmlcov/index.html"
width="100%"
style="border:none;"></iframe>
<script>
function adjustIframeHeight() {
var iframe = document.getElementById('coverage-iframe');
if (iframe && iframe.contentWindow && iframe.contentWindow.document.body) {
iframe.style.height = (iframe.contentWindow.document.body.scrollHeight + 50) + 'px';
}
}

document.addEventListener("DOMContentLoaded", function() {
const iframe = document.getElementById('coverage-iframe');
iframe.onload = adjustIframeHeight; // Adjust height when iframe content loads
});
</script>
```
22 changes: 21 additions & 1 deletion contribute.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<li class="toctree-l3"><a class="reference internal" href="#setting-up-environment">Setting up environment</a></li>
<li class="toctree-l3"><a class="reference internal" href="#installing-sparc-c-c-binary">Installing SPARC C/C++ binary</a></li>
<li class="toctree-l3"><a class="reference internal" href="#running-tests">Running tests</a></li>
<li class="toctree-l3"><a class="reference internal" href="#checking-test-coverage">Checking test coverage</a></li>
<li class="toctree-l3"><a class="reference internal" href="#editing-documentation">Editing documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="#adding-examples">Adding examples</a></li>
</ul>
Expand Down Expand Up @@ -173,6 +174,25 @@ <h3>Running tests<a class="headerlink" href="#running-tests" title="Link to this
</li>
</ul>
</section>
<section id="checking-test-coverage">
<h3>Checking test coverage<a class="headerlink" href="#checking-test-coverage" title="Link to this heading"></a></h3>
<p>You could use the <code class="docutils literal notranslate"><span class="pre">coverage</span></code> package to generate a coverage report for
the test codes. The current coverage report for the master branch of
SPARC-X-API can be accessed <a class="reference internal" href="test_coverage.html"><span class="std std-doc">here</span></a>.</p>
<p>If running locally, please use the following commands:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Set up proper environment variables first</span>
<span class="c1"># Run the code at the repo root</span>
coverage<span class="w"> </span>run<span class="w"> </span>-a<span class="w"> </span>-m<span class="w"> </span>pytest<span class="w"> </span>-svv<span class="w"> </span>tests/
coverage<span class="w"> </span>html<span class="w"> </span>--omit<span class="o">=</span><span class="s2">&quot;tests/*.py&quot;</span>
</pre></div>
</div>
<p>which will generate a folder <code class="docutils literal notranslate"><span class="pre">htmlcov</span></code> under the repo root. Open
<code class="docutils literal notranslate"><span class="pre">htmlcov/index.html</span></code> in a browser to see the coverage broken down to
files and lines, as shown in the following screenshot:</p>
<figure class="align-center" style="width: 80%">
<img alt="_images/coverage_example.png" src="_images/coverage_example.png" />
</figure>
</section>
<section id="editing-documentation">
<h3>Editing documentation<a class="headerlink" href="#editing-documentation" title="Link to this heading"></a></h3>
<p>Source files for documentation are placed under <code class="docutils literal notranslate"><span class="pre">doc/</span></code> directory,
Expand Down Expand Up @@ -208,7 +228,7 @@ <h3>Adding examples<a class="headerlink" href="#adding-examples" title="Link to
that are important for demonstrating the functionalities of
<code class="docutils literal notranslate"><span class="pre">SPARC-X-API</span></code> while the calculations can be finished using moderate
computating power (e.g. a few minutes with 4 CPU cores).</p>
<p>The examples can have the name in the format <code class="docutils literal notranslate"><span class="pre">ex[Number]-[purpose].py</span></code>.</p>
<!-- The examples can have the name in the format `ex[Number]-[purpose].py`. -->
</section>
</section>
<section id="notes-for-repo-maintainers">
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h1>SPARC-X-API: A Python API for the SPARC-X DFT Code<a class="headerlink" href
<!-- [![Package](https://raw.githubusercontent.com/SPARC-X/SPARC-X-API/badges/badges/package.svg)](https://raw.githubusercontent.com/SPARC-X/SPARC-X-API/badges/badges/package.svg) -->
<p><a class="reference external" href="https://anaconda.org/conda-forge/sparc-x-api"><img alt="Conda Version" src="https://img.shields.io/conda/v/conda-forge/sparc-x-api" /></a>
<a class="reference external" href="https://pypi.org/project/sparc-x-api/"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/sparc-x-api" /></a>
<a class="reference external" href="https://raw.githubusercontent.com/SPARC-X/SPARC-X-API/badges/badges/coverage.svg"><img alt="Coverage" src="https://raw.githubusercontent.com/SPARC-X/SPARC-X-API/badges/badges/coverage.svg" /></a>
<a class="reference external" href="https://sparc-x-api.github.io/SPARC-X-API/test_coverage.html"><img alt="Coverage" src="https://raw.githubusercontent.com/SPARC-X/SPARC-X-API/badges/badges/coverage.svg" /></a>
<a class="reference external" href="https://github.com/SPARC-X/SPARC-X-API/actions/workflows/unit_test.yml"><img alt="Unit tests for SPARC-X-API" src="https://github.com/SPARC-X/SPARC-X-API/actions/workflows/unit_test.yml/badge.svg" /></a>
<a class="reference external" href="https://raw.githubusercontent.com/SPARC-X/SPARC-X-API/master/sparc/sparc_json_api/parameters.json"><img alt="JSON-API" src="https://raw.githubusercontent.com/SPARC-X/SPARC-X-API/badges/badges/api_version.svg" /></a>
<a class="reference external" href="https://sparc-x.github.io/SPARC-X-API/"><img alt="Doc" src="https://raw.githubusercontent.com/SPARC-X/SPARC-X-API/badges/badges/doc.svg" /></a></p>
Expand Down
Binary file modified objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions test_coverage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@


<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Test Coverage Report &mdash; SPARC-X-API documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />


<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>

<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >



<a href="index.html" class="icon icon-home">
SPARC-X-API
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="setup_environment.html">Configurations for SPARC-X-API</a></li>
<li class="toctree-l1"><a class="reference internal" href="basic_usage.html">Basic Usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced_socket.html">Advanced Usage: SPARC-X-API as a Socket Interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="package_components.html">SPARC-X-API Package Components</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced_topics.html">Advanced Topics</a></li>
<li class="toctree-l1"><a class="reference internal" href="api_changes.html">Changes in API</a></li>
<li class="toctree-l1"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">How to Contribute</a></li>
<li class="toctree-l1"><a class="reference internal" href="maintainers.html">Documentation for Maintainers</a></li>
</ul>

</div>
</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">SPARC-X-API</a>
</nav>

<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Test Coverage Report</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/sparc-x/SPARC-X-API/blob/master/doc/test_coverage.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">

<section id="test-coverage-report">
<h1>Test Coverage Report<a class="headerlink" href="#test-coverage-report" title="Link to this heading"></a></h1>
<p>The following coverage test was generated by the <a class="reference external" href="https://coverage.readthedocs.io/en/7.6.7/other.html"><code class="docutils literal notranslate"><span class="pre">coverage</span></code> package</a>:</p>
<iframe id="coverage-iframe"
src="_static/htmlcov/index.html"
width="100%"
style="border:none;"></iframe>
<script>
function adjustIframeHeight() {
var iframe = document.getElementById('coverage-iframe');
if (iframe && iframe.contentWindow && iframe.contentWindow.document.body) {
iframe.style.height = (iframe.contentWindow.document.body.scrollHeight + 50) + 'px';
}
}

document.addEventListener("DOMContentLoaded", function() {
const iframe = document.getElementById('coverage-iframe');
iframe.onload = adjustIframeHeight; // Adjust height when iframe content loads
});
</script></section>


</div>
</div>
<footer>

<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, SPARC-X Developmers.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.


</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>

</body>
</html>

0 comments on commit dc3e34d

Please sign in to comment.