Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of R packages automation tools in Python

I'm an R user. I'm used to, when creating a project in R, developing an R package. Simply because R packages have a standard structure of file organization, naming, conventions, etc... So that makes life way easier. Whenever I need a new R package, I simply go on RStudio and "Create New Package". If I need to use tests or add dependencies, I'll use usethis package and that pretty much does it for me.

Now I'm doing a bit of a switch to Python and... How would I do the same? I can create some python scripts, define some dependencies. But what is the "convention" for doing python projects? I know there's a pattern defined by https://pypi.org/.

Is there a way to automate such pattern creation, just like RStudio automates R packages developing?

like image 397
eduardokapp Avatar asked Oct 15 '25 04:10

eduardokapp


2 Answers

Eventually, I found an online book that was exactly what I was looking for. https://py-pkgs.org/ is pretty much a complete guide (from design practices to unit tests, documentation and whatnot) for making python packages using automation tools such as cookiecutter and poetry. The key point is that the whole book is inspired by the process of making R packages, which is what I was looking for.

like image 95
eduardokapp Avatar answered Oct 17 '25 14:10

eduardokapp


uv is a powerful tool for managing dependencies and other package development tasks (e.g. adding a package to a project with uv add):
https://github.com/astral-sh/uv
This is similar to poetry as recommended in the other answer but is more heavily optimized for performance and is also more standards compliant.

For other project configuration tasks such as configuring a test suite, linter tools and the like, consider using usethis for Python:
https://github.com/nathanjmcdougall/usethis-python
e.g. usethis tool pytest.

Disclaimer: I am the author of the usethis Python package.

like image 32
nathan.j.mcdougall Avatar answered Oct 17 '25 12:10

nathan.j.mcdougall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!