diff --git a/README.md b/README.md index 7f38655c1..bb38882df 100644 --- a/README.md +++ b/README.md @@ -301,30 +301,38 @@ brew services start postgresql@15 brew services start redis ``` +#### Upgrading Python in existing projects -### Switching to different environment +If you're upgrading an existing project to a newer version of Python, you can +follow these steps to get yourself up-to-date. -Once all of pre-requisites for the project are installed and for first time setup or if you're upgrading an existing project to newer environment with newer python version follow below steps to create new virtual environment. - -First install the newer Python version we need with `pyenv`, (say the planned upgrade to 3.15) like so : +First, use `pyenv` to install the newer version of Python you'd like to use; +we'll use `3.12` in our example here since we recently upgraded to this version: ```sh pyenv install 3.12 ``` -Now go into the project directory (`notifications-api` by default), create a -virtual environment, and set the local Python version to point to the virtual -environment (assumes version Python `3.12.2` is what is installed on your -machine): +Next, delete the virtual environment you previously had set up. If you followed +the instructions above with the first-time set up, you can do this with `pyenv`: + +```sh +pyenv virtualenv-delete notify-api +``` + +Now, make sure you are in your project directory and recreate the same virtual +environment with the newer version of Python you just installed: ```sh cd notifications-api -pyenv virtualenv 3.12.2 notify-api-upgrade -pyenv local notify-api-upgrade +pyenv virtualenv 3.12.2 notify-api +pyenv local notify-api ``` -_If you're not sure which version of Python was installed with `pyenv`, you can check by running `pyenv versions` and it'll list everything available currently.You can deactivate the current environment by running `source deactivate` or `deactivate`.Close the shell session and reopen a new shell session should show the newer virtual environment._ -_You can get version,executable, and other details for any environment by running `poetry env info`._ +At this point, proceed with the rest of the instructions here in the README and +you'll be set with an upgraded version of Python. + +_If you're not sure about the details of your current virtual environment, you can run `poetry env info` to get more information. If you've been using `pyenv` for everything, you can also see all available virtual environments with `pyenv virtualenvs`._ ### Final environment setup diff --git a/poetry.lock b/poetry.lock index 6ae5deea5..64108e397 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2595,7 +2595,7 @@ requests = ">=2.0.0" [[package]] name = "notifications-utils" -version = "0.3.0" +version = "0.4.0" description = "" optional = false python-versions = "^3.12.2" @@ -2646,8 +2646,8 @@ werkzeug = "^3.0.1" [package.source] type = "git" url = "https://github.com/GSA/notifications-utils.git" -reference = "341886d" -resolved_reference = "341886df778842aaaeefe2a3bad4d7878bb655b9" +reference = "HEAD" +resolved_reference = "4cf526bc1fd9532507936c174418dbd3be52c925" [[package]] name = "numpy" @@ -4695,4 +4695,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.12.2" -content-hash = "17452ec954f93a8488cf8e34b1a3bba9d8f0a8a234078a5713655955c9e3d247" +content-hash = "4146fba7b1b851dfdca41511a2e7239ed11999b293fa7312c5d57a296a375fd5" diff --git a/pyproject.toml b/pyproject.toml index 7c3f90c83..0309642fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ marshmallow = "==3.20.2" marshmallow-sqlalchemy = "==0.30.0" newrelic = "*" notifications-python-client = "==9.0.0" -notifications-utils = {git = "https://github.com/GSA/notifications-utils.git", rev="341886d"} +notifications-utils = {git = "https://github.com/GSA/notifications-utils.git"} oscrypto = "==1.3.0" packaging = "==23.2" poetry-dotenv-plugin = "==0.2.0"