| 
 | 1 | +Manim Installation For Developers  | 
 | 2 | +=================================  | 
 | 3 | + | 
 | 4 | +	This documentation is for developers who want to contribute to ``ManimCommunity/manim``.  | 
 | 5 | + | 
 | 6 | +Installing Poetry  | 
 | 7 | +*****************  | 
 | 8 | + | 
 | 9 | +Poetry can be easily installed in any OS by just running the below command.  | 
 | 10 | + | 
 | 11 | +If your system has the ``curl`` program installed, which is usually true in Linux and Mac,  | 
 | 12 | + | 
 | 13 | +.. code-block:: bash  | 
 | 14 | +	  | 
 | 15 | +	  curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python  | 
 | 16 | +
  | 
 | 17 | +
  | 
 | 18 | +If you are a Windows developer and want to use PowerShell, you can use the below command.  | 
 | 19 | + | 
 | 20 | +.. code-block:: bash  | 
 | 21 | +	  | 
 | 22 | +	  (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python  | 
 | 23 | +
  | 
 | 24 | +.. note:: Poetry can be installed by other ways also, such as with ``pip``. See `<https://python-poetry.org/docs/#alternative-installation-methods-not-recommended>`_.  | 
 | 25 | + | 
 | 26 | +It will add it to ``PATH`` variable automatically. In order to make sure you have poetry installed correctly, try running:  | 
 | 27 | + | 
 | 28 | +.. code-block:: bash  | 
 | 29 | +
  | 
 | 30 | +	poetry --version  | 
 | 31 | +
  | 
 | 32 | +
  | 
 | 33 | +.. note:: You may need to restart your shell in order for the changes to take effect.  | 
 | 34 | + | 
 | 35 | +See the `docs on installation python poetry for more information  | 
 | 36 | +<https://python-poetry.org/docs/>`_.  | 
 | 37 | + | 
 | 38 | +Installing System Dependencies  | 
 | 39 | +******************************  | 
 | 40 | + | 
 | 41 | +Please follow the instructions under :ref:`installing-manim` to install all dependencies. Then come back to this page to continue with the installation.  | 
 | 42 | + | 
 | 43 | +.. important:: Windows Users can skip the steps to install Pycairo.  | 
 | 44 | + | 
 | 45 | + | 
 | 46 | +Additionally, ``git`` has to be installed. For instructions see `Documentation  | 
 | 47 | +<https://git-scm.com/>`_.  | 
 | 48 | + | 
 | 49 | +.. _install-manim-poetry:  | 
 | 50 | + | 
 | 51 | +Installing Manim using Poetry  | 
 | 52 | +*****************************  | 
 | 53 | + | 
 | 54 | +1.  First, clone the Manim repo locally using git.  | 
 | 55 | + | 
 | 56 | +    .. code-block:: bash  | 
 | 57 | +		  | 
 | 58 | +		git clone https://github.com/ManimCommunity/manim.git  | 
 | 59 | + | 
 | 60 | +    or  | 
 | 61 | + | 
 | 62 | +    .. code-block:: bash  | 
 | 63 | +		  | 
 | 64 | +		git clone git@github.com:ManimCommunity/manim.git  | 
 | 65 | + | 
 | 66 | +2.  Open a Terminal/Powershell/Command Prompt and cd into the cloned directory.  | 
 | 67 | + | 
 | 68 | +    .. code-block:: bash  | 
 | 69 | +		  | 
 | 70 | +		cd path/to/manim  | 
 | 71 | +      | 
 | 72 | + | 
 | 73 | +    .. note:: This path should contain a file called ``pyproject.toml`` if it doesn't contain it, you would need to go a level up.  | 
 | 74 | + | 
 | 75 | +3.  Use the below command to install python dependencies. This will use the default python version installed.  | 
 | 76 | + | 
 | 77 | +    .. code-block:: bash  | 
 | 78 | +	  | 
 | 79 | +         poetry install  | 
 | 80 | +
  | 
 | 81 | +
  | 
 | 82 | +    .. note:: Poetry will create a virtual environment rooted at the current directory.  | 
 | 83 | +      | 
 | 84 | +    You can select the desired python version using   | 
 | 85 | + | 
 | 86 | +    .. code-block:: bash  | 
 | 87 | +	  | 
 | 88 | +         poetry env use <python version you need>  | 
 | 89 | +
  | 
 | 90 | +    For example you can use for python 3.7.  | 
 | 91 | + | 
 | 92 | +    .. code-block:: bash  | 
 | 93 | +	  | 
 | 94 | +         poetry env use 3.7  | 
 | 95 | +       | 
 | 96 | +    For more information about this you can visit the `docs  | 
 | 97 | +    <https://python-poetry.org/docs/managing-environments/>`_.  | 
 | 98 | + | 
 | 99 | +4.  Now you can activate the virtual environment ``Poetry`` has created by using the command below.  | 
 | 100 | + | 
 | 101 | +    .. code-block:: bash  | 
 | 102 | +
  | 
 | 103 | +       poetry shell  | 
 | 104 | +      | 
 | 105 | +    Or if you want to run a single command use  | 
 | 106 | + | 
 | 107 | +    .. code-block:: bash  | 
 | 108 | +
  | 
 | 109 | +       poetry run manim -h  | 
 | 110 | +
  | 
 | 111 | +Now you are free to start developing on the Manim Repository.  | 
 | 112 | + | 
 | 113 | +Running the Tests Using Poetry  | 
 | 114 | +******************************  | 
 | 115 | + | 
 | 116 | +Once you are done with :ref:`install-manim-poetry`, you can run manim's test suite by activating a shell using ``poetry shell`` command and then running the command ``pytest`` to run the tests.   | 
 | 117 | + | 
 | 118 | +.. code-block:: bash  | 
 | 119 | +
  | 
 | 120 | +   poetry shell  | 
 | 121 | +   pytest  | 
 | 122 | +
  | 
 | 123 | +.. important:: You should always run the test suite before making a PR. For other contributing guidelines, see `the guide for contributions to manim <../contributing.html>`_.  | 
 | 124 | + | 
 | 125 | + | 
 | 126 | +Code Formatting Using Poetry  | 
 | 127 | +****************************  | 
 | 128 | + | 
 | 129 | +Once you are done with :ref:`install-manim-poetry`, you can run the code formatter ``black`` by activating a shell using ``poetry shell`` and then running the command ``black manim``. Or alternatively just use the command ``poetry run black manim``.   | 
 | 130 | + | 
 | 131 | +.. code-block:: bash  | 
 | 132 | +
  | 
 | 133 | +   poetry shell  | 
 | 134 | +   black  | 
 | 135 | +
  | 
 | 136 | +.. note:: Here, the word ``manim``, as used in the commands ``black manim`` or ``poetry run black manim``, refers to the folder which ``black`` is to format. You can also reformat the files containing the test suite by running the command ``black tests``.  | 
 | 137 | + | 
 | 138 | +For example, if you have written some new example and want to format it use the below command  | 
 | 139 | + | 
 | 140 | +.. code-block:: bash  | 
 | 141 | +
  | 
 | 142 | +    poetry run black example_scenes  | 
 | 143 | +
  | 
0 commit comments