cookiecutter-pypackage icon indicating copy to clipboard operation
cookiecutter-pypackage copied to clipboard

Fix travis_pypi_setup.py

Open pydanny opened this issue 7 years ago • 6 comments

  • Date you used Cookiecutter PyPackage: 2018/01/17
  • Cookiecutter version used, if any: 1.6
  • Python version, if any: 3.6
  • Operating System: OSX

Description

Failed with this stack trace:

$ python travis_pypi_setup.py 
Traceback (most recent call last):
  File "travis_pypi_setup.py", line 131, in <module>
    main(args)
  File "travis_pypi_setup.py", line 116, in main
    public_key = fetch_public_key(args.repo)
  File "travis_pypi_setup.py", line 65, in fetch_public_key
    data = json.loads(urlopen(keyurl).read().decode())
  File "/usr/local/Cellar/python36/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/Cellar/python36/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python36/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python36/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python36/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python36/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

What I Did

python travis_pypi_setup.py

YAML Parsing Concerns for Windows Users

PyYAML is hard to get working on Windows and last update was in 2016. Raumel.yaml works better but can also have issues.

pydanny avatar Feb 17 '18 22:02 pydanny

@eliasdorneles, would you have a problem if I removed this module for now? Or moved it to a beta folder? The reason is we have an upcoming workshop and this is causing problems, especially for Windows users trying to get YAML libraries working.

pydanny avatar Feb 18 '18 04:02 pydanny

If anyone can get this working, including for Windows users, we'll put it back in.

pydanny avatar Feb 18 '18 04:02 pydanny

Hi @pydanny ! No problem at all, please go ahead! Thanks for asking, but there was no need I was considering removing it myself, albeit for different reasons (it seems confusing first-time users). Good luck with workshop!

eliasdorneles avatar Feb 18 '18 08:02 eliasdorneles

Thanks @eliasdorneles!

pydanny avatar Feb 18 '18 19:02 pydanny

Tasks remaining:

  • [ ] Get working again:test_project_with_hyphen_in_module_name.py
  • [ ] Get working again: test_bake_and_run_travis_pypi_setup.py

pydanny avatar Feb 18 '18 19:02 pydanny

@pydanny I'd be willing to work on this issue. I have mostly resolved it for my fork cookiecutter-pipenv, and figure it might be good to contribute back upstream.

I have a few caveats for my solution.

First, in order to get the tests running, I use Pipenv to install all generated dependencies, including cryptography, in a virtualenv inside the baked test project. I assume you'd like to keep the existing requirements.txt and requirements_dev.txt dependency specification instead of Pipfile and Pipfile.lock.

Second, tests failed for pypy because of problems installing cryptography. I haven't had a chance dig into this issue, so for the time being, I've removed pypy support for my fork.

Third, the travis_pypy_setup.py script really needs a flag to differentiate between travis-ci.com and travis-ci.org. Since last year, Travis has requested that new repos (including open source) should run on com. I plan on adding a --com flag to the CLI options, but wanted to make a note.

Fourth, the v3 of the Travis API requires user authentication using the travis CLI in order to retrieve a public key. When using v2.1 (which is still supported), no authentication is necessary. If Travis deprecates the existing v2.1 API, users may have to use the travis CLI tool regardless, unless we implement the login & token functionality under the v3 API.

I can handle these last two items on my own when I have some more time. However, I'd like your thoughts on the first two. What is an acceptable way to get dependencies installed within the tests? And what are your thoughts on running tests on pypy?

elgertam avatar May 21 '19 04:05 elgertam