Live data from Hacker News

How to create a Python package in 2022

mathspp.com

51–60 of 153 posts

Re: How to create a Python package in 2022

#52
post #8

You can take this a step further and completely automate the release of your package. That means the tagging, publishing and the GitHub release notes. I don't have a blog post but you can see the process on my personal project https://github.com/DontShaveTheYak/cf2tf Check out the merged PR's and the GitHub actions. I even do alpha releases to test pypi.

To that end, I've had good success with `replease-please`: https://github.com/googleapis/release-please . It's available as a GitHub Action and works out of the box very easily. It does tagging, publishing, editing the CHANGELOG, creating a release and more. Whatever you want it to, really, using a bool flag in the CI pipeline that triggers after a release-please release was made aka merged into main.

Re: How to create a Python package in 2022

#53

This is really nicely written; kudos to the author for compiling a great deal of information in a readable format. If I can be forgiven one nitpick: Poetry does not use a PEP 518-style[1] build configuration by default, which means that its use of `pyproject.toml` is slightly out of pace with the rest of the Python packaging ecosystem. That isn't to say that it isn't excellent, because it is! But you the standards ha…

If I can be forgiven another nitpick regarding readability:

The font size is extremely small to the point of being unreadable on a mobile phone.

Re: How to create a Python package in 2022

#54
post #53

This is really nicely written; kudos to the author for compiling a great deal of information in a readable format. If I can be forgiven one nitpick: Poetry does not use a PEP 518-style[1] build configuration by default, which means that its use of `pyproject.toml` is slightly out of pace with the rest of the Python packaging ecosystem. That isn't to say that it isn't excellent, because it is! But you the standards ha…

If I can be forgiven another nitpick regarding readability: The font size is extremely small to the point of being unreadable on a mobile phone.

I think the font size is perfect, but I take offense to the font used for headings

Re: How to create a Python package in 2022

#55
My only gripe with poetry is that when I tried it out last year there was no equivalent for `pip install -e` which can be used to install other python package dependancies that you are simultaneously developing. I found that feature useful enough to stick with setuptools and setup.py instead.

Re: How to create a Python package in 2022

#56
post #55

My only gripe with poetry is that when I tried it out last year there was no equivalent for `pip install -e` which can be used to install other python package dependancies that you are simultaneously developing. I found that feature useful enough to stick with setuptools and setup.py instead.

Poetry has path dependencies and the develop flag to enable the same editable functionality

https://python-poetry.org/docs/dependency-specification/#pat...

Re: How to create a Python package in 2022

#57
I wish people would just forget about pre-commit, this thing is especially useless in a setting where a CI/CD pipeline exists. It's not that hard to write a simple Makefile or shellscript to run linters on push.

Pre-commit is one of the most annoying tools that have come into existence in recent years that everyone seems to be cargo-culting. It doesn't play well with editors since in order to find the actual binary path, you'd have to open up a sqlite database to fish out the virtualenv pre-commit created. Pre-commit also increases maintenance burden, since its configuration is completely separate from your usual requirements-dev.txt/pyproject.toml/setup.cfg etc. If you have dev dependencies in one of these files because making your editors to find the pre-commit created binaries are hard, now you have to keep both versions in sync.

I really don't see the point of any pre-commit hooks unless you are the one guy that doesn't use a modern CI/CD platform.

Re: How to create a Python package in 2022

#58
Fantastic article. Thank you so much for putting this together. Any thoughts of putting this in a Git repo somewhere so that it can be a living reference contributed to by others? Otherwise, I worry that in 6 months this will start to get confusing, and in 18 months it will be dangerously out of date (though I haven’t used poetry yet, so maybe they aim for more stability).

Re: How to create a Python package in 2022

#59
post #55

My only gripe with poetry is that when I tried it out last year there was no equivalent for `pip install -e` which can be used to install other python package dependancies that you are simultaneously developing. I found that feature useful enough to stick with setuptools and setup.py instead.

Poetry has path dependencies and the develop flag to enable the same editable functionality https://python-poetry.org/docs/dependency-specification/#pat...

Thanks, I think that the thing this still lacks compared to `pip install -e` is that the develop dependency is then only visible inside other packages configured with poetry. So it is not useful for example if you want to locally install a package you make to be accessed through cli or any other python script not using poetry.

Re: How to create a Python package in 2022

#60
Hm, it's very strange argument regarding src directory. Article they refers to mentioned main issue with package in root is: it's possible to miss submodules in final released py-package. But src doesn't prevent this. You also can run your tests. But without proper packages option or find_packages in setup.py one gets a broken package.
Post reply on HN