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

Can't trace an exception #73

Closed
betterthanever2 opened this issue Mar 28, 2023 · 36 comments
Closed

Can't trace an exception #73

betterthanever2 opened this issue Mar 28, 2023 · 36 comments
Assignees
Labels
bug Something isn't working

Comments

@betterthanever2
Copy link

Describe the bug
Whenever I run poetry poly libs, or poetry poly check I get this error: 'charmap' codec can't decode byte 0x98 in position 880: character maps to <undefined>
I have no idea what is wrong and where to look.

To Reproduce
I'm not sure this is reproducible.

Expected behavior
A more detailed description of the error, preferably with indication of which file is faulting.

Desktop (please complete the following information):

  • OS: Win10
  • Python version: 3.10.5
  • Poetry version: 1.3.2

Additional context
Just moved a multifaceted project to polylith structure, and for starters assigned everything to one project . I started moving things around (that is, creating new bases/components and moving code there from legacy ones, then removing legacy ones). This wasn't happening at the beginning.

@DavidVujic
Copy link
Owner

Thank you for reporting @betterthanever2!

It looks like the commands have run into unexpected encodings in one or more files. I think I might have missed out in explicitly specifying the encoding when analyzing files (as done in the check and libs commands).

I'll look into this right away!

@DavidVujic DavidVujic self-assigned this Mar 28, 2023
@DavidVujic DavidVujic added the bug Something isn't working label Mar 28, 2023
@betterthanever2
Copy link
Author

Thank you! Love this software, btw

@DavidVujic
Copy link
Owner

There's a new version out: 1.5.0

I have added some file opening guards that I hope will solve your issues! The bump includes a new feature too (that is why it is 1.5.0): including the development project in poly info and libs.

Please try it out and let me know if it works 🙏

@betterthanever2
Copy link
Author

@DavidVujic quick question: how do I update the plugin? Pardon me if it's stupid, but I haven't found it in the docs.

@DavidVujic
Copy link
Owner

A very good question! The Poetry docs doesn't seem to describe that.

I usually remove, and then add again:

poetry self remove poetry-polylith-plugin

poetry self add poetry-polylith-plugin@latest

@betterthanever2
Copy link
Author

betterthanever2 commented Mar 28, 2023

Thank you! Updating to 1.5.0 went fine, and I no longer get the error I was getting. I'm a little confused by the output, though. Take a look at a screenshot. Judging by the different number of reported missing packages in the 2 blocks (what's up with that, btw?), something may have been duplicated.
4OxJKTk7Vr
UPD: for some reason "Libraries summary for development" line is missing from this specific output.

@DavidVujic
Copy link
Owner

That looks a bit weird, yes 😄

How does the files and folders look like?
Is there only one project in the projects folder?

@DavidVujic
Copy link
Owner

And, if possible, could you share the contents of the pyproject.toml file? Unless it is an in-house project that is not allowed to expose in public.

@betterthanever2
Copy link
Author

Yes, there is just one project. And here's the file structure:
image

@betterthanever2
Copy link
Author

Here's a gist

@DavidVujic
Copy link
Owner

Thank you! Looks good! Can I have a look at the one in the projects folder too?

@betterthanever2
Copy link
Author

Not much different...

@DavidVujic
Copy link
Owner

This was confusing. Even more that the "wapatools" is registered as a library in the list.

Not that it would matter, but why does the project-specific toml have the plugin declaration?

@DavidVujic
Copy link
Owner

May I ask for a look in the workspace.toml too? Just to make sure.

@betterthanever2
Copy link
Author

I'm not sure. It was either added automatically, or I may have copied it over from one of the 2 example projects I looked into

@betterthanever2
Copy link
Author

[tool.polylith]
namespace = "wapaganda"
git_tag_pattern = "stable-*"

[tool.polylith.structure]
theme = "loose"

[tool.polylith.resources]
brick_docs_enabled = true

[tool.polylith.test]
enabled = false

Note: test was "disabled" already after the setup

@betterthanever2
Copy link
Author

So I don't need that plugin declaration?

@DavidVujic
Copy link
Owner

No, you shouldn't need that. It looks like a declaration used when you actually build a plugin of your own.

@DavidVujic
Copy link
Owner

What is the output when you run the Poetry built in command poetry show?

@betterthanever2
Copy link
Author

No, you shouldn't need that. It looks like a declaration used when you actually build a plugin of your own.

It's declared in project-level file in this repo 🤦 Overkill 😄

@betterthanever2
Copy link
Author

