Example of how to use Habushu to publish to a development repository
Project description
[Return to Examples Documentation]
Publish Package to Development Repository
Overview
This example demonstrates how to use Habushu to publish a package to a development repository, streamlining the deployment process for development and testing purposes. With Habushu, you can configure a package's build settings to automatically push to a private development repository, ensuring a smooth workflow for private deployments and iterative testing before release.
Key Features
- Development Repository Configuration: Easily configure your
pom.xmlto publish directly to a private development repository. - Secure Credentials: Leverages Maven's secure password encryption to safely store repository credentials.
- Private Repository Usage: Guides on setting up a private PyPI server to act as a development repository.
- Flexible Configuration: Includes options for enabling or disabling URL suffix additions for custom repositories.
How It Works
The example involves configuring pom.xml and Maven settings to enable the publishing of packages to a private repository during development. The configuration includes:
- Activate development repository publishing by setting the following parameters in the
pom.xml:
<configuration>
<useDevRepository>true</useDevRepository>
<devRepositoryId>YOUR-REPO-NAME</devRepositoryId>
<devRepositoryUrl>http://YOUR-URL-ADDERSS/</devRepositoryUrl>
<!-- Set enableDevRepositoryUrlUploadSuffix to false if your devRepositoryUrl
does not have an upload suffix -->
<enableDevRepositoryUrlUploadSuffix>false</enableDevRepositoryUrlUploadSuffix>
</configuration>
- Store credentials securely in Maven settings using an encrypted password:
<server>
<id>YOUR-REPO-NAME</id>
<username>YOUR-USERNAME</username>
<password>{ENCRYPTED-PASSWORD}</password>
</server>
- Build and deploy the package with the command:
mvn clean deploy
When the project is built, Habushu will push the packaged module to the configured development repository.
Benefits
- Simplified Development: Quickly deploy packages to a development repository for private testing.
- Secure Integration: Ensures development repository credentials are securely managed.
- Customizable Repository Settings: Flexible settings allow easy integration with a variety of private repository setups.
- Streamlined Workflow: Enables rapid iteration during development by decoupling testing deployments from production releases.
Example Setup
This section is required purely to execute this example. If you already have a private repository, you can skip this section.
Install Required Packages
The pypiserver and passlib packages are required to execute this example.
pip install pypiserver passlib
Make the Private PyPi Directory
mkdir ~/private-pypi
Create the Username and Password File for pypiserver
htpasswd -c ~/.htpasswd myuser
# Set the password to whatever you want. e.g., `password`
Start the Private Server
In a separate terminal, start the private server and keep it running until you are completed with this example.
pypi-server run -p 8080 -a update,download,list --passwords ~/.htpasswd ~/private-pypi
Save your Development Repository Credentials in Maven
Encrypt the password you chose by running mvn --encrypt-password <your-password>. For example,
% mvn --encrypt-password password
{j5M3wbZdMlYHNEgrFNEPuDMN20jlMOkryKoKSjNzyc8=}
Then update your ~/.m2/settings.xml.
<!-- ~/.m2/settings.xml -->
<server>
<id>private-repo</id>
<username>myuser</username>
<password>{j5M3wbZdMlYHNEgrFNEPuDMN20jlMOkryKoKSjNzyc8=}</password>
</server>
Update your pom.xml
In this example, the following configuration is located in the deploy-example profile. Outside the habushu repository, you can save this configuration in the build section of your project/module's pom.xml file.
<configuration>
<useDevRepository>true</useDevRepository>
<devRepositoryId>private-repo</devRepositoryId>
<!-- Leave off simple/ suffix to enable seamless upload and download capabilities -->
<devRepositoryUrl>http://127.0.0.1:8080/</devRepositoryUrl>
<enableDevRepositoryUrlUploadSuffix>false</enableDevRepositoryUrlUploadSuffix>
</configuration>
Build the project
To publish this package/module to the development repository, run mvn clean deploy -pl :habushu-uv-publish-to-dev-repo -Pdeploy-example from the root directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file habushu_uv_publish_to_dev_repo-3.1.0.dev1750247662.tar.gz.
File metadata
- Download URL: habushu_uv_publish_to_dev_repo-3.1.0.dev1750247662.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c203c18f21afd7915fc8a46fe4cb49f389feb9580f950faabfeb8b0e24a7acf4
|
|
| MD5 |
be4678a6219a75a5099652954574b72e
|
|
| BLAKE2b-256 |
7b462ababaf82da171764a7dd93cf3e81543e0f7e670850e2101fa7f5b1469ac
|
File details
Details for the file habushu_uv_publish_to_dev_repo-3.1.0.dev1750247662-py3-none-any.whl.
File metadata
- Download URL: habushu_uv_publish_to_dev_repo-3.1.0.dev1750247662-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
731715e9044a6600cbc4fa8a2bb9dafefca0560e1ac5fbf19ac8792d003d312e
|
|
| MD5 |
cb28cc156e03c3ea75d7074d7cbe21dd
|
|
| BLAKE2b-256 |
53ca8113fe24a68ec310cc56f365cd9ae4d6e42c4773e8c82c47a0afae8e1d26
|