utils dependencies updates

This commit is contained in:
samathad2023
2024-03-21 13:01:14 -07:00
parent 00f81a74fd
commit b006e2cacf
3 changed files with 25 additions and 63 deletions

View File

@@ -234,7 +234,7 @@ Once all of pre-requisites for the project are installed and you have a
cloud.gov account, you can now set up the admin project and get things running
locally!
First, clone the respository in the directory of your choosing on your machine:
First, clone the repository in the directory of your choosing on your machine:
```sh
git clone git@github.com:GSA/notifications-admin.git
@@ -274,30 +274,38 @@ In addition to some infrastructure setup, this will also create a local `.env`
file for you in the project's root directory, which will include a handful of
project-specific environment variables.
### Switching to different environment
#### Upgrading Python in existing projects
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.
If you're upgrading an existing project to a newer version of Python, you can
follow these steps to get yourself up-to-date.
First install the newer Python version we need with `pyenv`, (say the planned upgrade to 3.12) 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-admin` 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-admin
```
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-admin
pyenv virtualenv 3.12.2 notify-admin-upgrade
pyenv local notify-admin-upgrade
pyenv virtualenv 3.12.2 notify-admin
pyenv local notify-admin
```
_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`._
#### Updating the .env file for E2E tests
@@ -405,52 +413,6 @@ You can do this by going through these steps:
- Make a new PR with the change
- Have the PR get reviewed and merged
### Python dependency management
We're using [`Poetry`](https://python-poetry.org/) for managing our Python
dependencies and local virtual environments. When it comes to managing the
Python dependencies, there are a couple of things to bear in mind.
For situations where you manually manipulate the `pyproject.toml` file, you
should use the `make py-lock` command to sync the `poetry.lock` file. This will
ensure that you don't inadvertently bring in other transitive dependency updates
that have not been fully tested with the project yet.
If you're just trying to update a dependency to a newer (or the latest) version,
you should let Poetry take care of that for you by running the following:
```sh
poetry update <dependency> [<dependency>...]
```
You can specify more than one dependency together. With this command, Poetry
will do the following for you:
- Find the latest compatible version(s) of the specified dependency/dependencies
- Install the new versions
- Update and sync the `poetry.lock` file
In either situation, once you are finished and have verified the dependency
changes are working, please be sure to commit both the `pyproject.toml` and
`poetry.lock` files.
### Keeping the notification-utils dependency up-to-date
The `notifications-utils` dependency references the other repository we have at
https://github.com/GSA/notifications-utils - this dependency requires a bit of
extra legwork to ensure it stays up-to-date.
Whenever a PR is merged in the `notifications-utils` repository, we need to make
sure the changes are pulled in here and committed to this repository as well.
You can do this by going through these steps:
- Make sure your local `main` branch is up-to-date
- Create a new branch to work in
- Run `make update-utils`
- Commit the updated `poetry.lock` file and push the changes
- Make a new PR with the change
- Have the PR get reviewed and merged
## Known Installation Issues
### Python Installation Errors

8
poetry.lock generated
View File

@@ -1646,7 +1646,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"
@@ -1697,8 +1697,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"
@@ -3011,4 +3011,4 @@ files = [
[metadata]
lock-version = "2.0"
python-versions = "^3.12.2"
content-hash = "c3b2d9be88b2ae0d93c12c1f3c2e4f10de54f14dd414e0e7b6ac44ca1907d11b"
content-hash = "3215a1c0003ab142038dc0e104f6b68715a70b698b61841993154726682190f8"

View File

@@ -23,7 +23,7 @@ itsdangerous = "~=2.1"
jinja2 = "~=3.1"
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"}
pyexcel = "==0.7.0"
pyexcel-io = "==0.6.6"
pyexcel-ods3 = "==0.6.1"