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

Comparison with cookiecutter #10

Open
elyase opened this issue Dec 10, 2015 · 10 comments
Open

Comparison with cookiecutter #10

elyase opened this issue Dec 10, 2015 · 10 comments

Comments

@elyase
Copy link

elyase commented Dec 10, 2015

It would be great to have a comparison with cookiecutter. Pros/cons, when it is more appropriate to use a project over the other, etc

@arokem
Copy link
Contributor

arokem commented Dec 10, 2015

Agreed. This one is supposed to be more of an instructional tool, and a
place to conduct experiments with a variety of tools (see recent addition
of appveyor). But I agree that some clarification, and a link to
cookiecutter, would be appropriate. I am keeping this around until I (or
someone else - PRs welcome!) find the time to do that.

On Thu, Dec 10, 2015 at 7:45 AM, Yaser Martinez Palenzuela <
[email protected]> wrote:

It would be great to have a comparison with cookiecutter
https://github.com/audreyr/cookiecutter. Pros/cons, when it is more
appropriate to use a project over the other, etc


Reply to this email directly or view it on GitHub
#10.

@bcipolli
Copy link
Contributor

A small note for newbies like me: looks like https://github.com/audreyr/cookiecutter-pypackage may be more directly comparable to shablona; I think cookiecutter is an entire framework for supporting project templates, across languages..

@mgaitan
Copy link

mgaitan commented Mar 18, 2016

Why no to convert this in a cookiecutter template? If so, the whole "use shablona as your template" would be cookicutter https://github.com/uwescience/shablona.git

@arokem
Copy link
Contributor

arokem commented Mar 18, 2016

That potentially sounds like a good idea. What would it take?

@mnarayan
Copy link

As a start maybe all the actions listed under https://github.com/uwescience/shablona#using-shablona-as-a-template can be automated via cookiecutter.

This would mainly involve replacing project variables specific to this template such as repo name into a generic cookiecutter variable. See the cookiecutter.json files for examples.

https://github.com/mkrapp/cookiecutter-reproducible-science & https://github.com/mnarayan/cookiecutter-data-science

@arokem
Copy link
Contributor

arokem commented Sep 25, 2017

Again, I haven't used cookiecutter, so I don't entirely understand what it would take. How am I supposed to read the following file?

https://github.com/mkrapp/cookiecutter-reproducible-science/blob/master/cookiecutter.json

I think that the best way for me to understand what it entails would to write a PR that does this, including the change you propose to the instructions. You make it sound like it's straightforward. Thanks!

@mnarayan
Copy link

mnarayan commented Sep 26, 2017

I took a rough stab at cookiecutterizing this project.

You will need to first install cookiecutter pip install cookiecutter

When you run cookiecutter gh:mnarayan/cookiecutter-shablona, you will be asked to initialize the cookiecutter variables, which would look like this
image

If you stick with the default variables, the end result is a directory shablona that will be nearly identical to a git clone of this repository in structure and content.
For a superficial check ls shablona shows directory & file names are identical to the original.

LICENSE  Makefile  README.md  appveyor.yml  doc  examples  scripts  setup.py  shablona

More generally, all cookiecutter variables will be customized. A quick example for directories

ls "{{ cookiecutter.repo_name }}"/
LICENSE  Makefile  README.md  appveyor.yml  doc  examples  scripts  setup.py  {{ cookiecutter.package_name }}

A few things to note:

  • Given the re-organization required to incorporate cookiecutter is a bit disruptive, I was not so sure it would make for a good PR. Hence the separate repo. It could certainly be an eventual goal if @arokem thinks that is a good direction for this repo. The main benefit would be in reducing the friction in using this as a template.
  • I had to delete doc/_template files because cookiecutter could not handle this.
  • I only replaced package name, author name, author email in certain key files with cookiecutter variables. For example, I did not try to template the README. Also, since I didn't want to eliminate credit/contributions to @arokem entirely from the template!

I haven't contributed to other people's projects that often, so apologies in advance for deviating from any expected conventions.

If those experienced with cookiecutter (@mgaitan or @elyase) have any thoughts on how to restructure documentation or deal with the sphinx hiccups, please comment here

Thanks!

@arokem
Copy link
Contributor

arokem commented Sep 29, 2017

Interesting. Thanks for creating this! It looks like this mostly takes care of the last step of using the template, by cleanly replacing the name of the package. Does it do anything else? I don't see any problem eliminating me from the resulting thing, by the way. I expect that users of the template will want to do this anyway (for example, see richford/cloudknot-fork@42f05ff)

@mnarayan
Copy link

Thanks, @arokem.

Right now I've mainly used the cookiecutter to cleanly replace package name, author name, github repo name and so forth. I suspect cookiecutter could automate a few other things, but it didn't seem like there was much else to be done to re-use this project as a template.

I can initiate a PR when I get back to this. One thing I would additionally change would be to move your current README which explains how to use the template one level up from the `{{ cookiecutter.repo-name }} folder which would contain everything templateable and perhaps contain a more barebones README template.

@sabiharustam
Copy link

https://github.com/MolSSI/cookiecutter-cms This one might be a great example for to setting up shablona to be used with cookiecutter. This one is also from the developers of cookiecutter.

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

6 participants