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

Add 'list-stacks' command #274

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

jdemaeyer
Copy link
Contributor

@jdemaeyer jdemaeyer commented May 11, 2017

Example outputs

Print only major versions by default

$ shub list-stacks
Scrapy stacks:
  scrapy:1.3
  scrapy:1.3-py3
  scrapy:1.2
  scrapy:1.2-py3
  scrapy:1.1
  scrapy:1.1-test
  scrapy:1.1-py3
  scrapy:1.0

Portia stacks:
  portia:0.13

Print regular versions with the -a/--all flag

% shub list-stacks -a
Scrapy stacks:                                                       
  scrapy:1.3
  scrapy:1.3-py3
  scrapy:1.3-py3-20170421
  scrapy:1.3-py3-20170322
  scrapy:1.3-py3-20170215
  scrapy:1.3-py3-20170209
  scrapy:1.3-py3-20170208
  scrapy:1.3-py3-20170203
  scrapy:1.3-20170421
  scrapy:1.3-20170322
  scrapy:1.3-20170215
[...]

Print URLs for manual lookup if there is an error while accessing the GitHub API

$ shub list-stacks
Error: Error while retrieving the list of stacks from GitHub: API rate
limit exceeded for 86.153.115.4. (But here's the good news: Authenticated
requests get a higher rate limit. Check out the documentation for more
details.)

Please visit the following URLs to see the available stacks: 
  Scrapy: https://github.com/scrapinghub/scrapinghub-stack-scrapy/releases
  Portia: https://github.com/scrapinghub/scrapinghub-stack-portia/releases

Help page

$ shub list-stacks -h
Usage: shub list-stacks [OPTIONS]

  List the available stacks that you can run your project in. Use --all to
  include regular releases.

  See
  https://helpdesk.scrapinghub.com/support/solutions/articles/22000200402-scrapy-cloud-stacks
  for a general introduction to stacks, and
  https://shub.readthedocs.io/en/stable/configuration.html#choosing-a-scrapy-cloud-stack
  for information on how to configure a stack for your project.

Options:
  -a, --all   include regular releases
  -h, --help  Show this message and exit.

@jdemaeyer jdemaeyer requested review from chekunkov and redapple May 11, 2017 15:40
@jdemaeyer
Copy link
Contributor Author

jdemaeyer commented May 11, 2017

Some notes for discussion:

  1. GitHub paginates the tag list. Currently, shub list-stacks makes five requests (three for the Scrapy stacks, two for the Portia stacks) on every call, and this number will grow as we make more releases. Another advantage of having a Dash endpoint that lists the available stacks is that this would be avoided. (The "filter regular versions" logic could remain in shub I think, but I have no strong opinion on that.)
  2. The --all list is pretty long. We could consider filtering it with an additional argument, e.g. shub list-stacks scrapy:1.3 would only print stacks that begin with scrapy:1.3. In my eyes it's a bit over the top as we wouldn't save any requests and grep provides the same functionality without having to look into the shub help page.

@codecov-io
Copy link

codecov-io commented May 11, 2017

Codecov Report

Merging #274 into master will increase coverage by 0.04%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #274      +/-   ##
==========================================
+ Coverage   90.82%   90.87%   +0.04%     
==========================================
  Files          30       31       +1     
  Lines        1930     1972      +42     
==========================================
+ Hits         1753     1792      +39     
- Misses        177      180       +3
Impacted Files Coverage Δ
shub/tool.py 95% <ø> (ø) ⬆️
shub/list_stacks.py 92.85% <92.85%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4dfb083...df3805f. Read the comment docs.

@rafaelcapucho rafaelcapucho force-pushed the master branch 2 times, most recently from a290a34 to b0e4614 Compare January 15, 2021 02:28
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