Skip to content

Project: update to Python 3.10#307

Merged
taimontgomery merged 22 commits intomasterfrom
issue-261
May 26, 2023
Merged

Project: update to Python 3.10#307
taimontgomery merged 22 commits intomasterfrom
issue-261

Conversation

@AlexTate
Copy link
Member

@AlexTate AlexTate commented May 24, 2023

The tinyRNA environment and its dependencies have been upgraded to use Python 3.10. This PR also improves the developer experience for managing dependencies and updating lockfiles.

Environment Management

The update-lockfiles.sh script has been replaced with env.py. The previous script only converted an environment.yml file (manually created) to lockfiles for osx and linux. The new script offers the following commands:

  • new-env: Automated creation of new environment.yml files for a specified version of Python and a template file. The file environment_template.yml has been provided. If additional dependencies or pinned specifications are required, they should be manually added to the template before passing it to the command. All unpinned specifications are solved with mamba before the new file is written.
  • rebuild-locks: Rebuilds the (OS-specific) lockfiles from the (OS-agnostic) environment file using conda-lock. Once complete, the new lockfiles are scanned for vulnerable Conda packages using jake. Lockfiles produced using this command will overwrite any existing lockfiles so that they are immediately available for use with setup.sh (i.e. unlike the environment.yml files produced above, their filenames do not indicate the version of Python)
  • make-archive: Produces a compressed archive of an existing Conda environment using conda-pack. The archive can be used to perform a fully offline installation of the environment on another machine, even if the requested packages don't exist in the target machine's local package cache. The archive is OS-specific, however.

Installation Script Changes and Improvements

The installation script no longer supports in-place upgrades for existing tinyRNA environments. The environment, and any packages the user may have installed, must now be removed by the script during an update. This functionality had been introduced when dependency updates were frequent but the Python version remained unchanged. Unfortunately it seems that there isn't a reliable way to change an environment's Python version without re-solving the environment, which brings back the unacceptable 20-40 minute wait times. If users really want to do an in-place upgrade, they can always use conda update --file with the desired environment*.yml file to initiate the re-solve but this is advanced usage and likely to cause issues.

Additionally:

  • The Miniconda installer version has been updated
  • The proper Miniconda installer is now used if the user has a mac with an M1 or M2 chip
  • If Miniconda required installation, the user is notified of a final setup step they must perform if they want to immediately begin using Conda

Security Improvements

This PR improves the handling of configuration file fields to avoid potential shell injection vulnerabilities.

Closes #261

AlexTate added 22 commits May 9, 2023 13:24
… the prior solve only pushed it to 0.20 which is incompatible with Apple's M1/M2 processors. Updating lock files accordingly.
…Base class. This makes it consistent with the current argparse config
…e name as a commandline parameter. The default filename remains environment.yml
…eating environments for yet-unsupported versions of Python
…onment.yml files and for updating lockfiles from a given environment file.
The rebuild-locks command now runs a vulnerability scan on the packages reported in the new lockfiles.

A make-archive command has been added to allow for making offline archives of an existing environment. The archives are os-specific. It's a simple wrapper for conda-pack.
…at are necessary for functioning environments.
…ng syntax for exact vs. fuzzy matching for conda-forge packages since it appears conda-lock doesn't properly parse these specifications when the channel scope is also provided
Most importantly, in-place updates to the tinyRNA environment are no longer supported. The environment must be removed and recreated. When this functionality was originally added, dependency updates were taking place within the same Python version. Now they are across Python versions, and this can cause many, many problems. I tried several approaches to preserve this functionality, and while some got close, they were not stable or reliable. This is the safest way.

Additionally:
- Updated the version of miniconda that the script installs (if necessary)
- The Apple Silicon version of Miniconda is installed, if appropriate and necessary
- The Miniconda installer is executed with bash as it appears the latest version doesn't work with zsh
- If Miniconda was installed, the user is instructed to source their shell's .rc file to finalize installation
- It is now possible to run the script from outside of the project directory
@AlexTate AlexTate marked this pull request as draft May 24, 2023 23:34
@AlexTate AlexTate requested a review from taimontgomery May 24, 2023 23:34
@AlexTate AlexTate marked this pull request as ready for review May 25, 2023 00:34
@taimontgomery
Copy link
Collaborator

Test installation and run on MacBook-M2 and server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project: update dependencies for transition to Python 3.10

2 participants