|
| 1 | +# Pipenv Example |
| 2 | + |
| 3 | +## Overview |
| 4 | +This example demonstrates how to build a Python Pipenv project with Artifactory, while collecting build-info. |
| 5 | + |
| 6 | +## Before Running the Example |
| 7 | +### Set Up the Environment |
| 8 | +1. Make sure **Python** is installed and the **python** command is in your PATH. |
| 9 | +2. Install **pipenv**. You can use the [Pip Documentation](https://pipenv.pypa.io/en/latest/) and also [Installing packages using pip and virtual environments](https://realpython.com/pipenv-guide/) |
| 10 | +3. Create three Pypi repositories in Artifactory - a local, remote and a virtual repository. You can use the [PyPi Repositories Documentation](https://www.jfrog.com/confluence/display/RTF/PyPI+Repositories). |
| 11 | +* The remote repository should proxy *https://files.pythonhosted.org* (the default when creating a Pypi remote repository). |
| 12 | +* Name the virtual repository *pipy*. |
| 13 | +* The virtual repository should include the remote repository. |
| 14 | +* The virtual repository should have the local repository set as the *Default Deployment Repository*. |
| 15 | +4. Make sure **wheel** and **setuptools** are installed. You can use the [Installing Packages Documentation](https://packaging.python.org/tutorials/installing-packages/). |
| 16 | +5. Make sure version 1.28.0 or above of [JFrog CLI](https://jfrog.com/getcli/) is installed. |
| 17 | + |
| 18 | +### Validate the Setup |
| 19 | +In your terminal, validate that the following commands work. |
| 20 | +```console |
| 21 | +Output Python version: |
| 22 | +> python --version |
| 23 | + |
| 24 | +Output pipenv version: |
| 25 | +> pipenv --version |
| 26 | + |
| 27 | +Output JFrog CLI version: |
| 28 | +> jfrog --version |
| 29 | +``` |
| 30 | + |
| 31 | +## Running the Example |
| 32 | +CD to the root project directory |
| 33 | + |
| 34 | +```console |
| 35 | +Configure Artifactory: |
| 36 | +> jfrog c add |
| 37 | + |
| 38 | +Configure the project's resolution repository. You shoud set the virtual repository you created. |
| 39 | +> jfrog pipec |
| 40 | + |
| 41 | +Install project dependencies with pip from Artifactory: |
| 42 | +> jfrog pipenv install --build-name=my-pipenv-build --build-number=1 --module=jfrog-pipenv-example |
| 43 | + |
| 44 | +Package the project, create distribution archives (tar.gz and whl): |
| 45 | +> python setup.py sdist bdist_wheel |
| 46 | + |
| 47 | +Upload the packages to the pypi repository in Artifactory: |
| 48 | +> jfrog rt u dist/ pypi/ --build-name=my-pipenv-build --build-number=1 --module=jfrog-pipenv-example |
| 49 | + |
| 50 | +Collect environment variables and add them to the build info: |
| 51 | +> jfrog rt bce my-pipenv-build 1 |
| 52 | + |
| 53 | +Publish the build info to Artifactory: |
| 54 | +> jfrog rt bp my-pipenv-build 1 |
| 55 | + |
| 56 | +Install published package by installing it from Artifactory using pip: |
| 57 | +> jfrog pipenv-install jfrog-pipenv-example |
| 58 | + |
| 59 | +Learn about [Building Python Packages with JFrog CLI](https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-BuildingPythonPackages). |
0 commit comments