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

apollo_fpga: get rid of poetry and add prompt-toolkit dependency #36

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

mndza
Copy link
Contributor

@mndza mndza commented Feb 15, 2024

Fixes #35.

@mndza mndza mentioned this pull request Feb 16, 2024
@mossmann mossmann self-requested a review March 7, 2024 16:31
Copy link
Member

@miek miek left a comment

Choose a reason for hiding this comment

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

For me this throws errors trying to find the sub-modules:

$ apollo
Traceback (most recent call last):
  File "/home/mike/.local/bin/apollo", line 5, in <module>
    from apollo_fpga.commands.cli import main
  File "/home/mike/.local/lib/python3.10/site-packages/apollo_fpga/__init__.py", line 9, in <module>
    from .jtag  import JTAGChain
  File "/home/mike/.local/lib/python3.10/site-packages/apollo_fpga/jtag.py", line 13, in <module>
    from .support.bits import bits
ModuleNotFoundError: No module named 'apollo_fpga.support'

and it turns out the issue is that they aren't installed because the setuptools include key is too strict. It could be solved by setting it to apollo_fpga* instead, but I think using the packages key is a bit cleaner:

diff --git a/pyproject.toml b/pyproject.toml
index 05e5938..82f2223 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -34,9 +34,8 @@ dependencies = [
 [project.urls]
 repository = "https://github.com/greatscottgadgets/apollo"
 
-[tool.setuptools.packages.find]
-where = ["."]
-include = ["apollo_fpga"]
+[tool.setuptools]
+packages = ["apollo_fpga"]
 
 [project.scripts]
 apollo = "apollo_fpga.commands.cli:main"

@mndza
Copy link
Contributor Author

mndza commented Mar 7, 2024

Thank you for catching this! Previously I only tested installing this in editable mode and the bug did not appear.

I am able to reproduce this now, but the packages solution did not solve it for me. Using apollo_fpga* did, though.

Edit: forget about what I said, it works. Force-pushing now.

@mossmann
Copy link
Member

I tried testing this with a user pip install, replacing a previous installation. The initial uninstall worked:

mossmann@costard:~/src/apollo$ pip3 uninstall apollo_fpga  --break-system-packages
Found existing installation: apollo-fpga 0.0.5
Uninstalling apollo-fpga-0.0.5:
  Would remove:
    /home/mossmann/.local/bin/apollo
    /home/mossmann/.local/lib/python3.11/site-packages/apollo_fpga-0.0.5.dist-info/*
    /home/mossmann/.local/lib/python3.11/site-packages/apollo_fpga/*
Proceed (Y/n)? y
  Successfully uninstalled apollo-fpga-0.0.5

Then the install worked:

mossmann@costard:~/src/apollo$ pip3 install .  --break-system-packages
Defaulting to user installation because normal site-packages is not writeable
Processing /home/mossmann/src/apollo
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pyusb>1.1.1 in /usr/lib/python3/dist-packages (from apollo-fpga==0.0.5) (1.2.1.post1)
Requirement already satisfied: pyvcd>=0.2.4 in /home/mossmann/.local/lib/python3.11/site-packages (from apollo-fpga==0.0.5) (0.2.4)
Requirement already satisfied: prompt-toolkit>3.0.16 in /usr/lib/python3/dist-packages (from apollo-fpga==0.0.5) (3.0.36)
Building wheels for collected packages: apollo-fpga
  Building wheel for apollo-fpga (pyproject.toml) ... done
  Created wheel for apollo-fpga: filename=apollo_fpga-0.0.5-py3-none-any.whl size=33337 sha256=3bdea1a94735c5f6d2551e562a2e15f679e1f76911113b66c492ec3cb5acdcc9
  Stored in directory: /tmp/pip-ephem-wheel-cache-61jsvh74/wheels/e8/8c/ac/f7cce1ec4ddb45ffe2cc29d17b39d287331da0a67f85a743c7
Successfully built apollo-fpga
Installing collected packages: apollo-fpga
Successfully installed apollo-fpga-0.0.5

But a subsequent uninstall did not:

mossmann@costard:~/src/apollo$ pip3 uninstall apollo_fpga  --break-system-packages
Found existing installation: apollo-fpga 0.0.5
Can't uninstall 'apollo-fpga'. No files were found to uninstall.

I got the same result using a hyphen instead of an underscore:

mossmann@costard:~/src/apollo$ pip3 uninstall apollo-fpga  --break-system-packages
Found existing installation: apollo-fpga 0.0.5
Can't uninstall 'apollo-fpga'. No files were found to uninstall

@mossmann
Copy link
Member

My uninstall failure only happens if my working directory is the top level of the repo. We're guessing that this has to do with the way pip resolves package names and is not a bug in apollo. Removing pyproject.toml did not change my result.

Copy link
Member

@mossmann mossmann left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

@mossmann mossmann merged commit 76326cc into greatscottgadgets:master Mar 19, 2024
3 checks passed
@antoinevg antoinevg mentioned this pull request Apr 16, 2024
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.

Undeclared dependency on prompt_toolkit
3 participants