spacetelescope / style-guides

An opinionated guide on how we work.
Creative Commons Attribution 4.0 International
55 stars 33 forks source link

travis build fails with ModuleNotFoundError on freshly created repository #66

Closed Johannes-Sahlmann closed 3 years ago

Johannes-Sahlmann commented 5 years ago

I am not sure whether this should be an issue here (style-guides) or rather on the stsci-package-template:

I followed the steps described at https://github.com/spacetelescope/style-guides/blob/master/guides/python-package.md for creating a new package/repo (https://github.com/spacetelescope/pystortion)

The travis build fails (https://travis-ci.com/spacetelescope/pystortion/builds/91425159) with ModuleNotFoundError: No module named 'astropy_helpers'

Did I make a mistake in the process or is there an oversight in the guide or template?

pllim commented 5 years ago

Which template did you use? There is a flavor with astropy-helpers and one without.

Johannes-Sahlmann commented 5 years ago

I am not sure. Below is the log of events:

(fpy35) nereus:~ jsahlmann$ cookiecutter https://github.com/spacetelescope/stsci-package-template --checkout stsci-cookiecutter
package_name [packagename]: pystortion
module_name [pystortion]: pystortion
short_description [pystortion]: Support for distortion measurements in astronomical imagers.
long_description []: tbw
author_name [Space Telescope Science Institute]: Johannes Sahlmann STScI/AURA
author_email [help@stsci.edu]: 
Select license:
1 - Aura
2 - BSD 3-Clause
3 - GNU GPL v3+
4 - Apache Software Licence 2.0
5 - BSD 2-Clause
6 - Other
Choose from 1, 2, 3, 4, 5, 6 (1, 2, 3, 4, 5, 6) [1]: 1
project_url [http://stsci.edu]: 
project_version [0.0.dev]: 0.01
include_example_code [y]: 
include_example_cython_code [n]: n
include_cextern_folder [n]: n
edit_on_github_extension [False]: 
github_project [spacetelescope/stsci-package-template]: spacetelescope/pystortion                       
use_travis_ci [y]: 
use_appveyor_ci [n]: 
use_read_the_docs [y]: 
sphinx_theme [stsci_rtd_theme]: 
initialize_git_repo [y]: n
Select minimum_python_version:
1 - 3.7
2 - 3.6
3 - 3.5
Choose from 1, 2, 3 (1, 2, 3) [1]: 3
astropy_helpers_version [v3.0.2]: 
pllim commented 5 years ago

@sosey or @stscicrawford ?

pllim commented 5 years ago

p.s. Your link is broken. I can't see the actual error.

Johannes-Sahlmann commented 5 years ago

Strange, it works for me. Maybe this one is better? https://travis-ci.com/spacetelescope/pystortion/

pllim commented 5 years ago

I see a fallen cone picture with "No builds for this repository" message. Perhaps you can click on "raw log" of the failed job, download the text, and attach it here?

Johannes-Sahlmann commented 5 years ago

Clicking on "raw log" leads to a page that displays

{
  "@type": "error",
  "error_type": "not_found",
  "error_message": "log not found (or insufficient access)",
  "resource_type": "log"
}

I attached a screenshot instead.

screen shot 2018-11-15 at 21 17 23
stscicrawford commented 5 years ago

It should have astropy_helpers as a submodule and when I look at the directory here: https://github.com/spacetelescope/pystortion, it appears to be missing.

In the original directory that you created, can you let me know the contents of it and also the output from running git log in the directory for the new repository?

I also wasn't seeing the same things as @pllim up until a few seconds ago, and now, I can start to see some of the build information.

Johannes-Sahlmann commented 5 years ago

There is indeed no astropy_helpers submodule in my package. To be sure that I did not accidentally delete it, I repeated the package generation:

(fpy35) nereus:~ jsahlmann$ cookiecutter https://github.com/spacetelescope/stsci-package-template --checkout stsci-cookiecutter
You've downloaded /Users/jsahlmann/.cookiecutters/stsci-package-template before. Is it okay to delete and re-download it? [yes]: 
package_name [packagename]: trial
module_name [trial]:      
short_description [trial]: testing
long_description []: more testing
author_name [Space Telescope Science Institute]: 
author_email [help@stsci.edu]: 
Select license:
1 - Aura
2 - BSD 3-Clause
3 - GNU GPL v3+
4 - Apache Software Licence 2.0
5 - BSD 2-Clause
6 - Other
Choose from 1, 2, 3, 4, 5, 6 (1, 2, 3, 4, 5, 6) [1]: 1
project_url [http://stsci.edu]: 
project_version [0.0.dev]: 0.0.1
include_example_code [y]: 
include_example_cython_code [n]: n
include_cextern_folder [n]: 
edit_on_github_extension [False]: 
github_project [spacetelescope/stsci-package-template]: spacetelescope/trial
use_travis_ci [y]: 
use_appveyor_ci [n]: 
use_read_the_docs [y]: 
sphinx_theme [stsci_rtd_theme]: 
initialize_git_repo [y]: n
Select minimum_python_version:
1 - 3.7
2 - 3.6
3 - 3.5
Choose from 1, 2, 3 (1, 2, 3) [1]: 3
astropy_helpers_version [v3.0.2]: 

The resulting directory structure can be seen in the attached screenshot. There is no astropy_helpers submodule. screen shot 2018-11-16 at 08 16 56

stscicrawford commented 5 years ago

Okay, I can reproduce it. So you have two options here:

  1. If you want to have astropy_helpers installed (as we recommend), then you do need to have the option selected as 'y' for 'initialize_git_repo'. It looks like if it isn't, then the astropy_helpers won't be installed. There probably should be a warning if it doesn't occur.

  2. If you'd not like to run the cookie cutters again, you can initialize astropy_helpers with the following command in your repository:

    git submodule add https://github.com/astropy/astropy-helpers.git

Then push that to your repository on github and it should then work.

I would have also suggested using the default value for the version as well with the .dev in it. With astropy_helpers, it will automatically create a version number based on the git hashes.

Johannes-Sahlmann commented 5 years ago

thanks @stscicrawford . I got it to work with option (2) but had to additionally copy an ah_bootstrap.py file into the top-level directory. I agree that raising a warning when 'initialize_git_repo' is set to 'n' would be very useful.