########### Development ########### .. toctree:: :maxdepth: 3 .. _dev_env: *********************** Development environment *********************** It is convenient to setup a separate virtual environment: Using pipenv ============ 1. Install pipenv:: $ pip install pipenv 2. Navigate to the shobnetpy folder:: $ cd shobnetpy 3. Create virtual environment:: $ pipenv shell 4. Install requirements:: $ pipenv install $ pipenv install -r requirements_dev.txt *********** Style Guide *********** - Code should stick to PEP 8 (https://peps.python.org/pep-0008/)  Documenting code ================ - Docstrings in `numpy format `_ - Members starting with an underscore (_) will not be included in the docs. String formatting ================= The use of `f-strings `_ has precedence over `format()` and the modulo operator. F-strings are `easier to read and perform better `_. Exceptions apply when lazy evaluation of strings is required. F-Strings also allow format specifiers as 2nd argument after a ":" within the curly brackets. :: message = ( f"Number of retrieved rows ({len(mz_df)}) for BC={gtvalue}, OT={otvalue} and " f"BAC={bakvalue} deviates from requested number ({samplesize:5d}) by more than 1!" ) .. include:: development/testing.rst ******************* Documentation Guide ******************* SHoBNetPy uses sphinx to document concepts, modules, use instructions, API and so on. Resources: `reStructuredText `_ `reStructuredText Directives `_ - Docs for new modules can be generated by :: # Windows cd shobnetpy\doc\sphinx sphinx-apidoc.exe -o .\source\application\api\ ..\shobnetpy\ #*unix cd shobnetpy/doc/sphinx sphinx-apidoc -o ./source/application/api/ ../shobnetpy/ .. note:: You may need to remove existing subpackage rst files for new modules to be added. Then, replace `Submodules` with `.. contents::` in teh new rst files. Generated files modules.rst, shopnetpy.rst and setup.rst can be deleted to avoid warnings (they are not linked). - Heading hierarchy: 1. :: ######### 1st level ######### 2. :: ********* 2nd level ********* 3. :: 3rd level ========= 4. :: 4th level --------- Building documentation ====================== - HTML pages :: cd /doc/sphinx make html For windows, `make.bat html` should work. - Docx document :: cd /doc/sphinx make docx In order for this to work, either ensure to be in the shopnetpy (see :ref:`dev_env`) virtual environment or set the path to the `sphinx-build` executable manually by :: set SPHINXBUILD=\.venv\Scripts\sphinx-build.exe in Windows command line before running the above `make`-commands. ******* Logging ******* See :ref:`concepts_logging_implementation`. ****************** 3rd Party Packages ****************** shapely ======= = `Shapely User Manual `_ mesa ==== = `Mesa project website `_ mesa=geo ======== = `Mesa-Geo project website `_ networkx ======== = `NetworkX = Network Analysis in python `_ pytreemap ========= = `pytreemap project website `_ dynaconf ======== = `dynaconf project website `_ scipy ===== = `SciPy website `_ qgispy ====== = `QGIS Python API documentation `_ ********************** Release Workflow (WiP) ********************** 1. Testing 2. Update dependencies 1. requirements.txt 2. poetry 3. Update documentation 1. Update API 2. Update settings 4. Commit to gitlab 5. Publish new version