Skip to content

Commit

Permalink
Merge pull request #148 from bradmwilliams/packaging-modernization-v1
Browse files Browse the repository at this point in the history
[v1] Converting to modern python packaging
  • Loading branch information
openshift-merge-bot[bot] authored Feb 5, 2024
2 parents f523fd8 + 4cb3eba commit 8c40409
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 95 deletions.
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
test:
./run_unittests.sh
.PHONY: test

clean:
rm -rf dist packages/openshift_client.egg-info packages/openshift_client/__pycache__ build
.PHONY: clean

release: clean
python -m build
.PHONY: release

publish-testpypi:
twine upload --repository testpypi dist/*
.PHONY: publish-testpypi

publish-pypi:
twine upload --repository pypi dist/*
.PHONY: publish-pypi
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ the CLI documentation to find the pass-through arguments a given interaction req

#### For development
1. Git clone https://github.com/openshift/openshift-client-python.git (or your fork).
2. Append ./packages to your PYTHONPATH environment variable (e.g. export PYTHONPATH=$(pwd)/packages:$PYTHONPATH).
3. Write and run your python script!
2. Add required libraries
```bash
sudo pip install -r requirements.txt
```
3. Append ./packages to your PYTHONPATH environment variable (e.g. export PYTHONPATH=$(pwd)/packages:$PYTHONPATH).
4. Write and run your python script!

## Usage

Expand Down
30 changes: 13 additions & 17 deletions docs/PACKAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,14 @@ username = __token__
password = pypi-<API TOKEN>
```

### setup.cfg
The openshift-client module has been tested to support both python2 and python3. Therefore, elect to build a `univeral` wheel instead of platform specific wheels. To do so, we have added the necessary flags to our `setup.cfg` file:
```text
[bdist_wheel]
universal = 1
[metadata]
license_file = LICENSE
```

The alternative is to add the necessary flag to the commandline when building your packages:

```bash
python setup.py build bdist_wheel --universal
```

## Building
For openshift-client, build both a source distribution and a universal wheel:
```bash
python setup.py build sdist bdist_wheel
python -m build
```
or:
```bash
make release
```

## Publishing
Expand All @@ -82,11 +70,19 @@ Publishing to either package index is accomplished by using [Twine](https://pypi
```bash
twine upload --repository testpypi dist/*
```
or
```bash
make publish-testpypi
```

### PyPI
```bash
twine upload --repository pypi dist/*
```
or
```bash
make publish-pypi:
```

## Installation

Expand Down
50 changes: 50 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["packages"]

[tool.setuptools.dynamic]
version = {attr = "openshift.__VERSION__"}

[project]
name = "openshift-client"
description = "OpenShift python client"
keywords = ["OpenShift"]
readme = "README.md"
license = {file = "LICENSE"}
authors = [
{name = "Justin Pierce", email = "[email protected]"},
]
maintainers = [
{name = "Brad Williams", email = "[email protected]"},
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Topic :: Utilities",
]
requires-python = ">= 2.7"
dependencies = [
"pyyaml",
"six",
]
dynamic = [
"version",
]

[project.optional-dependencies]
ssh = ["paramiko"]

[project.urls]
Homepage = "https://github.com/openshift/openshift-client-python"
Issues = "https://github.com/openshift/openshift-client-python/issues"
8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#
# This file can be used to install dependencies for local library development
#
build
six
pyyaml

# paramiko is only required if ssh connections are required (e.g. use of client_host context)
paramiko
paramiko
5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.

68 changes: 0 additions & 68 deletions setup.py

This file was deleted.

0 comments on commit 8c40409

Please sign in to comment.