advent-of-code-py


Nameadvent-of-code-py JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/iamsauravsharma/advent-of-code-py
SummaryAdvent of Code helper CLI and library
upload_time2023-03-15 12:10:58
maintainer
docs_urlNone
authorSaurav Sharma
requires_python>=3.7,<4.0
licenseMIT
keywords advent-of-code aoc aocpy advent of code
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Advent-of-code-py

[Advent of Code][advent_of_code_link] helper CLI and library for python projects.

**Status & Info:**

|                Code style                |                    License                     |            Project Version             |
| :--------------------------------------: | :--------------------------------------------: | :------------------------------------: |
| [![Code style][black_badge]][black_link] | [![License: MIT][license_badge]][license_link] | [![PyPI][project_badge]][project_link] |

## Usage

### Installation

To install advent-of-code-py run following command which installs advent-of-code-py CLI and advent_of_code_py library.

```bash
pip install advent-of-code-py
```

**OR**

```bash
poetry add advent-of-code-py
```

### Usage

Initially for advent-of-code-py to work it need session value or session ID which you can obtain by viewing cookie while visiting advent of code server.
After collecting session cookie value you need to add those values in config using advent-of-code-py CLI

```bash
advent-of-code-py config add <session-name> <session-value>
```

Now you can import library by using

```python
import advent_of_code_py
```

After importing a library you can use either two decorator present which are solve and submit decorator for a function of puzzle

For example:-

```python
@advent_of_code_py.submit(2018,3,1,session_list="<session-name>")
def puzzle_2018_3_1(input=None):
    # do some calculation with data and return final output
    return final_output
```

Now after decorating function now you can call function like regular function call

```python
puzzle_2018_3_1()
```

After calling function `final_output` value will be submitted by library to Advent of Code server for 2018 year day 3
problem, then returns whether the submitted answer was correct or not. If session value is not provided then
the solution will be submitted to all session value present in config file.

You can also use advent-of-code-py builtin Initializer and runner to create appropriate CLI for problem so
problem can be run from CLI instead of modifying python file every time to run appropriate function
To set advent-of-code-py puzzle as CLI

```python
@advent_of_code_py.advent_runner()
def main_cli():
    initializer = advent_of_code_py.Initializer()
    initializer.add(<function_alias>=<function>)
    # for example to run above function you can write
    initializer.add(p_3_1=puzzle_2018_3_1)
    # add other functions ...
    return initializer
```

Now you can set main_cli as entry points, and it will create CLI with the appropriate name and function which was added.
So for example to run function puzzle_2018_3_1() you have to run command as `entry-point-name run p_3_1` which
will run the appropriate function as well as submit as desired if the function was decorated by submit decorator or else
prints its output if the function was decorated by solve decorator.

