NVE/ebm-docs
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
<!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>Contributing — EBM - Energibruksmodell documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="_static/css/custom.css?v=9ed7352e" />
<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" />
<link rel="next" title="Changelog" href="changelog.html" />
<link rel="prev" title="ebm.validators module" href="modules/ebm.validators.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">
EBM - Energibruksmodell
</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">
<ul>
<li class="toctree-l1"><a class="reference internal" href="about_the_model.html">About EBM</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">User guide</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="user_guide/getting_started.html">Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="results.html">Result files</a></li>
<li class="toctree-l1"><a class="reference internal" href="user_guide/user_case.html">User case</a></li>
<li class="toctree-l1"><a class="reference internal" href="input_description.html">Input files</a></li>
<li class="toctree-l1"><a class="reference internal" href="user_guide/geographical_distribution.html">Geographical distribution</a></li>
<li class="toctree-l1"><a class="reference internal" href="user_guide/configuration.html">Model configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="user_guide/troubleshooting.html">Troubleshooting</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Model Functionality</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="model_description/index.html">Model Description</a></li>
<li class="toctree-l1"><a class="reference internal" href="limitations.html">Limitations</a></li>
<li class="toctree-l1"><a class="reference internal" href="building_parameters/index.html">Building categories and building codes</a></li>
<li class="toctree-l1"><a class="reference internal" href="area/index.html">Area</a></li>
<li class="toctree-l1"><a class="reference internal" href="energy_need/index.html">Energy need</a></li>
<li class="toctree-l1"><a class="reference internal" href="heating_systems/index.html">Heating systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="energy_use/index.html">Energy use</a></li>
<li class="toctree-l1"><a class="reference internal" href="geographical_distribution/index.html">Geographical distribution</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Reference</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="user_guide/calibrating_the_model.html">Calibrating the model</a></li>
<li class="toctree-l1"><a class="reference internal" href="api_reference.html">API Reference</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</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">EBM - Energibruksmodell</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">Contributing</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/contributing.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="contributing">
<h1>Contributing<a class="headerlink" href="#contributing" title="Link to this heading"></a></h1>
<p>Thank you for your interest in contributing to <strong>Energibruksmodell</strong>!
Your help is greatly appreciated. This guide outlines how you can get
involved, report issues, suggest improvements, and submit code.</p>
<section id="how-to-contribute">
<h2>How to Contribute<a class="headerlink" href="#how-to-contribute" title="Link to this heading"></a></h2>
<p>There are many ways to contribute:</p>
<section id="report-bugs">
<h3>1. Report Bugs<a class="headerlink" href="#report-bugs" title="Link to this heading"></a></h3>
<p>If you find a bug, please open an issue with:</p>
<ul class="simple">
<li><p>A clear and descriptive title</p></li>
<li><p>Steps to reproduce the issue</p></li>
<li><p>Expected vs. actual behavior</p></li>
<li><p>Environment details (OS, Python version, etc.)</p></li>
</ul>
</section>
<section id="suggest-enhancements">
<h3>2. Suggest Enhancements<a class="headerlink" href="#suggest-enhancements" title="Link to this heading"></a></h3>
<p>Have an idea for a new feature or improvement? Open an issue and
describe:</p>
<ul class="simple">
<li><p>The motivation behind the suggestion</p></li>
<li><p>How it would benefit users</p></li>
<li><p>Any potential implementation ideas</p></li>
</ul>
</section>
<section id="submit-code">
<h3>3. Submit Code<a class="headerlink" href="#submit-code" title="Link to this heading"></a></h3>
<p>We welcome pull requests! To contribute code:</p>
<ol class="arabic simple">
<li><p>Fork the repository</p></li>
<li><p>Create a new branch (<code class="docutils literal notranslate"><span class="pre">feature/my-feature</span></code> or <code class="docutils literal notranslate"><span class="pre">bugfix/my-bug</span></code>)</p></li>
<li><p>Make your changes with clear, concise commits</p></li>
<li><p>Write or update tests if applicable</p></li>
<li><p>Ensure the code passes linting and tests</p></li>
<li><p>Submit a pull request with a detailed description</p></li>
</ol>
</section>
<section id="improve-documentation">
<h3>4. Improve Documentation<a class="headerlink" href="#improve-documentation" title="Link to this heading"></a></h3>
<p>Good documentation is key! You can help by:</p>
<ul class="simple">
<li><p>Fixing typos or grammar</p></li>
<li><p>Adding examples or clarifications</p></li>
<li><p>Translating content (if applicable)</p></li>
</ul>
<p>The documentation is written in reStructuredText and is located under the subdirectory <code class="docutils literal notranslate"><span class="pre">docs/source</span></code></p>
</section>
</section>
<hr class="docutils" />
<section id="development-setup">
<h2>Development Setup<a class="headerlink" href="#development-setup" title="Link to this heading"></a></h2>
<p>To set up the project locally:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/nve/Energibruksmodell.git
<span class="nb">cd</span><span class="w"> </span>Energibruksmodell
python<span class="w"> </span>-m<span class="w"> </span>venv<span class="w"> </span>venv
<span class="nb">source</span><span class="w"> </span>venv/bin/activate<span class="w"> </span><span class="c1"># or venv\Scripts\activate.ps1 on Windows</span>
</pre></div>
</div>
</section>
<hr class="docutils" />
<section id="code-style-guidelines">
<h2>Code Style & Guidelines<a class="headerlink" href="#code-style-guidelines" title="Link to this heading"></a></h2>
<ul class="simple">
<li><p>Follow PEP 8 for Python code</p></li>
<li><p>Use meaningful commit messages</p></li>
<li><p>Keep pull requests focused and minimal</p></li>
<li><p>Include docstrings and comments where helpful</p></li>
</ul>
</section>
<hr class="docutils" />
<section id="testing-with-pytest">
<h2>Testing with Pytest<a class="headerlink" href="#testing-with-pytest" title="Link to this heading"></a></h2>
<p>We use pytest for testing. All new features and bug fixes should include
relevant tests.</p>
<section id="running-tests">
<h3>Running Tests<a class="headerlink" href="#running-tests" title="Link to this heading"></a></h3>
<p>To run the test suite:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pytest<span class="w"> </span>tests/
</pre></div>
</div>
</section>
<section id="writing-tests">
<h3>Writing Tests<a class="headerlink" href="#writing-tests" title="Link to this heading"></a></h3>
<ul class="simple">
<li><p>Place your tests in the <code class="docutils literal notranslate"><span class="pre">tests/ebm</span></code> directory.</p></li>
<li><p>Name test files starting with <code class="docutils literal notranslate"><span class="pre">test_</span></code>.</p></li>
<li><p>Use descriptive names for test functions.</p></li>
<li><p>Prefer fixtures for setup and teardown logic.</p></li>
</ul>
<p>Example:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">ebm.model.scurve</span><span class="w"> </span><span class="kn">import</span> <span class="n">SCurve</span>
<span class="k">def</span><span class="w"> </span><span class="nf">test_energy_calculation</span><span class="p">():</span>
<span class="n">s_curve</span> <span class="o">=</span> <span class="n">SCurve</span><span class="p">(</span><span class="n">earliest_age</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">average_age</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span>
<span class="n">rush_years</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span>
<span class="n">last_age</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span>
<span class="n">rush_share</span><span class="o">=</span><span class="mf">0.8</span><span class="p">,</span>
<span class="n">never_share</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span>
<span class="k">assert</span> <span class="n">s_curve</span><span class="o">.</span><span class="n">_calc_pre_rush_rate</span><span class="p">()</span> <span class="o">==</span> <span class="mf">0.01</span>
</pre></div>
</div>
</section>
</section>
<hr class="docutils" />
<section id="license">
<h2>License<a class="headerlink" href="#license" title="Link to this heading"></a></h2>
<p>By contributing, you agree that your contributions will be licensed
under the MIT license.</p>
</section>
<hr class="docutils" />
<section id="thank-you">
<h2>Thank You<a class="headerlink" href="#thank-you" title="Link to this heading"></a></h2>
<p>Your contributions make this project better. Whether it’s a typo fix or
a major feature, <strong>thank you</strong> for helping improve Energibruksmodell!</p>
<hr class="docutils" />
<p>Last Updated on 2026-03-26.</p>
<p>Version: 1.0.7.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="modules/ebm.validators.html" class="btn btn-neutral float-left" title="ebm.validators module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="changelog.html" class="btn btn-neutral float-right" title="Changelog" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2025, The Norwegian Water Resources and Energy Directorate (NVE).</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>