pkg-deploy 1.0.12__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.
@@ -0,0 +1,382 @@
1
+ Metadata-Version: 2.4
2
+ Name: pkg-deploy
3
+ Version: 1.0.12
4
+ Summary: Modern Python Package Deployment Tool
5
+ Author-email: cw <cw.devworks@gmail.com>
6
+ License: Apache-2.0
7
+ Classifier: License :: OSI Approved :: Apache Software License
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Classifier: Topic :: System :: Software Distribution
19
+ Classifier: Operating System :: OS Independent
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: toml
23
+ Requires-Dist: tomlkit
24
+ Requires-Dist: build
25
+ Requires-Dist: twine
26
+ Requires-Dist: Cython
27
+ Requires-Dist: setuptools>=70
28
+ Requires-Dist: cibuildwheel
29
+
30
+ # pkg-deploy
31
+
32
+ Modern Python Package Deployment Tool
33
+
34
+ ## What is it
35
+
36
+ `pkg-deploy` is a comprehensive Python package deployment tool that streamlines the process of building, versioning, and publishing Python packages to PyPI and private repositories. It supports both standard and Cython builds, automatic version management, and seamless Git integration.
37
+
38
+ ## Features
39
+
40
+ - **Automatic Version Management**: Support for semantic versioning with patch, minor, major, alpha, beta, and release candidate bumps
41
+ - **Flexible Build System**: Standard Python builds and optimized Cython compilation
42
+ - **Multiple Repository Support**: Deploy to PyPI, private Nexus repositories, and custom package indexes
43
+ - **Git Integration**: Automatic tagging and commit management
44
+ - **Environment Detection**: Native support for both pip and uv virtual environments
45
+ - **Dry Run Mode**: Test deployments without making actual changes
46
+ - **Interactive Authentication**: Secure credential input with API token support
47
+ - **Automatic Cleanup**: Clean removal of build artifacts after deployment
48
+
49
+ ## Installation
50
+
51
+ ### From PyPI
52
+
53
+ ```bash
54
+ pip install pkg-deploy
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ ### Basic Usage
60
+
61
+ After installing pkg-deploy , navigate to your project directory (the folder containing your pyproject.toml ) and use the pkg-deploy command directly.
62
+ Example project structure:
63
+
64
+ ```text
65
+ my-package/
66
+ ├── src/
67
+ │ └── my_package/
68
+ │ ├── __init__.py
69
+ │ └── main.py
70
+ ├── pyproject.toml
71
+ └── README.md
72
+ ```
73
+
74
+ #### Running the Deployment
75
+
76
+ Use the `pkg-deploy` command with your desired arguments:
77
+
78
+ ```bash
79
+ # Deploy with patch version bump to PyPI
80
+ pkg-deploy --repository-name pypi --version-type patch
81
+
82
+ # Deploy to private repository with minor version bump
83
+ pkg-deploy --repository-url https://nexus.example.com/repository/pypi-internal/ \
84
+ --username admin --password secret --version-type minor
85
+
86
+ # Dry run to test configuration
87
+ pkg-deploy --repository-name pypi --version-type patch --dry-run
88
+ ```
89
+ ## Configuration
90
+
91
+ ### pyproject.toml
92
+
93
+ Ensure your `pyproject.toml` includes the required project metadata:
94
+
95
+ ```toml
96
+ [build-system]
97
+ requires = ["setuptools>=70"]
98
+ build-backend = "setuptools.build_meta"
99
+
100
+ [project]
101
+ name = "your-package-name"
102
+ version = "1.0.0"
103
+ description = "Your package description"
104
+ requires-python = ">=3.10"
105
+ authors = [
106
+ { name = "Your Name", email = "your.email@example.com" },
107
+ ]
108
+ readme = "README.md"
109
+ dependencies = [
110
+ "dependency1",
111
+ "dependency2",
112
+ ]
113
+
114
+ [tool.setuptools]
115
+ package-dir = {"" = "src"}
116
+ zip-safe = false
117
+
118
+ [tool.setuptools.packages.find]
119
+ where = ["src"]
120
+
121
+ # Optional: Version bump configuration, other wise will only bump version in pyproject.toml
122
+ [[tool.bumpversion.file]]
123
+ filename = "src/your_package/__init__.py"
124
+ search = '__version__ = "{current_version}"'
125
+ replace = '__version__ = "{new_version}"'
126
+ ```
127
+
128
+ ### Package Directory Resolution
129
+
130
+ `pkg-deploy` automatically resolves the package directory using the following priority:
131
+
132
+ 1. **Explicit --package-dir**: If specified via command line, this path is used directly
133
+ 2. **pyproject.toml Configuration**: Automatically parsed from setuptools configuration:
134
+ - `tool.setuptools.packages.find.where` - source directory location
135
+ - `tool.setuptools.package-dir` - package directory mapping
136
+ 3. **Default Fallback**: Uses `project_dir/package_name` based on the project name
137
+
138
+ Example configurations in `pyproject.toml`:
139
+
140
+ ```toml
141
+ # Standard src layout
142
+ [tool.setuptools]
143
+ package-dir = {"" = "src"}
144
+
145
+ [tool.setuptools.packages.find]
146
+ where = ["src"]
147
+
148
+ # Custom package location
149
+ [tool.setuptools]
150
+ package-dir = {"my_package" = "custom/path"}
151
+ ```
152
+
153
+ > **⚠️ Important**: When package directory is configured in multiple places within `pyproject.toml` (such as both `tool.setuptools.packages.find.where` and `tool.setuptools.package-dir`), all configurations must point to the same directory. If they differ, `pkg-deploy` will raise a `ValueError` with the message "Package directory from toml are not the same".
154
+
155
+ ### .pypirc Configuration
156
+
157
+ For repository authentication, create a `.pypirc` file in your user home directory:
158
+ - Unix/macOS: `~/.pypirc`
159
+ - Windows: `C:\Users\username\.pypirc`
160
+
161
+ ```ini
162
+ [distutils]
163
+ index-servers =
164
+ pypi
165
+ private-repo
166
+
167
+ [pypi]
168
+ repository = https://upload.pypi.org/legacy/
169
+ username = __token__
170
+ password = pypi-your-api-token-here
171
+
172
+ [private-repo]
173
+ repository = https://nexus.example.com/repository/pypi-internal/
174
+ username = your-username
175
+ password = your-password
176
+ ```
177
+
178
+ ## Usage Examples
179
+
180
+ ### Version Management
181
+
182
+ ```bash
183
+ # Patch version bump (1.0.0 -> 1.0.1)
184
+ pkg-deploy --repository-name pypi --version-type patch
185
+
186
+ # Minor version bump (1.0.1 -> 1.1.0)
187
+ pkg-deploy --repository-name pypi --version-type minor
188
+
189
+ # Major version bump (1.1.0 -> 2.0.0)
190
+ pkg-deploy --repository-name pypi --version-type major
191
+
192
+ # Use specific version
193
+ pkg-deploy --repository-name pypi --new-version 2.1.0
194
+
195
+ # Pre-release versions
196
+ pkg-deploy --repository-name pypi --version-type alpha # 1.0.0a1
197
+ pkg-deploy --repository-name pypi --version-type beta # 1.0.0b1
198
+ pkg-deploy --repository-name pypi --version-type rc # 1.0.0rc1
199
+ ```
200
+
201
+ ### Cython Builds
202
+
203
+ ```bash
204
+ # Build with Cython optimization
205
+ pkg-deploy --repository-name pypi --version-type patch --cython
206
+
207
+ # Cython build for private repository
208
+ pkg-deploy --repository-url https://nexus.example.com/repository/pypi-internal/ \
209
+ --username user_name --password secret --cython
210
+ ```
211
+
212
+ ### Cross-Platform Multiple Version Builds with cibuildwheel
213
+
214
+ `pkg-deploy` supports `cibuildwheel` for building wheels across multiple Python versions and platforms as specified in your `pyproject.toml` configuration.
215
+
216
+ #### Benefits
217
+ - **Cython Integration**: Build wheels for all specified versions in one run
218
+ - **Multi-Platform Support**: Automatically builds wheels for Linux, macOS, and Windows
219
+ - **Multiple Python Versions**: Builds for all Python versions specified in configuration
220
+ - **Binary Compatibility**: Creates optimized binary wheels with proper platform tags
221
+
222
+ #### Requirements
223
+ - **Docker (Linux only)**: Docker must be installed and running when building on Linux systems
224
+ - **cibuildwheel**: Automatically installed as a build dependency
225
+ - **Sufficient disk space**: Cross-platform builds require more storage
226
+
227
+ #### Configuration
228
+
229
+ Add cibuildwheel configuration to your `pyproject.toml` (Optional):
230
+
231
+ ```toml
232
+ [tool.cibuildwheel]
233
+ # Specify which Python versions to build for
234
+ build = "cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*"
235
+ before-build = "pip install Cython"
236
+
237
+ [tool.cibuildwheel.linux]
238
+ # Use manylinux images for better compatibility
239
+ before-all = "yum install -y gcc || apt-get update && apt-get install -y gcc"
240
+
241
+ [tool.cibuildwheel.macos]
242
+ # Ensure Cython is available for macOS builds
243
+ before-build = "pip install Cython"
244
+
245
+ [tool.cibuildwheel.windows]
246
+ # Ensure Cython is available for Windows builds
247
+ before-build = "pip install Cython"
248
+ ```
249
+
250
+ #### Usage Examples
251
+
252
+ ```bash
253
+ # Cross-platform Cython build with cibuildwheel
254
+ pkg-deploy --repository-name pypi --version-type patch --cython --cibuildwheel
255
+
256
+ # Deploy to private repository with cross-platform builds
257
+ pkg-deploy --repository-url https://nexus.example.com/repository/pypi-internal/ \
258
+ --username admin --password secret --cython --cibuildwheel
259
+
260
+ # Dry run to test cross-platform build configuration
261
+ pkg-deploy --repository-name pypi --cython --cibuildwheel --dry-run
262
+ ```
263
+
264
+ #### Limitations
265
+ - **Build Time**: Cross-platform builds take significantly longer than single-platform builds
266
+ - **Docker Dependency**: Linux builds require Docker to be installed and running
267
+ - **Resource Usage**: Requires more CPU, memory, and disk space during build process
268
+ - **Platform Restrictions**: Some platform-specific dependencies may not be available across all targets
269
+
270
+ ### Advanced Options
271
+
272
+ ```bash
273
+ # Custom project directory
274
+ pkg-deploy --project-dir /path/to/project --repository-name pypi
275
+
276
+ # Custom package directory
277
+ pkg-deploy --package-dir /path/to/package --repository-name pypi
278
+
279
+ # Skip Git operations
280
+ pkg-deploy --repository-name pypi --skip-git-push
281
+
282
+ # Verbose logging
283
+ pkg-deploy --repository-name pypi --verbose
284
+
285
+ # Dry run with verbose output
286
+ pkg-deploy --repository-name pypi --dry-run --verbose
287
+ ```
288
+
289
+ ## Command Line Interface
290
+
291
+ ### Arguments
292
+
293
+ - `--project-dir`: Project directory (default: current directory)
294
+ - `--package-dir`: Package directory path (default: auto-resolved from pyproject.toml or project name)
295
+ - `--version-type, -vt`: Version bump type: patch, minor, major, alpha, beta, or rc
296
+ - `--new-version, -v`: Specify exact version number (overrides version-type)
297
+ - `--cython, -c`: Enable Cython compilation for performance
298
+ - `--cibuildwheel`: Use cibuildwheel for cross-platform wheel building (requires Docker on Linux)
299
+ - `--repository-name, -rn`: Repository name from .pypirc configuration (e.g., 'pypi', 'testpypi')
300
+ - `--repository-url, -rl`: Repository upload URL (prompts for username/password if not in .pypirc)
301
+ - `--username, -u`: Authentication username (optional if configured in .pypirc)
302
+ - `--password, -p`: Authentication password/token (optional if configured in .pypirc)
303
+ - `--skip-git-push`: Skip pushing version changes and tags to Git repository
304
+ - `--skip-git-status-check`: Skip Git status validation before deployment
305
+ - `--dry-run`: Simulate deployment without making actual changes
306
+ - `--verbose, -V`: Enable detailed logging output
307
+
308
+ ## Environment Support
309
+
310
+ ### UV Virtual Environments
311
+
312
+ `pkg-deploy` automatically detects and supports UV-managed virtual environments:
313
+
314
+
315
+ ## Security Considerations
316
+
317
+ ### API Tokens (Recommended)
318
+
319
+ For PyPI, use API tokens instead of passwords:
320
+
321
+ 1. Generate token at https://pypi.org/manage/account/token/
322
+ 2. Use `__token__` as username
323
+ 3. Use the generated token as password
324
+
325
+ ### Credential Storage
326
+
327
+ - Store credentials in `.pypirc` for reusability
328
+ - Enable interactive mode for secure input
329
+
330
+ ## Troubleshooting
331
+
332
+ ### Common Issues
333
+
334
+ **Git Repository Not Clean**
335
+ ```
336
+ Error: Git repo is NOT clean
337
+ ```
338
+ Solution: Commit or stash your changes before deployment or use `--skip-git-push`.
339
+
340
+ **Missing Dependencies**
341
+ ```
342
+ Error: Missing required packages: build, twine
343
+ ```
344
+ Solution: Install missing packages with `pip install build twine`.
345
+
346
+ **Cython Build Conflicts**
347
+ ```
348
+ Error: Cannot build Cython code: setup.py already exists
349
+ ```
350
+ Solution: Backup existing `setup.py` or migrate configuration to `pyproject.toml`.
351
+
352
+ **Docker Not Available (Linux)**
353
+ ```
354
+ Error: Docker is required for cibuildwheel on Linux
355
+ ```
356
+ Solution: Install and start Docker service, or use `--cython` without `--cibuildwheel` for local builds only.
357
+
358
+ **cibuildwheel Build Failures**
359
+ ```
360
+ Error: cibuildwheel build failed
361
+ ```
362
+ Solution: Check Docker is running (Linux), verify `pyproject.toml` cibuildwheel configuration, and ensure sufficient disk space.
363
+
364
+ **Authentication Failures**
365
+ ```
366
+ Error: 403 Forbidden
367
+ ```
368
+ Solution: Verify credentials, use API tokens for PyPI, or enable interactive mode.
369
+
370
+ ### Debug Mode
371
+
372
+ Enable verbose logging for detailed troubleshooting:
373
+
374
+ ```bash
375
+ pkg-deploy --repository-name pypi --verbose --dry-run
376
+ ```
377
+
378
+ ---
379
+
380
+ Noticed that the `clibuildwheel` needs docker service in Linux to build different version
381
+
382
+ **pkg-deploy** - Streamlining Python package deployment since 2025.
@@ -0,0 +1,11 @@
1
+ pkg_deploy/__init__.py,sha256=mlcig4MZcuufPo6SvYuLN8MbhgvBMg3HPmyaAgRUADU,59
2
+ pkg_deploy/build.py,sha256=t0SpJax-FYnUsxWplIGnv3lKzqcvh2D2CM8a6YDXjO0,10286
3
+ pkg_deploy/deploy.py,sha256=LXwZmIlLEQtTMNoCengm8fI2PWgerV3eBLoL2c4Se-o,16234
4
+ pkg_deploy/upload.py,sha256=eCdAf56sOZauk8RvXGLjoTCfTfnOiblbbpM2DqjkfpQ,2946
5
+ pkg_deploy/utils.py,sha256=jpcAYM3AE629Ib2d6dLQk3sShhz-XGW0DHGBD9n10J8,7505
6
+ pkg_deploy/version_managment.py,sha256=ZmsY-MDnseZZ7HbedMIdIsY49eMI9y3MkzeYv0YW5EI,5624
7
+ pkg_deploy-1.0.12.dist-info/METADATA,sha256=9EDrxUo3tRfFgobAH-i2tPwFEK8yfnuOtEFki-k-RmA,12668
8
+ pkg_deploy-1.0.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ pkg_deploy-1.0.12.dist-info/entry_points.txt,sha256=U59a1k7lX6t2xgj6DehoqwdAEdiufp9Xb7iphH0Ike0,54
10
+ pkg_deploy-1.0.12.dist-info/top_level.txt,sha256=-yi8c2TJ5e9J3QATUf7_dRfmJp2gzHR_VvnEc7QgFM0,11
11
+ pkg_deploy-1.0.12.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pkg-deploy = pkg_deploy.deploy:main
@@ -0,0 +1 @@
1
+ pkg_deploy