|
| 1 | +Contributing as a developer |
| 2 | +########################### |
| 3 | + |
| 4 | +.. grid:: 1 1 3 3 |
| 5 | + |
| 6 | + .. grid-item-card:: :fa:`code-fork` Fork the repository |
| 7 | + :padding: 2 2 2 2 |
| 8 | + :link: fork-the-repository |
| 9 | + :link-type: ref |
| 10 | + |
| 11 | + Learn how to fork the project and get your own copy. |
| 12 | + |
| 13 | + .. grid-item-card:: :fa:`download` Clone the repository |
| 14 | + :padding: 2 2 2 2 |
| 15 | + :link: clone-the-repository |
| 16 | + :link-type: ref |
| 17 | + |
| 18 | + Download your own copy in your local machine. |
| 19 | + |
| 20 | + .. grid-item-card:: :fa:`download` Install for developers |
| 21 | + :padding: 2 2 2 2 |
| 22 | + :link: install-for-developers |
| 23 | + :link-type: ref |
| 24 | + |
| 25 | + Install the project in editable mode. |
| 26 | + |
| 27 | + |
| 28 | +.. _fork-the-repository: |
| 29 | + |
| 30 | +Fork the repository |
| 31 | +=================== |
| 32 | + |
| 33 | +Forking the repository is the first step to contributing to the project. This |
| 34 | +allows you to have your own copy of the project so you can make changes without |
| 35 | +affection the main project. Once you have made your changes, you can submit a |
| 36 | +pull-request to the main project to have your changes reviewed and merged. |
| 37 | + |
| 38 | +.. button-link:: https://github.com/ansys/ansys-sphinx-theme/fork |
| 39 | + :color: primary |
| 40 | + :align: center |
| 41 | + |
| 42 | + :fa:`code-fork` Fork this project |
| 43 | + |
| 44 | +.. note:: |
| 45 | + |
| 46 | + If you are an Ansys employee, you can skip this step. |
| 47 | + |
| 48 | +.. _clone-the-repository: |
| 49 | + |
| 50 | +Clone the repository |
| 51 | +==================== |
| 52 | + |
| 53 | +Make sure you `configure SSH`_ with your GitHub |
| 54 | +account. This allows you to clone the repository without having to use tokens |
| 55 | +or passwords. Also, make sure you have `git`_ installed in your machine. |
| 56 | + |
| 57 | +To clone the repository using SSH, run: |
| 58 | + |
| 59 | +.. code-block:: bash |
| 60 | +
|
| 61 | + git clone [email protected]:ansys/ansys-sphinx-theme |
| 62 | +
|
| 63 | +.. _install-for-developers: |
| 64 | + |
| 65 | +Install for developers |
| 66 | +====================== |
| 67 | + |
| 68 | +Installing Ansys sphinx theme in development mode allows you to perform changes to the code |
| 69 | +and see the changes reflected in your environment without having to reinstall |
| 70 | +the library every time you make a change. |
| 71 | + |
| 72 | +Virtual environment |
| 73 | +------------------- |
| 74 | + |
| 75 | +Start by navigating to the project's root directory by running: |
| 76 | + |
| 77 | +.. code-block:: |
| 78 | +
|
| 79 | + cd ansys-sphinx-theme |
| 80 | +
|
| 81 | +Then, create a new virtual environment named ``.venv`` to isolate your system's |
| 82 | +Python environment by running: |
| 83 | + |
| 84 | +.. code-block:: text |
| 85 | +
|
| 86 | + python -m venv .venv |
| 87 | +
|
| 88 | +Finally, activate this environment by running: |
| 89 | + |
| 90 | +.. tab-set:: |
| 91 | + |
| 92 | + .. tab-item:: Windows |
| 93 | + |
| 94 | + .. tab-set:: |
| 95 | + |
| 96 | + .. tab-item:: CMD |
| 97 | + |
| 98 | + .. code-block:: text |
| 99 | +
|
| 100 | + .venv\Scripts\activate.bat |
| 101 | +
|
| 102 | + .. tab-item:: PowerShell |
| 103 | + |
| 104 | + .. code-block:: text |
| 105 | +
|
| 106 | + .venv\Scripts\Activate.ps1 |
| 107 | +
|
| 108 | + .. tab-item:: macOS/Linux/UNIX |
| 109 | + |
| 110 | + .. code-block:: text |
| 111 | +
|
| 112 | + source .venv/bin/activate |
| 113 | +
|
| 114 | +Development mode |
| 115 | +---------------- |
| 116 | + |
| 117 | +Now, install Ansys sphinx theme in editable mode by running: |
| 118 | + |
| 119 | +.. code-block:: text |
| 120 | +
|
| 121 | + python -m pip install --editable . |
| 122 | +
|
| 123 | +Verify the installation by checking the version of the library: |
| 124 | + |
| 125 | + |
| 126 | +.. code-block:: python |
| 127 | +
|
| 128 | + from ansys_sphinx_theme import __version__ |
| 129 | +
|
| 130 | +
|
| 131 | + print(f"Ansys sphinx thenme version is {__version__}") |
| 132 | +
|
| 133 | +.. jinja:: |
| 134 | + |
| 135 | + .. code-block:: text |
| 136 | +
|
| 137 | + >>> Ansys sphinx theme version is {{ ANSYS_SPHINX_THEME_VERSION }} |
| 138 | +
|
| 139 | +Install Tox |
| 140 | +----------- |
| 141 | + |
| 142 | +Once the project is installed, you can install `Tox`_. This is a cross-platform |
| 143 | +automation tool. The main advantage of Tox is that it allows you to test your |
| 144 | +project in different environments and configurations in a temporary and |
| 145 | +isolated Python virtual environment. To install Tox, run: |
| 146 | + |
| 147 | +.. code-block:: text |
| 148 | +
|
| 149 | + python -m pip install tox |
| 150 | +
|
| 151 | +Finally, verify the installation by listing all the different environments |
| 152 | +(automation rules) for PySTK: |
| 153 | + |
| 154 | +.. code-block:: text |
| 155 | +
|
| 156 | + python -m tox list |
| 157 | +
|
| 158 | +.. jinja:: toxenvs |
| 159 | + |
| 160 | + .. dropdown:: Default Tox environments |
| 161 | + :animate: fade-in |
| 162 | + :icon: three-bars |
| 163 | + |
| 164 | + .. list-table:: |
| 165 | + :header-rows: 1 |
| 166 | + :widths: auto |
| 167 | + |
| 168 | + * - Environment |
| 169 | + - Description |
| 170 | + {% for environment in envs %} |
| 171 | + {% set name, description = environment.split("->") %} |
| 172 | + * - {{ name }} |
| 173 | + - {{ description }} |
| 174 | + {% endfor %} |
0 commit comments