Developer Guide¶
This section provides information on how to get started developing new features and capabilities for RAstro.
Setup¶
To set up a local development environment follow the steps below
MacOS¶
-
Ensure MacOS Command Line Tools are installed (if not already installed)
-
Create a location to clone the RAstro repository to. I generally clone my repositories to a
repos
folder in my home directory. -
Clone the RAstro repository locally
-
Install Rust1. The rust compiler and toolchain are needed to compile the core rust library
-
Install the Homebrew package manager (if not already installed)
-
Next we setup a Python 3.6+ virtual environment for isolated development of RAstro functionality
-
Install Pyenv to manage multiple python environments
Assuming you are running MacOS's default zsh shell to complete the Pyenv setup you need to run the following
-
Install Pyenv-virtualenv to create and manage virtual environments
Similarly, after installation has completed execute the following command to activate pyenv in your shell environment
-
Next we install the version of Python we want to use for our development environment
-
Once installation has completed create a
-
-
Build the python package and install documentation dependencies with
If this one-step build command doesn't succeed, you may need to to an incremental installation of the Python build dependencies
-
The setup of the development environment is now complete. To confirm it you can build and serve the package documetnation locally with
This command will compile all code examples in the
docs/examples
directory for both Rust and Python, as well as execute them to ensure that they properly execute with the current development environment. It will also execute all scripts in thedocs/figures/
directory to produce all figures.If changes have been made either to the underlying rust library or to the python package that need to be reflected in the behavior of the python package you will need to run the install command below to recompile the Python package:
Linux¶
WIP
Development Steps¶
When adding a new feature or capability to the RAstro package there are a few steps that should
all be done to ensure that everything works properly and that the package quality remains high.
This section will walk though the development of adding a fictious transporter
module and
function beam_me_up_scotty
to RAstro. This example is a bit more intensive since it adds
additional steps required to setup a new module.
- Create the module in Rust
- Add the Rust module to the library
- Implement the desired functionality in Rust
- Add tests in Rust
- Add a wrapper module to rastro_python
- Update
setup.py
to also build a Rust Extension for the module - Write a PyO3 wrapper to call Rust functionality from python
- Add the function to the package
__init__.py
in rastro_python - Add module to the
setup.py
script Rust extension to ensure the module is properly built. - Write tests of the Python functionality
- Create a documentation page in the User guide section
- Write example script in Rust and add it to the documentation
- Write example script in Python and add it to the documentation
- Write figure in Python and add it to the documentation
- Can be a Matplotlib figure
- Can be a dynamic Plotly figure
- Update
CHANGELOG.md
with summary of change
-
Steps taken from https://www.rust-lang.org/tools/install ↩