Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

git import error with cookiecutter #230

Closed
cdeil opened this issue Mar 30, 2017 · 5 comments · Fixed by #286
Closed

git import error with cookiecutter #230

cdeil opened this issue Mar 30, 2017 · 5 comments · Fixed by #286

Comments

@cdeil
Copy link
Member

cdeil commented Mar 30, 2017

@Cadair - I just saw that the cookiecutter branch is already merged and wanted to try it.

Unfortunately it failed after I entered all info:

$ cookiecutter gh:astropy/package-template --checkout cookiecutter
You've cloned /Users/deil/.cookiecutters/package-template before. Is it okay to delete and re-clone it? [yes]: 
package_name [packagename]: hips
module_name [hips]: 
short_description [hips]: Python HIPS client using Astropy and Healpy
long_description []: Python HIPS client using Astropy and Healpy
author_name [Astropy Developers]: hips developers                                    
author_email []:                          
Select license:
1 - BSD 3-Clause
2 - GNU GPL v3+
3 - Apache Software Licence 2.0
4 - BSD 2-Clause
5 - Other
Choose from 1, 2, 3, 4, 5 [1]: 
project_url [http://astropy.org]: https://github.com/tboch/hips
project_version [0.0.dev]: 
include_example_code [y]: n
include_example_cython_code [n]: 
include_cextern_folder [n]: 
edit_on_github_extension [False]: 
github_project [astropy/astropy]: tboch/hips
use_travis_ci [y]: 
use_appveyor_ci [y]: 
use_read_the_docs [y]: 
sphinx_theme [astropy-boostrap]: sphinx_rtd_theme
initialize_git_repo [y]: 
astropy_helpers_version [v1.3.1]: 
Traceback (most recent call last):
  File "/var/folders/sb/4qv5j4m90pz1rw7m70rj1b1r0000gn/T/tmpa2ea3jx_.py", line 41, in <module>
    from git import Repo
ImportError: No module named 'git'
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

Maybe move the from git import Repo to the top of the file to fail early?

@cdeil
Copy link
Member Author

cdeil commented Mar 30, 2017

With

pip install gitpython

the files seem to get scaffolded OK.


An unrelated question I guess: we already have a repo at https://github.com/tboch/hips and I'd like to scaffold the package-template there. Is it possible with one command?
(i.e. scaffold the files in that repo, not create a new sub-folder)
Or should I copy the files over manually to the existing repo, and then re-do the astropy-helpers sub-module manually?

@Cadair
Copy link
Member

Cadair commented Mar 30, 2017

@cdeil the git thing is on my to do list, I will make it so it won't init the repo if it's not installed.

I am not sure I fully get what you mean but you can set output dir using cookiecutter, but I think it will always create a top level dir. There is a switch to turn off git init if needs be.

@cdeil
Copy link
Member Author

cdeil commented Mar 31, 2017

I am not sure I fully get what you mean but you can set output dir using cookiecutter, but I think it will always create a top level dir. There is a switch to turn off git init if needs be.

The situation we have is the:

  • there is an existing repo (mostly empty, but with some notes and files)
  • I want to scaffold the template into that repo (and add it via a new commit)

I guess there is no single cookiecutter command to do that?
I.e. not make a new git repo, but just scaffold the files and add astropy-helpers as a git submodule to an existing git repo.

If I add the astropy-helpers subpackage manually, I know how to do it, so either way I have a working solution.

@cdeil
Copy link
Member Author

cdeil commented May 26, 2017

Just for reference, this is what I did for the new hips package: hipspy/hips#1

In the end to work around the problem described in my last comment I did use cookiecutter gh:astropy/package-template --checkout cookiecutter to scaffold the files into a folder hips from within the existing hips repo. And then I moved the files up one level to be in the right place.

@pllim
Copy link
Member

pllim commented Jan 31, 2020

git is no longer needed after #438

@pllim pllim closed this as completed Jan 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants