mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-21 15:40:58 +00:00
1 line
14 KiB
JSON
1 line
14 KiB
JSON
[{"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298455562.0360219, "message": "The core question is: do you use project or app-level imports for the apps which are unique to your project?", "group_id": 81, "id": 186509}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298455691.303961, "message": "But then this comes with the issue that the project dir has to be hacked into the Python path (unless I'm missing something..)", "group_id": 81, "id": 186516}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298455620.2827289, "message": "As in for the apps which exist solely to cater for your project as opposed to a 3rd party apps which could exist elsewhere on the Python path.", "group_id": 81, "id": 186510}, {"user_id": 5628, "stars": [], "topic_id": 8277, "date_created": 1298456001.762161, "message": "My main rationale being that it keeps code layout very clean.", "group_id": 81, "id": 186530}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298455659.2175989, "message": "My current thinking is that relative imports (\"from appname import models\") are better in that it makes it easier in the future to take that app out and make it 3rd party if need be.", "group_id": 81, "id": 186513}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298455757.018703, "message": "The Django docs until recently included project-level imports in installed apps (\"projectname.appname\"); there must have been a reason behind the change.", "group_id": 81, "id": 186518}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298455812.2373259, "message": "To sum up, which do you use and why?", "group_id": 81, "id": 186521}, {"user_id": 5628, "stars": [{"date_created": 1298467645.510993, "user_id": 257}, {"date_created": 1298473203.8166499, "user_id": 1126}, {"date_created": 1298487651.2416711, "user_id": 14022}], "topic_id": 8277, "date_created": 1298455940.8099921, "message": "I usually put an 'apps/' directory under my project and add that to the system path; I then refer to the apps as top-level packages.", "group_id": 81, "id": 186527}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298456244.568418, "message": "I'm going to guess a lot of this is going to preference - I tend to keep our apps in the project root; not really a fan of that separate apps/ folder; how do you find that keeps it cleaner?", "group_id": 81, "id": 186537}, {"user_id": 15180, "stars": [], "topic_id": 8277, "date_created": 1298457417.5077381, "message": "I think the apps specific to a given project should have the project level there, given that if it's going to be a reusable app, it should not be inside your project, but having it installed as a development egg. This helps me to actually make it self-contained and modular.", "group_id": 81, "id": 186619}, {"user_id": 15180, "stars": [{"date_created": 1298467826.9365251, "user_id": 257}], "topic_id": 8277, "date_created": 1298458464.584439, "message": "I assume as well that your application is installed on your python environment, not just added to your python path. Some interesting reading here https://github.com/ask/celery/issues/51#issue/51/comment/84091. I think the application should be namespaced and installed, just like any other dependency.", "group_id": 81, "id": 186719}, {"user_id": 257, "stars": [{"date_created": 1298476574.369477, "user_id": 4670}], "topic_id": 8277, "date_created": 1298467771.6383541, "message": "Yeah, \"projectname.appname\" is annoying! If you import from apps that way, it means the current app depends on the project. Using `project.appname` also creates problems for apps like Celery: http://celeryq.org/docs/userguide/tasks.html#automatic-naming-and-relative-imports", "group_id": 81, "id": 187454}, {"user_id": 719, "stars": [], "topic_id": 8277, "date_created": 1298469560.432411, "message": "@djm The Pinax committers (which include a couple of django core devs) go the 'apps/' directory route.", "group_id": 81, "id": 187580}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298469284.3664269, "message": "So we have both sides here; what do the core django devs do? @alex?", "group_id": 81, "id": 187551}, {"user_id": 5195, "stars": [], "topic_id": 8277, "date_created": 1298470450.2597799, "message": "I have 2 directories apps and vendor, both on PYTHONPATH. apps holds all project specific apps and vendor holds those 3rd party apps/libs which I need to or have modified. all imports are app level. Things remain like this until an app is stable enough. After that app goes into virtualenv", "group_id": 81, "id": 187696}, {"user_id": 3160, "stars": [], "topic_id": 8277, "date_created": 1298471430.653368, "message": "apps/, lib/ and vendor/ here - apps for Django apps (with relative imports), lib for our project-specific modules that aren't full-on Django apps, and vendor/ for git submodules", "group_id": 81, "id": 187741}, {"user_id": 257, "stars": [], "topic_id": 8277, "date_created": 1298471518.527292, "message": "We install all apps/libs from pypi, but have apps that are only related to the current project in an apps/ directory", "group_id": 81, "id": 187749}, {"user_id": 257, "stars": [], "topic_id": 8277, "date_created": 1298471565.008532, "message": "we use chishop to have a local PyPI server for apps that are reusable but not open sourced yet", "group_id": 81, "id": 187754}, {"user_id": 1126, "stars": [], "topic_id": 8277, "date_created": 1298473362.387336, "message": "+1 to apps/ subdirectory, beyond that I just have a pip requirements file checked-in to my conf/ directory for all third-party apps and libs. keeps your project organized and clean.", "group_id": 81, "id": 187911}, {"user_id": 2362, "stars": [], "topic_id": 8277, "date_created": 1298472984.9101241, "message": "I like the apps/ module. Keeps the top level directory more minimalist, as we have a lot of other support dirs there.", "group_id": 81, "id": 187893}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298474928.402797, "message": "Exactly, I started off with project-level imports; was convinced to use the sys.path hack instead and now I think I'm turning back around to the project-level to be honest.", "group_id": 81, "id": 188026}, {"user_id": 214, "stars": [], "topic_id": 8277, "date_created": 1298474677.859309, "message": "Frankly the whole \"but what if I make this app reusable?\" argument is kind of silly. Any decent editor would make the task of changing those imports trivial.", "group_id": 81, "id": 188001}, {"user_id": 214, "stars": [{"date_created": 1298474739.0526171, "user_id": 15180}], "topic_id": 8277, "date_created": 1298474622.7484989, "message": "I used to add the project directory to the path and avoid project name in imports, but I've changed my mind. I think avoiding all sys.path hacks is better practice, and this means making the project itself installable (with a setup.py) and not relying on any special apps/ directories being added to sys.path.", "group_id": 81, "id": 187997}, {"user_id": 8119, "stars": [], "topic_id": 8277, "date_created": 1298474713.925905, "message": "Also, as is well known, apps are so rarely that easy to re-use anyway", "group_id": 81, "id": 188004}, {"user_id": 214, "stars": [], "topic_id": 8277, "date_created": 1298474726.2698219, "message": "Having the project name in the import keeps things namespaced in a sensible way - if the app is actually part of the project and not generic, then the namespace should reflect that.", "group_id": 81, "id": 188005}, {"user_id": 214, "stars": [], "topic_id": 8277, "date_created": 1298474795.1870301, "message": "Unfortunately django itself still performs some sys.path hacking when you use manage.py/django-admin.py, but I know there's momentum among the core devs to fix that in 1.4.", "group_id": 81, "id": 188011}, {"user_id": 12775, "stars": [], "topic_id": 8277, "date_created": 1298476781.9904001, "message": "yeah - it makes my apps about as reusable as my TP", "group_id": 81, "id": 188286}, {"user_id": 7, "stars": [], "topic_id": 8277, "date_created": 1298476702.8339241, "message": "Hate having the project attached to the import path", "group_id": 81, "id": 188281}, {"user_id": 603, "stars": [], "topic_id": 8277, "date_created": 1298483205.9879389, "message": "i'm with @carljm, I'm not in favor of sys.path hacks to get imports to work when you already have a sensible namespace available.", "group_id": 81, "id": 189090}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298482566.663137, "message": "So to sum that up, there's definitely no 100% consensus on the right way to do this.", "group_id": 81, "id": 188990}, {"user_id": 5195, "stars": [], "topic_id": 8277, "date_created": 1298486203.4521511, "message": "@carljm moreover sys.path hacks are need only for local and maybe dev environments. In productions everything should be nicely tucked inside a virtualenv.", "group_id": 81, "id": 189652}, {"user_id": 2588, "stars": [], "topic_id": 8277, "date_created": 1298487778.3259671, "message": "We also use the apps directory convention and namespace our project-specific app imports with 'projname.apps', so we're probably on an extreme end of the spectrum :)", "group_id": 81, "id": 189954}, {"user_id": 2588, "stars": [], "topic_id": 8277, "date_created": 1298488078.2762599, "message": "Having worked with a number of different teams/companies, I've seen the whole range of how people handle it - often influenced by conventions from whatever frameworks/languages they came to Django from.", "group_id": 81, "id": 190006}, {"user_id": 5195, "stars": [], "topic_id": 8277, "date_created": 1298486062.312886, "message": "@carljm what if you have to change the name of your project level folder. won't it break all absolute imports?", "group_id": 81, "id": 189626}, {"user_id": 2588, "stars": [], "topic_id": 8277, "date_created": 1298487937.420707, "message": "We also treat / think of our projects as Python packages rather than just a source directory. Not that that changes much in practice, but it guides how we manage source overall.", "group_id": 81, "id": 189989}, {"user_id": 2588, "stars": [], "topic_id": 8277, "date_created": 1298487838.0033491, "message": "I like keeping the project root dir tidy, and for imports it makes things very explicit about where code specific to the project lives.", "group_id": 81, "id": 189962}, {"user_id": 5195, "stars": [{"date_created": 1298495117.8164661, "user_id": 1736}], "topic_id": 8277, "date_created": 1298488376.9968209, "message": "words of wisdom by @unbracketed. App level imports work for me and project level imports work for him. Use whatever works best for you.", "group_id": 81, "id": 190033}, {"user_id": 2588, "stars": [{"date_created": 1298488200.3707891, "user_id": 1}, {"date_created": 1298488259.6939931, "user_id": 5195}, {"date_created": 1298495159.8314459, "user_id": 1736}], "topic_id": 8277, "date_created": 1298488162.1592219, "message": "It's just a personal/team preference and matters very, very little in the day-to-day.", "group_id": 81, "id": 190015}, {"user_id": 8740, "stars": [{"date_created": 1298495161.3094001, "user_id": 1736}], "topic_id": 8277, "date_created": 1298491514.871769, "message": "Indeed; I've never heard of a consensus on this, and some people use both in different situations. I use app-level most of the time, but it's mostly preference now virtualenv is popular.", "group_id": 81, "id": 190492}, {"user_id": 214, "stars": [{"date_created": 1298539888.5573089, "user_id": 15180}], "topic_id": 8277, "date_created": 1298495703.6784151, "message": "@mirnazim The project name should never need to change: it's a Python package name like any other Python package. It's a directory within the repo; just like in any Python package distribution, the top-level repo root just has the setup.py and extras, the installable code package is in a subdirectory.", "group_id": 81, "id": 191271}, {"user_id": 5981, "stars": [], "topic_id": 8277, "date_created": 1298496636.9301951, "message": "I tend to go out of my way to turn each of my \"apps\" into a standalone python package that I work on outside of any \"project\". Actually, I usually don't use projects, just a settings module and django-admin.py", "group_id": 81, "id": 191376}, {"user_id": 214, "stars": [], "topic_id": 8277, "date_created": 1298495760.6169579, "message": "@mirnazim And if your project is not a normal installable Python package, then I guarantee you are using sys.path hacks _somewhere_, or you wouldn't be able to run your code ;)", "group_id": 81, "id": 191278}, {"user_id": 5981, "stars": [], "topic_id": 8277, "date_created": 1298496682.502557, "message": "Oh course, that pretty much only works if you're into virtualenv or buildout.", "group_id": 81, "id": 191381}, {"user_id": 5195, "stars": [], "topic_id": 8277, "date_created": 1298500623.1125751, "message": "@carljm correct. My apps directory is on sys.path, generally inside settings.py. But this is the case for local/dev/test environments only. In an ideal production environment everything lives inside virtualenv.\n\nI prefer to think of my django projects as collection of many modules rather than a single module. Its much easier for me to mange complexity this way.", "group_id": 81, "id": 192257}, {"user_id": 13912, "stars": [{"date_created": 1298893561.3648369, "user_id": 978}], "topic_id": 8277, "date_created": 1298654681.81233, "message": "If I really feel like something can be made reusable and I'm willing to even consider spending time on making it that way I put it outside of the project and make it a separate package with a setup.py I can make a dev egg of. Otherwise project level imports + a pip requirements file for the dependencies.", "group_id": 81, "id": 209795}, {"user_id": 6396, "stars": [], "topic_id": 8277, "date_created": 1298655327.8272231, "message": "@Vasil. That is exactly my current process.", "group_id": 81, "id": 209866}] |