pluralio 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a bug in pluralio
4
+ title: "[BUG] "
5
+ labels: bug
6
+ assignees: []
7
+ ---
8
+
9
+ ## Describe the bug
10
+
11
+ A clear and concise description of what the bug is.
12
+
13
+ ## To reproduce
14
+
15
+ ```python
16
+ import pluralio
17
+
18
+ # Minimal code that reproduces the issue
19
+ ```
20
+
21
+ ## Expected behavior
22
+
23
+ What you expected to happen.
24
+
25
+ ## Actual behavior
26
+
27
+ What actually happened.
28
+
29
+ ## Environment
30
+
31
+ - **pluralio version**: [e.g. 0.1.0]
32
+ - **Python version**: [e.g. 3.12]
33
+ - **OS**: [e.g. Ubuntu 24.04, Windows 11, macOS 14]
34
+
35
+ ## Additional context
36
+
37
+ Any other context about the problem.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest a feature for pluralio
4
+ title: "[FEATURE] "
5
+ labels: enhancement
6
+ assignees: []
7
+ ---
8
+
9
+ ## Is your feature request related to a problem?
10
+
11
+ A clear description of the problem. e.g. "I'm always frustrated when [...]"
12
+
13
+ ## Proposed solution
14
+
15
+ A clear description of what you want to happen.
16
+
17
+ ```python
18
+ # Example of the proposed API (if applicable)
19
+ import pluralio
20
+ pluralio.pluralize("word", lang="xx") # "words"
21
+ ```
22
+
23
+ ## Alternatives considered
24
+
25
+ Any alternative solutions or features you've considered.
26
+
27
+ ## Additional context
28
+
29
+ Any other context or screenshots about the feature request.
@@ -0,0 +1,28 @@
1
+ ## Summary
2
+
3
+ Brief description of the changes.
4
+
5
+ ## Type of change
6
+
7
+ - [ ] Bug fix (non-breaking change which fixes an issue)
8
+ - [ ] New feature (non-breaking change which adds functionality)
9
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10
+ - [ ] Documentation update
11
+ - [ ] Refactor / code quality
12
+ - [ ] New language support
13
+
14
+ ## Changes
15
+
16
+ - Change 1
17
+ - Change 2
18
+
19
+ ## Checklist
20
+
21
+ - [ ] My code follows the style guidelines (`ruff check` passes)
22
+ - [ ] My code passes type checking (`mypy` passes)
23
+ - [ ] I have added tests for my changes
24
+ - [ ] All tests pass (`pytest` passes)
25
+ - [ ] Test coverage remains >= 95%
26
+ - [ ] I have updated `CHANGELOG.md`
27
+ - [ ] I have updated `README.md` if needed
28
+ - [ ] My commits follow the commit message convention described in `CONTRIBUTING.md`
@@ -0,0 +1,32 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint-test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: ${{ matrix.python-version }}
21
+
22
+ - name: Install dependencies
23
+ run: pip install -e ".[dev]"
24
+
25
+ - name: Lint
26
+ run: ruff check pluralio/ tests/
27
+
28
+ - name: Type check
29
+ run: mypy pluralio/
30
+
31
+ - name: Test with coverage
32
+ run: pytest --cov=pluralio --cov-report=term-missing --cov-fail-under=95
@@ -0,0 +1,52 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ id-token: write
10
+ contents: write
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+ - run: pip install build
21
+ - run: python -m build
22
+ - uses: actions/upload-artifact@v4
23
+ with:
24
+ name: dist
25
+ path: dist/
26
+
27
+ publish:
28
+ needs: build
29
+ runs-on: ubuntu-latest
30
+ permissions:
31
+ id-token: write
32
+ steps:
33
+ - uses: actions/download-artifact@v4
34
+ with:
35
+ name: dist
36
+ path: dist/
37
+ - uses: pypa/gh-action-pypi-publish@release/v1
38
+
39
+ github-release:
40
+ needs: build
41
+ runs-on: ubuntu-latest
42
+ permissions:
43
+ contents: write
44
+ steps:
45
+ - uses: actions/download-artifact@v4
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+ - uses: softprops/action-gh-release@v2
50
+ with:
51
+ files: dist/*
52
+ generate_release_notes: true
@@ -0,0 +1,17 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .venv/
10
+ venv/
11
+ .env
12
+ .mypy_cache/
13
+ .pytest_cache/
14
+ .ruff_cache/
15
+ .coverage
16
+ htmlcov/
17
+ ref/
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ### Changed
6
+
7
+ - `LanguageRules` is now `frozen=True` — prevents accidental attribute reassignment while allowing in-place extension via the public API
8
+ - `register()` now raises `ValueError` if `code` is empty
9
+ - English pluralization rules expanded: `fe → ves`, `consonant+f → ves`, `consonant+o → oes` added as regex rules (previously handled only as irregulars)
10
+ - English singularization rules expanded: `ves → f`, `oes → o` added as regex rules
11
+ - `pyproject.toml`: added author email, `Bug Tracker` and `Changelog` URLs
12
+
13
+ ### Added
14
+
15
+ - 25 new English irregular exceptions for the new regex rules (`cafe → cafes`, `solo → solos`, `turf → turfs`, `shoe → shoes`, etc.)
16
+ - Tests for `frozen=True` behavior, empty code validation, and all new regex rules
17
+
18
+ ## [0.1.0] - 2025-07-10
19
+
20
+ ### Added
21
+
22
+ - `pluralize()` and `singularize()` for English and Spanish
23
+ - `count` parameter for count-aware pluralization
24
+ - Case preservation (title case, all caps)
25
+ - Hyphenated word support (`mother-in-law` → `mothers-in-law`)
26
+ - Extensibility API: `add_irregular`, `add_plural`, `add_singular`, `add_uncountable`, `add_plural_rule`, `add_singular_rule`, `register_language`
27
+ - `supported_languages()` to list registered languages
28
+ - `LanguageRules` dataclass for custom language registration
29
+ - `py.typed` marker for PEP 561
30
+ - CI workflow (lint + type check + test on Python 3.10–3.13)
31
+ - Release workflow (trusted publishing to PyPI)
32
+ - 95% coverage requirement enforced in CI
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ **mathias.paulenko@outlook.com**.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
126
+ at [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,142 @@
1
+ # Contributing to pluralio
2
+
3
+ Thanks for your interest in contributing! This document covers everything you need to get started.
4
+
5
+ ## Development setup
6
+
7
+ ### Prerequisites
8
+
9
+ - Python 3.10+
10
+ - [pip](https://pip.pypa.io/)
11
+
12
+ ### Install in development mode
13
+
14
+ ```bash
15
+ git clone https://github.com/MathiasPaulenko/pluralio.git
16
+ cd pluralio
17
+ pip install -e ".[dev]"
18
+ ```
19
+
20
+ ### Verify your environment
21
+
22
+ ```bash
23
+ ruff check pluralio/ tests/
24
+ mypy pluralio/
25
+ pytest
26
+ ```
27
+
28
+ All three must pass before submitting a PR.
29
+
30
+ ## Project structure
31
+
32
+ ```text
33
+ pluralio/
34
+ ├── pluralio/
35
+ │ ├── __init__.py # Public API + extensibility functions
36
+ │ ├── core.py # pluralize(), singularize(), _match_case(), hyphens
37
+ │ ├── registry.py # LanguageRules dataclass, register(), get_rules()
38
+ │ ├── rules_en.py # English rules (irregulars, regex, uncountables)
39
+ │ ├── rules_es.py # Spanish rules (irregulars, regex, uncountables)
40
+ │ └── py.typed # PEP 561 marker
41
+ ├── tests/
42
+ │ ├── conftest.py
43
+ │ ├── test_registry.py
44
+ │ ├── test_core.py
45
+ │ ├── test_en_plurals.py
46
+ │ ├── test_en_singles.py
47
+ │ ├── test_es_plurals.py
48
+ │ ├── test_es_singles.py
49
+ │ ├── test_edge_cases.py
50
+ │ ├── test_round_trip.py
51
+ │ └── test_registry_isolation.py
52
+ ├── ref/ # Design docs, rules reference, development plan
53
+ ├── .github/workflows/ # CI + release workflows
54
+ ├── pyproject.toml
55
+ ├── CHANGELOG.md
56
+ ├── CONTRIBUTING.md
57
+ ├── CODE_OF_CONDUCT.md
58
+ ├── SECURITY.md
59
+ └── README.md
60
+ ```
61
+
62
+ ## Coding standards
63
+
64
+ - **Style**: PEP 8, enforced by `ruff` (line-length = 100)
65
+ - **Typing**: Strict mypy, type hints required on all public functions
66
+ - **Tests**: 95% coverage minimum, enforced in CI (`--cov-fail-under=95`)
67
+ - **Dependencies**: Zero runtime dependencies (stdlib only)
68
+ - **Python**: Code must work on Python 3.10, 3.11, 3.12, and 3.13
69
+
70
+ ## Adding a new language
71
+
72
+ 1. Create `pluralio/rules_xx.py` with a `LanguageRules` dataclass
73
+ 2. Call `register(_RULES)` at module level
74
+ 3. Import the module in `pluralio/__init__.py`
75
+ 4. Add tests in `tests/test_xx_plurals.py` and `tests/test_xx_singles.py`
76
+ 5. Add round-trip tests in `tests/test_round_trip.py`
77
+ 6. Update `README.md` languages table
78
+ 7. Update `CHANGELOG.md`
79
+
80
+ No changes needed to `core.py` or `registry.py`.
81
+
82
+ ## Adding irregulars or rules to an existing language
83
+
84
+ Edit the corresponding `rules_xx.py` file and add tests in the appropriate test file.
85
+
86
+ ## Pull request process
87
+
88
+ 1. Fork the repo and create a branch from `main`
89
+ 2. Write tests for your changes
90
+ 3. Ensure all checks pass:
91
+
92
+ ```bash
93
+ ruff check pluralio/ tests/
94
+ mypy pluralio/
95
+ pytest
96
+ ```
97
+
98
+ 4. Update `CHANGELOG.md` with a description of your changes
99
+ 5. Open a pull request using the [PR template](.github/pull_request_template.md)
100
+ 6. Wait for CI to pass — all checks must be green
101
+
102
+ ## Commit messages
103
+
104
+ Use clear, descriptive commit messages. Suggested format:
105
+
106
+ ```text
107
+ <type>: <short description>
108
+
109
+ <optional longer description>
110
+ ```
111
+
112
+ Types: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `ci`
113
+
114
+ Examples:
115
+
116
+ ```text
117
+ feat: add Portuguese pluralization rules
118
+ fix: correct singularize for words ending in -ces
119
+ docs: update README with count parameter example
120
+ test: add round-trip tests for Spanish irregulars
121
+ ```
122
+
123
+ ## Reporting bugs
124
+
125
+ Use the [Bug Report template](.github/ISSUE_TEMPLATE/bug_report.md) when opening an issue. Include:
126
+
127
+ - Python version
128
+ - OS
129
+ - Minimal reproduction code
130
+ - Expected vs actual output
131
+
132
+ ## Suggesting features
133
+
134
+ Use the [Feature Request template](.github/ISSUE_TEMPLATE/feature_request.md) when opening an issue. Describe:
135
+
136
+ - The use case
137
+ - The proposed API
138
+ - Any alternatives you've considered
139
+
140
+ ## Code of Conduct
141
+
142
+ By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md).
pluralio-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mathias Paulenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.