{ "info": { "author": "Bryon Tjanaka", "author_email": "bryon.tjanaka@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6" ], "description": "# CPSM - Competitive Programming Solutions Manager\n\n

\n\"cpsm\n

\n\n## Overview\n\n\n\n- [Installation](#installation)\n- [Usage](#usage)\n - [Examples](#examples)\n- [Customization](#customization)\n - [cpsm_config.py](#cpsm_configpy)\n- [Uninstallation](#uninstallation)\n- [Contributing](#contributing)\n- [TODO](#todo)\n- [Credits](#credits)\n\n\n\nCPSM is a tool for managing solutions to programming problems, particularly\ncompetitive programming problems. It allows one to easily create and save new\nsolution files from templates.\n\nCPSM assumes that, in a given directory, you have several directories holding\nsolutions to problems. Furthermore, within each directory, there should be a\n`solving` directory holding problems that you are working on. Thus, the\nstructure should look something like this:\n\n```\n.\n\u251c\u2500\u2500 cpsm_config.py <-- configuration file\n\u251c\u2500\u2500 website-1\n\u2502 \u251c\u2500\u2500 solution1.cpp\n\u2502 \u251c\u2500\u2500 solution2.py\n\u2502 \u251c\u2500\u2500 ...\n\u2502 \u2514\u2500\u2500 solving\n\u2502 \u251c\u2500\u2500 solving1.cpp\n\u2502 \u2514\u2500\u2500 solving2.py\n\u2514\u2500\u2500 website-2\n \u251c\u2500\u2500 solution1.cpp\n \u251c\u2500\u2500 solution2.py\n \u251c\u2500\u2500 ...\n \u2514\u2500\u2500 solving\n \u251c\u2500\u2500 solving1.cpp\n \u2514\u2500\u2500 solving2.py\n```\n\nThen, when you decide to save a file, it moves from the solving directory to its\nmain directory.\n\n## Installation\n\nCPSM requires Python 3.6 or later (compatibility with earlier versions may be\ncoming soon, however). To install, run:\n\n```\npip install cpsm\n```\n\nIn a directory where you want to create solutions, do\n\n```\ncpsm init\n```\n\nThis will walk you through a few steps and eventually create a `cpsm_config.py`\nfile with your configuration. You can modify this `cpsm_config.py` file as you\nwish, as long as you retain at least the original variables, as they are needed\nby cpsm.\n\n## Usage\n\n```\nUSAGE: cpsm MODE [ARGS...]\n cpsm init | Initialize a directory for CPSM\n cpsm n abbrev problem template | Create a new solution (or open existing)\n cpsm r abbrev problem filetype | Run a solution\n cpsm s abbrev problem filetype | Save an existing solution\n cpsm h | Display this help message\n```\n\n### Examples\n\nCreate a new solution for the HackerRank problem `Journey to the Moon` using the\n`cpp` template, where the abbreviation for HackerRank is `hr` and the directory\nfor it is hackerrank. Note that the template need not be named `cpp`; it just so\nhappens that the template name matches the file extension here.\n\n```\ncpsm n hr \"Journey to the Moon\" cpp\n```\n\nThis creates a journey-to-the-moon.cpp and journey-to-the-moon.txt file in the\nhackerrank/solving directory and opens up an editor where you can work on the\nfiles. _Note that if any of these files exist already, they will simply be\nopened._\n\nWhile coding, you can run your solution with the input file by doing:\n\n```\ncpsm r hr \"Journey to the Moon\" cpp\n```\n\nBehind the scenes, this uses `g++` to compile journey-to-the-moon.cpp to create\na journey-to-the-moon.out file in the hackerrank/solving directory and runs it\nwith journey-to-the-moon.txt as input.\n\nOnce you are done, you can move the files to the main hackerrank directory (i.e.\n\"save\" them) with the following command. If your configuration file allows it,\nthe files will also be added and committed to the git repo. A prompt will be\nprovided if these files already exist in the directory.\n\n```\ncpsm s hr \"Journey to the Moon\" cpp\n```\n\nNote that you do not need quotes around your problem title if your problem title\nhas no spaces. For example, you can do `cpsm n uva 12345 cpp`.\n\n## Customization\n\n### cpsm_config.py\n\nConfigurations for CPSM are handled in a `cpsm_config.py` file, which is created\nupon running `cpsm init`. An example is shown below.\n\nYou can change the `cpsm_config.py` file at any time, as long as you maintain at\nleast the original variables, since they are used in CPSM. Here are some common\nways you might modify the file:\n\n- **Adding a template** - You can do this by adding an entry into the\n `templates` variable. You will need to provide the name of the template, the\n `filetype` that it is for, and the `code` used for it.\n - The `code` is a [Jinja](http://jinja.pocoo.org/docs/2.10/) template. You can\n add \"template variables\" into it by putting them in double curly braces,\n e.g. `{{ variable }}`. Then, you can define these variables in the\n `mappings` variable.\n- **Adding an abbreviation** - Modify the `abbreviations` variable, providing\n the `name` and `dir` along with the new abbreviation.\n- **Adding a new filetype for running** - Modify the `run_commands` variable,\n providing a list of commands to run for the filetype.\n\n```python\n# Configuration file for CPSM\n\n# Command to run for opening the files when starting a new solution\neditor = \"vim -p\"\n\n# Should CPSM open the input file along with the code file? This is particularly\n# useful if your editor does not support files\nopen_input = True\n\n# When saving, should CPSM add and commit the files to git? You can choose to\n# do this for one, both, or none of the code and input files\nsave_code_to_git = {{ save_code_to_git }}\nsave_input_to_git = {{ save_input_to_git }}\n\n# Abbreviations for directories and full names of websites/competitions/etc.\n# Abbreviations should be of the following form:\n# \"(abbrev)\": {\n# \"name\": \"(full name of website/competition/etc)\",\n# \"dir\": \"(name of directory)\",\n# },\nabbreviations = {\n\"hr\": {\n \"name\": \"HackerRank\",\n \"dir\": \"hackerrank\",\n },\n}\n\n# Mapping of strings that can be inserted into the templates below. Note that\n# the following keys are reserved for use by CPSM:\n# \"name\" - the name of the website/competition/etc for the problem\n# \"problem_name\" - the title of the problem\n# If you include these keys, they simply will not be used.\nmappings = {\n \"username\": \"anonymous\",\n \"fullname\": \"Anonymous Sample\",\n}\n\n# Mapping of template names. Each template should be of the following form:\n# \"(template name)\": {\n# \"filetype\": \"(file extension to use with this template)\",\n# \"code\": \"(code for the template)\",\n# },\n# Substitution in the code is done using Jinja's Template.render(), with the\n# mappings above. In short, you can represent variables from the mappings above\n# by putting them in double curly braces, e.g. {{ variable }}. Refer to the\n# Jinja docs at http://jinja.pocoo.org/docs/2.10/ for more info.\ntemplates = {\n \"cpp\": {\n \"filetype\": \"cpp\",\n \"code\":\n \"\"\"\\\n// Author: {{username}} ({{fullname}})\n// Problem: ({{name}}) {{problem_name}}\n#include \n#define GET(x) scanf(\"%d\", &x)\n#define GED(x) scanf(\"%lf\", &x)\ntypedef long long ll;\nusing namespace std;\ntypedef pair ii;\n\nint main() {\n\n return 0;\n}\n\"\"\",\n },\n \"cpp-blank\": {\n \"filetype\": \"cpp\",\n \"code\":\n \"\"\"\\\n// Author: {{username}} ({{fullname}})\n// Problem: ({{name}}) {{problem_name}}\n\"\"\",\n },\n \"py\": {\n \"filetype\": \"py\",\n \"code\":\n \"\"\"\\\n# Author: {{username}} ({{fullname}})\n# Problem: ({{name}}) {{problem_name}}\n\nimport sys\nfrom collections import defaultdict\n\n\"\"\",\n },\n \"py-blank\": {\n \"filetype\": \"py\",\n \"code\":\n \"\"\"\\\n# Author: {{username}} ({{fullname}})\n# Problem: ({{name}}) {{problem_name}}\n\"\"\",\n },\n}\n\n# A mapping of filetypes to a list of commands that should be run during run\n# mode. Each command should be of the form:\n# \"(filetype)\": {\n# [\"(command 1)\", \"(command 2)\", ...],\n# },\n# Each command is interpreted as a jinja template, and there is only one\n# variable, \"problem_name\", that is used during substitution. \"problem_name\"\n# consists of the filename of the problem, with directories prepended to it.\nrun_commands = {\n \"cpp\": [\n \"g++ {{ problem_name }}.cpp -o {{ problem_name }}.out\",\n \"{{ problem_name }}.out < {{ problem_name }}.txt\",\n ],\n \"py\": [\n \"python {{ problem_name }}.py < {{ problem_name }}.txt\",\n ],\n}\n```\n\n## Uninstallation\n\nShould you ever decide to uninstall cpsm :scream:, simply run:\n\n```\npip uninstall cpsm\n```\n\nYou may also want to remove your `cpsm_config.py` files if you are truly done\nwith CPSM.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Credits\n\n- [Kevin Wang](https://github.com/vitamintk), for encouraging me to push this to\n a full project\n- [Tianjiao Huang](https://github.com/gitletH), for being a pre-pre-pre-beta tester and suggesting the use\n of Jinja\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://btjanaka.net/cpsm", "keywords": "competitive-programming solutions kattis leetcode hackerrank uva", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cpsm", "package_url": "https://pypi.org/project/cpsm/", "platform": "", "project_url": "https://pypi.org/project/cpsm/", "project_urls": { "Homepage": "http://btjanaka.net/cpsm" }, "release_url": "https://pypi.org/project/cpsm/1.0.1/", "requires_dist": [ "Jinja2 (>=2.10.1)" ], "requires_python": "", "summary": "Competitive Programming Solutions Manager", "version": "1.0.1" }, "last_serial": 5135997, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "a098876bc1e2b1466039d8f94e4a2810", "sha256": "91b28e267b6cc9a73c36c159e91ac11c6439f33e8ecbf686e4491778159f3b56" }, "downloads": -1, "filename": "cpsm-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a098876bc1e2b1466039d8f94e4a2810", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9935, "upload_time": "2019-03-17T02:07:17", "url": "https://files.pythonhosted.org/packages/b1/84/0fde58762b34890c3128c878067f440951fb51808d07d0a30ecc5b11b3b9/cpsm-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "01b0143d0b5bbc4372b3306a4597f23b", "sha256": "7905274df20b4264e713a8c0445f751450d69e41105b1e4ce0de17db8e3a53b2" }, "downloads": -1, "filename": "cpsm-1.0.0.tar.gz", "has_sig": false, "md5_digest": "01b0143d0b5bbc4372b3306a4597f23b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 384436, "upload_time": "2019-03-17T02:07:19", "url": "https://files.pythonhosted.org/packages/8c/44/b7d8980d29d600f405b40f241db81e70f9ed5918a057f9e0740157f961c6/cpsm-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "a38b59e94590a2c9d18341fd82ea0a7d", "sha256": "bd630a5774229d8ec627d68af21ba0714e08099303228ebc67faee745e595e34" }, "downloads": -1, "filename": "cpsm-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "a38b59e94590a2c9d18341fd82ea0a7d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9848, "upload_time": "2019-04-12T22:46:08", "url": "https://files.pythonhosted.org/packages/58/99/c0b5ded2f6d40d4cf14362dbfbb1fc3cd39b32406a7f286b7220f3f3a5bc/cpsm-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "897cb7f83099e844b96578750580afdb", "sha256": "9d3bf1ca9dd37e4a6a444082fc5f7acf2a13d093f3763befa78eabcdd9709fcc" }, "downloads": -1, "filename": "cpsm-1.0.1.tar.gz", "has_sig": false, "md5_digest": "897cb7f83099e844b96578750580afdb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 384320, "upload_time": "2019-04-12T22:46:09", "url": "https://files.pythonhosted.org/packages/57/2f/a4f428b15636bf38e61e943645b2f910ef0498fb28210051bc7736424ad9/cpsm-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a38b59e94590a2c9d18341fd82ea0a7d", "sha256": "bd630a5774229d8ec627d68af21ba0714e08099303228ebc67faee745e595e34" }, "downloads": -1, "filename": "cpsm-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "a38b59e94590a2c9d18341fd82ea0a7d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9848, "upload_time": "2019-04-12T22:46:08", "url": "https://files.pythonhosted.org/packages/58/99/c0b5ded2f6d40d4cf14362dbfbb1fc3cd39b32406a7f286b7220f3f3a5bc/cpsm-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "897cb7f83099e844b96578750580afdb", "sha256": "9d3bf1ca9dd37e4a6a444082fc5f7acf2a13d093f3763befa78eabcdd9709fcc" }, "downloads": -1, "filename": "cpsm-1.0.1.tar.gz", "has_sig": false, "md5_digest": "897cb7f83099e844b96578750580afdb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 384320, "upload_time": "2019-04-12T22:46:09", "url": "https://files.pythonhosted.org/packages/57/2f/a4f428b15636bf38e61e943645b2f910ef0498fb28210051bc7736424ad9/cpsm-1.0.1.tar.gz" } ] }