Skip to content

Update documentations#43

Merged
Suke0811 merged 4 commits intomainfrom
update-documentations
Jan 5, 2026
Merged

Update documentations#43
Suke0811 merged 4 commits intomainfrom
update-documentations

Conversation

@Suke0811
Copy link
Owner

@Suke0811 Suke0811 commented Jan 5, 2026

This pull request introduces improved support and documentation for using lambda functions as stop conditions in the fspin library. It updates the cheatsheet, main documentation, and examples to recommend and demonstrate the use of lambdas for concise, readable loop control. Additionally, it adds a new example, enhances the package's usability, and improves performance reporting.

Lambda Condition Support and Documentation:

  • Updated fspin_cheatsheet.md, readme.md, and in-code docstrings to recommend using lambda functions for the condition_fn parameter, with new and revised examples for both sync and async workflows. [1] [2] [3] [4] [5] [6] [7] [8]
  • Added a new example script example/lambda_condition.py and updated example/README.md to showcase lambda-based loop conditions. [1] [2]

Cheatsheet and CLI Improvements:

  • Added fspin_cheatsheet.md to the package manifest and created a __main__.py entry point to print the cheatsheet when running python -m fspin. [1] [2]
  • The unified spin entry point now dynamically loads the cheatsheet into its docstring if available, improving inline help and discoverability.

Functionality and Reporting Enhancements:

  • Improved the RateControl.get_report() method to correctly count the initial iteration even when only a warmup iteration occurs.
  • Added a test to ensure the report's iteration count matches the number of function calls, including warmup.

These changes make it easier for users to implement concise loop exit conditions and improve the clarity and accessibility of the documentation.

@Suke0811 Suke0811 merged commit ba755a8 into main Jan 5, 2026
8 checks passed
@Suke0811 Suke0811 deleted the update-documentations branch January 5, 2026 01:13
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 811ffdfc00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +10 to +14
cheatsheet_path = os.path.join(current_dir, "fspin_cheatsheet.md")

# Fallback for development environment if not found in package dir
if not os.path.exists(cheatsheet_path):
cheatsheet_path = os.path.join(current_dir, "..", "fspin_cheatsheet.md")

Choose a reason for hiding this comment

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

P2 Badge Package cheatsheet so python -m fspin can find it

This lookup assumes fspin_cheatsheet.md is bundled alongside the installed package, but setup.py doesn’t set include_package_data/package_data, so wheels built via pip won’t contain that file even with MANIFEST.in. In that common install path, python -m fspin will always fall through to “Cheatsheet not found,” so the advertised feature won’t work. Consider shipping the file as package data (or moving it into fspin/ and loading via importlib.resources).

Useful? React with 👍 / 👎.

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