hatch icon indicating copy to clipboard operation
hatch copied to clipboard

Migration from setup.py to project.toml: comments in requirements.txt are included

Open wenh06 opened this issue 1 year ago • 3 comments

I ran "hatch new --init" and found the comments in the requirements files are also included in the generated project.toml file. This would fail the command python -m build.

wenh06 avatar Aug 24 '24 09:08 wenh06

Can you please provide an example?

ofek avatar Aug 24 '24 17:08 ofek

See the example

image

The example setup.py is as follows:

"""
"""

from pathlib import Path

import setuptools

cwd = Path(__file__).absolute().parent

long_description = (cwd / "README.md").read_text(encoding="utf-8")


setuptools.setup(
    name="sample",
    version="0.1.0",
    author="Hao WEN",
    author_email="[email protected]",
    license="MIT",
    description="Hatch Debug.",
    long_description=long_description,
    long_description_content_type="text/markdown",
    package_dir={"": "src"},
    packages=setuptools.find_packages("src"),
    classifiers=[
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "Programming Language :: Python :: 3.11",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    python_requires=">=3.6",
    install_requires=open("requirements.txt").readlines(),
)

Another question is: I specified the version explicitly in setup.py, why did hatch still point it to a file that does not exist?

wenh06 avatar Aug 25 '24 02:08 wenh06

@ofek

wenh06 avatar Aug 26 '24 08:08 wenh06