Skip to content

Commit be6c49a

Browse files
committed
move to pyinstaller from nuitka for linux compatibility
summarize FOCUS_BLOCKS readme
1 parent eff1b62 commit be6c49a

File tree

5 files changed

+148
-155
lines changed

5 files changed

+148
-155
lines changed

FOCUS_BLOCKS.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
# Introduction to Focus Blocks
22

3-
## Who is Focus Blocks for?
3+
## Who is it for?
4+
Focus Blocks is designed for self-motivated individuals who find repetitive daily routines too monotonous.
45

5-
Focus Blocks is for highly self-motivated people. It is for people who find the idea of having a daily-level repetition too boring.
6+
## How to Use Focus Blocks
7+
1. **Plan Monthly:** At the start of the month, decide the total number of Focus Blocks and allocate them across 4-7 areas (e.g., work, exercise).
8+
2. **Choose Daily:** Each morning, decide which areas to work on based on remaining blocks.
9+
3. **Track Progress:** Check off blocks throughout the day as you complete them.
10+
4. **Reflect Nightly:** Review and adjust block allocations if needed to match actual progress.
611

7-
## How to use Focus Blocks
12+
## Key Concepts
813

9-
1. At the start of the month, decide the total number of blocks and the number of blocks you want to allocate to each area.
10-
2. Each morning, choose to work on areas that have blocks remaining.
11-
3. Throughout the day, check off blocks as you finish working on them.
12-
4. At night, review. If necessary, modify the day's allocation of blocks to reflect what actually ended up happening.
14+
- **Block:** A 2–2.5 hour session of focused work. Aim for 2–5 blocks per day depending on your schedule.
15+
- **Area:** A specific focus for the month, such as projects, hobbies, or fitness.
16+
- **Buffer:** Extra blocks reserved for unforeseen circumstances, ensuring flexibility.
1317

14-
## Important Concepts
18+
## Tips for Success
1519

16-
+ **Block**: A block is a 2-2.5 hour period of focused work. Aim to schedule 2 to 5 blocks per day depending on your circumstances.
17-
+ **Area**: Somewhat specific areas that you want to work on during the month. Typically 4-7 areas including exercise.
18-
+ **Buffer**: When assigning blocks at the beginning of the month, it is highly recommended to reserve Buffer blocks. Buffer blocks are meant to be used when, due to unforeseen circumstances, you failed to spend a given block as allocated.
20+
1. **Integrate with Planning:**
21+
- **Long-Term Goals:** Use annual or multi-year visions to guide monthly block allocations.
22+
- **Daily Structure:** Wrap Focus Blocks with morning routines, breaks, and evening routines.
1923

20-
## Tips for using Focus Blocks in your life
24+
2. **Work vs. Rest Days:** Classify each day as either a "Work Day" or "Play Day." Rest days should be fully restorative, while workdays are structured around Focus Blocks.
2125

22-
Focus Blocks works best in conjunction with a longer-term and a shorter-term planning system.
23-
+ Longer-term: Your monthly block allocation should be informed by a year or multi-year vision / goal.
24-
+ Shorter-term: Focus Blocks only define what task you will do during the focused work hours of your day. You should have a daily routine that wraps Focus Blocks with a morning routine, break activities, and evening routine.
26+
## Benefits of Focus Blocks
2527

26-
Focus Blocks makes the assumption that a given day is classified either as "Work Day" or "Play Day". This reflect my opinion that on rest days, you should really rest, and work days should be strictly structured the whole day. Therefore the total number of blocks in a month is simply `blocks_per_day` * `working_days_per_month`.
28+
- **Sense of Achievement:** Completing a block is rewarding, as it’s based on effort rather than task completion.
29+
- **Flexibility with Agency:** Work on less enjoyable tasks without feeling pressured. Choose when to tackle them, knowing they must be addressed eventually.
30+
- **Task Decoupling:** Removes the pressure of finishing long-term tasks within one session by focusing on effort rather than visible results.
2731

28-
**The full story:** In the past (2020-2023), I have used Google Sheets to implement this functionality but it didn't offer the interactivity, simplicity, beauty, and customizability that I desired. Plus, writing Python for fun is fun. `fob` the CLI program was released on November 14, 2024.
32+
## Background
2933

