pm2insomnia 0.1.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.
- pm2insomnia-0.1.0/LICENSE +21 -0
- pm2insomnia-0.1.0/PKG-INFO +162 -0
- pm2insomnia-0.1.0/README.md +136 -0
- pm2insomnia-0.1.0/pyproject.toml +55 -0
- pm2insomnia-0.1.0/setup.cfg +4 -0
- pm2insomnia-0.1.0/src/pm2insomnia/__init__.py +3 -0
- pm2insomnia-0.1.0/src/pm2insomnia/bundle_writer.py +417 -0
- pm2insomnia-0.1.0/src/pm2insomnia/cli.py +297 -0
- pm2insomnia-0.1.0/src/pm2insomnia/converter.py +199 -0
- pm2insomnia-0.1.0/src/pm2insomnia/insomnia_writer.py +22 -0
- pm2insomnia-0.1.0/src/pm2insomnia/models.py +114 -0
- pm2insomnia-0.1.0/src/pm2insomnia/postman_environment_parser.py +82 -0
- pm2insomnia-0.1.0/src/pm2insomnia/postman_parser.py +374 -0
- pm2insomnia-0.1.0/src/pm2insomnia/reporting.py +50 -0
- pm2insomnia-0.1.0/src/pm2insomnia.egg-info/PKG-INFO +162 -0
- pm2insomnia-0.1.0/src/pm2insomnia.egg-info/SOURCES.txt +20 -0
- pm2insomnia-0.1.0/src/pm2insomnia.egg-info/dependency_links.txt +1 -0
- pm2insomnia-0.1.0/src/pm2insomnia.egg-info/entry_points.txt +2 -0
- pm2insomnia-0.1.0/src/pm2insomnia.egg-info/requires.txt +6 -0
- pm2insomnia-0.1.0/src/pm2insomnia.egg-info/top_level.txt +1 -0
- pm2insomnia-0.1.0/tests/test_cli.py +605 -0
- pm2insomnia-0.1.0/tests/test_parser_and_converter.py +205 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Antonio Saco
|
|
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.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pm2insomnia
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI to convert Postman collections into Insomnia imports
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Keywords: cli,postman,insomnia,api,converter
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
16
|
+
Classifier: Topic :: Utilities
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: build>=1.2.2; extra == "dev"
|
|
22
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
23
|
+
Requires-Dist: ruff>=0.11.0; extra == "dev"
|
|
24
|
+
Requires-Dist: twine>=6.1.0; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
<h1 align="center">
|
|
28
|
+
<img src="assets/post-insomnia-icon.svg" alt="pm2insomnia icon" width="180" /><br />
|
|
29
|
+
pm2insomnia
|
|
30
|
+
</h1>
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<a href="https://github.com/antonillos/pm2insomnia/actions/workflows/tests.yml">
|
|
34
|
+
<img src="https://github.com/antonillos/pm2insomnia/actions/workflows/tests.yml/badge.svg" alt="Tests" />
|
|
35
|
+
</a>
|
|
36
|
+
<img src="https://img.shields.io/badge/python-3.11%2B-blue" alt="Python 3.11+" />
|
|
37
|
+
<img src="https://img.shields.io/badge/code%20style-ruff-261230?logo=ruff&logoColor=white" alt="Code style: Ruff" />
|
|
38
|
+
<a href="LICENSE">
|
|
39
|
+
<img src="https://img.shields.io/badge/license-MIT-lightgrey" alt="MIT License" />
|
|
40
|
+
</a>
|
|
41
|
+
</p>
|
|
42
|
+
|
|
43
|
+
<h3 align="center">
|
|
44
|
+
Move your Postman collections to Insomnia in seconds — no manual work.
|
|
45
|
+
</h3>
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<a href="#install">Install</a> •
|
|
49
|
+
<a href="#usage">Usage</a> •
|
|
50
|
+
<a href="#what-gets-converted">What gets converted</a> •
|
|
51
|
+
<a href="#license">License</a>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
If your team exports collections from Postman but you prefer working in Insomnia, `pm2insomnia` does the conversion for you. Drop in a Postman export, get an Insomnia file ready to import — folders, requests, environments, auth, and examples included.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
The easiest way is with [pipx](https://pipx.pypa.io), which installs the tool globally and keeps it isolated from your Python environment:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pipx install pm2insomnia
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
That's it. The `pm2insomnia` command is now available anywhere in your terminal.
|
|
67
|
+
|
|
68
|
+
> **Don't have pipx?** Install it first:
|
|
69
|
+
> ```bash
|
|
70
|
+
> pip install pipx
|
|
71
|
+
> ```
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
### Convert a collection
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pm2insomnia convert --input my-collection.postman.json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This creates `my-collection.insomnia.json` in the same folder. Open Insomnia, go to **Import**, and select that file.
|
|
82
|
+
|
|
83
|
+
Want to include your Postman environments too?
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pm2insomnia convert \
|
|
87
|
+
--input my-collection.postman.json \
|
|
88
|
+
--environment my-environments.json
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Export a versioned bundle
|
|
92
|
+
|
|
93
|
+
If you want to store the collection and API docs together in a repository:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pm2insomnia bundle \
|
|
97
|
+
--input my-api-1.9.1.postman.json \
|
|
98
|
+
--workspace-name "My API" \
|
|
99
|
+
--output-dir exports/
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
This generates a tidy folder structure:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
exports/
|
|
106
|
+
collections/my-api/1.9.1/my-api.insomnia.json
|
|
107
|
+
api-docs/my-api/1.9.1/README.md
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
You can also attach an OpenAPI spec:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pm2insomnia bundle \
|
|
114
|
+
--input my-api-1.9.1.postman.json \
|
|
115
|
+
--workspace-name "My API" \
|
|
116
|
+
--spec openapi.yaml \
|
|
117
|
+
--environment environments.zip \
|
|
118
|
+
--output-dir exports/
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Importing in Insomnia
|
|
122
|
+
|
|
123
|
+
1. Open Insomnia → **Import**
|
|
124
|
+
2. Select the `.insomnia.json` file
|
|
125
|
+
3. Done — your collection, environments, and examples are ready
|
|
126
|
+
|
|
127
|
+
## Options
|
|
128
|
+
|
|
129
|
+
| Flag | What it does |
|
|
130
|
+
|------|-------------|
|
|
131
|
+
| `--input` | Path to your Postman collection JSON |
|
|
132
|
+
| `--environment` | Postman environment file (`.json` or `.zip`). Repeat for multiple files |
|
|
133
|
+
| `--output` | Where to write the Insomnia file (default: same folder as input) |
|
|
134
|
+
| `--output-dir` | Write the output into a specific directory |
|
|
135
|
+
| `--workspace-name` | Override the workspace name shown in Insomnia |
|
|
136
|
+
| `--pretty` | Format the JSON output so it's readable |
|
|
137
|
+
| `--strict` | Fail with exit code `2` if anything couldn't be converted |
|
|
138
|
+
|
|
139
|
+
## What gets converted
|
|
140
|
+
|
|
141
|
+
✅ Folders and subfolders
|
|
142
|
+
✅ Requests — method, URL, headers, query params
|
|
143
|
+
✅ Request and folder descriptions
|
|
144
|
+
✅ Body — raw, form, and URL-encoded
|
|
145
|
+
✅ Path variables
|
|
146
|
+
✅ Bearer auth
|
|
147
|
+
✅ Saved response examples
|
|
148
|
+
✅ Collection variables → Insomnia base environment
|
|
149
|
+
✅ Postman environments → Insomnia sub-environments
|
|
150
|
+
|
|
151
|
+
## What doesn't convert
|
|
152
|
+
|
|
153
|
+
These Postman features have no direct equivalent in Insomnia and are skipped. The tool will warn you when it encounters them:
|
|
154
|
+
|
|
155
|
+
- Pre-request and test scripts
|
|
156
|
+
- Auth types other than Bearer
|
|
157
|
+
- GraphQL body mode
|
|
158
|
+
- Variable resolution (placeholders are kept as-is)
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="assets/post-insomnia-icon.svg" alt="pm2insomnia icon" width="180" /><br />
|
|
3
|
+
pm2insomnia
|
|
4
|
+
</h1>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://github.com/antonillos/pm2insomnia/actions/workflows/tests.yml">
|
|
8
|
+
<img src="https://github.com/antonillos/pm2insomnia/actions/workflows/tests.yml/badge.svg" alt="Tests" />
|
|
9
|
+
</a>
|
|
10
|
+
<img src="https://img.shields.io/badge/python-3.11%2B-blue" alt="Python 3.11+" />
|
|
11
|
+
<img src="https://img.shields.io/badge/code%20style-ruff-261230?logo=ruff&logoColor=white" alt="Code style: Ruff" />
|
|
12
|
+
<a href="LICENSE">
|
|
13
|
+
<img src="https://img.shields.io/badge/license-MIT-lightgrey" alt="MIT License" />
|
|
14
|
+
</a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<h3 align="center">
|
|
18
|
+
Move your Postman collections to Insomnia in seconds — no manual work.
|
|
19
|
+
</h3>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="#install">Install</a> •
|
|
23
|
+
<a href="#usage">Usage</a> •
|
|
24
|
+
<a href="#what-gets-converted">What gets converted</a> •
|
|
25
|
+
<a href="#license">License</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
If your team exports collections from Postman but you prefer working in Insomnia, `pm2insomnia` does the conversion for you. Drop in a Postman export, get an Insomnia file ready to import — folders, requests, environments, auth, and examples included.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
The easiest way is with [pipx](https://pipx.pypa.io), which installs the tool globally and keeps it isolated from your Python environment:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pipx install pm2insomnia
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
That's it. The `pm2insomnia` command is now available anywhere in your terminal.
|
|
41
|
+
|
|
42
|
+
> **Don't have pipx?** Install it first:
|
|
43
|
+
> ```bash
|
|
44
|
+
> pip install pipx
|
|
45
|
+
> ```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Convert a collection
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pm2insomnia convert --input my-collection.postman.json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This creates `my-collection.insomnia.json` in the same folder. Open Insomnia, go to **Import**, and select that file.
|
|
56
|
+
|
|
57
|
+
Want to include your Postman environments too?
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pm2insomnia convert \
|
|
61
|
+
--input my-collection.postman.json \
|
|
62
|
+
--environment my-environments.json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Export a versioned bundle
|
|
66
|
+
|
|
67
|
+
If you want to store the collection and API docs together in a repository:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pm2insomnia bundle \
|
|
71
|
+
--input my-api-1.9.1.postman.json \
|
|
72
|
+
--workspace-name "My API" \
|
|
73
|
+
--output-dir exports/
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This generates a tidy folder structure:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
exports/
|
|
80
|
+
collections/my-api/1.9.1/my-api.insomnia.json
|
|
81
|
+
api-docs/my-api/1.9.1/README.md
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
You can also attach an OpenAPI spec:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pm2insomnia bundle \
|
|
88
|
+
--input my-api-1.9.1.postman.json \
|
|
89
|
+
--workspace-name "My API" \
|
|
90
|
+
--spec openapi.yaml \
|
|
91
|
+
--environment environments.zip \
|
|
92
|
+
--output-dir exports/
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Importing in Insomnia
|
|
96
|
+
|
|
97
|
+
1. Open Insomnia → **Import**
|
|
98
|
+
2. Select the `.insomnia.json` file
|
|
99
|
+
3. Done — your collection, environments, and examples are ready
|
|
100
|
+
|
|
101
|
+
## Options
|
|
102
|
+
|
|
103
|
+
| Flag | What it does |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `--input` | Path to your Postman collection JSON |
|
|
106
|
+
| `--environment` | Postman environment file (`.json` or `.zip`). Repeat for multiple files |
|
|
107
|
+
| `--output` | Where to write the Insomnia file (default: same folder as input) |
|
|
108
|
+
| `--output-dir` | Write the output into a specific directory |
|
|
109
|
+
| `--workspace-name` | Override the workspace name shown in Insomnia |
|
|
110
|
+
| `--pretty` | Format the JSON output so it's readable |
|
|
111
|
+
| `--strict` | Fail with exit code `2` if anything couldn't be converted |
|
|
112
|
+
|
|
113
|
+
## What gets converted
|
|
114
|
+
|
|
115
|
+
✅ Folders and subfolders
|
|
116
|
+
✅ Requests — method, URL, headers, query params
|
|
117
|
+
✅ Request and folder descriptions
|
|
118
|
+
✅ Body — raw, form, and URL-encoded
|
|
119
|
+
✅ Path variables
|
|
120
|
+
✅ Bearer auth
|
|
121
|
+
✅ Saved response examples
|
|
122
|
+
✅ Collection variables → Insomnia base environment
|
|
123
|
+
✅ Postman environments → Insomnia sub-environments
|
|
124
|
+
|
|
125
|
+
## What doesn't convert
|
|
126
|
+
|
|
127
|
+
These Postman features have no direct equivalent in Insomnia and are skipped. The tool will warn you when it encounters them:
|
|
128
|
+
|
|
129
|
+
- Pre-request and test scripts
|
|
130
|
+
- Auth types other than Bearer
|
|
131
|
+
- GraphQL body mode
|
|
132
|
+
- Variable resolution (placeholders are kept as-is)
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pm2insomnia"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "CLI to convert Postman collections into Insomnia imports"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
keywords = ["cli", "postman", "insomnia", "api", "converter"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Software Development :: Build Tools",
|
|
24
|
+
"Topic :: Utilities",
|
|
25
|
+
]
|
|
26
|
+
dependencies = []
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
dev = ["build>=1.2.2", "pytest>=8.0.0", "ruff>=0.11.0", "twine>=6.1.0"]
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
pm2insomnia = "pm2insomnia.cli:main"
|
|
33
|
+
|
|
34
|
+
[tool.pytest.ini_options]
|
|
35
|
+
pythonpath = ["src"]
|
|
36
|
+
testpaths = ["tests"]
|
|
37
|
+
|
|
38
|
+
[tool.ruff]
|
|
39
|
+
line-length = 100
|
|
40
|
+
target-version = "py311"
|
|
41
|
+
|
|
42
|
+
[tool.ruff.lint]
|
|
43
|
+
select = ["E", "F", "I", "UP", "B"]
|
|
44
|
+
ignore = ["E501"]
|
|
45
|
+
|
|
46
|
+
[tool.ruff.format]
|
|
47
|
+
quote-style = "double"
|
|
48
|
+
indent-style = "space"
|
|
49
|
+
line-ending = "lf"
|
|
50
|
+
|
|
51
|
+
[tool.setuptools]
|
|
52
|
+
package-dir = {"" = "src"}
|
|
53
|
+
|
|
54
|
+
[tool.setuptools.packages.find]
|
|
55
|
+
where = ["src"]
|