Skip to content

Commit 92f627d

Browse files
authored
Add pipenv project example (jfrog#298)
* add pipenv project example * place pipenv inside python dir * pipenv example
1 parent 474b879 commit 92f627d

File tree

8 files changed

+84
-2
lines changed

8 files changed

+84
-2
lines changed

Diff for: python-example/README.md renamed to python-example/pip-example/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Python Example
1+
# Pip Example
22

33
## Overview
4-
This example demonstrates how to build a Python project with Artifactory, while collecting build-info.
4+
This example demonstrates how to build a Python Pip project with Artifactory, while collecting build-info.
55

66
## Before Running the Example
77
### Set Up the Environment
File renamed without changes.
File renamed without changes.

Diff for: python-example/pipenv-example/Pipfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[[source]]
2+
url = "https://pypi.python.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
toml = "*"
8+
pexpect = "4.8.0"
9+
10+
[dev-packages]
11+
12+
[requires]
13+
python_version = "*"

Diff for: python-example/pipenv-example/README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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).

Diff for: python-example/pipenv-example/pipenvProj.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/python
2+
3+
# Function definition is here
4+
def printme( str ):
5+
# This prints a passed string into this function
6+
print (str)
7+
return;
8+
9+
# Now you can call printme function
10+
printme("Hello from JFROG");

0 commit comments

Comments
 (0)