Tutorials and tips on Fedora Linux, Python programming, and software development. Clear guides, source code, and practical examples by Catalin George Festila.
Showing posts with label module. Show all posts
Showing posts with label module. Show all posts
Thursday, July 9, 2026
Sunday, October 27, 2024
Fedora 42 : Can be better? part 020.
I wrote in some posts about this blog about the possibility of improving the distribution of Linux Fedora.
Today I discovered that choosing GNOME is a better option with lighting modes and options for the Nemo file manager actions.
I would have wanted to have a better network system similar to portmanager with S.P.N. for fedora users and team on web.
SPN (Secure Peer Name) is a technology related to secure communication protocols, particularly in the context of peer-to-peer
networks and distributed systems.
I want to have more tools and applications on tty with GUI, like ncurses... I created an radio online application with ncurses and you can find it on my pagure.
The main goal of these type of graphic user interface is simplicity, no need hardware resources - this HP Compaq 6710b has only 4Gb RAM, and cand be used with Single Board Computer.
I think Fedora don't have a Fedora Spin for Single Board Computer hardware.
Let's start with python 3 action on nemo file manager.
Go to the action folder and create an action file named: python3.nemo_action.
[root@fedora mythcat]# cd /usr/share/nemo/actions
[root@fedora actions]# nano python3.nemo_actionAdd this source code :
[Nemo Action]
Name=Execute Python Script
Icon-Name=python
Exec=env /usr/bin/python3 %F
Selection=S
Name[tr]=Python script
Extensions=py;Reopen the Nemo file manager and you see an an Execute Python Script, only on the python script on right click menu.
Let's see some screenshots:



Posted by
Cătălin George Feștilă
Labels:
2024,
Fedora,
Fedora 42,
module,
python 3,
python modules,
tutorial,
tutorials
Monday, October 7, 2024
Fedora 42 : Fedora game project with pygame and agentpy - part 004.
... working on hacking game code , you can test two version of the unfinished game with agentpy at my pagure Fedora account.
* Hack the code based on minimal information versus total information.
The code has 5 distinct letters.
- click on the letters on the keypad
- the number of guessed letters is displayed in the form: centered - guessed letters on positions and moved guessed letters but on other positions
NOTE: the source code is under development, I need to enter a scroll to be able to enter more codes with letters
Saturday, September 28, 2024
Fedora 42 : Fedora game project with pygame and agentpy - part 003.
I have upgraded the source code with the following changes:
- added agent with logic using the python agentpy module;
- I increased the grid to 16 x 16;
- I kept the win condition at 8 pieces aligned in any direction;
- I added conditions for displaying the equality message;
The game is hard to win, you can try on my pagure account.
Wednesday, September 25, 2024
Fedora 42 : Fedora game project with pygame and agentpy - part 002.
... and update from 8 in 8 with SVG file type.

