links-notation


Namelinks-notation JSON
Version 0.10.0 PyPI version JSON
download
home_pageNone
SummaryPython implementation of the Lino protocol parser
upload_time2025-10-18 16:36:51
maintainerNone
docs_urlNone
authorNone
requires_python>=3.13
licenseUnlicense
keywords lino parser links notation protocol
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Platform.Protocols.Lino - Python

[![PyPI version](https://img.shields.io/pypi/v/platform-lino.svg)](https://pypi.org/project/platform-lino/)
[![Python versions](https://img.shields.io/pypi/pyversions/platform-lino.svg)](https://pypi.org/project/platform-lino/)
[![License](https://img.shields.io/badge/license-Unlicense-blue.svg)](../LICENSE)

Python implementation of the Lino (Links Notation) protocol parser.

## Installation

```bash
pip install platform-lino
```

## Quick Start

```python
from platform_lino import Parser

parser = Parser()
links = parser.parse("papa (lovesMama: loves mama)")

# Access parsed links
for link in links:
    print(link)
```

## Usage

### Basic Parsing

```python
from platform_lino import Parser, format_links

parser = Parser()

# Parse simple links
links = parser.parse("(papa: loves mama)")
print(links[0].id)  # 'papa'
print(len(links[0].values))  # 2

# Format links back to string
output = format_links(links)
print(output)  # (papa: loves mama)
```

### Working with Link Objects

```python
from platform_lino import Link

# Create links programmatically
link = Link('parent', [Link('child1'), Link('child2')])
print(str(link))  # (parent: child1 child2)

# Access link properties
print(link.id)  # 'parent'
print(link.values[0].id)  # 'child1'

# Combine links
combined = link.combine(Link('another'))
print(str(combined))  # ((parent: child1 child2) another)
```

### Indented Syntax

```python
parser = Parser()

# Parse indented notation
text = """3:
  papa
  loves
  mama"""

links = parser.parse(text)
# Produces: (3: papa loves mama)
```

## API Reference

### Parser

The main parser class for Lino notation.

- `parse(input_text: str) -> List[Link]`: Parse Lino text into Link objects

### Link

Represents a link in Lino notation.

- `__init__(id: Optional[str] = None, values: Optional[List[Link]] = None)`
- `format(less_parentheses: bool = False) -> str`: Format as string
- `simplify() -> Link`: Simplify link structure
- `combine(other: Link) -> Link`: Combine with another link

### format_links

Format a list of links into Lino notation.

- `format_links(links: List[Link], less_parentheses: bool = False) -> str`

## Examples

### Doublets (2-tuple)

```python
parser = Parser()
text = """
papa (lovesMama: loves mama)
son lovesMama
daughter lovesMama
"""
links = parser.parse(text)
```

### Triplets (3-tuple)

```python
text = """
papa has car
mama has house
(papa and mama) are happy
"""
links = parser.parse(text)
```

### Quoted References

```python
# References with special characters need quotes
text = '("has space": "value with: colon")'
links = parser.parse(text)
```

## Development

### Running Tests

```bash
# Install development dependencies
pip install pytest

# Run tests
pytest
```

### Building

```bash
pip install build
python -m build
```

## License

This project is released into the public domain under the [Unlicense](../LICENSE).

## Links

- [Main Repository](https://github.com/link-foundation/links-notation)
- [PyPI Package](https://pypi.org/project/platform-lino/)
- [Documentation](https://link-foundation.github.io/links-notation/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "links-notation",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": null,
    "keywords": "lino, parser, links, notation, protocol",
    "author": null,
    "author_email": "LinksPlatform <noreply@linksplatform.com>",
    "download_url": "https://files.pythonhosted.org/packages/82/6f/4bacb6846dcf7129109570ff92b1f91d3344e8f49330ef0f904874c509e4/links_notation-0.10.0.tar.gz",
    "platform": null,
    "description": "# Platform.Protocols.Lino - Python\n\n[![PyPI version](https://img.shields.io/pypi/v/platform-lino.svg)](https://pypi.org/project/platform-lino/)\n[![Python versions](https://img.shields.io/pypi/pyversions/platform-lino.svg)](https://pypi.org/project/platform-lino/)\n[![License](https://img.shields.io/badge/license-Unlicense-blue.svg)](../LICENSE)\n\nPython implementation of the Lino (Links Notation) protocol parser.\n\n## Installation\n\n```bash\npip install platform-lino\n```\n\n## Quick Start\n\n```python\nfrom platform_lino import Parser\n\nparser = Parser()\nlinks = parser.parse(\"papa (lovesMama: loves mama)\")\n\n# Access parsed links\nfor link in links:\n    print(link)\n```\n\n## Usage\n\n### Basic Parsing\n\n```python\nfrom platform_lino import Parser, format_links\n\nparser = Parser()\n\n# Parse simple links\nlinks = parser.parse(\"(papa: loves mama)\")\nprint(links[0].id)  # 'papa'\nprint(len(links[0].values))  # 2\n\n# Format links back to string\noutput = format_links(links)\nprint(output)  # (papa: loves mama)\n```\n\n### Working with Link Objects\n\n```python\nfrom platform_lino import Link\n\n# Create links programmatically\nlink = Link('parent', [Link('child1'), Link('child2')])\nprint(str(link))  # (parent: child1 child2)\n\n# Access link properties\nprint(link.id)  # 'parent'\nprint(link.values[0].id)  # 'child1'\n\n# Combine links\ncombined = link.combine(Link('another'))\nprint(str(combined))  # ((parent: child1 child2) another)\n```\n\n### Indented Syntax\n\n```python\nparser = Parser()\n\n# Parse indented notation\ntext = \"\"\"3:\n  papa\n  loves\n  mama\"\"\"\n\nlinks = parser.parse(text)\n# Produces: (3: papa loves mama)\n```\n\n## API Reference\n\n### Parser\n\nThe main parser class for Lino notation.\n\n- `parse(input_text: str) -> List[Link]`: Parse Lino text into Link objects\n\n### Link\n\nRepresents a link in Lino notation.\n\n- `__init__(id: Optional[str] = None, values: Optional[List[Link]] = None)`\n- `format(less_parentheses: bool = False) -> str`: Format as string\n- `simplify() -> Link`: Simplify link structure\n- `combine(other: Link) -> Link`: Combine with another link\n\n### format_links\n\nFormat a list of links into Lino notation.\n\n- `format_links(links: List[Link], less_parentheses: bool = False) -> str`\n\n## Examples\n\n### Doublets (2-tuple)\n\n```python\nparser = Parser()\ntext = \"\"\"\npapa (lovesMama: loves mama)\nson lovesMama\ndaughter lovesMama\n\"\"\"\nlinks = parser.parse(text)\n```\n\n### Triplets (3-tuple)\n\n```python\ntext = \"\"\"\npapa has car\nmama has house\n(papa and mama) are happy\n\"\"\"\nlinks = parser.parse(text)\n```\n\n### Quoted References\n\n```python\n# References with special characters need quotes\ntext = '(\"has space\": \"value with: colon\")'\nlinks = parser.parse(text)\n```\n\n## Development\n\n### Running Tests\n\n```bash\n# Install development dependencies\npip install pytest\n\n# Run tests\npytest\n```\n\n### Building\n\n```bash\npip install build\npython -m build\n```\n\n## License\n\nThis project is released into the public domain under the [Unlicense](../LICENSE).\n\n## Links\n\n- [Main Repository](https://github.com/link-foundation/links-notation)\n- [PyPI Package](https://pypi.org/project/platform-lino/)\n- [Documentation](https://link-foundation.github.io/links-notation/)\n",
    "bugtrack_url": null,
    "license": "Unlicense",
    "summary": "Python implementation of the Lino protocol parser",
    "version": "0.10.0",
    "project_urls": {
        "Homepage": "https://github.com/link-foundation/links-notation",
        "Issues": "https://github.com/link-foundation/links-notation/issues",
        "Repository": "https://github.com/link-foundation/links-notation"
    },
    "split_keywords": [
        "lino",
        " parser",
        " links",
        " notation",
        " protocol"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0b6a6c9cf519567ad8d49fceb3d9d8dc2c9d8e7b9eb50e2d236782b08de581b8",
                "md5": "5b16a71f2a03a2612cf479d8d698fa72",
                "sha256": "c10992f19c4ff2d04d94c5e28e2a7ce4cc0539e4f95f8e584ce6ce64421ff065"
            },
            "downloads": -1,
            "filename": "links_notation-0.10.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b16a71f2a03a2612cf479d8d698fa72",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 8154,
            "upload_time": "2025-10-18T16:36:49",
            "upload_time_iso_8601": "2025-10-18T16:36:49.948741Z",
            "url": "https://files.pythonhosted.org/packages/0b/6a/6c9cf519567ad8d49fceb3d9d8dc2c9d8e7b9eb50e2d236782b08de581b8/links_notation-0.10.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "826f4bacb6846dcf7129109570ff92b1f91d3344e8f49330ef0f904874c509e4",
                "md5": "30eccb569be499d1fcf55c62b0e6cd55",
                "sha256": "e3ab3d7fcba9c16a8e3f3522d6ff5eac960b73beb080e86a9444bc6491415332"
            },
            "downloads": -1,
            "filename": "links_notation-0.10.0.tar.gz",
            "has_sig": false,
            "md5_digest": "30eccb569be499d1fcf55c62b0e6cd55",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 10579,
            "upload_time": "2025-10-18T16:36:51",
            "upload_time_iso_8601": "2025-10-18T16:36:51.080807Z",
            "url": "https://files.pythonhosted.org/packages/82/6f/4bacb6846dcf7129109570ff92b1f91d3344e8f49330ef0f904874c509e4/links_notation-0.10.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-18 16:36:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "link-foundation",
    "github_project": "links-notation",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "links-notation"
}
        
Elapsed time: 1.94716s