pyekw


Namepyekw JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryPython library for Polish eKW (Land Registry)
upload_time2025-08-15 18:50:27
maintainerNone
docs_urlNone
authorMateusz Hajder
requires_python>=3.8
licenseMIT License Copyright (c) 2025 Mateusz Hajder Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ekw land-registry poland utilities validation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyekw - Polish eKW (Land Registry) Utilities

A Python library for working with Polish eKW (Elektroniczne Księgi Wieczyste) land registry numbers.

## Features

- **KW Number Validation**: Validate complete KW numbers including court codes and check digits
- **Check Digit Generation**: Calculate correct check digits for court codes and register numbers
- **Court Registry**: Comprehensive database of Polish courts handling land registry matters
- **Utility Functions**: Normalize, extract, and analyze KW numbers from various sources

## Installation

```sh
uv add "git+https://github.com/mhajder/pyekw.git"
```

## Quick Start

```python
from pyekw import KWValidator, CheckDigitGenerator, CourtRegistry, KWUtils

# Validate a KW number
validator = KWValidator()
is_valid, error = validator.validate_kw_number("WA4M/00123456/4")
print(f"Valid: {is_valid}")  # True

# Generate check digit
generator = CheckDigitGenerator()
check_digit = generator.calculate_check_digit("WA4M", "00123456")
print(f"Check digit: {check_digit}")  # 4

# Work with court registry
registry = CourtRegistry()
court_name = registry.get_court_name("WA4M")
print(f"Court: {court_name}")  # WARSZAWA

# Utility functions
utils = KWUtils()
normalized = utils.normalize_kw_number(" wa4m / 00123456 / 4 ")
print(f"Normalized: {normalized}")  # WA4M/00123456/4
```

## API Documentation

### KWValidator

Class for validating Polish KW numbers.

**Methods:**

- `validate_kw_number(kw_number: str) -> Tuple[bool, Optional[str]]`  
  Validates a complete KW number.  
  **Returns:** `(is_valid, error_message)`

- `parse_kw_number(kw_number: str) -> Tuple[str, str, str]`  
  Parses a KW number into its components: court code, register number, check digit.

- `validate_court_code(court_code: str) -> bool`  
  Checks if the court code is valid.

- `validate_check_digit(court_code: str, register_number: str, check_digit: str) -> bool`  
  Validates the check digit for given court code and register number.

---

### CheckDigitGenerator

Class for generating check digits and full KW numbers.

**Methods:**

- `calculate_check_digit(court_code: str, register_number: str) -> int`  
  Calculates the check digit for a given court code and register number.

- `generate_full_kw_number(court_code: str, register_number: str) -> str`  
  Generates a complete KW number with the correct check digit.

---

### CourtRegistry

Class for working with the court database.

**Methods:**

- `is_valid_court(court_code: str) -> bool`  
  Checks if a court code exists in the registry.

- `get_court_name(court_code: str) -> str`  
  Returns the name of the court for a given code.

- `search_courts(query: str) -> List[Dict]`  
  Searches courts by name or code.

- `get_all_courts() -> Dict[str, str]`  
  Returns a dictionary of all court codes and names.

---

### KWUtils

Utility class for working with KW numbers.

**Methods:**

- `normalize_kw_number(kw_number: str) -> str`  
  Normalizes the format of a KW number.

- `extract_kw_numbers(text: str) -> List[str]`  
  Extracts all KW numbers from a given text.

- `get_kw_info(kw_number: str) -> Dict`  
  Returns detailed information about a KW number.

- `generate_kw_number_variants(court_code: str, start_number: int, count: int) -> List[str]`  
  Generates a series of KW numbers.

- `validate_multiple_kw_numbers(kw_numbers: List[str]) -> List[Tuple[str, bool, Optional[str]]]`  
  Validates multiple KW numbers at once.

- `suggest_corrections(kw_number: str) -> List[str]`  
  Suggests possible corrections for an invalid KW number.

## Examples

You can find example usage of all main functions and classes in the `examples/` directory.

- [`examples/example_all_functions.py`](examples/example_all_functions.py): Demonstrates validation, parsing, check digit generation, court registry operations, and utility functions.

To run the example:

```sh
python examples/example_all_functions.py
```

