-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: better support for converter tool on windows
- Loading branch information
1 parent
68bf97d
commit 0c0a8dc
Showing
2 changed files
with
17 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0c0a8dc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad my edits were helpful! However, in
convertfromhtml.py
you left out the initialized value of_encoding
, which is needed in case there is noencodingflag
set. Just add the line_encoding = 'utf8'
on line 153, and change line 169 to sayencoding=_encoding
, and everything should work properly.Also, you may want to update
README.md
to include this update to the conversion tool, in case other Windows users need to make use of it.0c0a8dc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the
extras_require
insetup.py
needs to either be changed toinstall_require={"all":...
(as the dependencies are mandatory for all portions of htmlgenerator to function properly), or toextras_require={"converter":...
to only install the dependencies if the user plans to useconvertfromhtml
. I believe the "proper" solution is to useconverter
, and then add a note inREADME.md
stating that the command-line tool needs to be installed by usingpip install "htmlgenerator[converter]"
.0c0a8dc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups, that went missing (I only have tests for the html-parser, but none for the parsing of the commandline flags). Fixed it, but I initialize it with the default encoding of the system, which mirrors the original behaviour when not passing the flag. And actually I am not sure if we should even consider the encoding parameter when writing the file. In your case you got a "cp1252" encoded file as output, didn't you?
README.md
is updated too now.0c0a8dc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not aware that
install_require
can use a dictionary, how do you mean that?Regarding the "converter" extra requirement, I will keep it with "all". I prefer "all" because it is a very common extra dependency name in Python packages to make sure every possibly necessary dependency is installed.
0c0a8dc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, running
locale.getpreferredencoding()
returns cp1252 on my Windows machines and utf8 on my Mac. You're right that encoding parameter is not needed for this example, as I didn't realize that cp1252 and utf8 are compatible, but there may be cases where the encoding flag is still necessary.That was a mistake on my part, it should have been
install_require=["black", "beautifulsoup4", "lxml;platform_system!='Windows'"]
. I believe thatextras_require={"all"...
is the same asinstall_requires=
, except it requires the user to install the package aspip install "htmlgenerator[all]"
, which would need to be mentioned in readme. The only reason I would say to use the extras dictionary is so that applications built using htmlgenerator don't automatically bundle the dependencies, as the converter tool would not be utilized.