devscript 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

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.
devscript/__init__.py CHANGED
@@ -2,7 +2,7 @@ import argparse, os, json, tomllib, yaml
2
2
  from dataclasses import dataclass
3
3
  from typing import Literal
4
4
 
5
- __version__ = '0.1.0'
5
+ __version__ = '0.1.2'
6
6
 
7
7
 
8
8
  @dataclass
@@ -22,7 +22,7 @@ class DevScriptCore:
22
22
  self.config = self._config_obj.data
23
23
  self._config_file = 'devscript.yaml'
24
24
  elif self._config_obj.type == 'toml':
25
- self.config = self._config_obj.data['devscript']
25
+ self.config = self._config_obj.data.get('tool')['devscript'] or self._config_obj.data['devscript']
26
26
  self._config_file = 'pyproject.toml'
27
27
  elif self._config_obj.type == 'npmjs':
28
28
  self.config = self._config_obj.data['devscript']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devscript
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A utility for managing custom development scripts via JSON or TOML configuration
5
5
  Author-email: "Маг Ильяс DOMA (MagIlyasDOMA)" <magilyas.doma.09@list.ru>
6
6
  License: GPL-3.0-only
@@ -24,7 +24,268 @@ License-File: LICENSE
24
24
  Requires-Dist: pyyaml>=6.0.3
25
25
  Dynamic: license-file
26
26
 
27
+ <a id="doc_en"></a>
27
28
  # DevScript
