File: installation.rst

package info (click to toggle)
sphinx-needs 5.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,924 kB
  • sloc: python: 21,132; javascript: 187; makefile: 89; sh: 29; xml: 10
file content (181 lines) | stat: -rw-r--r-- 5,623 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
.. _installation:

Installation
============

.. .. only:: html

..    .. image:: https://img.shields.io/pypi/dm/sphinx-needs.svg
..        :target: https://pypi.python.org/pypi/sphinx-needs
..        :alt: Downloads
..    .. image:: https://img.shields.io/pypi/l/sphinx-needs.svg
..        :target: https://pypi.python.org/pypi/sphinx-needs
..        :alt: License
..    .. image:: https://img.shields.io/pypi/pyversions/sphinx-needs.svg
..        :target: https://pypi.python.org/pypi/sphinx-needs
..        :alt: Supported versions
..    .. image:: https://readthedocs.org/projects/sphinx-needs/badge/?version=latest
..        :target: https://readthedocs.org/projects/sphinx-needs/
..        :alt: ReadTheDocs
..    .. image:: https://github.com/useblocks/sphinx-needs/actions/workflows/ci.yaml/badge.svg
..        :target: https://github.com/useblocks/sphinx-needs/actions
..        :alt: GitHub CI Action status
..    .. image:: https://img.shields.io/pypi/v/sphinx-needs.svg
..        :target: https://pypi.python.org/pypi/sphinx-needs
..        :alt: PyPI Package latest release

Using pip
---------

.. code-block:: bash

    pip install sphinx-needs

If you wish to also use the plotting features of sphinx-needs (see :ref:`needbar` and :ref:`needpie`), you need to also install ``matplotlib``, which is available *via* the ``plotting`` extra:

.. code-block:: bash

    pip install sphinx-needs[plotting]

.. note::

   Prior to version **1.0.1** the package was named ``sphinxcontrib-needs``.

Using sources
-------------

.. code-block:: bash

    git clone https://github.com/useblocks/sphinx-needs
    cd sphinx-needs
    pip install .


Activation
----------

For final activation, please add ``sphinx_needs`` to the project's extension list of your **conf.py** file.

.. code-block:: python

   extensions = ["sphinx_needs",]

For the full configuration, please read :ref:`config`.

.. _install_theme:

HTML Theme support
------------------

To represent needs and data tables within HTML builds,
``sphinx-needs`` injects some CSS styles into the pages.

This CSS is designed to be generally compatible with common Sphinx themes,
but may require some adjustments depending on the theme you use.
In particular, `CSS Variables`_ are used to specify the coloring of most components.
The default values are as follows (see also :ref:`needs_css`):

.. dropdown:: Default CSS Variables
    :icon: paintbrush

    .. literalinclude:: ../sphinx_needs/css/themes/modern.css
        :language: css

These variables can be overridden by adding your own CSS file to the Sphinx project
(see `this how-to`_).

For examples of how to adjust the CSS, this documentation is configured to build against multiple themes using the following CSS:

.. dropdown:: furo
    :icon: paintbrush

    .. literalinclude:: _static/_css/furo.css
        :language: css
        :start-after: /* doc config start */
        :end-before: /* doc config end */

.. dropdown:: pydata-sphinx-theme
    :icon: paintbrush

    .. literalinclude:: _static/_css/pydata_sphinx_theme.css
        :language: css
        :start-after: /* doc config start */
        :end-before: /* doc config end */

.. dropdown:: sphinx-rtd-theme
    :icon: paintbrush

    .. literalinclude:: _static/_css/sphinx_rtd_theme.css
        :language: css

.. dropdown:: sphinx-immaterial
    :icon: paintbrush

    .. literalinclude:: _static/_css/sphinx_immaterial.css
        :language: css
        :start-after: /* doc config start */
        :end-before: /* doc config end */

.. _CSS Variables: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties
.. _this how-to: https://docs.readthedocs.io/en/stable/guides/adding-custom-css.html

.. _install_plantuml:

PlantUML support
----------------

:ref:`needflow` uses `PlantUML <http://plantuml.com>`_ and the
Sphinx-extension `sphinxcontrib-plantuml <https://pypi.org/project/sphinxcontrib-plantuml/>`_ for generating the flows.

Both must be available and correctly configured to work.


Install PlantUML
~~~~~~~~~~~~~~~~

1. Download the latest version of the plantuml.jar file:
   http://sourceforge.net/projects/plantuml/files/plantuml.jar/download
2. Make a new folder called ``utils`` inside your docs folder. Copy the ``plantuml.jar`` file into the ``utils`` folder.
3. Install the plantuml sphinx extension: ``pip install sphinxcontrib-plantuml``.
4. Add ``sphinxcontrib.plantuml`` to the sphinx extension list in ``conf.py``

.. code-block:: python

      extensions = ['sphinxcontrib.plantuml',
                    'sphinx_needs']


5. Configure plantuml in ``conf.py``

.. code-block:: python

  on_rtd = os.environ.get('READTHEDOCS') == 'True'
  if on_rtd:
      plantuml = 'java -Djava.awt.headless=true -jar /usr/share/plantuml/plantuml.jar'
  else:
      plantuml = 'java -jar %s' % os.path.join(os.path.dirname(__file__), "utils", "plantuml.jar"))

      plantuml_output_format = 'png'

The final configuration contains already a setup for building and deploying the documentation on
`ReadTheDocs <https://readthedocs.org/>`_.

ReadTheDocs provides ``plantuml.jar`` already on their system, so do not store it inside your source version control system.


Using Docker
------------

Sphinx-Needs is also available as a Docker Image.

See :ref:`docker` for the documentation and hints how to use it.

.. _ide:
.. _ide_vscode:

VS Code Extension
-----------------

The VS Code extension `ubCode <https://marketplace.visualstudio.com/items?itemName=useblocks.ubcode>`_ provides 
support for Sphinx-Needs.
See more details in the `Documentation <https://docs.useblocks.com/ubcode/>`_.