Skip to content

Commit b3362aa

Browse files
Merge pull request #147 from bradmwilliams/packaging-modernization
Converting to modern python packaging
2 parents f57420f + f50188f commit b3362aa

File tree

7 files changed

+93
-95
lines changed

7 files changed

+93
-95
lines changed

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
test:
2+
./run_unittests.sh
3+
.PHONY: test
4+
5+
clean:
6+
rm -rf dist packages/openshift_client.egg-info packages/openshift_client/__pycache__ build
7+
.PHONY: clean
8+
9+
release: clean
10+
python -m build
11+
.PHONY: release
12+
13+
publish-testpypi:
14+
twine upload --repository testpypi dist/*
15+
.PHONY: publish-testpypi
16+
17+
publish-pypi:
18+
twine upload --repository pypi dist/*
19+
.PHONY: publish-pypi

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ the CLI documentation to find the pass-through arguments a given interaction req
7676

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

8286
## Usage
8387

docs/PACKAGING.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,14 @@ username = __token__
5353
password = pypi-<API TOKEN>
5454
```
5555

56-
### setup.cfg
57-
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:
58-
```text
59-
[bdist_wheel]
60-
universal = 1
61-
62-
[metadata]
63-
license_file = LICENSE
64-
```
65-
66-
The alternative is to add the necessary flag to the commandline when building your packages:
67-
68-
```bash
69-
python setup.py build bdist_wheel --universal
70-
```
71-
7256
## Building
7357
For openshift-client, build both a source distribution and a universal wheel:
7458
```bash
75-
python setup.py build sdist bdist_wheel
59+
python -m build
60+
```
61+
or:
62+
```bash
63+
make release
7664
```
7765

7866
## Publishing
@@ -82,11 +70,19 @@ Publishing to either package index is accomplished by using [Twine](https://pypi
8270
```bash
8371
twine upload --repository testpypi dist/*
8472
```
73+
or
74+
```bash
75+
make publish-testpypi
76+
```
8577

8678
### PyPI
8779
```bash
8880
twine upload --repository pypi dist/*
8981
```
82+
or
83+
```bash
84+
make publish-pypi:
85+
```
9086

9187
## Installation
9288

pyproject.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools.packages.find]
6+
where = ["packages"]
7+
8+
[tool.setuptools.dynamic]
9+
version = {attr = "openshift_client.__VERSION__"}
10+
11+
[project]
12+
name = "openshift-client"
13+
description = "OpenShift python client"
14+
keywords = ["OpenShift"]
15+
readme = "README.md"
16+
license = {file = "LICENSE"}
17+
authors = [
18+
{name = "Justin Pierce", email = "[email protected]"},
19+
]
20+
maintainers = [
21+
{name = "Brad Williams", email = "[email protected]"},
22+
]
23+
classifiers = [
24+
"Development Status :: 4 - Beta",
25+
"Intended Audience :: Developers",
26+
"Intended Audience :: Information Technology",
27+
"License :: OSI Approved :: Apache Software License",
28+
"Operating System :: OS Independent",
29+
"Programming Language :: Python",
30+
"Programming Language :: Python :: 2",
31+
"Programming Language :: Python :: 2.7",
32+
"Programming Language :: Python :: 3",
33+
"Programming Language :: Python :: 3.12",
34+
"Topic :: Utilities",
35+
]
36+
requires-python = ">= 2.7"
37+
dependencies = [
38+
"pyyaml",
39+
"six",
40+
]
41+
dynamic = [
42+
"version",
43+
]
44+
45+
[project.optional-dependencies]
46+
ssh = ["paramiko"]
47+
48+
[project.urls]
49+
Homepage = "https://github.com/openshift/openshift-client-python"
50+
Issues = "https://github.com/openshift/openshift-client-python/issues"

requirements.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#
2+
# This file can be used to install dependencies for local library development
3+
#
4+
build
15
six
26
pyyaml
3-
4-
# paramiko is only required if ssh connections are required (e.g. use of client_host context)
5-
paramiko
7+
paramiko

setup.cfg

Lines changed: 0 additions & 5 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)