Skip to content

Commit

Permalink
feat: User changes to contentful content model
Browse files Browse the repository at this point in the history
  • Loading branch information
ons-spp-machine-user committed Oct 1, 2024
1 parent 1f67fae commit 179f3df
Showing 1 changed file with 182 additions and 0 deletions.
182 changes: 182 additions & 0 deletions CONTENTFUL_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3727,3 +3727,185 @@ You can verify which versions are installed using __sessionInfo()__

— 01/10/2024 at 09:48:25 AM —

# CMS Update: 01/10/2024 at 10:11:08 AM

Editor: Sabrina Golonka

Environment: preprod

Content Type: helpCentreInformation

Revision: 11

Updated At: 2024-10-01T10:11:08.612Z

Content Updated:

```txt
id: install-a-method
title: Install a method
content: # This page covers the following topics:
- How to install date adjustment, selective editing, thousand pounds, or totals and components
- How to install other Python methods
- How to install R methods
- Managing package dependencies with SML methods
**IDS Users:**
IDS users should follow the IDS guidance for downloading and installing SML methods.
**Using a method:**
Information on how to use individual methods can be found in the User Documentation.
You can access the User Documentation from the Method Summary which you find by clicking on the method name in the Method Catalogue.
**Package dependencies:**
SML methods may require installation of specific versions of Python, R or essential packages. To avoid changing installations in your base environment, we recommend creating a virtual environment (Python) or using renv in an R Studio project.
If you’d like further guidance on this, please see “Managing package dependencies with SML methods” below.
## How to install date adjustment, selective editing, thousand pounds, or totals and components
Once you have set up the virtual environment and connected to your IDE (if using), follow the steps below.
- Check you have installed the correct versions of Python and required packages such as Pandas (see User Documentation).
- From your Python environment enter: __pip install sml_small__
- To install a specific version enter: __pip install sml_small==version_number__, for example: __pip install sml_small==1.1.0__
Search "sml_small" on “PyPI · The Python Package Index” for available versions.
- To use Date Adjustment or Selective Editing run the following: __import sml_small.date_adjustment as date_adjust__ OR __import sml_small.selective_editing as seled__
- To use Totals and Components or Thousand Pounds run the following: __from sml_small.editing import thousand_pounds__ OR __from sml_small.editing import totals_and_components__
The methods are now available for you to use.
## Installing other Python methods
Once you have set up the virtual environment and connected to an IDE (if using), follow the steps below.
- Check you have installed the correct versions of Python and required packages such as Pandas (see User Documentation).
- From your Python environment enter __pip install method_name__, for example: the Python version of cell-key-perturbation is installed using __pip install cell_key_perturbation__
- To install a specific version enter __pip install method_name==version_number__, for example: __pip install cell_key_perturbation==1.1.1__
Search the method name on “PyPI · The Python Package Index” for available versions.
The method is now available for you to import.
## Installing R methods
Once you have created an R Studio project using renv to install required packages, you are ready to download the method. For more guidance on using renv please see 'Managing package dependencies in R Studio with renv' below.
- Install the method in your project using __renv::install("method_name")__, for example, if the method was named "aggregate" you would enter __renv::install("aggregate")__
- To install a specific version use __renv::install("package@version")__, for example: __renv::install("[email protected]")__
The method is now available for you to load.
## Managing package dependencies with SML methods
This section covers the following topics:
- Managing package dependencies for Python methods using Conda
- Connecting Spyder to a virtual environment
- Connecting Jupyter Notebook to a virtual environment
- Managing package dependencies in R Studio using renv
### Managing package dependencies for Python methods using Conda
Virtual environments allow you to install specific versions of software in a contained environment. For example, you can install an older version of Python in a virtual environment but continue to use the most recent version of Python in your default environment.
Please refer to the method User Documentation for information about which version of Python and packages like Pandas as Numpy you need to use for a specific method. You will need this information to correctly set up your environment.
This guidance uses conda to create a virtual environment on your device. Conda is an open-source environment management system that allows you to create virtual environments.
- Search Anaconda Prompt on your device and click to open it (note, this will only work if you have already installed Anaconda or Miniconda).
- At the prompt enter __conda create environment_name__, for example, to create and environment called "test_env" you would enter __conda create test_env__
You should name your environment something that will help you remember what it’s used for. If prompted, enter 'y' to proceed.
- Enter __conda activate environment_name__
You should now see your environment name to the left of the C:/ prompt. This shows you are working within the virtual environment.
To leave the environment at any time enter __conda deactivate__ To come back to your environment later, simply repeat step 3.
- Consult the User Documentation to identify what version of Python is required and to see what packages (and package versions) are needed. Make note of these.
- Now, enter __conda install python=version_number__ If prompted, enter 'y' to proceed.
Note, Python versions > 3.4 automatically install pip, so that will likely be available to you in your environment after successfully installing Python. If not, enter __conda install pip__
- Install required packages using __pip install package_name==version__, for example: __pip install pandas==1.5.3__
- If you want to check what is currently installed in your environment enter __conda list__
- If you would like to use the methods from within an IDE like Visual Studio, Spyder, or Jupyter Notebook, then you will need to install the kernels for these in the virtual environment and connect them to your session (see further guidance below)
Your virtual environment is now set up and ready for you to install your chosen SML method. Remember to deactivate your environment when you’re done setting it up by entering __conda deactivate__ from the Anaconda prompt window.
The environment does not need to be activated here for you to use it with Spyder or Jupyter Notebook, providing you have followed the steps to connect the environment to these.
## Connecting Spyder to a virtual environment
- Enter __pip install spyder-kernels__ (still within Anaconda prompt and your virtual environment). If you have installed an older version of python (e.g., 3.7.1 for use with sml_small) then you need to specify an older version of spyder-kernels, e.g., __pip install spyder-kernels=1.9.2__
- Open Spyder.
- From the top menu, go to __Tools -> Preferences -> Python Interpreter__.
- Select __Use the following Python Interpreter__.
- Click on the __select file__ icon (to the right of the address bar below).
- Navigate to the location of your virtual environment.
If you’re unsure where this is, go to your Anaconda prompt window and enter __conda list__ from within your virtual environment. The file path you need will appear at the top of the list.
- Click on the folder to open your virtual environment and scroll down to find and click on the __python.exe file__.
- Click __Apply__ and __OK__ to close the Preferences window.
You should see your virtual environment name and the python version it’s running on the bottom of the Spyder window.
- When you are done working from this environment, go back to __Tools -> Preferences-> Python Interpreter__, and select the __Default interpreter__, instead of your virtual environment.
## Connecting Jupyter Notebook to a virtual environment
- Enter __pip install ipykernel__ (still within Anaconda prompt and your virtual environment).
- Then enter __python -m ipykernel install --name env_name__
- Start Jupyter Notebook.
- From the __Files__ page (you should be here by default) go to __New__, located in the top right.
- Click on __New__ and select your virtual environment name.
- Your new notebook now will use the Python and package versions installed in this environment.
## Managing package dependencies in R Studio with renv
- Open R Studio and select __File -> New Project__.
- Select __New Directory -> New Project__ and give your directory a useful name.
- Tick __Use renv with this project__.
- Consult the User Documentation for details about what packages are required to run a method. Make note of these.
- Install required package versions using __renv::install("package@version")__, for example: to install devtools 2.4.4 use __renv::install("[email protected]")__
- Download and run the chosen SML method within this project environment (see "Installing R Methods" above for more guidance).
Using renv will make specified versions of packages available for this project, but will not affect versions installed outside the project.
You can verify which versions are installed using __sessionInfo()__
```

— 01/10/2024 at 10:11:08 AM —

0 comments on commit 179f3df

Please sign in to comment.