From b6573efb5785438180c4a83da8fddd51053f3e1e Mon Sep 17 00:00:00 2001 From: Kai Striega Date: Tue, 2 Apr 2024 10:17:21 +1100 Subject: [PATCH 1/3] DOC: Document how to build with anaconda and spin --- doc/source/dev/building_with_poetry.md | 67 -------------------------- doc/source/dev/building_with_spin.md | 63 ++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 67 deletions(-) delete mode 100644 doc/source/dev/building_with_poetry.md create mode 100644 doc/source/dev/building_with_spin.md diff --git a/doc/source/dev/building_with_poetry.md b/doc/source/dev/building_with_poetry.md deleted file mode 100644 index ffc17d2..0000000 --- a/doc/source/dev/building_with_poetry.md +++ /dev/null @@ -1,67 +0,0 @@ -# Building with poetry - -## Installing poetry -numpy-financial uses [poetry](https://python-poetry.org/) to manage -dependencies, build wheels and sdists, and publish to PyPI this page documents -how to work with poetry. - -To install poetry follow their [official guide](https://python-poetry.org/docs/#installing-with-the-official-installer) -it is recommended to use the official installer for local development. - -To check your installation try to check the version of poetry: - -```shell -poetry -V -``` - -## Setting up a virtual environment using poetry - -Once poetry is installed it is time to set up the virtual environment. To do -this run: - -```shell -poetry install -``` - -``poetry install`` looks for dependencies in the ``pyproject.toml`` file, -resolves them to the most recent version and installs the dependencies -in a virtual environment. It is now possible to launch an interactive REPL -by running the following command: - -```shell -poetry run python -``` - -## Running the test suite - -numpy-financial has an extensive test suite, which can be run with the -following command: - -```shell -poetry run pytest -``` - -## Building distributions - -It is possible to manually build distributions for numpy-financial using -poetry. This is possible via the `build` command: - -```shell -poetry build -``` - -The `build` command creates a `dist` directory containing a wheel and sdist -file. - - -## Publishing to PyPI - -poetry provides support to publish packages to PyPI. This is possible using -the ``publish`` command: - -```shell -poetry publish --build --username --password -``` - -Note that this builds the package before publishing it. You will need to -provide the correct username and password for PyPI. diff --git a/doc/source/dev/building_with_spin.md b/doc/source/dev/building_with_spin.md new file mode 100644 index 0000000..f47b551 --- /dev/null +++ b/doc/source/dev/building_with_spin.md @@ -0,0 +1,63 @@ +# Building with poetry + +## Installing poetry +numpy-financial uses [spin](https://github.com/scientific-python/spin) and conda +to manage dependencies, build wheels and sdists, and publish to PyPI this page +documents how to work with spin and conda. + +To install poetry follow their [official guide](https://docs.anaconda.com/free/miniconda/miniconda-install/) +it is recommended to use the official installer for local development. + +To check your installation try to check the version of miniconda: + +```shell +conda -V +``` + +## Setting up a virtual environment using poetry + +Once conda is installed it is time to set up the virtual environment. To do +this run: + +```shell +conda env create -f environment.yml +``` + +This command looks for dependencies in the ``environment.yml`` file, +resolves them to the most recent version and installs the dependencies +in a virtual environment. It is now possible to launch an interactive REPL +by running the following command: + +```shell +conda activate numpy-financial-dev +``` + +## Building NumPy-Financial + +NumPy-Financial is built using a combination of Python and Cython. We therefore +require a build step. This can be run using + +```shell +spin build +``` + +## Running the test suite + +NumPy-Financial has an extensive test suite, which can be run with the +following command: + +```shell +spin test +``` + +## Building distributions + +It is possible to manually build distributions for numpy-financial using +poetry. This is possible via the `build` command: + +```shell +spin build +``` + +The `build` command creates a `dist` directory containing a wheel and sdist +file. From fba51155847d541a867c3d403d53fad3bd670555 Mon Sep 17 00:00:00 2001 From: Kai Striega Date: Tue, 2 Apr 2024 10:23:04 +1100 Subject: [PATCH 2/3] DOC: Document how to build the docs with conda and spin --- doc/source/dev/building_the_docs.md | 29 +++++++++-------------------- doc/source/dev/index.rst | 4 +++- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/doc/source/dev/building_the_docs.md b/doc/source/dev/building_the_docs.md index c745936..43e35ac 100644 --- a/doc/source/dev/building_the_docs.md +++ b/doc/source/dev/building_the_docs.md @@ -5,37 +5,26 @@ This guide goes through how to build the NumPy-Financial documentation with poet ## Assumptions This guide assumes that you have set up poetry and a virtual environment. If you have -not done this please read [building_with_poetry](building_with_poetry.md). +not done this please read [building_with_spin](building_with_spin). -You can check that poetry is installed by running: +You can check that conda and spin are installed by running: ```shell -poetry -V +conda -V ``` -## Installing the documentation dependencies - -NumPy-Financial is built using [sphinx](https://www.sphinx-doc.org/en/master/) with [numpydoc](https://numpydoc.readthedocs.io/en/latest/). - -The dependencies can be installed using poetry and the ``docs`` group: - ```shell -poetry install --with docs +spin -V ``` ## Building the documentation -The documentation is located in the ``doc`` directory. The first step is to change directory into this directory - -```shell -cd doc -``` - -Once you are in the ``doc`` directory, the documentation can be built using ``make``. +spin handles building the documentation for us. All we have to do is invoke the built-in command. ```shell -poetry run make html +spin docs -j 1 ``` -This will create the docs as a html document in the ``build`` directory. Note that there are several options available, -however, only the html documentation is built officially. +This will create the docs as a html document in the ``doc/build`` directory. Note that there are several options +available, however, only the html documentation is built officially. + \ No newline at end of file diff --git a/doc/source/dev/index.rst b/doc/source/dev/index.rst index f83107e..6fbac86 100644 --- a/doc/source/dev/index.rst +++ b/doc/source/dev/index.rst @@ -5,8 +5,10 @@ Development :maxdepth: 1 getting_the_code.md - building_with_poetry.md + building_with_spin.md running_the_benchmarks.md + building_the_docs.md + checking_out_an_upstream_pr.md .. include:: ../_includes/release-notes.rst From fc70786c956581d419a0bdbd27b5fc8bce1a00ff Mon Sep 17 00:00:00 2001 From: Kai Striega Date: Tue, 2 Apr 2024 10:26:48 +1100 Subject: [PATCH 3/3] DOC: Replace poetry with conda --- doc/source/dev/building_the_docs.md | 2 +- doc/source/dev/building_with_spin.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/dev/building_the_docs.md b/doc/source/dev/building_the_docs.md index 43e35ac..e050419 100644 --- a/doc/source/dev/building_the_docs.md +++ b/doc/source/dev/building_the_docs.md @@ -1,6 +1,6 @@ # Building the docs -This guide goes through how to build the NumPy-Financial documentation with poetry +This guide goes through how to build the NumPy-Financial documentation with spin and conda ## Assumptions diff --git a/doc/source/dev/building_with_spin.md b/doc/source/dev/building_with_spin.md index f47b551..7a6713c 100644 --- a/doc/source/dev/building_with_spin.md +++ b/doc/source/dev/building_with_spin.md @@ -1,6 +1,6 @@ -# Building with poetry +# Building with spin and conda -## Installing poetry +## Installing conda numpy-financial uses [spin](https://github.com/scientific-python/spin) and conda to manage dependencies, build wheels and sdists, and publish to PyPI this page documents how to work with spin and conda. @@ -14,7 +14,7 @@ To check your installation try to check the version of miniconda: conda -V ``` -## Setting up a virtual environment using poetry +## Setting up a virtual environment using conda Once conda is installed it is time to set up the virtual environment. To do this run: