4 ms·
It seems like being single-file is mostly gimmick. What are the drawbacks to creating a folder with an __init__.py and a handful of readably-long files?
by heydenberk 15y ago
It seems like being single-file is mostly gimmick. What are the drawbacks to creating a folder with an __init__.py and a handful of readably-long files?
- deleted 15y ago[deleted]
- stevenleeg 15y agoAgreed. The project is ~2700 lines of code all jammed into a single file. Each component is pretty clearly separated from the others with big comment headers, but I don't understand what advantage this has over separate files other than the ability to advertise that it is a single file library.
- Jach 15y agoPerhaps they're not trying to advertise to the Python crowd but to the PHP and JavaScript crowd who might be suckered in by the "Ooh, I only have to include one file?" line.
- dpatru 15y agoJQuery is single file too and that's a big part of it's attraction. Simplicity is a huge plus, not only for users, but also for the developer who is forced to be disciplined. I haven't used bottle yet (just starting), but I'm very impressed with the templating code which seems very powerful and simple. Including the templating system along with the rest of the framework in a single file, forced the developer to think about it more.
- andybak 15y agoBut part of the advantage with jQuery being single-file there is ease of deployment. Python isn't quite as handicapped in this areas as Javascript is. A single line in requirements.txt can add something as complex a complex library to your project without a second thought.
- lifthrasiir 15y agoAnd you'll end up with the complexity of dependencies with mismatched and/or incompatible versions. Adding a dependency explicitly to the source code is the ultimate, albeit somewhat inefficient, solution which is often useful. In Python, for example, BeautifulSoup has long recommended this practice. See also the SQLite amalgamation for another example of a single-file deployment: http://www.sqlite.org/amalgamation.html http://www.sqlite.org/amalgamation.html
- heydenberk 15y ago(Client-side) JavaScript doesn't have a simple, builtin pattern for module dependency the way Python does, though.
- stephth 15y agoI imagine it's about being able to include the whole framework inside your project, without inflating it with a number of files or even having to create a new folder.
- LeafStorm 15y agoIf you are using pip and virtualenv (which are currently understood as "best practice" in the Python world), it's as simple as running "pip install PACKAGE==VERSION" (or, better, adding "PACKAGE==VERSION" to your requirements.txt file). Even if it was expected that people would frequently fork their own version and drop it in their application, a package is still just be a directory with a few .py files. Hardly an issue for version control systems or even setuptools, and it has the advantage that your application code is separated from the forked framework code.
- jpr 15y agoLooking at the source is just one search away, instead of having to navigate many files or build a tag file or whatever. Also provides an incentive to keep shit tidy.
- defnull 15y ago"Also provides an incentive to keep shit tidy." This :)