Skip to content
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

Suggestion: A self-contained binary for easier installation #29

Closed
mumoshu opened this issue Jan 19, 2018 · 4 comments
Closed

Suggestion: A self-contained binary for easier installation #29

mumoshu opened this issue Jan 19, 2018 · 4 comments

Comments

@mumoshu
Copy link
Contributor

mumoshu commented Jan 19, 2018

In my organization, dozens of devs are starting to use onelogin-aws-cli(Thank you very much for creating/maintaining this!). The only and largest struggle for me is that many of them already has a working python2 and/or python3 envs each with virutalenv(s) or no virtualenv at all. There seems like no uniform, easy way to keep one's onelogin-aws-login installation up-to-date and accessible whatever python/virutualenv he/she uses for ones own development work.

Possible solution

While hanging around GitHub, I got to know that there's a tool named pex which is capable of creating a self-contained executable python env for your app.

See how it works in the wild at e.g.: datawire/forge@6fd6d6d

Would you mind hosting the self-contained binary at GitHub releases of this project once if I contributed the script for automating it?

Thanks!

@slycoder
Copy link
Contributor

Sure thing!

@slycoder
Copy link
Contributor

Thanks @mumoshu !

mumoshu added a commit to mumoshu/onelogin-aws-cli that referenced this issue Jan 23, 2018
Resolves physera#29

This is verified to work by:

- Running `pip install -e .` and then `onelogin-aws-login`
- Running `scripts/build.sh` and then `dist/onelogin-aws-login`
- Running `docker build -t onelogin-aws-login-test .` with Dockerfile:
  ```
  FROM alpine:3.7

   RUN apk add --update --no-cache python3

   ADD dist/onelogin-aws-login /
   ```
   and running `docker run --rm -it onelogin-aws-login /onelogin-aws-login -h`

Note that running the pex binary requires a working python3 installation beforehand.
mumoshu added a commit to mumoshu/onelogin-aws-cli that referenced this issue Jan 23, 2018
This adds `scripts/build.sh` which produces a pex binary `dist/onelogin-aws-login`.

The pex binary supports multiple archs/platforms - currently, it is runnable on both linux/macOS, x86_64/i686.
The existing way to install onelogin-aws-login with `pip install` is still supported.

Note that a pex binary doesn't contain a python runtime. You still need to install python3 in order to run the onelogin-aws-login command.
However, this will still allow you to install onelogin-aws-login without polluting your python env. Also, installing onelogin-aws-login is easier as it is just a matter of running `curl -o onelogin-aws-login <onelogin-aws-login release> && chmod +x onelogin-aws-login`.

Resolves physera#29

---

This is verified to work by:

- Running `pip install -e .` and then `onelogin-aws-login`
- Running `scripts/build.sh` and then `dist/onelogin-aws-login`
- Running `docker build -t onelogin-aws-login-test .` with Dockerfile:
  ```
  FROM alpine:3.7

   RUN apk add --update --no-cache python3

   ADD dist/onelogin-aws-login /
   ```
   and running `docker run --rm -it onelogin-aws-login /onelogin-aws-login -h`
mumoshu added a commit to mumoshu/onelogin-aws-cli that referenced this issue Jan 23, 2018
This adds `scripts/build.sh` which produces a pex binary `dist/onelogin-aws-login`.

The pex binary supports multiple archs/platforms - currently, it is runnable on both linux/macOS, x86_64/i686.
The existing way to install onelogin-aws-login with `pip install` is still supported.

Note that a pex binary doesn't contain a python runtime. You still need to install python3 in order to run the onelogin-aws-login command.
However, this will still allow you to install onelogin-aws-login without polluting your python env. Also, installing onelogin-aws-login is easier as it is just a matter of running `curl -o onelogin-aws-login <onelogin-aws-login release> && chmod +x onelogin-aws-login`.

Resolves physera#29

---

This is verified to work by:

- Running `pip install -e .` and then `onelogin-aws-login`
- Running `scripts/build.sh` and then `dist/onelogin-aws-login`
- Running `docker build -t onelogin-aws-login-test .` with Dockerfile:
  ```
  FROM alpine:3.7

  RUN apk add --update --no-cache python3

  ADD dist/onelogin-aws-login /
  ```
  and running `docker run --rm -it onelogin-aws-login /onelogin-aws-login -h`
@mumoshu
Copy link
Contributor Author

mumoshu commented Jan 23, 2018

Hi @slycoder, I've just submitted a PR at #30 for this.
Would you mind reviewing it?
Thanks!

slycoder pushed a commit that referenced this issue Feb 18, 2018
…30)

This adds `scripts/build.sh` which produces a pex binary `dist/onelogin-aws-login`.

The pex binary supports multiple archs/platforms - currently, it is runnable on both linux/macOS, x86_64/i686.
The existing way to install onelogin-aws-login with `pip install` is still supported.

Note that a pex binary doesn't contain a python runtime. You still need to install python3 in order to run the onelogin-aws-login command.
However, this will still allow you to install onelogin-aws-login without polluting your python env. Also, installing onelogin-aws-login is easier as it is just a matter of running `curl -o onelogin-aws-login <onelogin-aws-login release> && chmod +x onelogin-aws-login`.

Resolves #29

---

This is verified to work by:

- Running `pip install -e .` and then `onelogin-aws-login`
- Running `scripts/build.sh` and then `dist/onelogin-aws-login`
- Running `docker build -t onelogin-aws-login-test .` with Dockerfile:
  ```
  FROM alpine:3.7

  RUN apk add --update --no-cache python3

  ADD dist/onelogin-aws-login /
  ```
  and running `docker run --rm -it onelogin-aws-login /onelogin-aws-login -h`
@drewsonne
Copy link
Contributor

@mumoshu How did you get the dist stage to successfully build? I'm trying to debug this, but it requires lxml for all possible platforms being built.

As lxml is distributed only as platform specific wheels, I've tried download only the specific platform, but they do not seem to match your platforms in pex. What was the configuration you used when testing this to build on all the specified platforms?

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

No branches or pull requests

3 participants