Skip to content

Latest commit

 

History

76 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-training

This is an interactive, online introduction to python training for employees in Public Health Scotland.

Running in Posit Workbench

This project has a renv (R environment) and you can recreate the needed packages following these steps:

  1. Install renv in your current R session:
install.packages("renv")
  1. Restart your R session
  2. Run this command in R console:
renv::restore()
  1. All the required packages will be installed.
  2. If the restore process fails you can install required R packages running these lines of code in your R console:
install.packages("learnr")
install.packages("reticulate")

R required packages

Package Description
learnr It is required to build the shiny app
reticulate It is required for running embedded python sessions

Python required packages

The required Python are available in requirements.txt file. No need to install since reticulate R package manages the required virtual environment installation.

Package Description
pandas It is required to read files (e.g. CSV) and wrangle its content

Troubleshooting

  • If PWB has been updated it means there are new Python versions. So you have to check if your previously created pyenv is still there. Run this command in the terminal tab: ls -l ~/.virtualenvs
  • If you see pyenv folder, you have to delete it using this command: rm -rf ~/.virtualenvs/pyenv
  • The previous pyenv gets obsolete because of a PWB update with new Python versions.
  • We will be able to run this project because it will create a new pyenv (with the new Python version).

Deployment

This project can be deployed in Posit connect using Posit Publisher Positron extension. Go to the following repo vscode_prep and go to Deployment folder. This folder contains general steps to deploy a project.

  • You will need an API token to authenticate your permissions (Viewer/Publisher) in Posit Connect
  • Ask for the current Posit connect project URL if it has already been deployed.
  • Check Folder content table to see which files are required for deployment (if you upload everything you will waste space)

Folder content

This project contains the following folders and files:

Folder/File Description To deploy On GitHub
data/ This folder contains all CSV files used in this project
images/ This folder contains all required images
css/ This folder contains CSS to style the project
.gitignore This file contains a list of files/folders which are not uploaded to GitHub
intro.Rmd This is the entry point file which contains the main R shiny application
README.md This file contains the project description
requirements.txt This file is essencial to create your Python virtual environment using Reticulate R package
.Rprofile R project file generated by R studio
renv/ R environment to recreated needed packages
renv.lock This file captures the state of a project's library at some point in time
.posit Temporary folder created when using posit publisher extension for deployment

About

An interactive, online introduction to python training for employees in Public Health Scotland.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages