Skip to content
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

pc run failed - because bun's upgrading is not work from installation. #901

Closed
milochen0418 opened this issue Apr 28, 2023 · 4 comments · Fixed by #938
Closed

pc run failed - because bun's upgrading is not work from installation. #901

milochen0418 opened this issue Apr 28, 2023 · 4 comments · Fixed by #938

Comments

@milochen0418
Copy link
Contributor

milochen0418 commented Apr 28, 2023

Describe the bug
A clear and concise description of what the bug is.
In constants.py, we have

BUN_PATH = "$HOME/.bun/bin/bun"
INSTALL_BUN = "curl -fsSL https://bun.sh/install | bash -s -- bun-v0.5.9"

In pynecone/utils/prerequisites.py, we have

def install_bun():
    """Install bun onto the user's system.
    Raises:
        FileNotFoundError: If the required packages are not installed.
    """
    # Bun is not supported on Windows.
    if platform.system() == "Windows":
        console.log("Skipping bun installation on Windows.")
        return

    # Only install if bun is not already installed.
    if not os.path.exists(get_package_manager()):
        console.log("Installing bun...")

        # Check if curl is installed
        curl_path = path_ops.which("curl")
        if curl_path is None:
            raise FileNotFoundError("Pynecone requires curl to be installed.")

        # Check if unzip is installed
        unzip_path = path_ops.which("unzip")
        if unzip_path is None:
            raise FileNotFoundError("Pynecone requires unzip to be installed.")

        os.system(constants.INSTALL_BUN)

When the user calls pc init, the INSTALL_BUN will be invoked.
This installation will not automatically replace the old version, and the good thing is to avoid downloading again.
The pynecone application developer doesn't need to know what bun version they use.

If we change the bun version for fitting new pynecone, they will upgrade their pynecone package and then
find out pc run will get failed.

After my testing, the INSTALL_BUN can work well on my mac, we can replace any bun version by the command
#494

But the only issue of the logic is this logic condition

    if not os.path.exists(get_package_manager()):

it check this path to decide updating bun or not.

If you ever install pynecone install from 2023 Feb 10
Then you can check ~/.bun/bin/bun --version to see what bun version you have
And you can find out the bun version is old.

To Reproduce
Steps to reproduce the behavior:

  • Code/Link to Repo:

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

** Specifics (please complete the following information):**

  • Python Version: python 3.11
  • Pynecone Version: upgrading from old pynecone install from 2023 Feb 10 to 2023 Apr 24 version into 0.1.27
  • OS: Mac OS X
  • Browser (Optional): Chrome

Additional context
Add any other context about the problem here.

@Alek99
Copy link
Contributor

Alek99 commented May 1, 2023

I see, thank for pointing out. Ok I will look into making a new command which will upgrade the install.

@milochen0418
Copy link
Contributor Author

milochen0418 commented May 2, 2023

@Alek99
I have another idea that doesn't use another command for this install.
Because it will make junior developers or student to feel afraid pynecone.

The purpose of the following idea is to make sure pynecone has a good development experience.

Maybe we can check the version of bun in pc init,
If the version is not the expected version of the current pynecone,
then the command line can guide the user to do
curl -fsSL https://bun.sh/install | bash -s -- bun-v0.5.9

For them, they just need to follow the order without understanding too much information.

If they are high-level users but beginner programmers,
they will not feel afraid to understand what bun-runtime it is.
For them, they just follow what we guide.

If they are a senior program, they can check this suggestion and
understand what bun-runtime it is. Then they can start to use this command to install.

So everyone can feel good about this guidance.
Is this a good idea? What do you think?

@milochen0418
Copy link
Contributor Author

Thanks @Lendemor ~~~

@milochen0418
Copy link
Contributor Author

@picklelo @Lendemor
My OS is Mac OS X
After testing on pynecone 0.1.29, it does not work.
#938 (comment)
So we may need to reopen this issue again.

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 a pull request may close this issue.

2 participants