Archive

Posts Tagged ‘cross-platform’

pynt: a lightweight build tool, written in Python

Problem
I mainly work under Linux and when I write a Python program, I don’t care if it runs on other platforms or not. Does it work for me? Good :) So far I haven’t really used any build tools. If I needed something, I solved it with a Bash script.

However, a few weeks ago I started to work on a larger side project (JiVE Image Viewer) and I wanted to make it portable from the beginning. Beside Linux, it must also work on Windows (on Mac I couldn’t try it).

Now, if I want to automate some build task (e.g. creating a standalone executable from the project), a Bash script is not enough as it doesn’t run under Windows. Should I write the same thing in a .bat file? Hell, no! Should I install Cygwin on all my Windows machines? No way! It’s time to start using a build tool. The time has finally come.

Solution
There are tons of build tools. I wanted something very simple with which I can do some basic tasks: run an external command, create a directory, delete a directory, move a file, move a directory, etc. As I am most productive in Python, I wanted a build tool that I can program in pure Python. And I wanted something simple that I can start using right away without reading tons of docs.

And this is how I found pynt. Some of its features:

  • easy to learn
  • build tasks are just python funtions
  • manages dependencies between tasks
  • automatically generates a command line interface
  • supports python 2.7 and python 3.x” (source)

Just create a file called build.py in your project’s root folder and invoke the build tool with the command “pynt“.

My project is in a virtual environment. First I installed pynt in the virt. env.:

$ pip install pynt

Here you can find an example that I wrote for JiVE.

Update (20180628)
I had a little contribution to the project: https://github.com/rags/pynt/pull/17. If the name of a task starts with an underscore, then it’s a hidden task, thus it won’t appear in the auto-generated docs. This way you can easily hide sub-tasks.

Categories: python Tags: , , ,

JiVE: A general purpose, cross-platform image viewer with some built-in NSFW support, written in Python 3.6 using PyQt5

In the past 2-3 weeks I’ve been working on a general purpose, cross-platform image viewer that has some built-in NSFW support. It’s called JiVE and it’s in Python 3.6 using PyQt5. A unique feature of JiVE is that it allows you to browse online images just as if they were local images.

You can find it on GitHub: https://github.com/jabbalaci/JiVE-Image-Viewer. I also wrote a detailed documentation.

Screenshots

In action:

jive.png

Selecting an NSFW subreddit:

nsfw.png

Read the docs for more info.