betterthanever2 commented Mar 28, 2023

What is the output when you run the Poetry built in command poetry show?

When I run poetry show I get a really long list of libraries
UPD: wapaganda or wapatools are not among them

@DavidVujic
Copy link
Owner

DavidVujic commented Mar 28, 2023

  1. I think the poly libs feature is a bit too naive when it tries to figure out if a library is installed or not. If the name in the list of dependencies is too different from the one used in the python code, it will end up in the "could not locate" list. I'll see if I can do some better comparisons than what is done today. For now, see it as a guide (that might be wrong).

  2. I cannot figure out why the screenshot looks weird. It should have had a header Libraries summary for development there.

  3. Very unclear why wapatools is there among the libraries. Could be a side-effect from my updated file reading (and ignoring unknown characters when reading files).

@DavidVujic
Copy link
Owner

DavidVujic commented Mar 28, 2023

One thing that comes to mind: how does the snapshot base import wapatools and others?

@betterthanever2
Copy link
Author

betterthanever2 commented Mar 28, 2023

2. I cannot figure out why the screenshot looks weird. It should have had a header Libraries summary for development there.

This is indeed weird. It may be related to some terminal bug. Another thing that happened on that front is that when I enlarged the terminal window, the whole 2nd section of the output disappeared.

@betterthanever2
Copy link
Author

betterthanever2 commented Mar 28, 2023

One thing that comes to mind: how does the snapshot base import wapatools and others?

As entire scripts
image

UPD: Btw, I am curious if it's ok to have asset files in those folders

@DavidVujic
Copy link
Owner

Thanks! Looks good. According to the screenshot, the snapshot base imports something called py7zr is that correct, or is the poly libs summary wrong there?

@betterthanever2
Copy link
Author

Thanks! Looks good. According to the screenshot, the snapshot base imports something called py7zr is that correct, or is the poly libs summary wrong there?

It is correct. This dependency is also actually missing from the pyproject.toml

@betterthanever2
Copy link
Author

loaders and pyyoutube are aliases of python-loaders and python-youtube respectively

@DavidVujic
Copy link
Owner

DavidVujic commented Mar 28, 2023

Ok! So the tool seems to have gotten some missing dependencies reported right. The aliases is making the tool miss them, and that's a bug.

Is there anywhere in the python code where the imports for wapatools isn't from wapatools or import wapatools?

Sorry, not wapatools, but wapaganda!

@betterthanever2
Copy link
Author

Sorry, not wapatools, but wapaganda!

There were (it's legacy residue). I corrected almost all, but may have missed something
Also: it would've been really nice to see where the missing dependency is used. For example, there is a supaword package, among other things, and it's just the old name of this one, and it shouldn't be there.

@DavidVujic
Copy link
Owner

DavidVujic commented Mar 28, 2023

Thank you for helping out with this, and I appreciate your patience with the polylith tool! 😄

There's a couple of bugs we already have identified that I will add as issues and work on:

  • terminal weirdness with double screens (looks like PowerShell)
  • too naive library comparison, such as python-youtube vs pyyoutube

The rest is a bit difficult to find out for now. If it would be ok for you I could have a closer look in the code in a zoom-call or similar later this week or any other time, or if I could have access to the repo (I totally understand if that is not possible, just a suggestion).

@betterthanever2
Copy link
Author

Thank you for helping out with this, and I appreciate your patience with the polylith tool! 😄

There's a couple of bugs we already have identified that I will add as issues and work on:

* terminal weirdness with double screens (looks like PowerShell)

* too naive library comparison, such as python-youtube vs pyyoutube

The rest is a bit difficult to find out for now. If it would be ok for you I could have a closer look in the code in a zoom-call or similar later this week or any other time, or if I could have access to the repo (I totally understand if that is not possible, just a suggestion).

Wow, you're really going heavy on this. I appreciate it. Let me sleep on the code exposure thing, tough.

As for the patience - really not much was required. Sure, I got confused here and there, like it happens every time I learn something new, but it was comparatively easy to resolve in each case. I think, this is in part, due to easy-to-grasp architecture, and in part, - to the really great documentation you have. Thanks for that - saves time, reduces frustration.

@betterthanever2
Copy link
Author

@DavidVujic we can do a zoom call, if you don't mind me asking questions about polylith

@DavidVujic
Copy link
Owner

Great! Of course, questions are welcome 😄

@betterthanever2
Copy link
Author

Not sure how to connect. Here's my email

@DavidVujic
Copy link
Owner

I'll close this one, added new Github issues:

#76
#77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants