Skip to content

Commit

Permalink
remove python installation scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
halcarleton committed Jan 21, 2022
1 parent 7f7f9c9 commit 4ca5282
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 572 deletions.
Binary file removed DEMO.png
Binary file not shown.
237 changes: 87 additions & 150 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,108 @@
## EB CLI Installer
# EB CLI Installer

------

### 1. Overview

------
## 1. Overview

This repository hosts scripts to generate self-contained installations of the [EB CLI](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3.html).

------
### 1.1. Prerequisites

You will need to have the following prerequisites installed before running the install script.

### 1.1. Prerequisites
* **Git**
* If not already installed you can download git from the [Git downloads page](https://git-scm.com/downloads).
* **Python**
* We recommend that you install Python using the [pyenv](https://github.com/pyenv/pyenv) Python version manager. Alternately, you can download Python from the [Python downloads page](https://www.python.org/downloads/).
* **virtualenv**
* Follow the [virtualenv documentation](https://virtualenv.pypa.io/en/latest/installation.html) to install virtualenv.

If you don't have Git, install it from [Git Downloads](https://git-scm.com/downloads).
## 2. Quick start

Python, which the EBCLI Installer depends on, requires the following prerequisites for each operating system.
### 2.1. Clone this repository

- **Linux**
- **Ubuntu and Debian**
Use the following:

```shell
build-essential zlib1g-dev libssl-dev libncurses-dev libffi-dev libsqlite3-dev libreadline-dev libbz2-dev
```
```
git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git
```

- **Amazon Linux and Fedora**
### 2.2. Install/Upgrade the EB CLI

```shell
"Development Tools" zlib-devel openssl-devel ncurses-devel libffi-devel sqlite-devel.x86_64 readline-devel.x86_64 bzip2-devel.x86_64
```
#### MacOS/Linux
On **Bash** or **Zsh**:

- **macOS**
```
python ./aws-elastic-beanstalk-cli-setup/scripts/ebcli_installer.py
```

#### Windows
In **PowerShell** or in a **Command Prompt** window:

```shell
Xcode openssl zlib readline
```
```
python .\aws-elastic-beanstalk-cli-setup\scripts\ebcli_installer.py
```

------
### 2.3. After installation

### 2. Use
On Linux and macOS, the output contains instructions to add the EB CLI (and Python) executable file to the shell's `$PATH` variable, if it isn't already in it.

------
## 3. Usage

#### 2.1. Clone this repository
The `ebcli_installer.py` Python script will install the [awsebcli](https://pypi.org/project/awsebcli/) package in a virtual environment to prevent potential conflicts with other Python packages.

Use the following:
For most use cases you can execute the `ebcli_installer.py` script with no arguments.

```shell
git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git
```
python ./aws-elastic-beanstalk-cli-setup/scripts/ebcli_installer.py
```

#### 2.2. Install/Upgrade the EB CLI
### 3.1 Advanced usage

On **Bash** and **Zsh** on macOS and Linux:
- To install a **specific version** of the EB CLI:

```shell
./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
```
```shell
python scripts/ebcli_installer.py --version 3.14.13
```

In **PowerShell** or in a **Command Prompt** window:
- To install the EB CLI with a specific **version of Python** (the Python version doesn't need to be in `$PATH`):
```shell
python scripts/ebcli_installer.py --python-installation /path/to/some/python/on/your/computer
```
- To install the EB CLI **from source** (Git repository, .tar file, .zip file):
```shell
python scripts/ebcli_installer.py --ebcli-source /path/to/awsebcli.zip
python scripts/ebcli_installer.py --ebcli-source /path/to/EBCLI/codebase/on/your/computer
```
- To install the EB CLI at a **specific location**, instead of in the standard `.ebcli-virtual-env` directory in the user's home directory:

```ps1
.\aws-elastic-beanstalk-cli-setup\scripts\bundled_installer
```shell
python scripts/ebcli_installer.py --location /path/to/ebcli/installation/location
```
### 3.2 Options

```
options:
-h, --help show this help message and exit
-e VIRTUALENV_EXECUTABLE, --virtualenv-executable VIRTUALENV_EXECUTABLE
path to the virtualenv installation to use to create the EBCLI's virtualenv
-i, --hide-export-recommendation
boolean to hide recommendation to modify PATH
-l LOCATION, --location LOCATION
location to store the awsebcli packages and its dependencies in
-p PYTHON_INSTALLATION, --python-installation PYTHON_INSTALLATION
path to the python installation under which to install the awsebcli and its
dependencies
-q, --quiet enable quiet mode to display only minimal, necessary output
-s EBCLI_SOURCE, --ebcli-source EBCLI_SOURCE
filesystem path to a Git repository of the EBCLI, or a .zip or .tar file of
the EBCLI source code; useful when testing a development version of the EBCLI.
-v VERSION, --version VERSION
version of EBCLI to install
```
#### 2.3. Troubleshooting
## 4. Troubleshooting
- **Linux**
Expand Down Expand Up @@ -110,123 +148,34 @@ In **PowerShell** or in a **Command Prompt** window:
pip install virtualenv
python .\aws-elastic-beanstalk-cli-setup\scripts\ebcli_installer.py
```
## 5. Frequently asked questions
#### 2.4. After installation

On Linux and macOS, the output contains instructions to add the EB CLI (and Python) executable file to the shell's `$PATH` variable, if it isn't already in it.

#### 2.5. Demo execution of `bundled_installer`

![Demo](./DEMO.png)

### 3. Advanced use

To install the EB CLI, `bundled_installer` runs `ebcli_installer.py`. `ebcli_installer.py` has the following capabilities:

- To install a **specific version** of the EB CLI:

```shell
python scripts/ebcli_installer.py --version 3.14.13
```

- To install the EB CLI with a specific **version of Python** (the Python version doesn't need to be in `$PATH`):
```shell
python scripts/ebcli_installer.py --python-installation /path/to/some/python/on/your/computer
```
- To install the EB CLI **from source** (Git repository, .tar file, .zip file):
```shell
python scripts/ebcli_installer.py --ebcli-source /path/to/awsebcli.zip
python scripts/ebcli_installer.py --ebcli-source /path/to/EBCLI/codebase/on/your/computer
```
- To install the EB CLI at a **specific location**, instead of in the standard `.ebcli-virtual-env` directory in the user's home directory:

```shell
python scripts/ebcli_installer.py --location /path/to/ebcli/installation/location
```

Run the following command to view the help text for `ebcli_installer.py`:

```shell
python scripts/ebcli_installer.py --help
```
### 5.1. For the **experienced Python developer**, what's the advantage of this mode of installation instead of regular `pip` inside a `virtualenv`?
### 4. Frequently asked questions
Even within a `virtualenv`, a developer might need to install multiple packages whose dependencies are in conflict. For example, at times the AWS CLI and the EB CLI have used conflicting versions of `botocore`. [One such instance](https://github.com/aws/aws-cli/issues/3550) was particularly egregious. When there are conflicts, users have to manage separate `virtualenvs` for each of the conflicting packages, or find a combination of the packages without conflicts.
------
Both of these workarounds become unmanageable over time, and as the number of packages that are in conflict increases.
#### 4.1. Can I skip the Python installation?

**Yes.** If you already have Python installed on your system, after step `2.1.`, run the following.

On **Bash** and **Zsh**:

```shell
python aws-elastic-beanstalk-cli-setup/scripts/ebcli_installer.py
```

In **PowerShell** and from the **Command Prompt** window:

```shell
python .\aws-elastic-beanstalk-cli-setup\scripts\ebcli_installer.py
```

#### 4.2. For the **experienced Python developer**, what's the advantage of this mode of installation instead of regular `pip` inside a `virtualenv`?

Even within a `virtualenv`, a developer might need to install multiple packages whose dependencies are in conflict. For example, at times the AWS CLI and the EB
CLI have used conflicting versions of `botocore`. [One such instance](https://github.com/aws/aws-cli/issues/3550) was particularly egregious. When there are
conflicts, users have to manage separate `virtualenvs` for each of the conflicting packages, or find a combination of the packages without conflicts.
Both these workarounds become unmanageable over time, and as the number of packages that are in conflict increases.

#### 4.3. On macOS (or Linux systems with `brew`), is this better than `brew install awsebcli`?
### 5.2. On macOS (or Linux systems with `brew`), is this better than `brew install awsebcli`?
**Yes**, for these reasons:
- The AWS Elastic Beanstalk team has no control over how `brew` operates.
- The `brew install ...` mechanism doesn't solve the problem of dependency conflicts, which is a primary goal of this project.
#### 4.3. For developers who are **new to Python**, does this mode of installation pose challenges?
The opinion of the AWS Elastic Beanstalk team is "**No**".
Aside from the problem described in `4.2.`, developers new to Python are often confused by the presence of multiple versions of Python and `pip` executable files on
their system. A common problem that such developers encounter is that when they install `eb` with one `pip` executable file (presumably using the `sudo`
prefix),
no `eb`-related commands work because the correct set of directories isn't referenced correctly.

Typically, for such developers, use of `virtualenv` is the correct path forward. However, this becomes yet another hurdle before using `eb`.

Another common problem is where users install Python and `pip` in ways that Elastic Beanstalk Documentation doesn't recommend, such as using arbitrary Personal Package Archives
(PPAs) on Ubuntu, or similar unmaintained sources that lack scrutiny.
#### 4.4. Can I execute the Bash scripts in a Cygwin, git-bash, or other Bash-like shell on Windows?
**No**. At this time, we don't directly support execution on Bash-like environments on Windows. Use PowerShell or the Command Prompt window to install. You can
add the location of the `eb` and `Python` executable files to `$PATH` .

#### 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 don't 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.
#### 4.6. I already have Python installed. Can I still execute `bundled_installer`?
**Yes**. It's safe to execute `bundled_installer` even if you already have Python installed. The installer will skip reinstallation.

#### 4.7. I already have the EB CLI installed. Can I still execute `ebcli_installer.py`?
### 5.3. I already have the EB CLI installed. Can I still execute `ebcli_installer.py`?
**Yes**.
Consider the following two cases:
- `ebcli_installer.py` was previously run, 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 EB CLI will overwrite `.ebcli-virtual-env` and attempt to install the latest version of the EB CLI in the `virtualenv` within it.
- `ebcli_installer.py` was previously run, 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 EB CLI will overwrite `.ebcli-virtual-env` and attempt to install the latest version of the EB CLI in the `virtualenv` within it.
- `eb` is in `$PATH`, however, it wasn't 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 you perform this action, the older `eb` executable file will continue to be referenced when you type `eb`.
#### 4.8. How does `ebcli_installer.py` work?
### 5.4. How does `ebcli_installer.py` work?
When executing the Python script, `ebcli_installer.py` does the following:
Expand All @@ -237,24 +186,12 @@ When executing the Python script, `ebcli_installer.py` does the following:
- `.bat` and `.ps1` wrappers for `eb` on Windows.
- When complete, you will be prompted to add `<installation-location>/executables` to `$PATH`, only if the directory is not already in it.
#### 4.8. How does `bundled_installer` work?
- On macOS or Linux, `bundled_installer` uses the extremely popular [`pyenv` project](https://github.com/pyenv/pyenv) to install the latest version of Python 3.7.
- On Windows, it downloads the MSI installer of the latest Python version from Python's website and silently installs it.

#### 4.9. Are there dependency problems that this mode of installation doesn't solve?
### 5.5. Are there dependency problems that this mode of installation doesn't solve?
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 not work.
#### 4.10. Is it okay to use Python 2.7 to install the EB CLI?

**Yes**, however, be aware that Python 2.7 will be deprecated on January 1, 2020. There won't be security updates after that date.
Also, the latest minor version series, Python 3.7, offers significant improvements over the Python 2.7 series. We highly recommend that you use Python 3.7
for testing purposes, even though the Elastic Beanstalk team tests the EB CLI against Python 2.7.
### 5. License
## 6. License
This library is licensed under the Mozilla Public License Version 2.0.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.2
0.2.0
71 changes: 0 additions & 71 deletions scripts/bundled_installer

This file was deleted.

1 change: 0 additions & 1 deletion scripts/bundled_installer.bat

This file was deleted.

Loading

0 comments on commit 4ca5282

Please sign in to comment.