Skip to content

Commit ba99e69

Browse files
committed
DOC: Add developer documentation on how to use poetry
1 parent 1dc6338 commit ba99e69

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

doc_developer/building_with_poetry.md

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "numpy-financial"
3-
version = "1.1.0"
3+
version = "1.1.0.dev0"
44
description = "Simple financial functions"
55
license = "BSD-3-Clause"
66
authors = ["Travis E. Oliphant et al."]

0 commit comments

Comments
 (0)