The Wombelix Post - Pythonhttps://dominik.wombacher.cc/2021-10-09T00:00:00+02:00Release: MoinMoin Wiki Container, powered by PyPy22021-10-09T00:00:00+02:002021-10-09T00:00:00+02:00Dominik Wombachertag:dominik.wombacher.cc,2021-10-09:/posts/release-moinmoin-wiki-container-powered-by-pypy2.html<!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>Today I published the first version of <strong>moinmoin-pypy2-container</strong>,
a ready to use image to run MoinMoin Wiki, based on openSUSE Leap.</p>
<p>It contains some enhancements regarding the intial wiki setup ... <a class="read-more" href="/posts/release-moinmoin-wiki-container-powered-by-pypy2.html"> [read more]</a></p><!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>Today I published the first version of <strong>moinmoin-pypy2-container</strong>,
a ready to use image to run MoinMoin Wiki, based on openSUSE Leap.</p>
<p>It contains some enhancements regarding the intial wiki setup to make it
easier to get started and already ships with a pre-configured nginx.</p>
<p>Latest stable release of <a class="reference external" href="https://moinmo.in">MoinMoin</a>
was 8th November 2020 and requires Python 2, development of the successor
<a class="reference external" href="https://github.com/moinwiki/moin">moin2</a> is ongoing but wasn't released yet.</p>
<p><strong>moin2</strong> supports Python 3, but there is still a lot to do and the Project could use some
<a class="reference external" href="https://github.com/moinwiki/moin/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22">help</a>,
what about a <a class="reference external" href="https://github.com/moinwiki/moin/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22">good first issue</a>?</p>
<p>It might be that User still want to keep using the latest stable
release and wait with the migration for a while.</p>
<p>Besides minor enhancements, the main goal of <strong>moinmoin-pypy2-container</strong>
is to provide a easy to use alternative to keep using MoinMoin.</p>
<p>The official Python 2 Runtime is <a class="reference external" href="https://www.python.org/doc/sunset-python-2/">End-of-Life</a>.
But PyPy will support Python 2 <a class="reference external" href="https://doc.pypy.org/en/latest/faq.html#how-long-will-pypy-support-python2">"forever"</a>
and still provide updates in future.</p>
<p>Please check the <strong>README</strong> in the below linked Source code Repository
for further details about the <em>features</em> and <em>usage</em>.</p>
<p>The repository is available on
<a class="reference external" href="https://codeberg.org/wombelix/moinmoin-pypy2-container">Codeberg</a> (Primary),
<a class="reference external" href="https://gitlab.com/wombelix/moinmoin-pypy2-container">Gitlab</a> (Mirror),
<a class="reference external" href="https://github.com/wombelix/moinmoin-pypy2-container">Github</a> (Mirror).</p>
<p>Pre-build Container Images can be downloaded from
<a class="reference external" href="https://quay.io/repository/wombelix/moinmoin-pypy2?tab=info">quay.io</a>.</p>
Installing static site generator Pelican inclusive Plugins with pipx2021-09-25T00:00:00+02:002021-09-25T00:00:00+02:00Dominik Wombachertag:dominik.wombacher.cc,2021-09-25:/posts/installing-static-site-generator-pelican-inclusive-plugins-with-pipx.html<!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>Quick one, after re-installing my Notebook, I had to configure lot of things again and I wasn't happy with my earlier Python venv setup.</p>
<p>I was taking a deeper look ... <a class="read-more" href="/posts/installing-static-site-generator-pelican-inclusive-plugins-with-pipx.html"> [read more]</a></p><!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>Quick one, after re-installing my Notebook, I had to configure lot of things again and I wasn't happy with my earlier Python venv setup.</p>
<p>I was taking a deeper look into pipx and I think that's way easier to use.
It just take care about a venv per package that I'm going to install, I don't have to take care about anything on my own.</p>
<p>I tried it and after learning about the <em>inject</em> feature, mentioned by
<a class="reference external" href="https://github.com/getpelican/pelican/issues/2554#issuecomment-485136726">cs01 in a GitHub Issue</a>
(Archive: <a class="reference external" href="https://web.archive.org/web/20200920144105/https://github.com/getpelican/pelican/issues/2554">[1]</a>,
<a class="reference external" href="https://archive.today/2021.09.28-125020/https://github.com/getpelican/pelican/issues/2554">[2]</a>)
it was no problem to install Pelican including some Plugins via pipx:</p>
<pre class="code text literal-block">
pipx install pelican
pipx inject pelican pelican-pdf
pipx inject pelican markdown
pipx inject pelican pelican-read-more
</pre>
pipx behave different than pip if package already exists2021-09-23T00:00:00+02:002021-09-23T00:00:00+02:00Dominik Wombachertag:dominik.wombacher.cc,2021-09-23:/posts/pipx-behave-different-than-pip-if-package-already-exists.html<!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>I decided to put as much as possible of my local config into an Ansible Playbook.
Makes it easier to track what I install and change, also to setup from ... <a class="read-more" href="/posts/pipx-behave-different-than-pip-if-package-already-exists.html"> [read more]</a></p><!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>I decided to put as much as possible of my local config into an Ansible Playbook.
Makes it easier to track what I install and change, also to setup from scratch should it necessary.</p>
<p>In the past I mainly used <cite>pip</cite> in combination with <cite>venv</cite> to install Python stuff.
Changing for most of it to <cite>pipx</cite> seems logical, it will take care about the necessary <em>venvs</em> on it's own.</p>
<p>Just had to learn that the return code of <cite>pip</cite> is <strong>0</strong> but from <cite>pipx</cite> it's <strong>1</strong> in case a package already exists.</p>
<p>Why does it matter? Not the most elegant solution but I decided to just use <cite>command</cite> to trigger <em>pip</em> / <em>pipx</em> from my Playbook:</p>
<pre class="code yaml literal-block">
<span class="pygments-p-Indicator">-</span><span class="pygments-w"> </span><span class="pygments-nt">name</span><span class="pygments-p">:</span><span class="pygments-w"> </span><span class="pygments-l-Scalar-Plain">Python Package Installation (pip)</span><span class="pygments-w">
</span><span class="pygments-nt">command</span><span class="pygments-p">:</span><span class="pygments-w"> </span><span class="pygments-s">"python3</span><span class="pygments-nv"> </span><span class="pygments-s">-m</span><span class="pygments-nv"> </span><span class="pygments-s">pip</span><span class="pygments-nv"> </span><span class="pygments-s">install</span><span class="pygments-nv"> </span><span class="pygments-s">--user</span><span class="pygments-nv"> </span><span class="pygments-s">{{</span><span class="pygments-nv"> </span><span class="pygments-s">item</span><span class="pygments-nv"> </span><span class="pygments-s">}}"</span><span class="pygments-w">
</span><span class="pygments-nt">changed_when</span><span class="pygments-p">:</span><span class="pygments-w"> </span><span class="pygments-l-Scalar-Plain">false</span><span class="pygments-w">
</span><span class="pygments-nt">loop</span><span class="pygments-p">:</span><span class="pygments-w">
</span><span class="pygments-p-Indicator">-</span><span class="pygments-w"> </span><span class="pygments-l-Scalar-Plain">pipx</span><span class="pygments-w">
</span><span class="pygments-p-Indicator">-</span><span class="pygments-w"> </span><span class="pygments-l-Scalar-Plain">nox</span><span class="pygments-w">
</span><span class="pygments-p-Indicator">-</span><span class="pygments-w"> </span><span class="pygments-nt">name</span><span class="pygments-p">:</span><span class="pygments-w"> </span><span class="pygments-l-Scalar-Plain">Python Package Installation (pipx)</span><span class="pygments-w">
</span><span class="pygments-nt">command</span><span class="pygments-p">:</span><span class="pygments-w"> </span><span class="pygments-s">"pipx</span><span class="pygments-nv"> </span><span class="pygments-s">install</span><span class="pygments-nv"> </span><span class="pygments-s">{{</span><span class="pygments-nv"> </span><span class="pygments-s">item</span><span class="pygments-nv"> </span><span class="pygments-s">}}"</span><span class="pygments-w">
</span><span class="pygments-nt">changed_when</span><span class="pygments-p">:</span><span class="pygments-w"> </span><span class="pygments-l-Scalar-Plain">false</span><span class="pygments-w">
</span><span class="pygments-nt">loop</span><span class="pygments-p">:</span><span class="pygments-w">
</span><span class="pygments-p-Indicator">-</span><span class="pygments-w"> </span><span class="pygments-l-Scalar-Plain">poetry</span><span class="pygments-w">
</span><span class="pygments-p-Indicator">-</span><span class="pygments-w"> </span><span class="pygments-l-Scalar-Plain">duplicity</span><span class="pygments-w">
</span><span class="pygments-p-Indicator">-</span><span class="pygments-w"> </span><span class="pygments-l-Scalar-Plain">pre-commit</span><span class="pygments-w">
</span>
</pre>
<p>No problem with <cite>pip</cite>, but <cite>pipx</cite> failed after the first run.</p>
<p>There was an older <a class="reference external" href="https://github.com/pypa/pipx/issues/125">GitHub Issue</a>, based on the comments,
<cite>pipx</cite> was supposed to behave smilar as <cite>pip</cite> and also use return code 0 since v0.13 already.
After some research I found the <a class="reference external" href="https://github.com/pypa/pipx/pull/560">Pull Request</a>
that reverted the earlier change during some re-factoring.</p>
<p>Thanks to the great improvements in that PR, it was just a very small change necessary to restore the
functionality introduced in <a class="reference external" href="https://github.com/pypa/pipx/commit/11b853e9c6926b32133b27822516b2a5b4f35411">Commit 11b853e</a>:</p>
<pre class="code diff literal-block">
<span class="pygments-gh">diff --git a/docs/changelog.md b/docs/changelog.md</span><span class="pygments-w">
</span><span class="pygments-gh">index 0a95ce15..67d14929 100644</span><span class="pygments-w">
</span><span class="pygments-gd">--- a/docs/changelog.md</span><span class="pygments-w">
</span><span class="pygments-gi">+++ b/docs/changelog.md</span><span class="pygments-w">
</span><span class="pygments-gu">@@ -1,6 +1,7 @@</span><span class="pygments-w">
</span>dev<span class="pygments-w">
</span>- Fixed `pipx list` output phrasing to convey that python version displayed is the one with which package was installed.<span class="pygments-w">
</span><span class="pygments-gi">+- Fixed `pipx install` to provide return code 0 if venv already exists, similar to pip’s behavior. (#736)</span><span class="pygments-w">
</span>0.16.4<span class="pygments-w">
</span><span class="pygments-gh">diff --git a/src/pipx/constants.py b/src/pipx/constants.py</span><span class="pygments-w">
</span><span class="pygments-gh">index 4fe2d58b..11fc013f 100644</span><span class="pygments-w">
</span><span class="pygments-gd">--- a/src/pipx/constants.py</span><span class="pygments-w">
</span><span class="pygments-gi">+++ b/src/pipx/constants.py</span><span class="pygments-w">
</span><span class="pygments-gu">@@ -21,7 +21,7 @@</span><span class="pygments-w">
</span># pipx shell exit codes<span class="pygments-w">
</span>EXIT_CODE_OK = ExitCode(0)<span class="pygments-w">
</span>EXIT_CODE_INJECT_ERROR = ExitCode(1)<span class="pygments-w">
</span><span class="pygments-gd">-EXIT_CODE_INSTALL_VENV_EXISTS = ExitCode(1)</span><span class="pygments-w">
</span><span class="pygments-gi">+EXIT_CODE_INSTALL_VENV_EXISTS = ExitCode(0)</span><span class="pygments-w">
</span>EXIT_CODE_LIST_PROBLEM = ExitCode(1)<span class="pygments-w">
</span>EXIT_CODE_UNINSTALL_VENV_NONEXISTENT = ExitCode(1)<span class="pygments-w">
</span>EXIT_CODE_UNINSTALL_ERROR = ExitCode(1)<span class="pygments-w">
</span><span class="pygments-gh">diff --git a/tests/test_install.py b/tests/test_install.py</span><span class="pygments-w">
</span><span class="pygments-gh">index 941f4c01..0eb2d9cc 100644</span><span class="pygments-w">
</span><span class="pygments-gd">--- a/tests/test_install.py</span><span class="pygments-w">
</span><span class="pygments-gi">+++ b/tests/test_install.py</span><span class="pygments-w">
</span><span class="pygments-gu">@@ -109,7 +109,7 @@ def test_install_no_packages_found(pipx_temp_env, capsys):</span><span class="pygments-w">
</span>def test_install_same_package_twice_no_force(pipx_temp_env, capsys):<span class="pygments-w">
</span> assert not run_pipx_cli(["install", "pycowsay"])<span class="pygments-w">
</span><span class="pygments-gd">- assert run_pipx_cli(["install", "pycowsay"])</span><span class="pygments-w">
</span><span class="pygments-gi">+ assert not run_pipx_cli(["install", "pycowsay"])</span><span class="pygments-w">
</span> captured = capsys.readouterr()<span class="pygments-w">
</span> assert (<span class="pygments-w">
</span> "'pycowsay' already seems to be installed. Not modifying existing installation"<span class="pygments-w">
</span>
</pre>
<p>Related Pull Request: <a class="reference external" href="https://github.com/pypa/pipx/pull/736">https://github.com/pypa/pipx/pull/736</a></p>
<p>Merged into <cite>pipx/main</cite> on 25th September 2021</p>
<p>That's a good example why I love and prefer Open Source, I could fix the Problem on my own and share the improvement with the community, within a few days it was already merged and will be part of the next Release.</p>
Pelican Plugin: read-more2021-04-05T00:00:00+02:002021-04-05T00:00:00+02:00Dominik Wombachertag:dominik.wombacher.cc,2021-04-05:/posts/pelican-plugin-read-more.html<!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>The read-more Pelican Plugin was the second one I helped to migrate to the <a class="reference external" href="https://github.com/pelican-plugins">new Structure / GitHub Organization</a>.</p>
<p>After a specified length, it adds a <em>"read more"</em> link the the ... <a class="read-more" href="/posts/pelican-plugin-read-more.html"> [read more]</a></p><!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>The read-more Pelican Plugin was the second one I helped to migrate to the <a class="reference external" href="https://github.com/pelican-plugins">new Structure / GitHub Organization</a>.</p>
<p>After a specified length, it adds a <em>"read more"</em> link the the Posts Overview, you can see it on this Blog in action for example.</p>
<p>The Configuration is very easy, the Plugin supports a few Parameter for your pelican.conf File.</p>
<p>It can by installed by running <code>python -m pip install pelican-read-more</code>, the Source is available on <a class="reference external" href="https://github.com/pelican-plugins/read-more">https://github.com/pelican-plugins/read-more</a></p>
Proudly present: My first accepted Pull Request for Pelican2021-03-03T00:00:00+01:002021-03-03T00:00:00+01:00Dominik Wombachertag:dominik.wombacher.cc,2021-03-03:/posts/proudly-present-my-first-accepted-pull-request-for-pelican.html<!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>As already mentioned in my Post <a class="reference external" href="https://dominik.wombacher.cc/posts/migration-from-wordpress-to-pelican.html">Migration from Wordpress to Pelican</a>
the fact that Pelican is written in Python and provide a Plugin system was important for me. So I ... <a class="read-more" href="/posts/proudly-present-my-first-accepted-pull-request-for-pelican.html"> [read more]</a></p><!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher <dominik@wombacher.cc> -->
<!-- -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<p>As already mentioned in my Post <a class="reference external" href="https://dominik.wombacher.cc/posts/migration-from-wordpress-to-pelican.html">Migration from Wordpress to Pelican</a>
the fact that Pelican is written in Python and provide a Plugin system was important for me. So I can adjust the Code and also give
something back to the <a class="reference external" href="https://www.getpelican.com">Pelican Community</a></p>
<p>The Project is moving away from their <a class="reference external" href="https://www.github.com/getpelican/pelican-plugins">monolithic Plugin Repository</a> to a
separate <a class="reference external" href="https://www.github.com/pelican-plugins/">Organization Namespace</a> were every Plugin has it's own Repository and
get published to <a class="reference external" href="https://www.pypi.org">PyPI</a>.</p>
<p>Due to the fact that i wanted to use the <a class="reference external" href="https://www.github.com/pelican-plugins/pdf">PDF Generator</a> but it wasn't yet migrated,
i decided to <a class="reference external" href="https://github.com/getpelican/pelican-plugins/issues/1328">contribute</a>
(Archive: <a class="reference external" href="https://web.archive.org/web/20210303101921/https://github.com/getpelican/pelican-plugins/issues/1328">[1]</a>,
<a class="reference external" href="https://archive.today/2021.03.03-101922/https://github.com/getpelican/pelican-plugins/issues/1328">[2]</a>)
and assist with updating and migrating this Plugin.</p>
<p>Today I proudly present: <a class="reference external" href="https://github.com/pelican-plugins/pdf/pull/1">My first accepted Pull Request for Pelican (PDF Plugin)</a>
(Archive: <a class="reference external" href="https://web.archive.org/web/20210303100907/https://github.com/pelican-plugins/pdf/pull/1">[1]</a>,
<a class="reference external" href="https://archive.today/2021.03.03-100750/https://github.com/pelican-plugins/pdf/pull/1">[2]</a>)</p>
<p>There is still room for improvement and i'm working on further fixes and features, but it's a starting Point.</p>
<p>You find at the bottom of every Article and Page a PDF Download Link, the linked PDF file was generated by the mentioned Plugin.</p>