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

Hook for automatic package generation #31

Closed
wants to merge 2 commits into from

Conversation

Sparks29032
Copy link
Collaborator

@Sparks29032 Sparks29032 commented Jun 19, 2024

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 Sparks29032 changed the title Add hook to remove diffpy directory Hook for automatic package generation Jun 19, 2024
Copy link
Collaborator

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@@ -1,8 +1,9 @@
{
"full_name": "Name or Organization",
"project_name": "MyProject",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not have caps/camelcase, so "myproject", but we could also use "diffpy.myproject" to remind people that they can use "a.b.project" pattern?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or "my-project"

@@ -1,8 +1,9 @@
{
"full_name": "Name or Organization",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is asking for org, why don't we call the key "org_name"? or will that break things too much?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to touch these names, but I can open a new issue addressing the names in the .json.

Copy link
Collaborator

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added another comment

@@ -1,8 +1,9 @@
{
"full_name": "Name or Organization",
"project_name": "MyProject",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or "my-project"

@Sparks29032
Copy link
Collaborator Author

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
Copy link
Collaborator

sbillinge commented Jun 19, 2024 via email

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

Successfully merging this pull request may close these issues.

2 participants