[advent_of_code_link]: https://adventofcode.com
[black_badge]: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge
[black_link]: https://github.com/ambv/black
[license_badge]: https://img.shields.io/github/license/iamsauravsharma/advent-of-code-py.svg?style=for-the-badge
[license_link]: LICENSE
[project_badge]: https://img.shields.io/pypi/v/advent-of-code-py?style=for-the-badge&color=blue&logo=python
[project_link]: https://pypi.org/project/advent-of-code-py

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iamsauravsharma/advent-of-code-py",
    "name": "advent-of-code-py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "advent-of-code,aoc,aocpy,advent of code",
    "author": "Saurav Sharma",
    "author_email": "appdroiddeveloper@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/fb/9c713087935b5ba3f48661fc8ad0121e131faf84b9db0c2cc38d71da9bae/advent_of_code_py-0.4.0.tar.gz",
    "platform": null,
    "description": "# Advent-of-code-py\n\n[Advent of Code][advent_of_code_link] helper CLI and library for python projects.\n\n**Status & Info:**\n\n|                Code style                |                    License                     |            Project Version             |\n| :--------------------------------------: | :--------------------------------------------: | :------------------------------------: |\n| [![Code style][black_badge]][black_link] | [![License: MIT][license_badge]][license_link] | [![PyPI][project_badge]][project_link] |\n\n## Usage\n\n### Installation\n\nTo install advent-of-code-py run following command which installs advent-of-code-py CLI and advent_of_code_py library.\n\n```bash\npip install advent-of-code-py\n```\n\n**OR**\n\n```bash\npoetry add advent-of-code-py\n```\n\n### Usage\n\nInitially for advent-of-code-py to work it need session value or session ID which you can obtain by viewing cookie while visiting advent of code server.\nAfter collecting session cookie value you need to add those values in config using advent-of-code-py CLI\n\n```bash\nadvent-of-code-py config add <session-name> <session-value>\n```\n\nNow you can import library by using\n\n```python\nimport advent_of_code_py\n```\n\nAfter importing a library you can use either two decorator present which are solve and submit decorator for a function of puzzle\n\nFor example:-\n\n```python\n@advent_of_code_py.submit(2018,3,1,session_list=\"<session-name>\")\ndef puzzle_2018_3_1(input=None):\n    # do some calculation with data and return final output\n    return final_output\n```\n\nNow after decorating function now you can call function like regular function call\n\n```python\npuzzle_2018_3_1()\n```\n\nAfter calling function `final_output` value will be submitted by library to Advent of Code server for 2018 year day 3\nproblem, then returns whether the submitted answer was correct or not. If session value is not provided then\nthe solution will be submitted to all session value present in config file.\n\nYou can also use advent-of-code-py builtin Initializer and runner to create appropriate CLI for problem so\nproblem can be run from CLI instead of modifying python file every time to run appropriate function\nTo set advent-of-code-py puzzle as CLI\n\n```python\n@advent_of_code_py.advent_runner()\ndef main_cli():\n    initializer = advent_of_code_py.Initializer()\n    initializer.add(<function_alias>=<function>)\n    # for example to run above function you can write\n    initializer.add(p_3_1=puzzle_2018_3_1)\n    # add other functions ...\n    return initializer\n```\n\nNow you can set main_cli as entry points, and it will create CLI with the appropriate name and function which was added.\nSo for example to run function puzzle_2018_3_1() you have to run command as `entry-point-name run p_3_1` which\nwill run the appropriate function as well as submit as desired if the function was decorated by submit decorator or else\nprints its output if the function was decorated by solve decorator.\n\n[advent_of_code_link]: https://adventofcode.com\n[black_badge]: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge\n[black_link]: https://github.com/ambv/black\n[license_badge]: https://img.shields.io/github/license/iamsauravsharma/advent-of-code-py.svg?style=for-the-badge\n[license_link]: LICENSE\n[project_badge]: https://img.shields.io/pypi/v/advent-of-code-py?style=for-the-badge&color=blue&logo=python\n[project_link]: https://pypi.org/project/advent-of-code-py\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Advent of Code helper CLI and library",
    "version": "0.4.0",
    "split_keywords": [
        "advent-of-code",
        "aoc",
        "aocpy",
        "advent of code"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "185d994d7221a9b93689a2090a68adba8798f8f22da03520a2bc0a1b1a8d561e",
                "md5": "7251db546eb8f086f65e2c9c89366166",
                "sha256": "f7153e406de5c68ee360b80aaa95b8229744c2a5b28759958384ee0abd7e4b32"
            },
            "downloads": -1,
            "filename": "advent_of_code_py-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7251db546eb8f086f65e2c9c89366166",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 11840,
            "upload_time": "2023-03-15T12:10:57",
            "upload_time_iso_8601": "2023-03-15T12:10:57.086952Z",
            "url": "https://files.pythonhosted.org/packages/18/5d/994d7221a9b93689a2090a68adba8798f8f22da03520a2bc0a1b1a8d561e/advent_of_code_py-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cfb9c713087935b5ba3f48661fc8ad0121e131faf84b9db0c2cc38d71da9bae",
                "md5": "848e28618af9e64487e2466ad0df5cef",
                "sha256": "5f65e178e40aabc69748534e1f0785af21d1b2b8db095102798c967fe1182edc"
            },
            "downloads": -1,
            "filename": "advent_of_code_py-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "848e28618af9e64487e2466ad0df5cef",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 9807,
            "upload_time": "2023-03-15T12:10:58",
            "upload_time_iso_8601": "2023-03-15T12:10:58.825910Z",
            "url": "https://files.pythonhosted.org/packages/5c/fb/9c713087935b5ba3f48661fc8ad0121e131faf84b9db0c2cc38d71da9bae/advent_of_code_py-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-15 12:10:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "iamsauravsharma",
    "github_project": "advent-of-code-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "advent-of-code-py"
}
        
Elapsed time: 0.04364s