-
Notifications
You must be signed in to change notification settings - Fork 10
Release 1.2.0 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Release 1.2.0 #25
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
dc184ce
Created context manager
liiight 8cc412b
Added test
liiight d0d63d0
Fixed pep8
liiight 384e6f8
Publish test
polyzen f038a8e
Exclude useless file in dist, #17
lord63 c6a7d56
Avoid ending output when spinner never starts
lord63 866dc91
Unify spinner rendering logic
lord63 60da802
Add spinner regression tests
lord63 ac4b087
Make spinner lifecycle helpers private
lord63 4ea76f7
Guard against re-entering a running spinner
lord63 eb0454c
Rename stop event for clarity
lord63 4c1e96d
Reset spinner state after stop
lord63 a2e3ac2
Rename init_spin to _init_spin
lord63 d2105c9
Deduplicate TTY check in make_spin
lord63 c73e6c3
Shorten context manager test wait
lord63 592b003
Harden tty detection
lord63 8ff29a3
Flush ending output in make_spin
lord63 8b03e16
Document Spinner context manager usage
lord63 a59c2f8
Fix no-isatty stdout test double
lord63 57b28da
Handle non-callable isatty safely
lord63 753eea8
Stabilize context manager test stdout handling
lord63 de146ec
Relax flush test timing-sensitive assertions
lord63 1b67847
Add more tests
lord63 2a0b42b
Merge pull request #22 from lord63/contex_manager_fixes
lord63 57a1704
Migrate to uv and github action, drop 2.x support
lord63 3d54390
Apply PR review: frozen sync, ruff lint, https URL, remove redundant …
Copilot e21ea5f
Set spinner thread as daemon to prevent hanging process on unexpected…
lord63 c223308
Modernize examples: drop Python 2 leftovers, add context manager usage
lord63 9a9bd69
Add comments
lord63 d2674b6
Release 1.2.0
lord63 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master, dev] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --dev --frozen | ||
|
|
||
| - name: Lint | ||
| run: uv run ruff check . | ||
|
|
||
| - name: Run tests | ||
| run: uv run pytest -v test_pyspin.py |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| include README.md | ||
| include README.rst | ||
| include LICENSE | ||
| include test_pyspin.py | ||
| global-exclude *.py[co] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| test: | ||
| @py.test --pep8 -v test_pyspin.py pyspin/ | ||
| @uv run pytest -v test_pyspin.py | ||
|
|
||
| lint: | ||
| @uv run ruff check . | ||
|
|
||
| create: | ||
| @python setup.py sdist bdist_wheel | ||
| @uv build | ||
|
|
||
| upload: | ||
| @python setup.py sdist bdist_wheel upload | ||
| @uv publish |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,42 +1,43 @@ | ||||||
| #!/usr/bin/env python | ||||||
| # -*- coding: utf-8 -*- | ||||||
| #!/usr/bin/env python3 | ||||||
| # Style showcase — runs each built-in spinner style so you can see what it looks like. | ||||||
|
|
||||||
| from __future__ import absolute_import, print_function | ||||||
|
|
||||||
| import sys | ||||||
| import time | ||||||
|
|
||||||
| from pyspin import spin | ||||||
|
|
||||||
| STYLES = [ | ||||||
| ("Default", spin.Default), | ||||||
| ("Box1", spin.Box1), | ||||||
| ("Box2", spin.Box2), | ||||||
| ("Box3", spin.Box3), | ||||||
| ("Box4", spin.Box4), | ||||||
| ("Box5", spin.Box5), | ||||||
| ("Box6", spin.Box6), | ||||||
| ("Box7", spin.Box7), | ||||||
| ("Spin1", spin.Spin1), | ||||||
| ("Spin2", spin.Spin2), | ||||||
| ("Spin3", spin.Spin3), | ||||||
| ("Spin4", spin.Spin4), | ||||||
| ("Spin5", spin.Spin5), | ||||||
| ("Spin6", spin.Spin6), | ||||||
| ("Spin7", spin.Spin7), | ||||||
| ("Spin8", spin.Spin8), | ||||||
| ("Spin9", spin.Spin9), | ||||||
| ] | ||||||
|
|
||||||
|
|
||||||
| def show(name, frames): | ||||||
| s = spin.Spinner(frames) | ||||||
| print(name) | ||||||
| for i in range(50): | ||||||
|
||||||
| for i in range(50): | |
| for _ in range(50): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,25 @@ | ||
| #!/usr/bin/env python | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| from __future__ import absolute_import, print_function | ||
| #!/usr/bin/env python3 | ||
|
|
||
| import time | ||
|
|
||
| from pyspin.spin import make_spin, Spin1 | ||
| from pyspin.spin import Default, Spinner, make_spin, Spin1 | ||
|
|
||
|
|
||
| @make_spin(Spin1, "Downloading...") | ||
| def demo(): | ||
| # Context manager — recommended usage. | ||
| def download_video(): | ||
| time.sleep(5) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| print("Assume we're downloading a video") | ||
| print("It would cost much time.") | ||
| demo() | ||
| print("Download success!") | ||
| print("Downloading a video with context manager:") | ||
| with Spinner(Default, "Downloading...", "Done!\n"): | ||
| download_video() | ||
|
|
||
| # Decorator — alternative usage. | ||
| @make_spin(Spin1, "Downloading...") | ||
| def download_video_with_decorator(): | ||
| time.sleep(5) | ||
|
|
||
| print("Downloading a video with decorator:") | ||
| download_video_with_decorator() | ||
| print("Done!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| [project] | ||
| name = "pyspin" | ||
| version = "1.2.0" | ||
| description = "Little terminal spinner lib." | ||
| readme = "README.rst" | ||
| license = { text = "MIT" } | ||
| authors = [{ name = "lord63", email = "lord63.j@gmail.com" }] | ||
| requires-python = ">=3.10" | ||
| keywords = ["terminal", "spin", "spinner"] | ||
| classifiers = [ | ||
| "Development Status :: 4 - Beta", | ||
| "Intended Audience :: Developers", | ||
| "License :: OSI Approved :: MIT License", | ||
| "Operating System :: POSIX", | ||
| "Operating System :: POSIX :: Linux", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/lord63/py-spin" | ||
|
|
||
| [build-system] | ||
| requires = ["hatchling"] | ||
| build-backend = "hatchling.build" | ||
|
|
||
| [dependency-groups] | ||
| dev = ["pytest>=8.0", "ruff"] | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["pyspin"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STYLESuses alignment spacing after commas (e.g.,("Box1", spin.Box1)), which will be flagged by ruff (E241: multiple spaces after ',') since CI runsruff check .. Please remove the extra alignment spaces (or run an auto-formatter) so the examples pass linting.