The source code I used or you can find it on the pagure project:
import pygame
from pygame.math import Vector2
import random
import os
username = os.getlogin()
# Initialize Pygame
pygame.init()
# Set up the display
width, height = 800, 800
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("Eight-in-a-Row")
# Font setup
font = pygame.font.Font(None, 74)
# Colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (0, 0, 120)
# Game board dimensions
BOARD_WIDTH = 8
BOARD_HEIGHT = 8
class Player:
def __init__(self, color, is_computer=False):
self.color = color
self.pieces = set()
self.is_computer = is_computer
self.svg_image = self.load_svg_image()
def add_piece(self, x, y):
self.pieces.add((x, y))
# def draw_pieces(self):
# for x, y in self.pieces:
# pygame.draw.circle(screen, self.color,
# (x * width // BOARD_WIDTH + width // (2 * BOARD_WIDTH),
# y * height // BOARD_HEIGHT + height // (2 * BOARD_HEIGHT)),
# min(width, height) // (2 * BOARD_WIDTH) - 5)
def load_svg_image(self):
if self.color == BLUE:
svg_path = "penguin-svgrepo-com.svg"
elif self.color == WHITE:
svg_path = "cube-svgrepo-com.svg"
else:
svg_path = "cube-svgrepo-com.svg"
return pygame.image.load(svg_path)
def draw_pieces(self):
piece_size = min(width, height) // (BOARD_WIDTH) - 10
for x, y in self.pieces:
pos = Vector2(x * width // BOARD_WIDTH + width // (2 * BOARD_WIDTH),
y * height // BOARD_HEIGHT + height // (2 * BOARD_HEIGHT))
scaled_image = pygame.transform.scale(self.svg_image, (piece_size, piece_size))
image_rect = scaled_image.get_rect(center=pos)
screen.blit(scaled_image, image_rect)
def make_move(self, board):
if self.is_computer:
empty_squares = [(x, y) for x in range(BOARD_WIDTH) for y in range(BOARD_HEIGHT)
if (x, y) not in board[0] and (x, y) not in board[1]]
if empty_squares:
return random.choice(empty_squares)
return None
def check_winner(player):
directions = [(0, 1), (1, 0), (1, 1), (1, -1)]
for x, y in player.pieces:
for dx, dy in directions:
if all((x + i*dx, y + i*dy) in player.pieces for i in range(8)):
return True
return False
def display_winner(winner):
text = font.render(f"Player {winner} wins!", True, [145,190,190])
text_rect = text.get_rect(center=(width // 2, height // 2))
screen.blit(text, text_rect)
pygame.display.flip()
pygame.time.wait(3000) # Display the message for 3 seconds
# Create players
player1 = Player(BLUE)
player2 = Player(WHITE, is_computer=True)
# Game loop
running = True
turn = 0
game_over = False
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.MOUSEBUTTONDOWN and not game_over:
if turn % 2 == 0: # Human player's turn
mouse_x, mouse_y = event.pos
column = mouse_x // (width // BOARD_WIDTH)
row = mouse_y // (height // BOARD_HEIGHT)
if (column, row) not in player1.pieces and (column, row) not in player2.pieces:
player1.add_piece(column, row)
if check_winner(player1):
# print("Player 1 wins!")
display_winner(username)
game_over = True
turn += 1
if not game_over and turn % 2 == 1: # Computer player's turn
move = player2.make_move((player1.pieces, player2.pieces))
if move:
player2.add_piece(*move)
if check_winner(player2):
# print("Player 2 (Computer) wins!")
display_winner("Computer")
game_over = True
turn += 1
screen.fill(BLACK)
# Draw game board
for i in range(BOARD_WIDTH + 1):
pygame.draw.line(screen, WHITE, (i * width // BOARD_WIDTH, 0), (i * width // BOARD_WIDTH, height), 2)
for i in range(BOARD_HEIGHT + 1):
pygame.draw.line(screen, WHITE, (0, i * height // BOARD_HEIGHT), (width, i * height // BOARD_HEIGHT), 2)
# Draw pieces
player1.draw_pieces()
player2.draw_pieces()
pygame.display.flip()
pygame.quit()
Saturday, September 21, 2024
Fedora 42 : Fedora game project with pygame and agentpy - part 001.
I started a game project with the python packages pygame and agentpy in the Fedora 42 Linux distribution.
I used this version of Fedora:
[mythcat@fedora fedora_game]$ uname -a
Linux fedora 6.11.0-63.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Sep 15 17:14:12 UTC 2024 x86_64 GNU/Linux
... and this python version:
Python 3.12.3 (main, Apr 17 2024, 00:00:00) [GCC 14.0.1 20240411 (Red Hat 14.0.1-0)] on linuxYou can find it on my fedora pagure repo
Tuesday, July 6, 2021
Fedora 34 : Can be better? part 019.
Another way to improve the Fedora 34 is to add the lastes PyQt6 python package into repo.
[root@desk mythcat]# dnf search PyQt6
Last metadata expiration check: 2:03:10 ago on Tue 06 Jul 2021 08:52:41 PM EEST.
No matches found.
First stable release for PyQt6 was on Jan 2021 by Riverbank Computing Ltd. under GPL or commercial and can be used with Python 3.
Let's install with pip tool:
[mythcat@desk ~]$ /usr/bin/python3 -m pip install --upgrade pip
...
WARNING: The scripts pip, pip3 and pip3.9 are installed in '/home/mythcat/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning,
use --no-warn-script-location.
Successfully installed pip-21.1.3
[mythcat@desk ~]$ pip install PyQt6 --user
...
Let's see a simple example with this python package:
import sys
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QApplication, QLabel
def main():
app = QApplication(sys.argv)
win = QLabel()
win.resize(640, 498)
win.setText("Qt is awesome!!!")
win.show()
app.exec()
if __name__ == "__main__":
main()
I tested and run well.
Posted by
Cătălin George Feștilă
Labels:
2021,
Fedora,
Fedora 34,
module,
python,
python 3,
python modules,
tutorial,
tutorials
Saturday, November 7, 2020
Fedora 33 : Install PyGame 2.0 on Fedora.
Today I will show you how to install the python PyGame version 2.0 package with python version 3.9 in Fedora 33 distro.
Let's install all Fedora packages need for this python package:
[root@desk pygame]# dnf install SDL2-devel.x86_64
...
Installed:
SDL2-devel-2.0.12-4.fc33.x86_64
Complete!
[root@desk pygame]# dnf install SDL2_ttf-devel.x86_64
...
Installed:
SDL2_ttf-2.0.15-6.fc33.x86_64 SDL2_ttf-devel-2.0.15-6.fc33.x86_64
Complete!
[root@desk pygame]# dnf install SDL2_image-devel.x86_64
...
Installed:
SDL2_image-2.0.5-5.fc33.x86_64 SDL2_image-devel-2.0.5-5.fc33.x86_64
Complete!
[root@desk pygame]# dnf install SDL2_mixer-devel.x86_64
...
Installed:
SDL2_mixer-2.0.4-7.fc33.x86_64 SDL2_mixer-devel-2.0.4-7.fc33.x86_64
Complete!
[root@desk pygame]# dnf install SDL2_gfx-devel.x86_64
...
Installed:
SDL2_gfx-1.0.4-3.fc33.x86_64 SDL2_gfx-devel-1.0.4-3.fc33.x86_64
Complete!
[root@desk pygame]# dnf install portmidi-devel.x86_64
...
Installed:
portmidi-devel-217-38.fc33.x86_64
Complete!
Use this command to clone it from GitHub and install it:[mythcat@desk ~]$ git clone https://github.com/pygame/pygame
Cloning into 'pygame'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 38509 (delta 0), reused 0 (delta 0), pack-reused 38505
Receiving objects: 100% (38509/38509), 17.78 MiB | 11.66 MiB/s, done.
Resolving deltas: 100% (29718/29718), done.
[mythcat@desk ~]$ cd pygame/
[mythcat@desk pygame]$ python3.9 setup.py install --user
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using UNIX configuration...
Hunting dependencies...
SDL : found 2.0.12
FONT : found
IMAGE : found
MIXER : found
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: found
PORTTIME: found
FREETYPE: found 23.4.17
If you get compiler errors during install, double-check
the compiler flags in the "Setup" file.
...
copying docs/pygame_tiny.gif -> build/bdist.linux-x86_64/egg/pygame/docs
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pygame.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
creating dist
creating 'dist/pygame-2.0.1.dev1-py3.9-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pygame-2.0.1.dev1-py3.9-linux-x86_64.egg
creating /home/mythcat/.local/lib/python3.9/site-packages/pygame-2.0.1.dev1-py3.9-linux-x86_64.egg
Extracting pygame-2.0.1.dev1-py3.9-linux-x86_64.egg to /home/mythcat/.local/lib/python3.9/site-packages
Adding pygame 2.0.1.dev1 to easy-install.pth file
Installed /home/mythcat/.local/lib/python3.9/site-packages/pygame-2.0.1.dev1-py3.9-linux-x86_64.egg
Processing dependencies for pygame==2.0.1.dev1
Finished processing dependencies for pygame==2.0.1.dev1
Let's test it:[mythcat@desk pygame]$ ls
build dist examples README.rst setup.cfg src_c test
buildconfig docs pygame.egg-info Setup setup.py src_py
[mythcat@desk pygame]$ python3.9
Python 3.9.0 (default, Oct 6 2020, 00:00:00)
[GCC 10.2.1 20200826 (Red Hat 10.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 2.0.1.dev1 (SDL 2.0.12, python 3.9.0)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>>
Friday, October 4, 2019
Fedora 30 : A general intro to linux signals with python.
UNIX/Linux systems offer special mechanisms to communicate between each individual process with signals.
Let's see these signals:
[mythcat@desk ~]$ kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3
38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8
43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAX
Each signal is represented by an integer value, and the list of signals that are available.
This simple python script create a process and print one message.
Each process named PID comes with a number.
[mythcat@desk ~]$ cat python3 signal_001.py
cat: python3: No such file or directory
import os
import sys
import time
print('PID number is:', os.getpid())
while True:
print('Waiting...')
time.sleep(6)
[mythcat@desk ~]$ python3 signal_001.py
PID number is: 2566
Waiting...
Waiting...
Waiting...
Waiting...
Waiting...
Hangup
The PID process can be kill with this command:
[mythcat@desk ~]$ kill -SIGTERM 2566
Let's see another example that receives the signal we have sent to the process.
import os
import signal
import time
def receiveSignal(signalNumber, frame):
print('Received:', signalNumber)
raise SystemExit('Exiting')
return
if __name__ == '__main__':
# register the signals to be caught
signal.signal(signal.SIGHUP, receiveSignal)
signal.signal(signal.SIGINT, receiveSignal)
signal.signal(signal.SIGQUIT, receiveSignal)
signal.signal(signal.SIGILL, receiveSignal)
signal.signal(signal.SIGTRAP, receiveSignal)
signal.signal(signal.SIGABRT, receiveSignal)
signal.signal(signal.SIGBUS, receiveSignal)
signal.signal(signal.SIGFPE, receiveSignal)
#signal.signal(signal.SIGKILL, receiveSignal)
signal.signal(signal.SIGUSR1, receiveSignal)
signal.signal(signal.SIGSEGV, receiveSignal)
signal.signal(signal.SIGUSR2, receiveSignal)
signal.signal(signal.SIGPIPE, receiveSignal)
signal.signal(signal.SIGALRM, receiveSignal)
signal.signal(signal.SIGTERM, receiveSignal)
# register the signal to be caught
signal.signal(signal.SIGUSR1, receiveSignal)
# register the signal to be ignored
signal.signal(signal.SIGINT, signal.SIG_IGN)
# output current process id
print('My PID is:', os.getpid())
signal.pause()
Let't run it and see what happend when send a signal to the PID:
[mythcat@desk ~]$ python3 py_pid.py
My PID is: 2698
Received: 10
Exiting
You can see the kill command will send this output: Received: 10 Exiting .
[mythcat@desk ~]$ kill -SIGUSR1 2698
Posted by
Cătălin George Feștilă
Labels:
2019,
linux,
linux tools,
module,
python,
python 3,
python modules,
tutorial,
tutorials
Monday, July 8, 2019
Fedora 30 : Using the python-wikitcms.
This python module named python-wikitcms can be used for interacting with the Fedora wiki.
The Fedora wiki used Fedora's Wikitcms.
Today I test it and works great with Fedora distro version 30.
First, the install of the fedora package with DNF tool:
The OpenID Connect client Wiki Test Control Management System is asking to authorize access for mythcat. this allow you to access it
After I agree with this the page tells me to close it:
You can close this window and return to the CLI
The next examples show you how to get and show information from the wiki:
The Fedora wiki used Fedora's Wikitcms.
Today I test it and works great with Fedora distro version 30.
First, the install of the fedora package with DNF tool:
[root@desk mythcat]# dnf install python3-wikitcms.noarch
...
Downloading Packages:
(1/8): python3-mwclient-0.9.3-3.fc30.noarch.rpm 186 kB/s | 61 kB 00:00
(2/8): python3-fedfind-4.2.5-1.fc30.noarch.rpm 314 kB/s | 105 kB 00:00
(3/8): python3-cached_property-1.5.1-3.fc30.noa 41 kB/s | 20 kB 00:00
(4/8): python3-requests-oauthlib-1.0.0-1.fc29.n 313 kB/s | 40 kB 00:00
(5/8): python3-jwt-1.7.1-2.fc30.noarch.rpm 112 kB/s | 42 kB 00:00
(6/8): python3-oauthlib-2.1.0-1.fc29.noarch.rpm 293 kB/s | 153 kB 00:00
(7/8): python3-simplejson-3.16.0-2.fc30.x86_64. 641 kB/s | 278 kB 00:00
(8/8): python3-wikitcms-2.4.2-2.fc30.noarch.rpm 264 kB/s | 84 kB 00:00
I used this simple example to get information about the Fedora wiki:
[mythcat@desk ~]$ python3
Python 3.7.3 (default, May 11 2019, 00:38:04)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from wikitcms.wiki import Wiki
>>> my_site = Wiki()
>>> event = my_site.current_event
>>> print(event.version)
31 Rawhide 20190704.n.1
>>> page = my_site.get_validation_page('Installation','23','Final','RC10')
>>> for row in page.get_resultrows():
... print(row.testcase)
...
QA:Testcase_Mediakit_Checksums
QA:Testcase_Mediakit_ISO_Size
QA:Testcase_Mediakit_Repoclosure
QA:Testcase_Mediakit_FileConflicts
QA:Testcase_Boot_default_install
...
>>> dir(my_site)
I used this source code to login with my account.
>>> my_site.login()
A webpage is open to get access to the account and show this info:The OpenID Connect client Wiki Test Control Management System is asking to authorize access for mythcat. this allow you to access it
After I agree with this the page tells me to close it:
You can close this window and return to the CLI
The next examples show you how to get and show information from the wiki:
>>> print(my_site.username)
Mythcat
>>> result = my_site.api('query', titles='Mythcat')
>>> for page in result['query']['pages'].values():
... print(page['title'])
...
Mythcat
>>> for my_contributions in my_site.usercontributions('Mythcat'):
... print(my_contributions)
...
This python module comes with low documentation.
Posted by
Cătălin George Feștilă
Labels:
2019,
Fedora,
Fedora 30,
linux,
linux tools,
module,
python,
python 3,
python modules,
python-wikitcms,
tutorial,
tutorials
Sunday, June 30, 2019
Fedora 30 : The Pythonic tool.
The tutorial for today is about Pythonic tool.
Named Pythonic is a graphical programming tool that makes it easy for users to create Python applications using ready-made function modules.
This tool providing the consistent features and characteristics of a trading bot with just a few clicks.
The Pythonic tool is currently available in four languages: English, German, Spanish, and Chinese.
The tool comes with basic functions such as a scheduler, if-branches, connectivity, and logging functions are available out of the box and can be parameterized using a corresponding GUI.
Each graphical element is functionally processed individually.
The base idea is: A unique graphical input mask to carry out the parameterization necessary for processing, then after a process completes successfully, the returned result can be transferred to a subsequent process for further use.
You can use server processes can be placed in parallel in the background as listener applications that wait for external events and initiate the creation of a process when the event arrives.
Pythonic's data type list makes it easy to utilize different access techniques (push, pop, insert, append).
The install of this tool is easy on Fedora 30 distro:
Named Pythonic is a graphical programming tool that makes it easy for users to create Python applications using ready-made function modules.
This tool providing the consistent features and characteristics of a trading bot with just a few clicks.
The Pythonic tool is currently available in four languages: English, German, Spanish, and Chinese.
The tool comes with basic functions such as a scheduler, if-branches, connectivity, and logging functions are available out of the box and can be parameterized using a corresponding GUI.
Each graphical element is functionally processed individually.
The base idea is: A unique graphical input mask to carry out the parameterization necessary for processing, then after a process completes successfully, the returned result can be transferred to a subsequent process for further use.
You can use server processes can be placed in parallel in the background as listener applications that wait for external events and initiate the creation of a process when the event arrives.
Pythonic's data type list makes it easy to utilize different access techniques (push, pop, insert, append).
The install of this tool is easy on Fedora 30 distro:
[mythcat@desk ~]$ python3.7 -m pip install Pythonic --user
Collecting Pythonic
...
Successfully installed PyQt5-5.8.2 Pythonic-0.12 pandas-0.24.2 pythonic-binance-0.7.2
This is a screenshot with this tool.
Posted by
Cătălin George Feștilă
Labels:
2019,
Fedora,
Fedora 30,
linux,
linux tools,
module,
python,
python 3,
python modules,
Pythonic,
tutorial,
tutorials
Thursday, March 21, 2019
Fedora 29 : Testing the dnf python module.
Today we tested with Fedora 29 a python module called DNF.
All users have used this tool.
This python module is not very documented on the internet.
A more complex example can be found on DNF tool documentation.
I tried to see what I can get from this module.
Let's start installing it with the pip tool:
All users have used this tool.
This python module is not very documented on the internet.
A more complex example can be found on DNF tool documentation.
I tried to see what I can get from this module.
Let's start installing it with the pip tool:
$ pip install dnf --user
Here are some tests that I managed to run in the python shell.[mythcat@desk ~]$ python
Python 2.7.15 (default, Oct 15 2018, 15:26:09)
[GCC 8.2.1 20180801 (Red Hat 8.2.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import dnf
>>> dir(dnf)
['Base', 'Plugin', 'VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__',
'__path__', '__version__', 'base', 'callback', 'cli', 'comps', 'conf', 'const', 'crypto', 'db',
'dnf', 'dnssec', 'drpm', 'exceptions', 'goal', 'history', 'i18n', 'lock', 'logging', 'match_counter',
'module', 'package', 'persistor', 'plugin', 'pycomp', 'query', 'repo', 'repodict', 'rpm', 'sack',
'selector', 'subject', 'transaction', 'unicode_literals', 'util', 'warnings', 'yum']
>>> import dnf.conf
>>> print(dnf.conf.Conf())
[main]
assumeno: 0
assumeyes: 0
autocheck_running_kernel: 1
bandwidth: 0
best: 0
...
>>> import dnf.module
>>> import dnf.rpm
>>> import dnf.cli
>>> base = dnf.Base()
>>> base.update_cache()
True
This read all repositories:
>>> base.read_all_repos()
You need to read the sack for querying:
>>> base.fill_sack()
>>> base.sack_activation = True
Create a query to matches all packages in sack:
>>> qr=base.sack.query()
Get only available packages:
>>> qa=qr.available()
Get only installed packages:
>>> qi=qr.installed()
>>> q_a=qa.run()
>>> for pkg in qi.run():
... if pkg not in q_a:
... print('%s.%s' % (pkg.name, pkg.arch))
...
NetworkManager-openvpn.x86_64
NetworkManager-openvpn-gnome.x86_64
coolkey.x86_64
glibc-debuginfo.x86_64
glibc-debuginfo-common.x86_64
kernel.x86_64
kernel.x86_64
kernel-core.x86_64
kernel-core.x86_64
Get all packages installed on Linux:
>>> q_i=qi.run()
>>> for pkg in qi.run():
... print('%s.%s' % (pkg.name, pkg.arch))
You can see more about the Python programming language on my blog.
Sunday, December 1, 2013
Using SOHO LASCO C3 instrument from helioviewer website I saw the comet C/2012 S1 ISON.
I make one python script to take this image using sunpy ... (see here)
I make one python script to take this image using sunpy ... (see here)
Monday, February 25, 2013
News: PP 1.6.4 is released ...
The new version: PP 1.6.4 is released and working well.
What is PP python module?
PP is a python module which provides a mechanism for parallel execution of python code on SMP and clusters.
SMP - systems with multiple processors or cores;
clusters - computers connected via the network;
Read more Parallel Python.
What is PP python module?
PP is a python module which provides a mechanism for parallel execution of python code on SMP and clusters.
SMP - systems with multiple processors or cores;
clusters - computers connected via the network;
Read more Parallel Python.
Subscribe to:
Posts (Atom)
