-
Notifications
You must be signed in to change notification settings - Fork 1
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
src to project_name #6
Comments
The To your point though, encouraging a package over single script layout is something that is reasonable to lay out. What about this structure?
|
@goatsweater Yes, that might work. As long as the package can be installed directly via Then we could have multiple packages under source, which can be installed separately, also from gitlab via pip..? There might be a couple of spots where to make changes to adapt to this design including setup.py, e.g. with
For sphinx we can let the user set the paths to the packages in the |
I've push a A lot of the metadata and options available through |
I would add to the docs to suggest people use the |
@ToucheSir could test out the install of subpackages via |
I'm planning on setting up a new project repo today and will test out whether this allows for editable installs. Will loop back once I have results. |
@ToucheSir ^ bump |
Sorry, I didn't get to touch the project code at all since setup (no coding yet), but I tried this out today. Can confirm that |
With confirmation that the approach works in principle I think the only remaining work on this is to document the use of |
I'm not sure if you guys actioned on this item but it seems to be open. I suggest to follow the structure proposed by @goatsweater , more generally :
The current
Installing the package Also creates a potentially name collision problem because without the top level package/project name using the installed package would be imported like this: In the case of multiple top level packages , I think the cookiecutter should only create the template with the project name by default but the user could include more top level packages manually or rename them. |
Another import detail to take under consideration is that if we use {{ cookiecutter.project_name }} as the package name and the project name contains dash ("-") (i.e., my-package). It's not a good identifier for a python package and it's not possible to import normally using
but I highly discourage this practice. Maybe a name convention of replacing non valid package identifier for "_" or just simple not accept it as a name. |
The current setup is going to create a top level project folder that consists of the English project name with any spaces the user enters replaced by a single dash ( This means it is possible that the name will not be desirable (or even legal) for a Python package, and I think it would be better not to attempt to do string parsing to develop a suitable name. I remember there being discussions of having some sample code in the templates that would provide a A neutral approach may be to pick a directory name like |
I took a simple approach to this by introducing another cookiecutter variable :package_name to specify my versioning package or top level package (in your case). By default is rendering the value You can have a look here (These are private, waiting to do a fork from this project ) |
Good point about the templated value just being a default. I forgot the user had a chance to change it. Per the PEP 8 guidelines the naming is actually a lot simpler than I thought:
This actually makes the string parsing fairly simple as every non-alpha character should be discarded except for creating an underscore. |
Hello,
I would suggest to have the
src
directory named according to the project name as discussed here to follow common package development standards.The text was updated successfully, but these errors were encountered: