|
| 1 | +==================== |
| 2 | +Building with poetry |
| 3 | +==================== |
| 4 | + |
| 5 | +Installing poetry |
| 6 | +================= |
| 7 | + |
| 8 | +numpy-financial uses `poetry <https://python-poetry.org/>`__ to manage |
| 9 | +dependencies, build wheels and sdists, and publish to PyPI this page documents |
| 10 | +how to work with poetry. |
| 11 | + |
| 12 | +To install poetry follow their `official guide <https://python-poetry.org/docs/#installing-with-the-official-installer>`__. |
| 13 | +It is recommended to use the official installer for local development. |
| 14 | + |
| 15 | +To check your installation try to check the version of poetry:: |
| 16 | + |
| 17 | + poetry -V |
| 18 | + |
| 19 | + |
| 20 | +Setting up a virtual environment using poetry |
| 21 | +============================================= |
| 22 | + |
| 23 | +Once poetry is installed it is time to set up the virtual environment. To do |
| 24 | +this, run:: |
| 25 | + |
| 26 | + poetry install |
| 27 | + |
| 28 | + |
| 29 | +``poetry install`` looks for dependencies in the ``pyproject.toml`` file, |
| 30 | +resolves them to the most recent version and installs the dependencies |
| 31 | +in a virtual environment. It is now possible to launch an interactive REPL |
| 32 | +by running the following command:: |
| 33 | + |
| 34 | + poetry run python |
| 35 | + |
| 36 | +Running the test suite |
| 37 | +====================== |
| 38 | + |
| 39 | +``numpy-financial``` has an extensive test suite, which can be run with the |
| 40 | +following command:: |
| 41 | + |
| 42 | + poetry run pytest |
| 43 | + |
| 44 | +Building distributions |
| 45 | +====================== |
| 46 | + |
| 47 | +It is possible to manually build distributions for ``numpy-financial`` using |
| 48 | +poetry. This is possible via the ``build`` command:: |
| 49 | + |
| 50 | + poetry build |
| 51 | + |
| 52 | +The ``build`` command creates a ``dist`` directory containing a wheel and sdist |
| 53 | +file. |
| 54 | + |
| 55 | +Publishing to PyPI |
| 56 | +================== |
| 57 | + |
| 58 | +poetry provides support to publish packages to PyPI. This is possible using |
| 59 | +the ``publish`` command:: |
| 60 | + |
| 61 | + poetry publish --build --username <your username> --password <your password> |
| 62 | + |
| 63 | +Note that this builds the package before publishing it. You will need to |
| 64 | +provide the correct username and password for PyPI. |
0 commit comments