Files
2012-02-21 01:15:00 -05:00

1 line
11 KiB
JSON

[{"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306756597.385874, "message": "I've begun using a template to wrap scripts; currently: https://gist.github.com/44abc196385ffde85eac", "group_id": 292, "id": 1226588}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306756712.615402, "message": "how can it be improved, or is there a better solution?", "group_id": 292, "id": 1226596}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306756655.1652391, "message": "it uses string % formatting with a dict, hence the variables", "group_id": 292, "id": 1226594}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306756852.525821, "message": "the main advantages are I can \"link\" to scripts anywhere without having to install as packages/modules somewhere that's already in sys.path, and it uses .pyc caching", "group_id": 292, "id": 1226612}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306756939.626431, "message": "I usually put the final file (template after substitution) in ~/.local/bin which is on my $PATH, but of course it could go anywhere", "group_id": 292, "id": 1226617}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306775253.4536531, "message": "How exactly is this better than setuptools' console_scripts entry point? That would make it work transparently with Windows, always use the correct Python interpreter, always use the correct library source, etc.", "group_id": 292, "id": 1229092}, {"user_id": 31883, "stars": [{"date_created": 1309004827.7772529, "user_id": 32671}], "topic_id": 37375, "date_created": 1306873731.8946021, "message": "thank you, setuptools' entry_point is exactly the type of suggestion I was hoping to get", "group_id": 292, "id": 1241253}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306873739.404526, "message": "it doesn't meet my needs, though", "group_id": 292, "id": 1241255}, {"user_id": 1736, "stars": [{"date_created": 1306891598.1704061, "user_id": 8391}], "topic_id": 37375, "date_created": 1306880559.541728, "message": "(hint, setuptools' scripts work with develop mode)", "group_id": 292, "id": 1243418}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306880526.509825, "message": "How does it not?", "group_id": 292, "id": 1243405}, {"user_id": 8391, "stars": [], "topic_id": 37375, "date_created": 1306891656.0245669, "message": "I usually use both entry_point and and a 'runner' script, which just runs the entry_point, essentially", "group_id": 292, "id": 1245760}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306895567.8843701, "message": "is there a way to get setuptools to just emit the wrapper it would create for entry_point items?", "group_id": 292, "id": 1246401}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306894747.2645581, "message": "@kennethreitz it sounds like that runner script is exactly the type of thing I'm generating with my template", "group_id": 292, "id": 1246293}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306895175.1898701, "message": "@coderanger one of my use-cases is 20-400 line utilities that would be inappropriate to install as python modules", "group_id": 292, "id": 1246348}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306911860.1029789, "message": "@rdpate Yes, use develop mode.", "group_id": 292, "id": 1250789}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306911916.203723, "message": "Regardless, there are technologies that will handle this in a cross-platform and cross-version safe way, I would recommend you avail yourself of them :-)", "group_id": 292, "id": 1250793}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306911883.423152, "message": "Though I question why you can't just make a single package of your utilities and throw everything in there", "group_id": 292, "id": 1250791}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306937253.7992051, "message": "many are completely unrelated and live in separate repositories; they cannot be in the same package", "group_id": 292, "id": 1253427}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306937386.7647099, "message": "@coderanger what other technologies do you refer to?", "group_id": 292, "id": 1253455}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306937310.2385759, "message": "cross-platform simply isn't a requirement", "group_id": 292, "id": 1253432}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306937339.920125, "message": "I still don't see how to get setuptools to just output a script to a file that I can mark executable", "group_id": 292, "id": 1253441}, {"user_id": 10377, "stars": [], "topic_id": 37375, "date_created": 1306944095.098047, "message": "http://docs.python.org/distutils/setupscript.html#installing-scripts", "group_id": 292, "id": 1254877}, {"user_id": 10377, "stars": [], "topic_id": 37375, "date_created": 1306943962.7477651, "message": "in your setup.py, you can put a line like this: scripts=['bin/myscript1', 'bin/myscript2']. Is that not what you're looking for?", "group_id": 292, "id": 1254839}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306947039.85656, "message": "an example derived from a real use case, but simplified: I have a module called \"doit.py\" which is used to manage something. it is specialized for a specific project and lives in that project's repo under a \"util\" directory (\"repo-base/util/doit.py\"). it is essentially a shell script, but python is a better language than sh for this purpose.", "group_id": 292, "id": 1255481}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306947101.4933, "message": "I want an executable wrapper that calls doit's main, where the wrapper lives somewhere off my main $PATH, such as \"repo-base/bin/doit\"", "group_id": 292, "id": 1255488}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306947538.018158, "message": "@rdpate Yes, add the entry point to your setup.py and run `python setup.py develop`", "group_id": 292, "id": 1255545}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306947193.104229, "message": "I don't want to install any module, package, or anything else globally, and don't want to use virtualenv because it would be cumbersome to do so (the main language of the repo isn't even python)", "group_id": 292, "id": 1255496}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306947552.251905, "message": "That will generate the scripts", "group_id": 292, "id": 1255549}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306947249.805434, "message": "is there a way to meet all of those requirements with setuptools?", "group_id": 292, "id": 1255501}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306948784.2938061, "message": "@coderanger if I create a new repo, with repo/util/doit.py containing \"def main(args): return 'TODO'\", what would the setup.py look like to generate repo/bin/doit?", "group_id": 292, "id": 1255678}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306947480.961437, "message": "what I had doing is making doit.py executable, using a hashbang line, and naming/placing it where I want the script (\"repo-base/bin/doit\"); then I started writing these scripts manually (they're not very long, after all), but they're 90% boilerplate, so I thought to automate that", "group_id": 292, "id": 1255539}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306946739.1625249, "message": "no, that's not what I'm looking for. my template is for generating those script files in the first place", "group_id": 292, "id": 1255409}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306948948.149672, "message": "using --prefix looks for a python installation, e.g. a virtualenv or the system installation, but not having that is explicitly one of the requirements", "group_id": 292, "id": 1255705}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306947535.8695221, "message": "which has the added benefit of being able to handle KeyboardInterrupt and possibly other things, which is why I asked here", "group_id": 292, "id": 1255544}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306948473.80972, "message": "@coderanger \"error: can't create or remove files in install directory\"", "group_id": 292, "id": 1255635}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306948482.099931, "message": "it is trying to install globally", "group_id": 292, "id": 1255638}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306948846.3629949, "message": "my repo/util/setup.py contained: from setuptools import setup; setup(entry_points={\"console_scripts\": [\"doit = doit:main\"]})", "group_id": 292, "id": 1255688}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306948876.20839, "message": "and that gave the error I quoted, I see no options (either in the docs or --help) that would help", "group_id": 292, "id": 1255693}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306958506.8553121, "message": "Not sure whats wrong with having a repo-base/.venv or something", "group_id": 292, "id": 1257832}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306958558.9068069, "message": "I usually just have a ~/.venv for user-global stuff", "group_id": 292, "id": 1257847}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306958491.484206, "message": "Just do --prefix . or something if you really want to", "group_id": 292, "id": 1257828}, {"user_id": 1736, "stars": [], "topic_id": 37375, "date_created": 1306958532.4209721, "message": "You seem pretty set on using your solution and are designing the requirements seemingly arbitrarily to exclude everything else", "group_id": 292, "id": 1257839}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306982947.9528289, "message": "I don't expect everyone to understand the exact situation I'm encountering, just like I don't always understand everyone else's", "group_id": 292, "id": 1261882}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306982805.711642, "message": "my solution is designed around my requirements, that shouldn't be surprising :)", "group_id": 292, "id": 1261848}, {"user_id": 31883, "stars": [], "topic_id": 37375, "date_created": 1306983005.0928781, "message": "but, back to the original question, does anyone have some thoughts on the template I listed above? (or know of another tool which does something similar, for comparison if nothing else?)", "group_id": 292, "id": 1261894}]