tratto-email 0.2.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,49 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ python-version: ['3.10', '3.11', '3.12']
19
+ steps:
20
+ - uses: actions/checkout@v6
21
+ - uses: actions/setup-python@v5
22
+ with: { python-version: '${{ matrix.python-version }}' }
23
+ - run: pip install -e ".[dev]"
24
+ - run: pytest --cov=tratto --cov-report=term-missing
25
+
26
+ lint:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v6
30
+ - uses: actions/setup-python@v5
31
+ with: { python-version: '3.12' }
32
+ - run: pip install ruff mypy
33
+ - run: ruff check tratto
34
+ - run: mypy tratto
35
+
36
+ build:
37
+ runs-on: ubuntu-latest
38
+ needs: [test, lint]
39
+ steps:
40
+ - uses: actions/checkout@v6
41
+ - uses: actions/setup-python@v5
42
+ with: { python-version: '3.12' }
43
+ - run: pip install hatchling build
44
+ - run: python -m build
45
+ - uses: actions/upload-artifact@v4
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+ retention-days: 7
@@ -0,0 +1,20 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags: ['v*']
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v6
15
+ - uses: actions/setup-python@v5
16
+ with: { python-version: '3.12' }
17
+ - run: pip install build
18
+ - run: python -m build
19
+ - name: Publish to PyPI (trusted publishing)
20
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .venv/
8
+ .env
9
+ .DS_Store
10
+ .pytest_cache/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ htmlcov/
14
+ .coverage
@@ -0,0 +1,127 @@
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
9
+ status, 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 advances
31
+ of any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political
33
+ attacks
34
+ - Public or private harassment
35
+ - Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ - Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards
43
+ of acceptable behavior and will take appropriate and fair corrective action
44
+ in response to any behavior that they deem inappropriate, threatening,
45
+ offensive, or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or
48
+ reject comments, commits, code, wiki edits, issues, and other contributions
49
+ that are not aligned with this Code of Conduct, and will communicate reasons
50
+ for moderation decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces (issues, pull
55
+ requests, discussions, and any other project-related communication), and
56
+ also applies when an individual is officially representing the community in
57
+ public spaces.
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
+ **conduct@tratto.email**. All complaints will be reviewed and investigated
64
+ promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of
67
+ the reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in
72
+ determining the consequences for any action they deem in violation of this
73
+ Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders,
81
+ providing clarity around the nature of the violation and an explanation of
82
+ why the behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external
93
+ channels like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public
103
+ or private interaction with the people involved, including unsolicited
104
+ interaction with those enforcing the Code of Conduct, is allowed during this
105
+ period. Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within
114
+ the community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][mozilla].
124
+
125
+ [homepage]: https://www.contributor-covenant.org
126
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
127
+ [mozilla]: https://github.com/mozilla/diversity
@@ -0,0 +1,168 @@
1
+ # Contributing to tratto-python
2
+
3
+ Thank you for helping improve the official Tratto Python SDK! This guide covers
4
+ everything you need to get started contributing.
5
+
6
+ ---
7
+
8
+ ## Code of Conduct
9
+
10
+ Be respectful and constructive. We follow the
11
+ [Contributor Covenant v2.1](./CODE_OF_CONDUCT.md).
12
+
13
+ ---
14
+
15
+ ## Ways to contribute
16
+
17
+ - **Bug reports** — open an issue with steps to reproduce, expected behaviour, and actual behaviour.
18
+ - **Feature requests** — open an issue describing the use-case before writing code.
19
+ - **Pull requests** — see the workflow below.
20
+ - **Documentation** — typos, clarifications, and extra examples are always welcome.
21
+
22
+ ---
23
+
24
+ ## Development setup
25
+
26
+ **Requirements:** Python 3.10+, `pip`.
27
+
28
+ ```bash
29
+ # 1. Fork the repository on GitHub, then clone your fork
30
+ git clone https://github.com/<your-username>/tratto-python.git
31
+ cd tratto-python
32
+
33
+ # 2. Create a virtual environment
34
+ python -m venv .venv
35
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
36
+
37
+ # 3. Install the package in editable mode with dev dependencies
38
+ pip install -e ".[dev]"
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Running the tests
44
+
45
+ ```bash
46
+ pytest
47
+ ```
48
+
49
+ With coverage report:
50
+
51
+ ```bash
52
+ pytest --cov=tratto --cov-report=term-missing
53
+ ```
54
+
55
+ Tests live in `tests/` and **must not make real network requests** — use
56
+ `unittest.mock.patch` to mock `urllib.request.urlopen`.
57
+
58
+ ---
59
+
60
+ ## Linting and type checking
61
+
62
+ ```bash
63
+ # Style
64
+ ruff check tratto tests
65
+
66
+ # Types
67
+ mypy tratto
68
+ ```
69
+
70
+ All checks must pass before a PR is merged.
71
+
72
+ ---
73
+
74
+ ## Pull request workflow
75
+
76
+ 1. **Open an issue first** (except for trivial fixes like typos).
77
+ 2. Fork and create a feature branch:
78
+ ```bash
79
+ git checkout -b feat/your-feature
80
+ ```
81
+ 3. Make your changes. Keep commits focused and descriptive.
82
+ 4. Add or update tests for every changed behaviour.
83
+ 5. Run `pytest`, `ruff check`, and `mypy tratto` locally — fix any failures.
84
+ 6. Push your branch and open a PR against `main`.
85
+
86
+ ### PR checklist
87
+
88
+ - [ ] Tests added or updated
89
+ - [ ] `ruff check tratto tests` passes
90
+ - [ ] `mypy tratto` passes
91
+ - [ ] Public API changes reflected in `README.md`
92
+
93
+ ---
94
+
95
+ ## Project structure
96
+
97
+ ```
98
+ tratto-python/
99
+ ├── tratto/
100
+ │ ├── __init__.py # public exports
101
+ │ ├── _http.py # internal HTTP client
102
+ │ ├── client.py # Tratto main class
103
+ │ ├── types.py # option dataclasses + TrattoError
104
+ │ └── resources/
105
+ │ ├── __init__.py
106
+ │ ├── emails.py
107
+ │ ├── contacts.py
108
+ │ ├── audiences.py
109
+ │ ├── templates.py
110
+ │ ├── domains.py
111
+ │ ├── campaigns.py
112
+ │ └── webhooks.py
113
+ ├── tests/
114
+ │ └── test_client.py
115
+ ├── pyproject.toml
116
+ ├── README.md
117
+ ├── CONTRIBUTING.md
118
+ └── LICENSE
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Coding conventions
124
+
125
+ - **No external runtime dependencies.** The SDK uses only Python's standard library.
126
+ - **Python 3.10+** — use native generics (`list[str]`, `dict[str, str]`, `str | None`).
127
+ - **Strict type hints** on all public functions and methods (enforced by `mypy --strict`).
128
+ - **Dataclasses for option objects** — one per write operation, matching the API body.
129
+ - **snake_case** in Python maps to **camelCase** in JSON request bodies and responses.
130
+ - **Resource sub-clients** — each API resource group has its own class in `tratto/resources/`.
131
+ - Follow `ruff` defaults for code style (line length 100).
132
+ - Do not add `print` statements or logging to the SDK.
133
+
134
+ ---
135
+
136
+ ## Versioning
137
+
138
+ This SDK follows [Semantic Versioning](https://semver.org/):
139
+
140
+ | Bump | When |
141
+ |---|---|
142
+ | **Patch** (`0.x.y`) | Bug fixes, non-breaking improvements |
143
+ | **Minor** (`0.x.0`) | New API coverage, new optional fields |
144
+ | **Major** (`x.0.0`) | Breaking changes to the public API |
145
+
146
+ When cutting a release, update:
147
+ - `__version__` in `tratto/__init__.py`
148
+ - `_SDK_VERSION` in `tratto/_http.py`
149
+ - `version` in `pyproject.toml`
150
+
151
+ ---
152
+
153
+ ## Release process (maintainers only)
154
+
155
+ 1. Bump the version in the three files above.
156
+ 2. Commit and merge to `main`.
157
+ 3. Push a tag:
158
+ ```bash
159
+ git tag v0.x.y && git push --tags
160
+ ```
161
+ 4. GitHub Actions publishes to PyPI automatically via the `publish` workflow.
162
+
163
+ ---
164
+
165
+ ## License
166
+
167
+ By contributing you agree that your work will be licensed under the
168
+ [MIT License](./LICENSE).
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tratto
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 urnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.