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

make meaningless encoding parameter from convert_file method deprecated #340

Merged

Conversation

chrisdecker1201
Copy link
Contributor

I think this encoding parameter is a relic of copying the convert_text method, because it's not used.

As far as I understood the current behavior of the convert_file method, it will just execute pandoc with the given file(s).

I think there might be the possibility to implement the encoding parameter in two ways:

  1. check the encoding and bring an error if it's the wrong encoding
  2. convert the given encoding to utf-8 in a temporary file and use this temporary file as input for pandoc

Nevertheless, I think to remove confusion it might be the best solution to just remove the parameter :)

@JessicaTegner
Copy link
Owner

@chrisdecker1201 I agree. We could remove it.
TO do this, I would suggest having it in the function signature as is (basically current behaviour), but issue a deprecation warning that it will be removed in pypandoc 1.13 so 1.11 (current) 1.12 (warning) 1.13 (removed).

Let me know what you think

@chrisdecker1201
Copy link
Contributor Author

@JessicaTegner I think this is a good idea. But I've no idea how to set this property to deprecated.

@JessicaTegner
Copy link
Owner

@chrisdecker1201 it's not that complicated, it is the following:

  • Change no functional code.

  • Let Write a deprecated in the docstring like the following

    :param str encoding (deprecated): the encoding of the input bytes (Default value = 'utf-8')

  • Use the logger to print a warning message.

@chrisdecker1201 chrisdecker1201 changed the title remove meaningless encoding parameter from convert_file make meaningless encoding parameter from convert_file deprecated Sep 1, 2023
@chrisdecker1201
Copy link
Contributor Author

@JessicaTegner Like that?

Thank you for taking your time for this 🙂

@chrisdecker1201 chrisdecker1201 changed the title make meaningless encoding parameter from convert_file deprecated make meaningless encoding parameter from convert_file method deprecated Sep 1, 2023
pypandoc/__init__.py Outdated Show resolved Hide resolved
pypandoc/__init__.py Outdated Show resolved Hide resolved
@JessicaTegner JessicaTegner merged commit 5848968 into JessicaTegner:master Sep 4, 2023
34 checks passed
@chrisdecker1201
Copy link
Contributor Author

@JessicaTegner Just question: Do you just remove the parameter then in version 1.13 or should I prepare a PR?

@JessicaTegner
Copy link
Owner

@chrisdecker1201 there is really 2 options.

  • You are more than welcome to make a pr for it
  • Or alternatively, you are more than welcome to make an issue descriping it, so someone else can take it on. It might even be a good first issue for some

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.

2 participants