rfc-editor 0.1.0.1__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.
- rfc_editor-0.1.0.1/PKG-INFO +172 -0
- rfc_editor-0.1.0.1/README.md +147 -0
- rfc_editor-0.1.0.1/pyproject.toml +65 -0
- rfc_editor-0.1.0.1/setup.cfg +4 -0
- rfc_editor-0.1.0.1/src/rfc_editor/__init__.py +430 -0
- rfc_editor-0.1.0.1/src/rfc_editor.egg-info/PKG-INFO +172 -0
- rfc_editor-0.1.0.1/src/rfc_editor.egg-info/SOURCES.txt +12 -0
- rfc_editor-0.1.0.1/src/rfc_editor.egg-info/dependency_links.txt +1 -0
- rfc_editor-0.1.0.1/src/rfc_editor.egg-info/requires.txt +6 -0
- rfc_editor-0.1.0.1/src/rfc_editor.egg-info/top_level.txt +1 -0
- rfc_editor-0.1.0.1/tests/test_author.py +54 -0
- rfc_editor-0.1.0.1/tests/test_document.py +134 -0
- rfc_editor-0.1.0.1/tests/test_editor.py +411 -0
- rfc_editor-0.1.0.1/tests/test_section.py +53 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rfc-editor
|
|
3
|
+
Version: 0.1.0.1
|
|
4
|
+
Summary: A Python library to parse and edit RFC TXT documents
|
|
5
|
+
Author-email: RFC Editor Team <team@rfc-editor.example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/example/rfc-editor
|
|
8
|
+
Project-URL: Repository, https://github.com/example/rfc-editor
|
|
9
|
+
Keywords: rfc,editor,document,ietf
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
22
|
+
Requires-Dist: flake8>=6.0; extra == "dev"
|
|
23
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
24
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
25
|
+
|
|
26
|
+
# RFC Editor Library
|
|
27
|
+
|
|
28
|
+
A Python library for parsing and editing RFC (Request for Comments) TXT documents.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- Parse RFC TXT documents and extract all sections
|
|
33
|
+
- Edit all RFC document sections including:
|
|
34
|
+
- Title
|
|
35
|
+
- Abstract
|
|
36
|
+
- Status of This Memo
|
|
37
|
+
- Copyright Notice
|
|
38
|
+
- Table of Contents
|
|
39
|
+
- Numbered sections (1., 2., etc.)
|
|
40
|
+
- Acknowledgements
|
|
41
|
+
- Contributors
|
|
42
|
+
- Author's Address
|
|
43
|
+
- Add, update, and delete sections
|
|
44
|
+
- Save modified documents back to TXT format
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install rfc-editor
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or install from source:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install -e .
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
### Parse an RFC Document
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from rfc_editor import RFCEditor
|
|
64
|
+
|
|
65
|
+
editor = RFCEditor()
|
|
66
|
+
doc = editor.load("rfc1234.txt")
|
|
67
|
+
|
|
68
|
+
# Or parse from string
|
|
69
|
+
doc = editor.parse(rfc_content_string)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Access Document Sections
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
print(doc.rfc_number) # RFC number
|
|
76
|
+
print(doc.category) # e.g., "Standards Track"
|
|
77
|
+
print(doc.title) # RFC title
|
|
78
|
+
print(doc.abstract) # Abstract content
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Edit Sections
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
# Edit title
|
|
85
|
+
editor.set_title("New Title")
|
|
86
|
+
|
|
87
|
+
# Edit abstract
|
|
88
|
+
editor.set_abstract("New abstract content...")
|
|
89
|
+
|
|
90
|
+
# Edit status
|
|
91
|
+
editor.set_status_of_memo("New status content...")
|
|
92
|
+
|
|
93
|
+
# Edit copyright
|
|
94
|
+
editor.set_copyright(2024, "Example Corp")
|
|
95
|
+
|
|
96
|
+
# Edit TOC
|
|
97
|
+
editor.set_toc("1. Introduction\n2. Body")
|
|
98
|
+
|
|
99
|
+
# Update a numbered section
|
|
100
|
+
editor.update_section("1", content="Updated introduction content...")
|
|
101
|
+
|
|
102
|
+
# Add a new section
|
|
103
|
+
editor.add_section("5", "New Section", "Section content...")
|
|
104
|
+
|
|
105
|
+
# Delete a section
|
|
106
|
+
editor.delete_section("1")
|
|
107
|
+
|
|
108
|
+
# Edit by section title
|
|
109
|
+
editor.set_section_by_title("Introduction", "New content...")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Save the Document
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
editor.save("output.txt")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Convert to Dictionary
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
data = editor.to_dict()
|
|
122
|
+
print(data["title"])
|
|
123
|
+
print(data["sections"])
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
### Install Dev Dependencies
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
pip install -e ".[dev]"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Run Tests
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pytest tests/
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Run Linting
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
flake8 src/ tests/
|
|
144
|
+
ruff check src/ tests/
|
|
145
|
+
black --check src/ tests/
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Project Structure
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
rfc-editor/
|
|
152
|
+
├── src/
|
|
153
|
+
│ └── rfc_editor/
|
|
154
|
+
│ └── __init__.py # Main library code
|
|
155
|
+
├── tests/
|
|
156
|
+
│ ├── test_author.py
|
|
157
|
+
│ ├── test_document.py
|
|
158
|
+
│ ├── test_editor.py
|
|
159
|
+
│ └── test_section.py
|
|
160
|
+
├── pyproject.toml
|
|
161
|
+
├── README.md
|
|
162
|
+
├── .gitignore
|
|
163
|
+
└── SPEC.md
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Version
|
|
167
|
+
|
|
168
|
+
0.1.0.1
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
MIT
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# RFC Editor Library
|
|
2
|
+
|
|
3
|
+
A Python library for parsing and editing RFC (Request for Comments) TXT documents.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Parse RFC TXT documents and extract all sections
|
|
8
|
+
- Edit all RFC document sections including:
|
|
9
|
+
- Title
|
|
10
|
+
- Abstract
|
|
11
|
+
- Status of This Memo
|
|
12
|
+
- Copyright Notice
|
|
13
|
+
- Table of Contents
|
|
14
|
+
- Numbered sections (1., 2., etc.)
|
|
15
|
+
- Acknowledgements
|
|
16
|
+
- Contributors
|
|
17
|
+
- Author's Address
|
|
18
|
+
- Add, update, and delete sections
|
|
19
|
+
- Save modified documents back to TXT format
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install rfc-editor
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or install from source:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### Parse an RFC Document
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from rfc_editor import RFCEditor
|
|
39
|
+
|
|
40
|
+
editor = RFCEditor()
|
|
41
|
+
doc = editor.load("rfc1234.txt")
|
|
42
|
+
|
|
43
|
+
# Or parse from string
|
|
44
|
+
doc = editor.parse(rfc_content_string)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Access Document Sections
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
print(doc.rfc_number) # RFC number
|
|
51
|
+
print(doc.category) # e.g., "Standards Track"
|
|
52
|
+
print(doc.title) # RFC title
|
|
53
|
+
print(doc.abstract) # Abstract content
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Edit Sections
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
# Edit title
|
|
60
|
+
editor.set_title("New Title")
|
|
61
|
+
|
|
62
|
+
# Edit abstract
|
|
63
|
+
editor.set_abstract("New abstract content...")
|
|
64
|
+
|
|
65
|
+
# Edit status
|
|
66
|
+
editor.set_status_of_memo("New status content...")
|
|
67
|
+
|
|
68
|
+
# Edit copyright
|
|
69
|
+
editor.set_copyright(2024, "Example Corp")
|
|
70
|
+
|
|
71
|
+
# Edit TOC
|
|
72
|
+
editor.set_toc("1. Introduction\n2. Body")
|
|
73
|
+
|
|
74
|
+
# Update a numbered section
|
|
75
|
+
editor.update_section("1", content="Updated introduction content...")
|
|
76
|
+
|
|
77
|
+
# Add a new section
|
|
78
|
+
editor.add_section("5", "New Section", "Section content...")
|
|
79
|
+
|
|
80
|
+
# Delete a section
|
|
81
|
+
editor.delete_section("1")
|
|
82
|
+
|
|
83
|
+
# Edit by section title
|
|
84
|
+
editor.set_section_by_title("Introduction", "New content...")
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Save the Document
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
editor.save("output.txt")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Convert to Dictionary
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
data = editor.to_dict()
|
|
97
|
+
print(data["title"])
|
|
98
|
+
print(data["sections"])
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Development
|
|
102
|
+
|
|
103
|
+
### Install Dev Dependencies
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install -e ".[dev]"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Run Tests
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pytest tests/
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Run Linting
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
flake8 src/ tests/
|
|
119
|
+
ruff check src/ tests/
|
|
120
|
+
black --check src/ tests/
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Project Structure
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
rfc-editor/
|
|
127
|
+
├── src/
|
|
128
|
+
│ └── rfc_editor/
|
|
129
|
+
│ └── __init__.py # Main library code
|
|
130
|
+
├── tests/
|
|
131
|
+
│ ├── test_author.py
|
|
132
|
+
│ ├── test_document.py
|
|
133
|
+
│ ├── test_editor.py
|
|
134
|
+
│ └── test_section.py
|
|
135
|
+
├── pyproject.toml
|
|
136
|
+
├── README.md
|
|
137
|
+
├── .gitignore
|
|
138
|
+
└── SPEC.md
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Version
|
|
142
|
+
|
|
143
|
+
0.1.0.1
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "rfc-editor"
|
|
7
|
+
version = "0.1.0.1"
|
|
8
|
+
description = "A Python library to parse and edit RFC TXT documents"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "RFC Editor Team", email = "team@rfc-editor.example.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["rfc", "editor", "document", "ietf"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
dependencies = []
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = [
|
|
31
|
+
"pytest>=7.0",
|
|
32
|
+
"flake8>=6.0",
|
|
33
|
+
"ruff>=0.1.0",
|
|
34
|
+
"black>=23.0",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/example/rfc-editor"
|
|
39
|
+
Repository = "https://github.com/example/rfc-editor"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
where = ["src"]
|
|
43
|
+
|
|
44
|
+
[tool.pytest.ini_options]
|
|
45
|
+
testpaths = ["tests"]
|
|
46
|
+
python_files = ["test_*.py"]
|
|
47
|
+
python_classes = ["Test*"]
|
|
48
|
+
python_functions = ["test_*"]
|
|
49
|
+
addopts = "-v --tb=short"
|
|
50
|
+
|
|
51
|
+
[tool.ruff]
|
|
52
|
+
line-length = 72
|
|
53
|
+
target-version = "py39"
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint]
|
|
56
|
+
select = ["E", "F", "W", "I", "N", "UP", "B", "C4", "SIM"]
|
|
57
|
+
ignore = ["E501"]
|
|
58
|
+
|
|
59
|
+
[tool.black]
|
|
60
|
+
line-length = 72
|
|
61
|
+
target-version = ["py39"]
|
|
62
|
+
|
|
63
|
+
[tool.flake8]
|
|
64
|
+
max-line-length = 72
|
|
65
|
+
extend-ignore = ["E501", "W503"]
|