30-
## Benefits / Magic of Focus Blocks
31-
32-
+ Compared to regular to-do lists or Kanban boards, Focus Blocks gives you a more regular sense of achievement, because you can still check off a block as complete as long as you did you best, instead of accomplishing a given task (nevermind how tasks aren't really complete)
33-
+ Focus Blocks makes the "illusion of free will" work **for** you, not against you. Typically, you will enjoy working on some areas more than others. With a less flexible system, you will feel pressured and negative about having to work the less enjoyable thing and probably will put it off. Focus Blocks gives you agency in 'choosing' to work on the less enjoyable thing, because you have to get it done anyhow. Plus, by decoupling blocks from to-do lists, you will feel less pressure on tasks that justifiably take more than a couple hours to achieve visible results.
34+
From 2020–2023, I used Google Sheets to track Focus Blocks but wanted something more interactive and customizable. On November 14, 2024, I released `fob`, a CLI program that brings Focus Blocks to life.

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ uv run fob
3535

3636
# Release
3737

38-
From the root of this repository, run `dev_install.sh`. It uses nuitka to compile the python code into a single file executable, and then installs it to the system.
38+
From the root of this repository, run `dev_install.sh`. It uses pyinstaller to create a standalone binary and places it in `~/.local/bin` for access from anywhere on the system.
3939

4040
Create a new Github Release with a new tag and upload the executable (path should be shown by `dev_install.sh`) to the Github Release.
4141

@@ -61,10 +61,6 @@ export FOB_DB_PATH="~/Dropbox/my-fob.db"
6161

6262
[`TinyDB`](https://github.com/msiemens/tinydb) is used to persist the data as a human-readable JSON file.
6363

64-
Since we're not using a SQL database, we are responsible for upholding the integrity and consistency of the data before writing it to the database. We implement that by first receiving all the data from the user, validating it, and then 'commiting' (writing) to the database in one go.
64+
Since we're not using a SQL database, we are responsible for upholding the integrity and consistency of the data before writing it to the database. We implement that by first receiving all the data from the user, validating it, and then 'committing' (writing) to the database in one go.
6565

66-
Run the program with debug option `fob -x` or `fob --debug` to see how the database gets updated. Also, the so-called database is actually just a human-readable JSON file, so you can open that to inspect / edit it if you're developing `fob`. Use `fob info` to see where the database is located.
67-
68-
## Compiling to C
69-
70-
We use [`nuitka`](https://nuitka.net/) to compile to C in order to create self-contained binaries for each platform. See [`dev_install.sh`](/dev_install.sh) for how it's used.
66+
Run the program with debug option `fob -x` or `fob --debug` to see how the database gets updated. Also, the so-called database is actually just a human-readable JSON file, so you can open that to inspect / edit it if you're developing `fob`. Use `fob info` to see where the database is located.

dev_install.sh

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,44 @@
11
#!/bin/bash
22

3-
# Detect the OS
4-
OS="$(uname)"
3+
OS=$(uname)
54

6-
if [ "$OS" = "Darwin" ]; then
7-
# If the OS is macOS, proceed with the installation
8-
echo "Detected macOS. Running Nuitka to create a standalone executable."
5+
# Linux or Mac
6+
if [ "$OS" = "Linux" ] || [ "$OS" = "Darwin" ]; then
7+
echo "Detected $OS. Running PyInstaller to create a standalone executable."
8+
else
9+
echo "The installation script is not implemented for $OS."
10+
exit 1
11+
fi
912

10-
# Install nuitka if not already installed
11-
if ! [ -x "$(command -v uv)" ]; then
12-
echo "uv not found. Please install uv before running this script."
13-
exit 1
14-
fi
13+
if ! [ -x "$(command -v uv)" ]; then
14+
echo "uv not found. Please install uv before running this script."
15+
exit 1
16+
fi
1517

16-
# Run nuitka to create a standalone executable
17-
uv run python -m nuitka --standalone --onefile src/fob/__init__.py --output-filename=fob
18+
# Activate the virtual environment
19+
uv venv
20+
source .venv/bin/activate
1821

19-
DEST_PATH="$HOME/.local/bin"
22+
# Install pyinstaller within the new virtual environment
23+
uv add pyinstaller
2024

21-
# Delete previous version
22-
rm "$DEST_PATH/fob"
25+
# Call the tool
26+
pyinstaller --onefile --name fob src/fob/__init__.py
2327

24-
# Copy the executable to somewhere on your PATH
25-
echo "Copying the executable to $DEST_PATH..."
26-
mkdir -p "$DEST_PATH"
27-
cp fob "$DEST_PATH"
28+
# Copy the executable to somewhere on your PATH
29+
DEST_PATH="$HOME/.local/bin"
2830

29-
# Clean up
30-
echo "Cleaning up..."
31-
rm -r __init__.dist __init__.build __init__.onefile-build fob
31+
# Delete previous version
32+
rm "$DEST_PATH/fob"
3233

33-
echo "Installation complete. The 'fob' command is now available. If not, please check that $DEST_PATH is in your PATH environment variable."
34-
else
35-
# Print a message for unsupported OS
36-
echo "The installation script is not implemented for $OS."
37-
fi
34+
# Copy the executable to somewhere on your PATH
35+
echo "Copying the executable to $DEST_PATH..."
36+
37+
mkdir -p "$DEST_PATH"
38+
cp dist/fob "$DEST_PATH"
39+
40+
# Clean up
41+
echo "Cleaning up..."
42+
rm -r dist build fob.spec
43+
44+
echo "Installation complete. The 'fob' command is now available. If not, please check that $DEST_PATH is in your PATH environment variable."

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ description = "Focus Blocks: Simple and elegant daily time management tool."
66
readme = "README.md"
77
authors = [{ name = "tensorturtle", email = "[email protected]" }]
88
requires-python = ">=3.12"
9-
dependencies = ["rich>=13.9.4", "tinydb>=4.8.2"]
9+
dependencies = [
10+
"pyinstaller>=6.11.1",
11+
"rich>=13.9.4",
12+
"tinydb>=4.8.2",
13+
]
1014

1115
[project.scripts]
12-
fob = "fob:main"
13-
14-
[tool.uv]
15-
dev-dependencies = ["nuitka>=2.4.11"]
16+
fob = "fob:main"

0 commit comments

Comments
 (0)