Patch coming in a few minutes, adds a port of pyinfra: https://pyinfra.com/ pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands. Think ansible but Python instead of YAML, and a lot faster. I also take maintainership of this port.
Created attachment 250912 [details] Add py-pyinfra port to sysutils, 2.9.2 release. Apply patch with `git am`. Added to the sysutils category like similar tools (e.g. ansible). Disclaimer: This is my first python port, so I may have overlooked something. But everything seems to work as far as I tested (poudriere, runtime, 14.0-RELEASE).
Created attachment 252324 [details] Add py-pyinfra port to sysutils, 3.0.2 release. Update the patch for pyinfra 3.0.2 release, apply with `git am`. Please consider to add this to the ports tree. I have pyinfra successfully in use now for quite some time, and I'm happy with it.
Hi Florian, suggestion: please check `portlint -abct` (ports-mgmt/portlint) and `portclippy Makefile`, `portfmt -D Makefile` (parts of ports-mgmt/portfmt). Question: why doesn't need py*-graphlib-backport, py*-importlib-metadata and py*-typing-extension only with "older" python versions? As I see all ports are available with python 3.11. The software ships test, as I see it uses pytest: https://docs.freebsd.org/en/books/porters-handbook/book/#uses-pytest Please adapt it too! Thanks for your work!
(In reply to Zsolt Udvari from comment #3) Hi Zsolt, thanks for tackling this. > suggestion: please check `portlint -abct` (ports-mgmt/portlint) and `portclippy Makefile`, `portfmt -D Makefile` (parts of ports-mgmt/portfmt). I think I did some but not all of the checks you mention - will double check. > Question: why doesn't need py*-graphlib-backport, py*-importlib-metadata and py*-typing-extension only with "older" python versions? As I see all ports are available with python 3.11. To make the port build with python versions older than 3.11, which are still available in the ports tree? These python libraries are backports of features introduced with newer python versions, so python 3.11 already has them included. If there's a more canonical way to achieve this, please tell me. > The software ships test, as I see it uses pytest: https://docs.freebsd.org/en/books/porters-handbook/book/#uses-pytest > Please adapt it too! The problem with tests is that upstream requires very specific versions of external python libraries, down to the exact point release. These are easily available on pip, but not in FreeBSD ports. I would have to either - Patch the build file with relaxed dependency versions, and use dependencies from FreeBSD ports. - Get the libraries from pip just for the tests, with libraries not patched for FreeBSD. I suppose the latter is not feasible, and somehow defies the purpose of testing when the library versions are different. For the first approach I'd need a way to define dependencies for testing only, IIRC they are somewhat extensive (formatters, linters etc.), and we don't want them in a normal package build?
"To make the port build with python versions older than 3.11, which are still available in the ports tree?" There is a default python version (now is 3.11), but available older versions too. If anyone builds your packages from ports tree can choose some versions. "These python libraries are backports of features introduced with newer python versions, so python 3.11 already has them included." All of them is available in package repositories too: py311-graphlib-backport-1.1.0 Backport of the Python 3.9 graphlib module for Python 3.6+ py311-importlib-metadata-7.2.1 Read metadata from Python packages py311-typing-extensions-4.12.2 Backported and Experimental Type Hints for Python 3.5+ I'm not using python so I don't know. Could you please test if it works if you install them as dependencies? Makefile would be simpler without these ifs. "For the first approach I'd need a way to define dependencies for testing only, IIRC they are somewhat extensive (formatters, linters etc.), and we don't want them in a normal package build?" Yes, you can set the TEST_DEPENDS variable. See an example: https://cgit.freebsd.org/ports/tree/editors/retext/Makefile
(In reply to Zsolt Udvari from comment #5) > "These python libraries are backports of features introduced with newer python versions, so python 3.11 already has them included." > All of them is available in package repositories too: > py311-graphlib-backport-1.1.0 Backport of the Python 3.9 graphlib module for Python 3.6+ > py311-importlib-metadata-7.2.1 Read metadata from Python packages > py311-typing-extensions-4.12.2 Backported and Experimental Type Hints for Python 3.5+ > I'm not using python so I don't know. Could you please test if it works if you install them as dependencies? Makefile would be simpler without these ifs. I can't tell you why these backports are available for python 3.11 - fact is they are not needed and these dependencies can be pruned when the older python versions are removed from ports. I would imagine there's some runtime trouble too when the backport is installed together with the python's own library. If you're not sure about it, I strongly suggest to follow what other python ports do. For e.g. graphlib backport see net/py-errbot or devel/py-strawberry-graphql, it's the same as proposed in my patch. For some of the other backports you'll find examples of both conditional and unconditional dependencies, but I think it's safer to omit the dependencies when not needed. Patch update coming soon.
Created attachment 252569 [details] Add sysutils/py-pyinfra ports, 3.0.2 release, with tests, Makefile linted. Ok, port linters and formatters are happy now, added TEST_DEPENDS (for the unit tests, no code formatting and type tests). Some tests are explicitly ignored, because they require docker or an installation of pyinfra first. I didn't change the conditional dependencies as explained in the previous comment.
(In reply to Florian Walpen from comment #6) "If you're not sure about it, I strongly suggest to follow what other python ports do. For e.g. graphlib backport see net/py-errbot or devel/py-strawberry-graphql, it's the same as proposed in my patch." Okay, it's a good example, you convinced me.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=c1d6e47d5cc43f23d5d93154b539de3a427a2465 commit c1d6e47d5cc43f23d5d93154b539de3a427a2465 Author: Florian Walpen <dev@submerge.ch> AuthorDate: 2024-08-07 05:47:57 +0000 Commit: Zsolt Udvari <uzsolt@FreeBSD.org> CommitDate: 2024-08-07 05:47:57 +0000 sysutils/py-pyinfra: new port: automates infrastructure pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands. Think ansible but Python instead of YAML, and a lot faster. PR: 279262 sysutils/Makefile | 1 + sysutils/py-pyinfra/Makefile (new) | 59 +++++++++++++++++++++++++++++++++++++ sysutils/py-pyinfra/distinfo (new) | 3 ++ sysutils/py-pyinfra/pkg-descr (new) | 6 ++++ 4 files changed, 69 insertions(+)
Great work! Committed, thanks!