Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Jul 11, 2025

Description

LCORE-240: Makefile targets + updated documentation

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Related Tickets & Documents

  • Related Issue #LCORE-240

Summary by CodeRabbit

  • New Features

    • Added new commands to build and upload Python package distributions to PyPI or Test PyPI.
  • Documentation

    • Updated the README with instructions for publishing the service as a Python package, including usage details for new commands and configuration guidance.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 11, 2025

Walkthrough

The Makefile was updated to support Python package distribution and uploading, introducing new targets and a registry variable. The README.md was expanded to document these new publishing steps, including instructions for configuring the registry and authentication. Additional make targets were also documented in the usage section.

Changes

File(s) Change Summary
Makefile Added PYTHON_REGISTRY variable, new distribution-archives and upload-distribution-archives targets, and a comment for verify.
README.md Added documentation for publishing to PyPI, new make targets, registry configuration, and authentication instructions.

Poem

🐇
New targets appear, the build hops ahead,
Distributions are made, and to PyPI they're led.
With a tweak in the Makefile, and docs clear and bright,
Uploads are simple, no tokens in sight!
The registry's set, the archives take flight.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (6)
Makefile (2)

4-6: Prefer ?= to keep the variable truly overridable

Using a simple = prevents a value coming from the environment (e.g. export PYTHON_REGISTRY=testpypi) from taking precedence.
Switching to ?= lets the env / CLI override and still keeps the default.

-PYTHON_REGISTRY = pypi
+PYTHON_REGISTRY ?= pypi

71-78: verify target exceeds checkmake’s max-body length

Static analysis already flags this. Wrap the individual linters into a helper target to shorten the body:

+lint-all:
+	$(MAKE) black pylint pyright ruff docstyle check-types
+
 verify: ## Run all linters
-	$(MAKE) black
-	$(MAKE) pylint
-	$(MAKE) pyright
-	$(MAKE) ruff
-	$(MAKE) docstyle
-	$(MAKE) check-types
+	$(MAKE) lint-all

This keeps the same behaviour and silences maxbodylength.

README.md (4)

26-29: Fix list indentation to satisfy Markdown linters

Current four-space indentation violates MD007. Two spaces are enough:

-* [Publish the service as Python package on PyPI](#publish-the-service-as-python-package-on-pypi)
-    * [Generate distribution archives to be uploaded into Python registry](#generate-distribution-archives-to-be-uploaded-into-python-registry)
-    * [Upload distribution archives into selected Python registry](#upload-distribution-archives-into-selected-python-registry)
-    * [Packages on PyPI and Test PyPI](#packages-on-pypi-and-test-pypi)
+* [Publish the service as Python package on PyPI](#publish-the-service-as-python-package-on-pypi)
+  * [Generate distribution archives to be uploaded into Python registry](#generate-distribution-archives-to-be-uploaded-into-python-registry)
+  * [Upload distribution archives into selected Python registry](#upload-distribution-archives-into-selected-python-registry)
+  * [Packages on PyPI and Test PyPI](#packages-on-pypi-and-test-pypi)

247-257: Specify language for fenced blocks

MD040 flags these blocks. Adding bash helps syntax highlighting & tooling:

-```
+```bash
 make distribution-archives
@@
-```
+```bash
 make upload-distribution-archives

265-273: Mark .pypirc fence as INI for clarity

-```
+```ini
 [testpypi]
@@
 pypi-{your-API-token}

---

`281-282`: **Convert bare URLs to reference links**

Avoid MD034 by wrapping them:

```diff
-* https://pypi.org/project/lightspeed-stack/
-* https://test.pypi.org/project/lightspeed-stack/0.1.0/
+* [PyPI](https://pypi.org/project/lightspeed-stack/)
+* [Test PyPI 0.1.0](https://test.pypi.org/project/lightspeed-stack/0.1.0/)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71d3667 and e76c9d1.

📒 Files selected for processing (2)
  • Makefile (2 hunks)
  • README.md (3 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

27-27: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


28-28: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


29-29: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


247-247: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


255-255: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


265-265: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


281-281: Bare URL used

(MD034, no-bare-urls)


282-282: Bare URL used

(MD034, no-bare-urls)

🪛 LanguageTool
README.md

[style] ~251-~251: Consider using a different verb to strengthen your wording.
Context: ... make distribution-archives ``` Please make sure that the archive was really built to av...

(MAKE_SURE_ENSURE)

🪛 checkmake (0.2.2)
Makefile

[warning] 71-71: Target body for "verify" exceeds allowed length of 5 (6).

(maxbodylength)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-pr

Comment on lines +82 to +85
upload-distribution-archives: ## Upload distribution archives into Python registry
pdm run python -m twine upload --repository ${PYTHON_REGISTRY} dist/*

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fail fast when no artefacts exist

twine expands dist/*; when the glob is empty the shell passes the literal string and twine aborts. Guard against this:

 upload-distribution-archives: ## Upload distribution archives into Python registry
-	pdm run python -m twine upload --repository ${PYTHON_REGISTRY} dist/*
+	@if [ -z "$$(ls -1 dist 2>/dev/null)" ]; then \
+	  echo "No distribution files found in ./dist – did you run make distribution-archives?"; exit 1; \
+	fi
+	pdm run python -m twine upload --repository ${PYTHON_REGISTRY} dist/*
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
upload-distribution-archives: ## Upload distribution archives into Python registry
pdm run python -m twine upload --repository ${PYTHON_REGISTRY} dist/*
upload-distribution-archives: ## Upload distribution archives into Python registry
@if [ -z "$$(ls -1 dist 2>/dev/null)" ]; then \
echo "No distribution files found in ./dist – did you run make distribution-archives?"; exit 1; \
fi
pdm run python -m twine upload --repository ${PYTHON_REGISTRY} dist/*
🤖 Prompt for AI Agents
In the Makefile at lines 82 to 84, the upload-distribution-archives target runs
twine upload on dist/* without checking if any files exist, causing twine to
fail if the glob is empty. Modify the target to first check if any files exist
in the dist directory before running twine, and if none exist, exit with an
error or skip the upload to fail fast and avoid passing a literal glob pattern
to twine.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
Makefile (1)

83-85: Guard against empty dist/* before calling Twine

Previous review already pointed out that twine aborts when the glob is empty; the safeguard is still missing.

upload-distribution-archives: ## Upload distribution archives into Python registry
-	pdm run python -m twine upload --repository ${PYTHON_REGISTRY} dist/*
+	@if [ -z "$$(ls -1 dist 2>/dev/null)" ]; then \
+	  echo "No distribution files found in ./dist – did you run make distribution-archives?"; exit 1; \
+	fi
+	pdm run python -m twine upload --repository ${PYTHON_REGISTRY} dist/*
🧹 Nitpick comments (3)
Makefile (2)

4-6: Use ?= to allow effortless override of PYTHON_REGISTRY

A conditional assignment (?=) lets users (or CI jobs) override the registry via environment/CLI without having to pass make PYTHON_REGISTRY=… --no-builtin-variables.

-PYTHON_REGISTRY = pypi
+PYTHON_REGISTRY ?= pypi

71-78: verify target exceeds recommended body length – split for clarity

Static analysis flags 6 commands (>5). Consider composing it from smaller phony targets (lint-python, lint-docs, etc.) and invoke them here to keep the body terse and self-describing.

README.md (1)

247-273: Add language identifiers to fenced code blocks

Markdown-lint (MD040) warns about missing languages; adding one improves syntax highlighting and copy-paste UX.

-```
-make distribution-archives
-```
+```bash
+make distribution-archives
+```-```
-make upload-distribution-archives
-```
+```bash
+make upload-distribution-archives
+```-```
-[testpypi]
+```ini
+[testpypi]
   username = __token__
   password = pypi-{your-API-token}
 
 [pypi]
   username = __token__
   password = pypi-{your-API-token}
-```
+```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between e76c9d16306acb34a51fc520d989271c2124721d and e4805cca245c72c4b0fa023bad57818b121a3ee0.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `Makefile` (2 hunks)
* `README.md` (3 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 checkmake (0.2.2)</summary>

<details>
<summary>Makefile</summary>

[warning] 71-71: Target body for "verify" exceeds allowed length of 5 (6).

(maxbodylength)

</details>

</details>
<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

<details>
<summary>README.md</summary>

27-27: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)

---

28-28: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)

---

29-29: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)

---

247-247: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

255-255: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

265-265: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

281-281: Bare URL used

(MD034, no-bare-urls)

---

282-282: Bare URL used

(MD034, no-bare-urls)

</details>

</details>
<details>
<summary>🪛 LanguageTool</summary>

<details>
<summary>README.md</summary>

[style] ~251-~251: Consider using a different verb to strengthen your wording.
Context: ... make distribution-archives ```  Please make sure that the archive was really built to av...

(MAKE_SURE_ENSURE)

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)</summary>

* GitHub Check: build-pr

</details>

<details>
<summary>🔇 Additional comments (1)</summary><blockquote>

<details>
<summary>Makefile (1)</summary>

`79-81`: **👍 `dist/` cleanup added – stale artefacts issue solved**  
The extra `rm -rf dist` prevents upload collisions.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@tisnik tisnik merged commit 9640295 into lightspeed-core:main Jul 11, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant