Skip to content

Bundled installer for unix #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 16, 2019

Conversation

rahulrajaram
Copy link
Contributor

@rahulrajaram rahulrajaram commented Apr 6, 2019

1. Description

This PR adds:

  • python_installer for Bash and Zsh that installs the latest Python (currently Python 3.7.3) (and virtualenv)
  • bundled_installer for Bash and Zsh that installs Python and the EBCLI.
  • a README.md with installation instructions and FAQs

2. Testing

2.1. python_installer

  • If pyenv is already in $PATH, pyenv is not cloned.
  • If pyenv is not in $PATH:
    • if pyenv has already been cloned to ~/.pyenv-repository, cloning is not attempted, execution proceeds
    • if pyenv has not been cloned, it is cloned to ~/.pyenv-repository
  • if Python 3.7.3 hasn't already been installed through pyenv, it is installed and execution proceeds
  • if Python 3.7.3 has already been installed through pyenv, (re)installation is skipped
  • if Python 3.7.3 has been successfully installed or an existing Python 3.7.3 installation has already been detected under pyenv, the pip corresponding to it is used to install virtualenv. As can be determined after a successful installation, virtualenv will be found inside ~/.pyenv/versions/3.7.3/bin/
  • if Bash is not in $PATH, the installer fails
  • after a successful installation:
    • if ~/.pyenv/versions/3.7.3/bin/ is in $PATH, the user is merely informed of the success of the operation
    • if ~/.pyenv/versions/3.7.3/bin/ is not in $PATH, Bash- and Zsh-specific instructions are provided to add to $PATH so that Python, pip, and virtualenv are discoverable.

2.2. bundled_installer

  • if Bash is not in $PATH, the installer fails
  • if script invokes the python_installer and the ebcli_installer
  • if python_installer fails, ebcli_installer's execution does not start; the script exits with a non-0 exit-code.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The script to realize this expects Git to be installed so that it
can downlod pyenv from GitHub, and install the latest available
Python or one close to it through pyenv.

The user of the script will be asked to add the locations of Python
to PATH so that installation can be completed and Python subsequently
found for other purposes such as for installing the EBCLI.

As an aside, the script also installs virtualenv so that the EBCLI
self-contained installer can use it. For this, the "pip" executable
located within the just-installed Python's "bin" directory
(/path-to/pyenv/versions/<PYTHON_VERSION>/bin/) is used.
@rahulrajaram rahulrajaram self-assigned this Apr 6, 2019
@rahulrajaram rahulrajaram force-pushed the BundledInstallerForUnix branch from 04cccae to baab077 Compare April 6, 2019 00:46

The EB CLI is a command line interface for Elastic Beanstalk that provides interactive commands that simplify creating, updating and monitoring environments from a local repository.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should use a different description. I know you took this from https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3.html, but as a first-read, it's not really intuitive as to what the eb cli is. This description is more relevant:

Elastic Beanstalk (EB) is a service used to deploy, manage, and scale web applications and services. You can use Elastic Beanstalk from the AWS Management console or from the command line using the Elastic Beanstalk Command Line Interface (EB CLI). You should use the EB CLI as part of your everyday development and testing cycle when you favor using the terminal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this was actually removed.

README.md Outdated

1. create **self-contained installations of the EBCLI** in a manner that prevents dependency collisions with other related projects such as the AWS CLI.

2. install the latest **Python 3.7 installation**
Copy link
Contributor

Choose a reason for hiding this comment

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

install Python 3.7

IMO, all the other verbiage is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense since we would like to be opinionated and insist on using Python 3.7.

README.md Outdated

2. install the latest **Python 3.7 installation**

3. combine 2. and 1. for users who do not want to be completely hands-off (**recommended**).
Copy link
Contributor

Choose a reason for hiding this comment

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

list in order: combine 1. and 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Following your comment above, I think we can eliminate these 3 steps in favour of:

"This package contains scripts to install Python 3.7 and the EBCLI."

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.

README.md Outdated

### 3. Advanced usage:

To install the EBCLI, `bundled_installer` runs `ebcli_installer.py`. If you already have Python installed on your system, as will be described later in `4.1.`
Copy link
Contributor

Choose a reason for hiding this comment

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

The if statement here doesn't seem to convey a complete thought.

README.md Outdated

#### 4.2. For the **seasoned Python developer**, what is the advantage of this mode of installation over regular `pip` inside a `virtualenv`:

