Skip to content

Commit e4805cc

Browse files
committed
Howto prepare and publish Python package
1 parent 2755fea commit e4805cc

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ docstyle:
6868
ruff:
6969
uv run ruff check . --per-file-ignores=tests/*:S101 --per-file-ignores=scripts/*:S101
7070

71-
verify:
71+
verify: ## Run all linters
7272
$(MAKE) black
7373
$(MAKE) pylint
7474
$(MAKE) pyright
@@ -77,6 +77,7 @@ verify:
7777
$(MAKE) check-types
7878

7979
distribution-archives: ## Generate distribution archives to be uploaded into Python registry
80+
rm -rf dist
8081
pdm run python -m build
8182

8283
upload-distribution-archives: ## Upload distribution archives into Python registry

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Lightspeed Core Stack (LCS) is an AI powered assistant that provides answers to
2323
* [Endpoints](#endpoints)
2424
* [Readiness Endpoint](#readiness-endpoint)
2525
* [Liveness Endpoint](#liveness-endpoint)
26+
* [Publish the service as Python package on PyPI](#publish-the-service-as-python-package-on-pypi)
27+
* [Generate distribution archives to be uploaded into Python registry](#generate-distribution-archives-to-be-uploaded-into-python-registry)
28+
* [Upload distribution archives into selected Python registry](#upload-distribution-archives-into-selected-python-registry)
29+
* [Packages on PyPI and Test PyPI](#packages-on-pypi-and-test-pypi)
2630
* [Contributing](#contributing)
2731
* [License](#license)
2832
* [Additional tools](#additional-tools)
@@ -162,6 +166,9 @@ format Format the code into unified format
162166
schema Generate OpenAPI schema file
163167
requirements.txt Generate requirements.txt file containing hashes for all non-devel packages
164168
shellcheck Run shellcheck
169+
verify Run all linters
170+
distribution-archives Generate distribution archives to be uploaded into Python registry
171+
upload-distribution-archives Upload distribution archives into Python registry
165172
help Show this help screen
166173
```
167174
@@ -230,6 +237,51 @@ The liveness endpoint performs a basic health check to verify the service is ali
230237
}
231238
```
232239

240+
# Publish the service as Python package on PyPI
241+
242+
To publish the service as an Python package on PyPI to be installable by anyone
243+
(including Konflux hermetic builds), perform these two steps:
244+
245+
## Generate distribution archives to be uploaded into Python registry
246+
247+
```
248+
make distribution-archives
249+
```
250+
251+
Please make sure that the archive was really built to avoid publishing older one.
252+
253+
## Upload distribution archives into selected Python registry
254+
255+
```
256+
make upload-distribution-archives
257+
```
258+
259+
The Python registry to where the package should be uploaded can be configured
260+
by changing `PYTHON_REGISTRY`. It is possible to select `pypi` or `testpypi`.
261+
262+
You might have your API token stored in file `~/.pypirc`. That file should have
263+
the following form:
264+
265+
```
266+
[testpypi]
267+
username = __token__
268+
password = pypi-{your-API-token}
269+
270+
[pypi]
271+
username = __token__
272+
password = pypi-{your-API-token}
273+
```
274+
275+
If this configuration file does not exist, you will be prompted to specify API token from keyboard every time you try to upload the archive.
276+
277+
278+
279+
## Packages on PyPI and Test PyPI
280+
281+
* https://pypi.org/project/lightspeed-stack/
282+
* https://test.pypi.org/project/lightspeed-stack/0.1.0/
283+
284+
233285
# Contributing
234286

235287
* See [contributors](CONTRIBUTING.md) guide.

0 commit comments

Comments
 (0)