29
+ #### [Документация на русском](#doc_ru)
30
+
31
+ DevScript is a simple utility for managing custom development scripts. It allows you to define commands in JSON or TOML files and execute them through a single interface. It is available in two implementations: **Python** and **TypeScript**.
32
+
33
+ ## Installation
34
+
35
+ ### Python version
36
+ ```shell
37
+ pip install devscript
38
+ ```
39
+
40
+ #### Or install from source:
41
+
42
+ ```shell
43
+ git clone https://github.com/MagIlyasDOMA/devscript.git
44
+ cd devscript
45
+ pip install -e .
46
+ ```
47
+
48
+ ### TypeScript version
49
+ ```shell
50
+ npm install -D @hren/devscript
51
+ # or
52
+ yarn add -D @hren/devscript
53
+ # or
54
+ pnpm add -D @hren/devscript
55
+ ```
56
+
57
+ #### Or install from source:
58
+
59
+ ```shell
60
+ git clone https://github.com/MagIlyasDOMA/devscript.git
61
+ cd devscript
62
+ npm install
63
+ npm run build
64
+ npm link
65
+ ```
66
+
67
+ ### Configuration formats
68
+ #### JSON (`devscript.json`)
69
+ ```json
70
+ {
71
+ "$schema": "https://raw.githubusercontent.com/MagIlyasDOMA/devscript/refs/heads/main/schema.json",
72
+ "build": "python -m build",
73
+ "test": "pytest tests/",
74
+ "lint": "flake8 src/",
75
+ "dev": "python -m app --debug"
76
+ }
77
+ ```
78
+
79
+ #### YAML (`devscript.yaml`)
80
+ ```yaml
81
+ build: "python -m build"
82
+ test: "pytest tests/"
83
+ lint: "flake8 src/"
84
+ dev: "python -m app --debug"
85
+ ```
86
+
87
+ #### TOML (`pyproject.toml`)
88
+ ```toml
89
+ [devscript]
90
+ build = "python -m build"
91
+ test = "pytest tests/"
92
+ lint = "flake8 src/"
93
+ dev = "python -m app --debug"
94
+ ```
95
+
96
+ #### `package.json`
97
+ ```json
98
+ {
99
+ "devscript": {
100
+ "build": "python -m build",
101
+ "test": "pytest tests/",
102
+ "lint": "flake8 src/",
103
+ "dev": "python -m app --debug"
104
+ }
105
+ }
106
+ ```
107
+
108
+ ### Running commands
109
+ #### The package provides four CLI commands:
110
+ - `devscript` — full name
111
+ - `devscr` — abbreviation
112
+ - `devs` — short
113
+ - `dvs` — shortest
114
+
115
+ #### All of them work the same:
116
+ ```shell
117
+ # Show the list of available commands
118
+ devscript --help
119
+
120
+ # Run a command
121
+ devscript build
122
+ devscr dev
123
+ devs test
124
+ dvs lint
125
+
126
+ # Pass arguments to a command
127
+ devscript dev --port 8000 --reload
128
+ ```
129
+ Here is the translation of the text into English, with the markdown formatting preserved:
130
+
131
+ ## Examples
132
+ ### Example 1: Basic usage
133
+ ```toml
134
+ # pyproject.toml
135
+ [devscript]
136
+ start = "uvicorn main:app --reload"
137
+ migrate = "alembic upgrade head"
138
+ shell = "ipython"
139
+ ```
140
+
141
+ ```shell
142
+ devs start # Starts the uvicorn server
143
+ devs migrate # Applies migrations
144
+ devs shell # Starts IPython
145
+ ```
146
+
147
+ ### Example 2: Passing arguments
148
+ ```json
149
+ {
150
+ "test": "pytest",
151
+ "cov": "pytest --cov=src"
152
+ }
153
+ ```
154
+
155
+ ```shell
156
+ devs test tests/test_api.py -v # pytest tests/test_api.py -v
157
+ devs cov --cov-report=html # pytest --cov=src --cov-report=html
158
+ ```
159
+
160
+ ## Development
161
+ ### Python version
162
+ ```shell
163
+ # Clone the repository
164
+ git clone https://github.com/MagIlyasDOMA/devscript.git
165
+ cd devscript
166
+
167
+ # Install in development mode
168
+ pip install -e .
169
+
170
+ # Run tests
171
+ devs test
172
+
173
+ # Run linter
174
+ devs lint
175
+ ```
176
+
177
+ ### TypeScript version
178
+ ```shell
179
+ # Clone the repository
180
+ git clone https://github.com/MagIlyasDOMA/devscript.git
181
+ cd devscript
182
+
183
+ # Install dependencies
184
+ npm install
185
+
186
+ # Build the project
187
+ npm run build
188
+
189
+ # Install in development mode
190
+ npm link
191
+
192
+ # Run tests
193
+ devs test
194
+
195
+ # Run linter
196
+ devs lint
197
+ ```
198
+
199
+ ## Project structure
200
+ ```text
201
+ devscript/
202
+ ├── python/ # Python implementation
203
+ │ ├── devscript/
204
+ │ │ ├── __init__.py
205
+ │ │ └── py.typed
206
+ │ ├── pyproject.toml
207
+ │ └── README.md
208
+ ├── typescript/ # TypeScript implementation
209
+ │ ├── devscript.ts
210
+ │ ├── package.json
211
+ │ ├── tsconfig.json
212
+ │ └── README.md
213
+ ├── schema.json # JSON Schema for autocompletion
214
+ └── LICENSE
215
+ ```
216
+
217
+ ## JSON Schema
218
+ For autocompletion and validation in code editors, use the schema:
219
+ ```json
220
+ {
221
+ "$schema": "https://raw.githubusercontent.com/MagIlyasDOMA/devscript/refs/heads/main/schema.json"
222
+ }
223
+ ```
224
+
225
+ ## API
226
+ ### Using in code
227
+ #### Python
228
+ ```python
229
+ from devscript import DevScriptCore
230
+
231
+ core = DevScriptCore()
232
+ print("Available commands:", core.commands_list())
233
+ core.run("build", ["--verbose"])
234
+ ```
235
+
236
+ #### Typescript
237
+ ```typescript
238
+ import { DevScriptCore } from 'devscript';
239
+ ```
240
+ ```javascript
241
+ const core = new DevScriptCore();
242
+ console.log("Available commands:", core.commands_list());
243
+ core.run("build", ["--verbose"]);
244
+ ```
245
+
246
+ ## Requirements
247
+ ### Python version
248
+ - Python 3.8 or higher
249
+ - No external dependencies (uses the standard library)
250
+
251
+ ### TypeScript version
252
+ - Node.js 14 or higher
253
+ - Dependencies: argparse, smol-toml
254
+
255
+ ## License
256
+ GPL-3.0-only
257
+
258
+ ## Author
259
+ #### Mag Ilyas DOMA (MagIlyasDOMA)
260
+ - GitHub: [@MagIlyasDOMA](https://github.com/MagIlyasDOMA)
261
+ - Project: [devscript](https://github.com/MagIlyasDOMA/devscript)
262
+
263
+ ## Contribution
264
+ 1. Fork the repository
265
+ 2. Create a branch for the feature (`git checkout -b feature/amazing-feature`)
266
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
267
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
268
+ 5. Open a Pull Request
269
+
270
+ ## Frequently Asked Questions
271
+ ##### Q: Can I use both versions at the same time?
272
+ A: Yes, they do not conflict as they use different commands for installation (pip vs npm).
273
+
274
+ ##### Q: Are other configuration formats supported?
275
+ A: Currently, JSON, YAML, pyproject.toml, and package.json are supported.
276
+
277
+ ##### Q: How do I add a new command?
278
+ A: Just add a new entry in the configuration file with the command name and the corresponding shell command.
279
+
280
+ ##### Q: Does it work on Windows?
281
+ A: Yes, both versions have been tested on Windows.
282
+
283
+
284
+ ---
285
+
286
+ <a id="doc_ru"></a>
287
+ # DevScript
288
+ #### [Documentation in English](#doc_en)
28
289
 
29
290
  DevScript — это простая утилита для управления пользовательскими скриптами разработки. Она позволяет определять команды в JSON или TOML файлах и запускать их через единый интерфейс. Доступна в двух реализациях: **Python** и **TypeScript**.
30
291
 
@@ -45,11 +306,11 @@ pip install -e .
45
306
 
46
307
  ### TypeScript версия
47
308
  ```shell
48
- npm install -D devscript
309
+ npm install -D @hren/devscript
49
310
  # или
50
- yarn add -D devscript
311
+ yarn add -D @hren/devscript
51
312
  # или
52
- pnpm add -D devscript
313
+ pnpm add -D @hren/devscript
53
314
  ```
54
315
 
55
316
  #### Или установка из исходного кода:
@@ -0,0 +1,7 @@
1
+ devscript/__init__.py,sha256=owXQwALyWL1NRth9EG-g1TniyXGg9WZYD6zCH3pIfq8,2722
2
+ devscript-0.1.2.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
3
+ devscript-0.1.2.dist-info/METADATA,sha256=meXo3hgCGiuDwMf4j8QQTtWjQIA3kOUPln1f3Uuy__0,14005
4
+ devscript-0.1.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
5
+ devscript-0.1.2.dist-info/entry_points.txt,sha256=npG9JMkfk8V9pQZwLKU1mb5L7P5nceGF7gB4VuSEM1c,112
6
+ devscript-0.1.2.dist-info/top_level.txt,sha256=Tk3VhyXXyXV8jxju8RTKMKYivzFb_496RWF5YfocI5g,10
7
+ devscript-0.1.2.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- devscript/__init__.py,sha256=TdCIcN4tQLTCQXxZH-Vb6nKg1Z9b38VV9NQDHWnUH7c,2672
2
- devscript-0.1.0.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
3
- devscript-0.1.0.dist-info/METADATA,sha256=-nmUEPP9jtdk-JUs6qWaJISUZwkPjBEeNrFC64GBx8Q,8200
4
- devscript-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
5
- devscript-0.1.0.dist-info/entry_points.txt,sha256=npG9JMkfk8V9pQZwLKU1mb5L7P5nceGF7gB4VuSEM1c,112
6
- devscript-0.1.0.dist-info/top_level.txt,sha256=Tk3VhyXXyXV8jxju8RTKMKYivzFb_496RWF5YfocI5g,10
7
- devscript-0.1.0.dist-info/RECORD,,