MAAP-Project / maap-documentation

Apache License 2.0
10 stars 13 forks source link

Alter Getting Started and DPS Tutorial conda env recommendations #409

Open rtapella opened 4 months ago

rtapella commented 4 months ago
wildintellect commented 3 months ago

There are some tips and tricks to this.

  1. Add any package you import (python) or library (R) to the list
  2. we're looking into ways to scan your code for things you might miss
  3. Adv. use conda lock files for better performance long term
  4. Version pin/lock the most critical package (and put those at the top)

For R here's a little python code to take your list of package installs and scan conda for matches by adding a prefix of r-

# using a python notebook - we can also make an R variant
pkgs = ['sys', 'askpass', 'pkgbuild', 'rprojroot', 'diffobj', 'rematch2', 'curl', 'jsonlite', 'mime', 'openssl', 'base64enc', 'brio', 'callr', 'desc', 'evaluate', 'pkgload', 'praise', 'processx', 'ps', 'waldo', 'prettyunits', 'fs', 'httr', 'purrr', 'aws.signature', 'digest', 'testthat']
rpkgs = [f"r-{item}"for item in pkgs]
print(rpkgs)
# then notebook shell
!conda install -c conda-forge {" ".join(rpkgs)}
#once you have your list format it for the conda yml file
for item in rpkgs:
    print(f"\t- {item}")

Note: some R packages will require the use of install.R instead of conda Here's an example:

rtapella commented 2 months ago

I think this should be expanded into its own section with the other conda/environment docs.

For now I am updating some mentions of setting up requirements.txt/conda