mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-21 15:40:58 +00:00
1 line
6.2 KiB
JSON
1 line
6.2 KiB
JSON
[{"user_id": 13912, "stars": [], "topic_id": 17485, "date_created": 1302044023.5030961, "message": "add the root to pythonpath - bad", "group_id": 292, "id": 549476}, {"user_id": 13893, "stars": [], "topic_id": 17485, "date_created": 1302043341.6909649, "message": "Lets say I have a package inside a project. The package is part of the project. Is it a good idea if I use relative imports in the scope of that package? Or should I just add the root to path and work with imports relative to the complete project?", "group_id": 292, "id": 549279}, {"user_id": 13912, "stars": [], "topic_id": 17485, "date_created": 1302043920.4394319, "message": "explicit relative imports?", "group_id": 292, "id": 549440}, {"user_id": 1, "stars": [{"date_created": 1302100454.0459099, "user_id": 7376}, {"date_created": 1302176835.9525459, "user_id": 6704}], "topic_id": 17485, "date_created": 1302043930.8422749, "message": "Good.", "group_id": 292, "id": 549445}, {"user_id": 13912, "stars": [{"date_created": 1302089211.1490791, "user_id": 11646}, {"date_created": 1302102959.6809511, "user_id": 20326}, {"date_created": 1302184327.402349, "user_id": 13916}], "topic_id": 17485, "date_created": 1302044028.0014, "message": "make a setup.py with setuptools and do python setup.py develop - good", "group_id": 292, "id": 549480}, {"user_id": 11646, "stars": [], "topic_id": 17485, "date_created": 1302089528.971266, "message": "I agree with Vasil. If your package is tightly coupled to your project, you should use the project as your root. If the package is generic, just install it and use the package as the root for imports.", "group_id": 292, "id": 557909}, {"user_id": 18539, "stars": [{"date_created": 1302107699.535588, "user_id": 141}, {"date_created": 1302126600.8938251, "user_id": 6415}, {"date_created": 1302265675.0543549, "user_id": 257}], "topic_id": 17485, "date_created": 1302095907.204792, "message": "I dislike them, but at least they're not implicit relative imports.", "group_id": 292, "id": 558943}, {"user_id": 1822, "stars": [], "topic_id": 17485, "date_created": 1302100032.020828, "message": "Pep8 still recommends full import from python path", "group_id": 292, "id": 559808}, {"user_id": 8391, "stars": [], "topic_id": 17485, "date_created": 1302116123.269608, "message": "@vasil `setup.py develop` is great for module development but not for cli application dev.", "group_id": 292, "id": 563025}, {"user_id": 1, "stars": [], "topic_id": 17485, "date_created": 1302116284.0212181, "message": "So IMO explicit relative imports are the way to go", "group_id": 292, "id": 563066}, {"user_id": 8391, "stars": [], "topic_id": 17485, "date_created": 1302116152.8146939, "message": "Relative is definitely the way to go.", "group_id": 292, "id": 563038}, {"user_id": 8391, "stars": [{"date_created": 1302116259.7464161, "user_id": 1}], "topic_id": 17485, "date_created": 1302116207.301625, "message": "It also makes vendorizing packages much easier. if the entire module is written w/ absolute, you have to modify a lot of import statements :)", "group_id": 292, "id": 563049}, {"user_id": 1, "stars": [], "topic_id": 17485, "date_created": 1302116300.1754169, "message": "But it's a recent-python-only feature :\\", "group_id": 292, "id": 563070}, {"user_id": 1, "stars": [], "topic_id": 17485, "date_created": 1302116278.0363319, "message": "But the implicit relative imports are bad because they can clash and that's bad too", "group_id": 292, "id": 563064}, {"user_id": 13893, "stars": [], "topic_id": 17485, "date_created": 1302122884.5161569, "message": "if it works on 2.6+ (and it does) i don't care for else. I really think they are a great idea. They give so much more flexibility and choice.", "group_id": 292, "id": 565113}, {"user_id": 13912, "stars": [], "topic_id": 17485, "date_created": 1302123703.799614, "message": "@kennethreitz unless your cli app is one module, setup.py with a scripts entry is still easier than setting PYTHONPATH and PATH on every new environment your script needs to run on.", "group_id": 292, "id": 565231}, {"user_id": 8391, "stars": [], "topic_id": 17485, "date_created": 1302137305.592056, "message": "@Vasil never. You have a 'runner' module one level above the package.", "group_id": 292, "id": 567293}, {"user_id": 8391, "stars": [], "topic_id": 17485, "date_created": 1302137349.171874, "message": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport myapp.cli\n\nif __name__ == '__main__':\n myapp.cli.main()", "group_id": 292, "id": 567300}, {"user_id": 13912, "stars": [], "topic_id": 17485, "date_created": 1302138838.4373081, "message": "if it runs only on the machine where you're developing, maybe. Dumping a package from a paste template handles both redistribution and fidling with environment variables without writing any code.", "group_id": 292, "id": 567423}, {"user_id": 13912, "stars": [], "topic_id": 17485, "date_created": 1302138895.282707, "message": "it's a matter of laziness, which kind you prefer, do a bit upfront and don't repeat something for every project or the reverse", "group_id": 292, "id": 567430}, {"user_id": 13912, "stars": [], "topic_id": 17485, "date_created": 1302138996.7436061, "message": "but it has nothing to do with the subject", "group_id": 292, "id": 567447}, {"user_id": 25337, "stars": [], "topic_id": 17485, "date_created": 1302159323.149493, "message": "Absolute imports. Readability counts. I want to be able to tell when code I'm importing is coming from without having to worry about what directory it's in. Failing that, explicit relative imports are OK. Old-style implicit relative imports are pretty nasty.", "group_id": 292, "id": 572677}, {"user_id": 25337, "stars": [{"date_created": 1302162023.1544321, "user_id": 13912}], "topic_id": 17485, "date_created": 1302159347.190058, "message": "That all said, if the existing code uses relative imports, you should either use them too, or change the project's convention. Consistency is important too :)", "group_id": 292, "id": 572684}, {"user_id": 8391, "stars": [], "topic_id": 17485, "date_created": 1302173781.4992599, "message": "@Vasil, FYI, end result is py2exe, py2app, or pyinstaller package.", "group_id": 292, "id": 574374}, {"user_id": 13912, "stars": [], "topic_id": 17485, "date_created": 1302222291.3953829, "message": "@kennethreitz mkay, so?!", "group_id": 292, "id": 582672}] |