Even within a `virtualenv`, a developer might find the need to install multiple packages whose dependencies are in conflict. For instance, at various points in time, the AWSCLI and the EBCLI have been conflict with one another owing to their dependency on `botocore`. [One such instance](https://github.com/aws/aws-cli/issues/3550) was particularly bad. When there are conflicts, users have to bear the onus of managing separate virtualenvs for each of the conflicting packages, or find a combination of the packages devoid of conflicts. Both these workarounds become unmanageable over time and as the number of packages that are in conflict increases.
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: replace owing with due

Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: replace bad with egregious.

README.md Outdated

#### 4.2. For the **seasoned Python developer**, what is the advantage of this mode of installation over regular `pip` inside a `virtualenv`:

Even within a `virtualenv`, a developer might find the need to install multiple packages whose dependencies are in conflict. For instance, at various points in time, the AWSCLI and the EBCLI have been conflict with one another owing to their dependency on `botocore`. [One such instance](https://github.com/aws/aws-cli/issues/3550) was particularly bad. When there are conflicts, users have to bear the onus of managing separate virtualenvs for each of the conflicting packages, or find a combination of the packages devoid of conflicts. Both these workarounds become unmanageable over time and as the number of packages that are in conflict increases.
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: replace bad with egregious.

README.md Outdated

Even within a `virtualenv`, a developer might find the need to install multiple packages whose dependencies are in conflict. For instance, at various points in time, the AWSCLI and the EBCLI have been conflict with one another owing to their dependency on `botocore`. [One such instance](https://github.com/aws/aws-cli/issues/3550) was particularly bad. When there are conflicts, users have to bear the onus of managing separate virtualenvs for each of the conflicting packages, or find a combination of the packages devoid of conflicts. Both these workarounds become unmanageable over time and as the number of packages that are in conflict increases.

#### 4.3. On OS X (or Linux systems with `brew`), Is this better than `brew install awsebcli`?
Copy link
Contributor

Choose a reason for hiding this comment

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

Is should be is

README.md Outdated

**Yes**, for a few reasons:

- the Beanstalk team does not have control over how `brew` operates. So installation problems and will take time to fix as will general queries to be responded to.
Copy link
Contributor

Choose a reason for hiding this comment

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

remove and

README.md Outdated

The opinion of the Beanstalk team is "**No**".

Besides the problem described in `3.2.`, developers new to Python are often confused by the presence of multiple Pythons, and `pip` executables on their system. A common problem that such developers encounter is where they install `eb` with one `pip` executable (presumably using the `sudo` prefix) only to find that `eb --help` despite repeated installations or any other command does not work because the correct set of directories is not being looked within.
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace Besides with Aside from or In addition to...

README.md Outdated

The opinion of the Beanstalk team is "**No**".

Besides the problem described in `3.2.`, developers new to Python are often confused by the presence of multiple Pythons, and `pip` executables on their system. A common problem that such developers encounter is where they install `eb` with one `pip` executable (presumably using the `sudo` prefix) only to find that `eb --help` despite repeated installations or any other command does not work because the correct set of directories is not being looked within.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would replace only to find that eb --help despite repeated installations or any other command does not work because the correct set of directories is not being looked within. with

only to find that no eb-related commands work because the correct set of directories is not properly referenced.

README.md Outdated

Normally, for such developers, usage of `virtualenv` is the correct path forward, however, this becomes yet another hurdle before executing with `eb`.

Another common problem is where, users install Python and `pip` though means not recommended by AWS Documentation such as arbitrary PPAs on Ubuntu, or similar unmaintained sources that lack scrutiny.
Copy link
Contributor

Choose a reason for hiding this comment

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

remove comma after where

README.md Outdated

#### 4.4. Can I execute the Bash scripts in a Cygwin, git-bash and other Bash-like shells on Windows?

**No**. At this time, we do not directly support execution on Bash-like environments on Windows. Please use PowerShell or CMD Prompt to install. You may add to `$PATH` the location of the `eb` and `Python` executables from your Bash-like terminals.
Copy link
Contributor

Choose a reason for hiding this comment

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

Period after executables and then remove the rest.

README.md Outdated
**No**. At this time, we do not directly support execution on Bash-like environments on Windows. Please use PowerShell or CMD Prompt to install. You may add to `$PATH` the location of the `eb` and `Python` executables from your Bash-like terminals.

#### 4.5. Can I execute the Bash scripts in a `fish` shell?
**Yes**, but only if you have Bash on your computer. At this time, we do not provide specific guidance on how to set `$PATH` in fish, however, Fish has [detailed documentation](https://fishshell.com/docs/current/tutorial.html#tut_path) for this purpose.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove comma after time. Period before however, then continue with However, Fish... Also, we should be consistent in how we reference fish - caps in one case, lower case in another.

README.md Outdated

- `ebcli_installer.py` was previously run, thereby creating `.ebcli-virtual-env` in the user's home directory (or the user's choice of a directory indicated through the `--location` argument). In this case, the EBCLI will simply overwrite `.ebcli-virtual-env` and attempt to install the latest version of the EBCLI in the virtualenv within it.

- `eb` is in `$PATH`, however, it was not installed by `ebcli_installer.py`. In this case, the installer will install `eb` within `.ebcli-virtual-env` in the user's home directory (or the user's choice of a directory indicated through the `--location` argument) and prompt the user to prefix `/path-to/.ebcli-virtual-env/executables` to `$PATH`. Until, this new path is prefixed, the older `eb` will be the primary installation.
Copy link
Contributor

Choose a reason for hiding this comment

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

The sentence with Until is not very clear as to what it is saying.

README.md Outdated

Unfortunately, **yes**.

Suppose the dependencies of `eb`, say `Dep A` and `Dep B` are in conflict, because `pip` lacks dependency management capabilities, the resulting `eb` installation might be rendered defective.
Copy link
Contributor

Choose a reason for hiding this comment

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

Period after conflict. Then Because

@rahulrajaram
Copy link
Contributor Author

Comments on the README have been addressed here

@rahulrajaram rahulrajaram force-pushed the BundledInstallerForUnix branch from 90dc5f6 to 770391d Compare April 16, 2019 23:17
@rahulrajaram rahulrajaram changed the base branch from AddEBCLIInstaller to master April 16, 2019 23:18
@rahulrajaram rahulrajaram changed the base branch from master to AddEBCLIInstaller April 16, 2019 23:19
@rahulrajaram rahulrajaram merged commit ec52c5b into AddEBCLIInstaller Apr 16, 2019
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.

2 participants