Skip to content

Use pypandoc.convert_text instead of pypandoc.convert#21

Open
shmpwk wants to merge 1 commit into
msabramo:masterfrom
shmpwk:patch-1
Open

Use pypandoc.convert_text instead of pypandoc.convert#21
shmpwk wants to merge 1 commit into
msabramo:masterfrom
shmpwk:patch-1

Conversation

@shmpwk

@shmpwk shmpwk commented May 11, 2022

Copy link
Copy Markdown

Currently, pypandoc does not have convert function. https://github.com/NicklasTegner/pypandoc/blob/master/pypandoc/__init__.py
pypandoc only has convert_file or convert_text.

Actually pypandoc previously have convert function like https://github.com/NicklasTegner/pypandoc/blob/c06d7b64a58729fa174b7721dac6c600fad166af/pypandoc/__init__.py

@jpic

jpic commented May 12, 2022

Copy link
Copy Markdown

Please release ASAP, convert function has been deprecated for over a year, also affected:

$ pip install -Ue .
Obtaining file:///home/jpic/src/web3.py
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [32 lines of output]
long_description_markdown_filename: dist = <setuptools.dist.Distribution object at 0x7f142f8e28c0>; attr = 'long_description_markdown_filename'; value = 'README.md'
markdown_filename = 'README.md'
Traceback (most recent call last):
File "/home/jpic/src/env/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in
main()
File "/home/jpic/src/env/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/jpic/src/env/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 164, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-1urt852u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 188, in prepare_metadata_for_build_wheel
self.run_setup()
File "/tmp/pip-build-env-1urt852u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 281, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-1urt852u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
exec(compile(code, file, 'exec'), locals())
File "setup.py", line 58, in
setup(
File "/tmp/pip-build-env-1urt852u/overlay/lib/python3.10/site-packages/setuptools/init.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/tmp/pip-build-env-1urt852u/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 109, in setup
_setup_distribution = dist = klass(attrs)
File "/tmp/pip-build-env-1urt852u/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 472, in init
_Distribution.init(
File "/tmp/pip-build-env-1urt852u/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 293, in init
self.finalize_options()
File "/tmp/pip-build-env-1urt852u/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 896, in finalize_options
ep(self)
File "/tmp/pip-build-env-1urt852u/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 917, in _finalize_setup_keywords
ep.load()(self, ep.name, value)
File "/tmp/pip-build-env-1urt852u/normal/lib/python3.10/site-packages/setuptools_markdown.py", line 43, in long_description_markdown_filename
output = pypandoc.convert(markdown_filename, 'rst', format='md')
AttributeError: module 'pypandoc' has no attribute 'convert'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: You are using pip version 22.0.4; however, version 22.1 is available.
You should consider upgrading via the '/home/jpic/src/env/bin/python -m pip install --upgrade pip' command.

jpic added a commit to jpic/web3.py that referenced this pull request May 12, 2022
bzamecnik added a commit to rossumai/nvgpu that referenced this pull request Mar 30, 2023
msabramo/setuptools-markdown#21
setuptools-markdown use old API of pandoc and is the updated.
boon-code added a commit to boon-code/docker-inside that referenced this pull request Jun 16, 2023
`setuptools-markdown` relies on a deprecated function
`pypandoc.convert`. This patch explicitly requests an older version of
`pypandoc` until a patch has been released for `setuptools-markdown`:
- msabramo/setuptools-markdown#21

In addition, the environment variable `NO_PANDOC` has been introduced
to allow to build and install `docker-inside` without adding
`setuptools-markdown` and `pypandoc` as a build time dependency
(`setup_requires`).
boon-code added a commit to boon-code/docker-inside that referenced this pull request Jun 16, 2023
`setuptools-markdown` relies on a deprecated function
`pypandoc.convert`. This patch explicitly requests an older version of
`pypandoc` until a patch has been released for `setuptools-markdown`:
- msabramo/setuptools-markdown#21

In addition, the environment variable `NO_PANDOC` has been introduced
to allow to build and install `docker-inside` without adding
`setuptools-markdown` and `pypandoc` as a build time dependency
(`setup_requires`).
boon-code added a commit to boon-code/docker-inside that referenced this pull request Jun 16, 2023
`setuptools-markdown` relies on a deprecated function
`pypandoc.convert`. This patch explicitly requests an older version of
`pypandoc` until a patch has been released for `setuptools-markdown`:
- msabramo/setuptools-markdown#21

In addition, the environment variable `NO_PANDOC` has been introduced
to allow to build and install `docker-inside` without adding
`setuptools-markdown` and `pypandoc` as a build time dependency
(`setup_requires`).
boon-code added a commit to boon-code/docker-inside that referenced this pull request Jun 18, 2023
`setuptools-markdown` relies on a deprecated function
`pypandoc.convert`. This patch explicitly requests an older version of
`pypandoc` until a patch has been released for `setuptools-markdown`:
- msabramo/setuptools-markdown#21

In addition, the environment variable `NO_PANDOC` has been introduced
to allow to build and install `docker-inside` without adding
`setuptools-markdown` and `pypandoc` as a build time dependency
(`setup_requires`).
boon-code added a commit to boon-code/docker-inside that referenced this pull request Jun 18, 2023
`setuptools-markdown` is deprecated now:
- https://dustingram.com/articles/2018/03/16/markdown-descriptions-on-pypi/

`setuptools >= 38.6.0` now has support to include markdown.

`setuptools-markdown` relies on a deprecated function
`pypandoc.convert`. Newer versions of pypandoc are not supporting this
function anymore and this broke the build. A patch is pending but
`setuptools-markdown` has been deprecated:
- msabramo/setuptools-markdown#21
- https://pypi.org/project/setuptools-markdown/

In addition, the environment variable `NO_README` has been introduced
to allow to build and install `docker-inside` without adding
the markdown description (which is only required for releases on
pypi).
@jquast

jquast commented Feb 22, 2024

Copy link
Copy Markdown

@msabramo this bug continues to cause of a lot of grief, hundreds of packages on github are still impacted https://github.com/search?q=long_description_markdown_filename+path%3A**%2Fsetup.py++NOT+is%3Afork&type=code

Could you please reconsider merging this change and re-releasing to pypi?

If you intend not to make any further changes to this project, please also let me know that. I will try to persuade @JessicaTegner to consider re-introducing this legacy function. As many of the impacted packages are no longer maintained it is difficult to persuade them to accept a setup.py change of long_description_markdown_filename='README.md' to long_description_content_type='text/markdown' and re-release to pypi.

Note that the error message is different without 'wheel' package installed,

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      /Users/jq/.virtualenvs/apple1serui-zxme/lib/python3.12/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      /private/var/folders/0x/y8s2qlk558596kyqdhv3nwv40000gn/T/pip-install-dqeaq8x1/streamexpect_b58f212c03f24251b5e515b64a78cb72/.eggs/pypandoc-1.13-py3.12.egg/pypandoc/pandoc_download.py:61: SyntaxWarning: invalid escape sequence '\.'
        regex = re.compile(r"/jgm/pandoc/releases/download/.*(?:"+processor_architecture+"|x86|mac).*\.(?:msi|deb|pkg)")
      long_description_markdown_filename: dist = <setuptools.dist.Distribution object at 0x103b7a3c0>; attr = 'long_description_markdown_filename'; value = 'README.md'
      markdown_filename = '/private/var/folders/0x/y8s2qlk558596kyqdhv3nwv40000gn/T/pip-install-dqeaq8x1/streamexpect_b58f212c03f24251b5e515b64a78cb72/README.md'
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/0x/y8s2qlk558596kyqdhv3nwv40000gn/T/pip-install-dqeaq8x1/streamexpect_b58f212c03f24251b5e515b64a78cb72/setup.py", line 20, in <module>
          setup(
        File "/Users/jq/.virtualenvs/apple1serui-zxme/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/jq/.virtualenvs/apple1serui-zxme/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
                                       ^^^^^^^^^^^^
        File "/Users/jq/.virtualenvs/apple1serui-zxme/lib/python3.12/site-packages/setuptools/dist.py", line 303, in __init__
          _Distribution.__init__(self, dist_attrs)
        File "/Users/jq/.virtualenvs/apple1serui-zxme/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 283, in __init__
          self.finalize_options()
        File "/Users/jq/.virtualenvs/apple1serui-zxme/lib/python3.12/site-packages/setuptools/dist.py", line 654, in finalize_options
          ep(self)
        File "/Users/jq/.virtualenvs/apple1serui-zxme/lib/python3.12/site-packages/setuptools/dist.py", line 674, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/private/var/folders/0x/y8s2qlk558596kyqdhv3nwv40000gn/T/pip-install-dqeaq8x1/streamexpect_b58f212c03f24251b5e515b64a78cb72/.eggs/setuptools_markdown-0.4.1-py3.12.egg/setuptools_markdown.py", line 43, in long_description_markdown_filename
          output = pypandoc.convert(markdown_filename, 'rst', format='md')
                   ^^^^^^^^^^^^^^^^
      AttributeError: module 'pypandoc' has no attribute 'convert'

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.

3 participants