-
Notifications
You must be signed in to change notification settings - Fork 249
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
Revive Django Plugin! #25
Comments
I'm not a huge django fan (or user) so I don't really care. |
One other thing: I just realized this plugin provides a task that blocks (until you kill the server, that is). This is contrary to the assumption that tasks are small building blocks that can be combined in a specific order to form a build process. |
The only reason I looked at this project (and tested it) was because of the django plugin listed. Even though you are not a "fan", the Django community is a large part of the Python development community and not making it easy to snap in projects will mean that this is just another build tool that no one uses. Which is too bad because its very well designed. I think the main thing that a plug for Django would provide would be some reduction of the very deeply nested file structure and make it easier to maintain a standard Django project layout.. Yes I am willing to do the work here, but not if the primary maintainers couldn't give a hoot about Django. |
Hi @zenweasel, thank you very much for your feedback! I am very happy to hear some ideas about what the plugin could do. I have been using Django a few times and actually I think it's a very nice framework. Once I tried to introduce PyBuilder to a existing Django project. We really wanted to use PyBuilder, but unfortunately one of the conventions in Django projects is to put the test code next to the production code into a package called "tests". PyBuilder separates production code, unit tests and integration (web) tests from each other - and I think this is a good idea. But on the other hand side you are absolutly right: a Django developer would expect to be able to simply create a It would be great for us to get a even more detailed view of your idea of the I think the problem for me and @mriehl is that we are both not working on Django projects right now ... but we would really be happy to turn the plugin into something great. What do you think about working on this together? Thanks again for your feedback! |
Hi @aelgru, thanks for an enthusiastic and positive response to my query. The current version of Django no longer requires that you place your tests anywhere is particular except inside the project. Most people do structure their project so that tests for an app are in that app but there is nothing but good organization that requires it. Django just uses the native unittest Discover functionality to do test discovery. Yes I would be glad to try and do what I can do to create a working Django plugin. I need to do some more intense reading of the code to understand all this going on and what side-effects of changing the default paths are. Again, this looks like a great project. I tried out the livestatus example and the one-liner from empty directory to running project was very impressive. |
Hi @zenweasel , I would like to apologize in case my statement sounded exclusive or negative to you. If you are willing to help us out figuring out what the plugin needs to do and how, I'm totally up for working on such a plugin! |
While thinking about the topic I started to remember why it was such a pain the last time I tried to adapt the plugin to the Django conventions. Right now PyBuilder is discovering (source, test, scripts ...) files using directories. See expand_path in core.py |
Just wanted to check in and saying that I am still working on this, but slowly. Has not been abandoned. |
I've started to work on an external plugin at https://github.com/pybuilder/pybuilder_django_plugin |
I was thinking about this for a while now. Somehow I believe the only way we can make sure that PyBuilder will be able to distinguish source and test files in a Django project will be by patching the corresponding functions in the plugin ... or regex? ... or maybe we need configurable / extendable file filters, like ... def django_source_file_filter(file_path):
if is_djang_source_file(file_path):
return True
return False
@init
def init(project):
project.set_property('source_files_filter', django_source_file_filter)
project.set_property('test_files_filter', ...)
project.set_property('script_files_filter', ...) Which should then be used by PyBuilder instead of default filters (which would be the glob filters). At least globs are not sufficient since you somehow have to make sure that everything that looks like a test file / module are not treated like source files. |
I'm not sure I understand how a test file might be treated as a source file. Is this a problem with the way django itself finds files? Why is the glob not enough? |
Please excuse the short answer, but I am at lunch right now. 🍝 🍵 Unfortunately it's a Django convention to place "test files" into the "production code" package: aelgru $ django-admin.py startapp example
aelgru $ tree example/
example/
├── admin.py
├── __init__.py
├── models.py
├── tests.py
└── views.py Another example: One purpose of the Django plugin has to been to be able to stick to the Django conventions. |
Well it was mentioned that django itself uses the standard python unittest discovery which is filename-based, so it seemed logical to me that you could map this to a glob. Is the problem that PyBuilder would package these tests as sources? Or is the problem discovering which files need to run? |
We are discussing this since 2013, but it's nice to see you catching up, @mriehl. But actually it's a nice idea to talk in detail about why we need a plugin for Django. SetupLet's checkout the django-backbone-example, create a virtualenv and install pybuilder git clone https://github.com/joshbohde/django-backbone-example.git
cd django-backbone-example/
virtualenv venv
source venv/bin/activate
pip install pybuilder Fail FastOf course executing
This error message makes me think, we could give new PyBuilder users a hint that --start-projectBut since I am a Django developer Project name (default: 'django-backbone-example') :
Source directory (default: 'src/main/python') : backbone_example
Unittest directory (default: 'src/unittest/python') : backbone_example
Scripts directory (default: 'src/main/scripts') : backbone_example
Use plugin python.flake8 (Y/n)? (default: 'y') :
Use plugin python.coverage (Y/n)? (default: 'y') :
Use plugin python.distutils (Y/n)? (default: 'y') : n Django projects don't have scripts. How do I tell But
Try againLet's remove the last line from
Of course PyBuilder could not detect any tests. What now?How can we make sure PyBuilder understands what are source files and what are test files? Test FilesTo find Source FilesNevertheless we have another problem: if you look at the output you can clearly see that PyBuilder thinks that So how will you exclude files using glob? As far as I know this is not possible. |
What are we going to do with the python.django plugin?
It's not doing a lot right now ...and what it is doing is buggy.
The text was updated successfully, but these errors were encountered: