<p>You’ll need to have <aclass="reference external"href="https://www.pyth1on.org/downloads/release/python-382/">Python 3.8</a> and <aclass="referenceexternal"href="https://github.com/python-poetry/poetry">poetry</a>
<h2>Creating the repository<aclass="headerlink"href="#creating-the-repository"title="Permalink to this headline">¶</a></h2>
<p>To create a new pack, create a new repository based on the <aclass="reference external"href="https://github.com/Steffo99/royalnet-pack-template">Royalnet Pack template</a>
<p>After cloning the template, run <codeclass="docutils literal notranslate"><spanclass="pre">poetry</span><spanclass="pre">install</span></code> to create a virtualenv and install the dependencies for the pack in it.</p>
<h3>pyproject.toml<aclass="headerlink"href="#pyproject-toml"title="Permalink to this headline">¶</a></h3>
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">pyproject.toml</span></code> file contains information about your Python project that will be read by <codeclass="docutils literal notranslate"><spanclass="pre">poetry</span></code> while building
the pack and publishing it to PyPI.</p>
<p>Choose a name for your Pack and set it in the <codeclass="docutils literal notranslate"><spanclass="pre">tool.property.name</span></code> field:</p>
<p>Follow the instructions in the other <codeclass="docutils literal notranslate"><spanclass="pre">#</span><spanclass="pre">TODO</span></code> comments to finish editing the file.</p>
</div>
<divclass="section"id="examplepack">
<h3>examplepack<aclass="headerlink"href="#examplepack"title="Permalink to this headline">¶</a></h3>
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">examplepack</span></code> folder contains the source code of your pack, and should be renamed to the name you set in the <codeclass="docutils literal notranslate"><spanclass="pre">pyproject.toml</span></code> file.</p>
<h3>The commands folder<aclass="headerlink"href="#the-commands-folder"title="Permalink to this headline">¶</a></h3>
<p>The commands folder should contain all commands that your Pack will add to the Royalnet instances it is installed in.</p>
<p>To learn how to create a new <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Command</span></code>, read the <aclass="reference internal"href="command.html"><spanclass="doc">Creating a new Command</span></a> page.</p>
</div>
<divclass="section"id="the-events-folder">
<h3>The events folder<aclass="headerlink"href="#the-events-folder"title="Permalink to this headline">¶</a></h3>
<p>The events folder should contain all events (remote procedure calls) that your Pack will add to the Royalnet instances it is installed in.</p>
<p>To learn how to create a new <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Event</span></code>, read the <aclass="reference internal"href="event.html"><spanclass="doc">Using Events</span></a> page.</p>
</div>
<divclass="section"id="the-stars-folder">
<h3>The stars folder<aclass="headerlink"href="#the-stars-folder"title="Permalink to this headline">¶</a></h3>
<p>The stars folder should contain all stars (webserver routes) that your Pack will add to the Royalnet instances it is installed in.</p>
<p>To learn how to create a new <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">PageStar</span></code>, read the <aclass="reference internal"href="star.html"><spanclass="doc">Adding a Star to the Pack</span></a> page.</p>
</div>
<divclass="section"id="the-tables-folder">
<h3>The tables folder<aclass="headerlink"href="#the-tables-folder"title="Permalink to this headline">¶</a></h3>
<p>The tables folder should contain all Alchemy tables (SQLAlchemy-compatible SQL tables) that your Pack will add to the Royalnet instances it is installed in.</p>
<p>To learn how to create a new table, read the <aclass="reference internal"href="table.html"><spanclass="doc">Using Tables and databases</span></a> page.</p>
</div>
<divclass="section"id="the-utils-folder">
<h3>The utils folder<aclass="headerlink"href="#the-utils-folder"title="Permalink to this headline">¶</a></h3>
<p>The utils folder should contain the utility functions and classes that your Pack uses.</p>
<p>Its contents are imported <strong>before</strong> the commands, events and stars but <strong>after</strong> the tables, so <strong>you can’t import them</strong> in the files contained in the <codeclass="docutils literal notranslate"><spanclass="pre">tables</span></code> folder, or you will create a <aclass="reference external"href="https://stackabuse.com/python-circular-imports/">circular import</a>!</p>
<p>Files in this folder are <strong>forbidden from importing modules</strong> from the <codeclass="docutils literal notranslate"><spanclass="pre">commands</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">events</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">stars</span></code> folders, as that will create a circular import too.</p>
</div>
<divclass="section"id="the-types-folder">
<h3>The types folder<aclass="headerlink"href="#the-types-folder"title="Permalink to this headline">¶</a></h3>
<p>The types folder should contain the enums and custom types that are used in your tables.</p>
<p>Please note that the contents of this folder are imported <strong>before</strong> everything else in the pack.</p>
<p>Its contents <strong>can be imported anywhere</strong> in the Pack, including the <codeclass="docutils literal notranslate"><spanclass="pre">tables</span></code> folder, without creating a circular import.</p>
<p>However, its files are <strong>forbidden from importing anything else</strong> from the rest of the pack!</p>
<p>As the Pack is actually a Python package, you can use <codeclass="docutils literal notranslate"><spanclass="pre">poetry</span></code> to add new dependencies!</p>
<p>Use <codeclass="docutils literal notranslate"><spanclass="pre">poetry</span><spanclass="pre">add</span><spanclass="pre">packagename</span></code> to add and install a new dependency from the PyPI.</p>
<h2>Updating the dependencies<aclass="headerlink"href="#updating-the-dependencies"title="Permalink to this headline">¶</a></h2>
<p>You can update all your dependencies by using: <codeclass="docutils literal notranslate"><spanclass="pre">poetry</span><spanclass="pre">update</span></code>.</p>
</div>
<divclass="section"id="the-readme-md-file">
<h2>The README.md file<aclass="headerlink"href="#the-readme-md-file"title="Permalink to this headline">¶</a></h2>
<p>The README.md file is the first thing that users of your pack will see!</p>
<p>It’s recommended to describe accurately how to install and configure the pack, so other users will be able to use it too!</p>
<p>To publish your Pack on the PyPI, run <codeclass="docutils literal notranslate"><spanclass="pre">poetry</span><spanclass="pre">publish</span><spanclass="pre">--build</span></code>.</p>
<p>Poetry will build your Pack and upload it to the PyPI for you!</p>
<ahref="command.html"class="btn btn-neutral float-right"title="Creating a new Command"accesskey="n"rel="next">Next <spanclass="fa fa-arrow-circle-right"></span></a>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.