Feel free to explore and modify the example to fit your use case.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyekw",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ekw, land-registry, poland, utilities, validation",
    "author": "Mateusz Hajder",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/10/ad/ce7a148e08202be49601ce10c566dd7a21d430521a834d62bbb71a285bd9/pyekw-0.1.0.tar.gz",
    "platform": null,
    "description": "# pyekw - Polish eKW (Land Registry) Utilities\n\nA Python library for working with Polish eKW (Elektroniczne Ksi\u0119gi Wieczyste) land registry numbers.\n\n## Features\n\n- **KW Number Validation**: Validate complete KW numbers including court codes and check digits\n- **Check Digit Generation**: Calculate correct check digits for court codes and register numbers\n- **Court Registry**: Comprehensive database of Polish courts handling land registry matters\n- **Utility Functions**: Normalize, extract, and analyze KW numbers from various sources\n\n## Installation\n\n```sh\nuv add \"git+https://github.com/mhajder/pyekw.git\"\n```\n\n## Quick Start\n\n```python\nfrom pyekw import KWValidator, CheckDigitGenerator, CourtRegistry, KWUtils\n\n# Validate a KW number\nvalidator = KWValidator()\nis_valid, error = validator.validate_kw_number(\"WA4M/00123456/4\")\nprint(f\"Valid: {is_valid}\")  # True\n\n# Generate check digit\ngenerator = CheckDigitGenerator()\ncheck_digit = generator.calculate_check_digit(\"WA4M\", \"00123456\")\nprint(f\"Check digit: {check_digit}\")  # 4\n\n# Work with court registry\nregistry = CourtRegistry()\ncourt_name = registry.get_court_name(\"WA4M\")\nprint(f\"Court: {court_name}\")  # WARSZAWA\n\n# Utility functions\nutils = KWUtils()\nnormalized = utils.normalize_kw_number(\" wa4m / 00123456 / 4 \")\nprint(f\"Normalized: {normalized}\")  # WA4M/00123456/4\n```\n\n## API Documentation\n\n### KWValidator\n\nClass for validating Polish KW numbers.\n\n**Methods:**\n\n- `validate_kw_number(kw_number: str) -> Tuple[bool, Optional[str]]`  \n  Validates a complete KW number.  \n  **Returns:** `(is_valid, error_message)`\n\n- `parse_kw_number(kw_number: str) -> Tuple[str, str, str]`  \n  Parses a KW number into its components: court code, register number, check digit.\n\n- `validate_court_code(court_code: str) -> bool`  \n  Checks if the court code is valid.\n\n- `validate_check_digit(court_code: str, register_number: str, check_digit: str) -> bool`  \n  Validates the check digit for given court code and register number.\n\n---\n\n### CheckDigitGenerator\n\nClass for generating check digits and full KW numbers.\n\n**Methods:**\n\n- `calculate_check_digit(court_code: str, register_number: str) -> int`  \n  Calculates the check digit for a given court code and register number.\n\n- `generate_full_kw_number(court_code: str, register_number: str) -> str`  \n  Generates a complete KW number with the correct check digit.\n\n---\n\n### CourtRegistry\n\nClass for working with the court database.\n\n**Methods:**\n\n- `is_valid_court(court_code: str) -> bool`  \n  Checks if a court code exists in the registry.\n\n- `get_court_name(court_code: str) -> str`  \n  Returns the name of the court for a given code.\n\n- `search_courts(query: str) -> List[Dict]`  \n  Searches courts by name or code.\n\n- `get_all_courts() -> Dict[str, str]`  \n  Returns a dictionary of all court codes and names.\n\n---\n\n### KWUtils\n\nUtility class for working with KW numbers.\n\n**Methods:**\n\n- `normalize_kw_number(kw_number: str) -> str`  \n  Normalizes the format of a KW number.\n\n- `extract_kw_numbers(text: str) -> List[str]`  \n  Extracts all KW numbers from a given text.\n\n- `get_kw_info(kw_number: str) -> Dict`  \n  Returns detailed information about a KW number.\n\n- `generate_kw_number_variants(court_code: str, start_number: int, count: int) -> List[str]`  \n  Generates a series of KW numbers.\n\n- `validate_multiple_kw_numbers(kw_numbers: List[str]) -> List[Tuple[str, bool, Optional[str]]]`  \n  Validates multiple KW numbers at once.\n\n- `suggest_corrections(kw_number: str) -> List[str]`  \n  Suggests possible corrections for an invalid KW number.\n\n## Examples\n\nYou can find example usage of all main functions and classes in the `examples/` directory.\n\n- [`examples/example_all_functions.py`](examples/example_all_functions.py): Demonstrates validation, parsing, check digit generation, court registry operations, and utility functions.\n\nTo run the example:\n\n```sh\npython examples/example_all_functions.py\n```\n\nFeel free to explore and modify the example to fit your use case.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025 Mateusz Hajder  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Python library for Polish eKW (Land Registry)",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://github.com/mhajder/pyekw#readme",
        "Homepage": "https://github.com/mhajder/pyekw",
        "Issues": "https://github.com/mhajder/pyekw/issues",
        "Repository": "https://github.com/mhajder/pyekw"
    },
    "split_keywords": [
        "ekw",
        " land-registry",
        " poland",
        " utilities",
        " validation"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "21a0f67d468362b59f7050cf5f7a5ffd2f4de0974cb47d3f976b2806d032d78d",
                "md5": "a23c8c0ad6385eb1121def784637a72b",
                "sha256": "b6a666c2f340df3ba69d0a806ebf2024dbdb4f08c566a3af85df13c4f204df83"
            },
            "downloads": -1,
            "filename": "pyekw-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a23c8c0ad6385eb1121def784637a72b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 16928,
            "upload_time": "2025-08-15T18:50:26",
            "upload_time_iso_8601": "2025-08-15T18:50:26.650401Z",
            "url": "https://files.pythonhosted.org/packages/21/a0/f67d468362b59f7050cf5f7a5ffd2f4de0974cb47d3f976b2806d032d78d/pyekw-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "10adce7a148e08202be49601ce10c566dd7a21d430521a834d62bbb71a285bd9",
                "md5": "b2d93e5617caeff21591239330ea9f44",
                "sha256": "91cacfef343d1aae478db06af76aad2efa6da941b7628b5159785276ad06aeff"
            },
            "downloads": -1,
            "filename": "pyekw-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b2d93e5617caeff21591239330ea9f44",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 61021,
            "upload_time": "2025-08-15T18:50:27",
            "upload_time_iso_8601": "2025-08-15T18:50:27.832643Z",
            "url": "https://files.pythonhosted.org/packages/10/ad/ce7a148e08202be49601ce10c566dd7a21d430521a834d62bbb71a285bd9/pyekw-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-15 18:50:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mhajder",
    "github_project": "pyekw#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyekw"
}
        
Elapsed time: 1.62532s