Skip to content

Commit 9640295

Browse files
authored
Merge pull request #222 from tisnik/lcore-240
LCORE-240: Makefile targets + updated documentation
2 parents 71d3667 + e4805cc commit 9640295

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
ARTIFACT_DIR := $(if $(ARTIFACT_DIR),$(ARTIFACT_DIR),tests/test_results)
22
PATH_TO_PLANTUML := ~/bin
33

4+
# Python registry to where the package should be uploaded
5+
PYTHON_REGISTRY = pypi
6+
47

58
run: ## Run the service locally
69
uv run src/lightspeed_stack.py
@@ -65,14 +68,21 @@ docstyle:
6568
ruff:
6669
uv run ruff check . --per-file-ignores=tests/*:S101 --per-file-ignores=scripts/*:S101
6770

68-
verify:
71+
verify: ## Run all linters
6972
$(MAKE) black
7073
$(MAKE) pylint
7174
$(MAKE) pyright
7275
$(MAKE) ruff
7376
$(MAKE) docstyle
7477
$(MAKE) check-types
7578

79+
distribution-archives: ## Generate distribution archives to be uploaded into Python registry
80+
rm -rf dist
81+
pdm run python -m build
82+
83+
upload-distribution-archives: ## Upload distribution archives into Python registry
84+
pdm run python -m twine upload --repository ${PYTHON_REGISTRY} dist/*
85+
7686
help: ## Show this help screen
7787
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
7888
@echo ''

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)