Billingegroup / cookiecutter

A cookie-cutter for DiffPy packages.
Other
1 stars 8 forks source link

Hook for automatic package generation #31

Closed Sparks29032 closed 2 months ago

Sparks29032 commented 2 months ago

Behavior: when user enters a package a.b.c this will create the following directory structure:

src
|--a
   |  __init__.py
   |--b
      |  __init__.py
      |--c
         |  __init__.py
         |  version.py
         |--tests

When only a package name c is given, the structure is simply:

src
|--c
   |  __init__.py
   |  version.py
   |--tests

The following string is used to create the __init__.py files:

f"""#!/usr/bin/env python
##############################################################################
#
# (c) {datetime.date.today().year} The Trustees of Columbia University
# in the City of New York.  All rights reserved.
#
# File coded by:    {{ cookiecutter.author_name }}
#
# See AUTHORS.rst for a list of people who contributed.
# See LICENSE.rst for license information.
#
##############################################################################

\"\"\"Blank namespace package for module {module_name}.\"\"\"

from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)

# End of file

"""

where module_name is the name of the namespace module the __init__.py is nested in.

Sparks29032 commented 2 months ago

this looks good to me. A couple of inline comments of a general nature.

now we have tests, can we set up CI in the cookiecutter repo itself? Also a pre-commit check?

I think there is a pre-commit check already for the cookiecutter repo. Does running pre-commit . in the root of this repo start it up?

sbillinge commented 2 months ago

I have it running locally (run pre-commit install) but it didn't run in CI on the PR

On Wed, Jun 19, 2024 at 3:28 PM Sparky @.***> wrote:

this looks good to me. A couple of inline comments of a general nature.

now we have tests, can we set up CI in the cookiecutter repo itself? Also a pre-commit check?

I think there is a pre-commit check already for the cookiecutter repo. Does running pre-commit . in the root of this repo start it up?

— Reply to this email directly, view it on GitHub https://github.com/Billingegroup/cookiecutter/pull/31#issuecomment-2179354386, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAOWUIR6NJGOQ6PB2S5ADDZIHLV3AVCNFSM6AAAAABJSIFNQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZZGM2TIMZYGY . You are receiving this because your review was requested.Message ID: @.***>

-- Simon Billinge Professor, Department of Applied Physics and Applied Mathematics Columbia University