Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include fspin_cheatsheet.md
include fspin/fspin_cheatsheet.md
44 changes: 27 additions & 17 deletions fspin/__main__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
import os
import sys

def main():
# Get the directory where this file is located
current_dir = os.path.dirname(os.path.abspath(__file__))

# Path to the cheatsheet (it should be bundled with the package)
# We look for it in the package directory or the project root
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")
try:
from importlib import resources
except ImportError:
# Fallback for Python < 3.7
import importlib_resources as resources

if os.path.exists(cheatsheet_path):
with open(cheatsheet_path, "r", encoding="utf-8") as f:
print(f.read())
else:
print("fspin Cheatsheet not found.")
print("Please check the online documentation at https://github.com/Suke0811/fspin")
def main():
# Use importlib.resources to access the cheatsheet bundled in the package
try:
# For modern Python (3.9+)
if hasattr(resources, 'files'):
cheatsheet_content = resources.files('fspin').joinpath('fspin_cheatsheet.md').read_text(encoding='utf-8')
else:
# Fallback for older importlib.resources (Python 3.7, 3.8)
with resources.open_text('fspin', 'fspin_cheatsheet.md', encoding='utf-8') as f:
cheatsheet_content = f.read()
print(cheatsheet_content)
except Exception:
# Fallback to local file path if importlib.resources fails (e.g. during development)
current_dir = os.path.dirname(os.path.abspath(__file__))
cheatsheet_path = os.path.join(current_dir, "fspin_cheatsheet.md")

if os.path.exists(cheatsheet_path):
with open(cheatsheet_path, "r", encoding="utf-8") as f:
print(f.read())
else:
print("fspin Cheatsheet not found.")
print("Please check the online documentation at https://github.com/Suke0811/fspin")

if __name__ == "__main__":
main()
File renamed without changes.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def read(rel_path):
},
license='MIT',
packages=find_packages(include=[PACKAGE_NAME, PACKAGE_NAME + '.*']),
include_package_data=True,
install_requires=requirements,
classifiers=CLASSIFIERS,
python_requires=PYTHON_REQUIRES,
Expand Down