• Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 months ago

    hatch has hardcoded awareness of Git and Mercurial and specifically searches for project-level .gitignore and .hgignore to read those files directly. But it doesn’t handle user-level or system-level config, so anything you have ignored from config outside of your project, like .env in my example, will not be ignored by hatch, and will wind up in your sdist.

    ah that probably explains why I didn’t have this problem, same reason why I don’t like global gitignores

    • dan_p_the_dev@lemmy.worldOP
      link
      fedilink
      arrow-up
      2
      ·
      2 months ago

      Even if you’re using git or hg for version control you’ll probably wind up with more in your sdist than you need: things like uv.lock, Justfile, or the contents of your tests/ dir might not be harmful, but they bloat your sdist and don’t really belong there, and hatch will package them up with your source code unless you explicitly configure it not to.

        • dan_p_the_dev@lemmy.worldOP
          link
          fedilink
          arrow-up
          2
          ·
          2 months ago

          Interesting discussion, thanks for the link! I side with pf_moore there; when I think of distributing a library I think of shipping only the library code itself and none of the supporting files, although I can understand the argument to include things like tests/ and docs/.

          That said, if you haven’t already tailored your project for hatch, configuring only-include is more work than switching to a build backend that just bundles source modules by default. With the right config hatch can do what you like, and I can understand existing users sticking with it, but for newbies I think it’s really risky to suggest a build backend that grabs everything it finds in the working directory and packages it up for PyPI. It’s just surprising and dangerous default behavior imo.

    • Eager Eagle@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      arrow-down
      1
      ·
      edit-2
      2 months ago

      It’s the conservative choice, which is maybe not ideal for new projects as it predates many PEPs. Hatch, uv, poetry, pdm, are probably all better modern choices.

        • Eager Eagle@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 months ago

          Caution

          If you use setuptools, please be aware that some features that predate standardisation efforts are now deprecated and only temporarily kept for compatibility.

          In particular, do not use direct python setup.py invocations. On the other hand, configuring setuptools with a setup.py file is still fully supported, although it is recommended to use the modern [project] table in pyproject.toml (or setup.cfg) whenever possible and keep setup.py only if programmatic configuration is needed. See Is setup.py deprecated?.

          Other examples of deprecated features you should not use include the setup_requires argument to setup() (use the [build-system] table in pyproject.toml instead), and the easy_install command (cf. pip vs easy_install).

          https://packaging.python.org/en/latest/guides/tool-recommendations/

          it’s just easier to have a modern hassle-free setup with the other tools

  • onlinepersona@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    2 months ago

    Thank you. That seems quite problematic. I would expect the build backend only to include what I tell it to. IIRC pyproject has a field to tell which packages exist in the project and I’d expect only that to be included + what was specified e.g resources like images.

  • logging_strict@programming.dev
    link
    fedilink
    arrow-up
    1
    arrow-down
    5
    ·
    2 months ago

    There is no way for xyz to be either included or excluded from a package cuz everyone should be running python -m build and checking the tarball and .whl before even considering a commit or a release.

    So although the OP chose hitch that doesn’t change the workflow of manually checking the tarball.

    I use setuptools, wreck (requirements management), and drain-swamp (choose versioning by either “tag” or “current” rather than specifying exact semantic version). What i use has no bearing on the opinion above.

    “modern” means you are a little bitch. I’m very tired of that term. A function with multiple return statements is considered “modern”. Whereas i see that as wrong. So now that “modern” word is being thrown around for packaging?! Please stop using that term. It’s a cope for not being able to code your own build backend (drain-swamp), frame stack free locals inspection (logging-strict), and requirements management (wreck)!

    Use whatever you are familiar with without peer pressuring others.