Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

MB-10413: Convert to using pipenv to manage dependencies#84

Merged
ahobson merged 22 commits into
masterfrom
adh-pipenv
Nov 18, 2021
Merged

MB-10413: Convert to using pipenv to manage dependencies#84
ahobson merged 22 commits into
masterfrom
adh-pipenv

Conversation

@ahobson
Copy link
Copy Markdown
Contributor

@ahobson ahobson commented Nov 15, 2021

Description

Pipenv lets us manage dependencies and creates a lock file so we can have reproducible builds.

In addition, direnv supports it natively and will install the dependencies and manage the virtualenv for us.

I also took the opportunity to get the pre-commit in sync with the dependencies and use a pyproject.toml

Finally, I fixed the tests and enabled them in CI

Reviewer Notes

I've tested this out with nix and as much as I can with brew, although I don't use it extensively, so any validation you all can do would be great

Setup

Check out the code and try to follow the README to get your environment set up

@ahobson ahobson force-pushed the adh-pipenv branch 4 times, most recently from 9895ff0 to 7e8d0fa Compare November 15, 2021 21:01
@ahobson ahobson changed the title Convert to using pipenv to manage dependencies MB-10413: Convert to using pipenv to manage dependencies Nov 16, 2021
@ahobson ahobson marked this pull request as ready for review November 17, 2021 14:11
Copy link
Copy Markdown
Contributor

@ronaktruss ronaktruss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested using nix.

Comment thread README.md Outdated
Comment thread pyproject.toml Outdated
Comment thread .circleci/config.yml Outdated
Comment thread README.md
When setting up for the first time, before you run `direnv allow`, run

```shell
make install_tools
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to update my pyenv with instructions from make install_tools because Python 3.9.6 was not in the available list of installs.

Installing python 3.9.6 ...
python-build: definition not found: 3.9.6

See all available versions with `pyenv install --list'.

If the version you need is missing, try upgrading pyenv:

  cd /Users/duncan/.pyenv/plugins/python-build/../.. && git pull && cd -
failed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh whoops! What version of python should we be using?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that matches what's in the Dockerfile but more recent than when I updated pyenv. I'm not sure how to address that in the brewfile if at all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I don't know either. I guess if you got it work, that's what counts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, did you have pyenv previously? I wonder if we need to update the setup script to update pyenv if you already have it 🤔

Comment thread utils/tests/test_hosts.py Outdated
Copy link
Copy Markdown
Contributor

@duncan-truss duncan-truss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependencies setup seems to work for me and the docker container seems to be getting built alright.

I know we are saying the local docker setup is deprecated, I noticed that local_locust.py doesn't get copied to the container anymore so those commands fail.

Copy link
Copy Markdown
Contributor

@felipe-lee felipe-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't finished reviewing yet, but a few comments:

@ronaktruss
Copy link
Copy Markdown
Contributor

Dependencies setup seems to work for me and the docker container seems to be getting built alright.

I know we are saying the local docker setup is deprecated, I noticed that local_locust.py doesn't get copied to the container anymore so those commands fail.

@duncan-truss This was kinda discussed here. Since its a small change we can likely fix this, but we should probably be a bit more explicit on why we discourage/don't support docker.

@ahobson
Copy link
Copy Markdown
Contributor Author

ahobson commented Nov 17, 2021

Haven't finished reviewing yet, but a few comments:

I removed the .python-version. I don't know/use the fresh brew stuff, so I'll need someone else to fix that if we want to keep supporting it

@felipe-lee
Copy link
Copy Markdown
Contributor

Haven't finished reviewing yet, but a few comments:

I removed the .python-version. I don't know/use the fresh brew stuff, so I'll need someone else to fix that if we want to keep supporting it

I can make those changes later today if you don't mind me pushing to your branch. I can also open a pr against this branch if you'd prefer.

@ahobson
Copy link
Copy Markdown
Contributor Author

ahobson commented Nov 17, 2021

Haven't finished reviewing yet, but a few comments:

I removed the .python-version. I don't know/use the fresh brew stuff, so I'll need someone else to fix that if we want to keep supporting it

I can make those changes later today if you don't mind me pushing to your branch. I can also open a pr against this branch if you'd prefer.

Push the to branch. We can hopefully merge this tomorrow

Comment thread Makefile
install_python_deps: ensure_venv ## Install all python dependencies/requirements
pip install -r requirements.txt
pip install -r requirements-dev.txt
install_python_deps: ## Install all python dependencies/requirements
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we actually just get rid of this one? Direnv is handling pipenv no? If so, we could also get rid of the setup target since at that point it would just be an alias for ensure_pre_commit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't have much experience with pipenv yet, can we leave it in to see if we ever need it? We can always remove it in the future

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. In that case i think this is ready

@felipe-lee
Copy link
Copy Markdown
Contributor

Haven't finished reviewing yet, but a few comments:

I removed the .python-version. I don't know/use the fresh brew stuff, so I'll need someone else to fix that if we want to keep supporting it

I can make those changes later today if you don't mind me pushing to your branch. I can also open a pr against this branch if you'd prefer.

Push the to branch. We can hopefully merge this tomorrow

I've made the changes for the fresh-brew stuff. Just one comment on the Makefile now, but otherwise I think it's ready.

@ahobson ahobson merged commit 3a16252 into master Nov 18, 2021
@ahobson ahobson deleted the adh-pipenv branch November 18, 2021 18:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants