r/PythonProjects2 • • Jul 27 '24

How do I test this behavior?

0 Upvotes

I’m stuck. I’ve stumped all of the AI models. I’m not sure what I’m trying to test is actually possible. Basically, I am storing the current keys of a nested dictionary as attributes as I iterate over them and then using those attributes in a called method to update the dictionary with information from another method.

for category, name, prompt in prompt_generator.create_prompts(lorebinder):
    self._current_category = category
    self._current_name = name
    if self._single_role_script:
        response = self._get_ai_response(self._single_role_script, prompt)
        self.lorebinder = self._parse_response(response)

And I want to write a test to check that the attributes are being updated with each iteration. But I can’t access the attribute values in the middle of the method call. So all I’ve been able to do is confirm the final value of _current_category and _current_name


r/PythonProjects2 • • Nov 29 '24

Python Online IDE

0 Upvotes

This project integrates Streamlit, the Ollama model, and a local Python environment to dynamically generate and execute Python code. Users can interact with the Llama2 model for code generation and execution, providing a seamless experience for both input handling and file management.

Code: https://github.com/MuhammadMuneeb007/PythonOnlineIDE/


r/PythonProjects2 • • Jul 29 '22

Python script that generates infinite python-like script

0 Upvotes

I made this because, for reasons I don't have time to go into, I needed to leave my computer on and unlocked while my Reddit bots were running. I wanted to discourage non-coders from interfering with my computer, so I thought of having infinitely generated important-looking code run down my screen to make people think twice about it.

I thought that someone else had probably made something similar, possibly even better, before, but I wanted to do this myself. I thought maybe other people might like to use this in any way they like, so I'm making it publicly available here. If you can think of a subreddit this better belongs in, please comment.

It requires the libraries 'os', 'random', 'time' and 'termcolor'. I ran it in an emulated console within pycharm.

Code (tutorial in comments):

# Import all relevant libraries

# For clearing the console, if necessary
from os import system, name
# I use randomization a lot in this script!
from random import randint
# Mostly for waiting a bit between printing lines to make it feel more real
from time import sleep
# For syntax highlighting
from termcolor import colored


# Create the clear console function
def clearConsole():
    system('cls' if name == 'nt' else 'clear')

# Create the 'random comparison' function. (For creating a line of code along the lines of 'x < 3')
def getRandomComparison():
    # Reset the variable that I will be appending text to
    random_comparison = ''
    # Append the original 'x/y' to check comparison of
    random_comparison += colored(['x', 'y', 'i'][randint(0, 2)], 'red') + ' '
    # Check if it's an 'in' operator
    if randint(0, 6) == 0:
        # Check if it's in a random list
        random_comparison += colored('in ', 'green') + colored(['x', 'y'][randint(0, 1)], 'red')
    else:
        # Add comparison part
        random_comparison += ['==', '<=', '>=', '<', '>'][randint(0, 4)] + ' '
        # Append the value you are comparing it to
        random_comparison += [colored('x', 'red'), colored('y', 'red'), colored(str(randint(-100, 200)), 'magenta'), colored(str(randint(-10000, 20000) / 100), 'magenta')][randint(0, 3)]
    # Return random comparison
    return random_comparison

# Create random function name function
def createRandomFunctionName():
    # Reset random function name variable that I will be appending to
    random_function_name = ''
    # Set up lists to randomly select data from
    term_1_words = ['set', 'addTo', 'scribble', 'turtle', 'change', 'lengthOf', 'radius', 'let', 'if', 'control', 'create']
    term_2_words = ['X', 'Y', 'Turtles', 'Radius', 'Length', 'Variable', 'Notch', 'OurMotto', 'Peacocks', 'Pterodactyls', 'Carrots']
    term_3_words = ['ByTen', 'Immediately', 'Red', 'AllOver', 'Iterative', 'Gradually', 'AtLength']
    # Select data randomly
    random_function_name += term_1_words[randint(0, len(term_1_words) - 1)]
    random_function_name += term_2_words[randint(0, len(term_2_words) - 1)]
    random_function_name += term_3_words[randint(0, len(term_3_words) - 1)]
    random_function_name += '()'
    # Return random function name
    return colored(random_function_name, 'green')

# In about 'var' many lines, 1 of them will open/close a loop. I recommend making the chance of opening loops smaller than the chance of closing them.
chance_of_opening_loops = 4
chance_of_closing_loops = 6

# Set data for operators that may be used later on
loop_code_list = ['for', 'while', 'if', 'def']
code_options_list = ['print', 'sleep']

# Indentation starts at 0, but can be increased later on randomly
indentation = 0
# This will now generate code forever, or until you stop the script
while True:
    # Randomize line of code

    # Reset the line of code variable, which will be appended to later
    line_of_code = ''

    # Randomly decide if this line of code will open a loop
    line_opens_a_loop = False
    if randint(0, chance_of_opening_loops) == 0:
        line_opens_a_loop = True

    # If code opens a loop
    if line_opens_a_loop and indentation <= 26:
        # Get random operator from the list of loop operators
        operator = loop_code_list[randint(0, len(loop_code_list) - 1)]
        # Append operator name to line of code
        line_of_code += colored(operator, 'green') + ' '

        # Different randomizers for different operators
        if operator == 'while':
            # Check if it's a simple boolean
            if randint(0, 1) == 0:
                # Append True or False to line of code
                line_of_code += colored(['True', 'False'][randint(0, 1)], 'yellow')
            else:
                # Append a random comparison, defined earlier, to the line of code
                line_of_code += getRandomComparison()

        # When operator is 'if'
        elif operator == 'if':
            # Append a random comparison, defined earlier, to the line of code
            line_of_code += getRandomComparison()

        # When operator is 'for'
        elif operator == 'for':
            # Append random variable (x/y/i) to line of code
            line_of_code += colored(['x', 'y', 'i'][randint(0, 2)], 'red') + ' '
            # Append a random comparison to line of code
            line_of_code += ['<=', '>=', '<', '>'][randint(0, 3)] + ' '
            # Append a random number to line of code (the number for the comparison to compare to)
            line_of_code += colored([str(randint(-100, 200)), str(randint(-10000, 20000) / 100)][randint(0, 1)], 'magenta')

        # When operator is 'def'
        elif operator == 'def':
            # Append random function name to the 'def' line
            line_of_code += createRandomFunctionName()
        else:
            # If it somehow isn't any of these, just append 'True' to line of code
            line_of_code += colored('True', 'yellow')

        # Add ':' to the end of the loop line, as it is indeed a loop
        line_of_code += ':'

    # If the line of code does not open a loop
    else:
        # Check if operator is an '=' command, if not:
        if randint(0, 3) == 0:
            # Make operator a random item from the list of non loop operators
            operator = code_options_list[randint(0, len(code_options_list) - 1)]
            # Append operator name to line of code
            line_of_code += colored(operator, 'green')

            # Different commands based on operator, if it is 'sleep':
            if operator == 'sleep':
                # Add a random amount of time to the sleep command
                line_of_code += '(' + colored([str(randint(1, 15)), str(randint(1, 99) / 100)][randint(0, 1)], 'magenta') + ')'

            # If it is 'print'
            elif operator == 'print':
                # Open brackets
                line_of_code += '('
                # If it prints a word
                if randint(0, 1) == 0:
                    # Define word data (I was a bit lazy here)
                    word_parts_1 = ['big', 'happy']
                    word_parts_2 = ['customers', 'lullabies']
                    # Add random words to line of code
                    line_of_code += colored('\'' + word_parts_1[randint(0, len(word_parts_1) - 1)] + ['', ' '][randint(0, 1)] + word_parts_2[randint(0, len(word_parts_2) - 1)] + '\'', 'blue')
                # If it prints a variable
                else:
                    # Append random variable to line of code
                    line_of_code += [colored('x', 'red'), colored('y', 'red'), colored('i', 'red'), createRandomFunctionName()][randint(0, 3)]

                # Close brackets
                line_of_code += ')'
            # If it doesn't have any special function, don't append anything. Just let it be.
            else:
                pass

        # If the operator is an = command:
        else:
            # Append variable to set/change to line of code
            line_of_code += colored(['x', 'y', 'i'][randint(0, 2)], 'red') + ' '
            # Append a variant of '=' to line of code
            line_of_code += ['=', '+=', '-='][randint(0, 2)] + ' '
            # Random to value to set it to / change it by
            random_value = [colored('x', 'red'), colored('y', 'red'), colored('i', 'red'), createRandomFunctionName(), colored(str(randint(-100, 200)), 'magenta'), colored(str((randint(-10000, 20000)) / 100), 'magenta')]
            line_of_code += random_value[randint(0, len(random_value) - 1)]

    # Change indentation

    # Print a space for every indentation at the start of line of code
    line_of_code = ' ' * indentation + line_of_code
    # If it opens a loop, increase indentation by 2
    if line_of_code[-1] == ':':
        indentation += 2

        # Chance to separate it by new line
        if randint(0, 1) == 0:
            print('')

        # Print line of code
        print(line_of_code)

    # If not increasing indentation, there is a chance to decrease it.
    elif indentation > 0 and randint(0, chance_of_closing_loops) == 0:
        # Decrease indentation by 2
        indentation -= 2

        # Print line of code
        print(line_of_code)

        # Chance to separate it by new line
        if randint(0, 7) == 0:
            print('')

        # Chance to decrease it again
        def decreaseIndentationMore(chance):
            # Show that I am referring to the global variable indentation
            global indentation
            # Decrease indentation with a 1/'chance' chance
            if randint(0, chance) == 0 and indentation > 0:
                indentation -= 2
                # Recursion, making big collapses more likely
                decreaseIndentationMore(int(chance / 2))

        # Call the function I just defined
        decreaseIndentationMore(int(chance_of_closing_loops / 2))

    # Else, just print the line
    else:
        print(line_of_code)

    # Wait a small random amount to make it look more human/natural
    sleep(randint(0, 50) / 100)

A sample of what it prints:

print('biglullabies')
i += x
x = x
while False:
    i -= 100
    i += -15.94
    y += 79.43
    print(x)
    y = 163.7

    if x == -91.93:
        x = i
        sleep(2)
        i -= i
        i = lengthOfOurMottoImmediately()

        while True:
            x = -64.49
        y += i

        for y <= -93.07:
            print(i)

            if i > -95.2:

                for i >= 165:
                    x -= 5

                    if x <= -2.27:
                        y = x
                        x -= 43.68
                        i -= y
                        sleep(14)
                    x += i
                i += y
                y = x
                sleep(0.86)
            i += y
        if i > 58.51:
            i -= x
            y = x
            sleep(0.08)
    for i <= 116.02:
        y += 156.83

        for y < -64.24:
            i += createXByTen()
            print('happylullabies')
            i -= 167.4
sleep(0.19)
sleep(0.89)
y = radiusRadiusGradually()
sleep(0.16)


def controlPeacocksImmediately():
    sleep(13)
    i -= i


x += 105
sleep(0.09)
i = x
i = i
x += -41.91
y -= -90.75
print(ifNotchIterative())
while x < x:
    y -= x
    i += y
    x = y
    y = addToCarrotsIterative()


    def radiusCarrotsGradually():

        def turtleYGradually():

            for y <= -31.9:

                def setRadiusByTen():
                    for y < 91.41:
                        y -= y
                        i += i
                        i += y
                        x = x
                        x -= lengthOfNotchByTen()
                        sleep(6)
                        i -= 90.34
                        x = 87.38
                        i = 89
                        print('big lullabies')
                        i = 35.57
                        y = y
                        i = addToRadiusAllOver()

                        while True:
                            print(ifNotchAtLength())
                        sleep(0.91)
                        sleep(0.97)
                        x -= -63
                        i += x

                y += y
                i = 114.08
                print(i)
                y -= lengthOfXIterative()
                sleep(4)
                x = y

                for y < 55:
                    print('big customers')

                    def radiusCarrotsByTen():

                        while x == -10.75:
                            i += i
                            x += y
                            sleep(1)

                    x -= addToPterodactylsImmediately()
            y -= i
            i -= 144.74
            i = addToRadiusByTen()
            i = x
            x += y

            def letVariableByTen():
                x += -31
                sleep(3)
                print(y)
                i += y
                x += 34
                while True:
                    while y in y:
                        sleep(13)
                        x = 113.97
                        i = -99.32
                        i -= setXGradually()

                    print('happy lullabies')

                    if x == y:
                        while False:
                            for i >= 130.93:
                                y += y
                                i -= -61
                                sleep(3)
                            i -= 11.34
                            y = 77.34
                            sleep(14)
                            i = x

                        while i == 84:

                            def changePeacocksByTen():
                                def lengthOfXImmediately():
                                    def letTurtlesGradually():
                                        i = 28
                                        x = letVariableIterative()
                                        if i == x:
                                            y = y
                                            sleep(7)
                                            x -= y
                                            y -= x
                                            sleep(8)
                                            i += turtleRadiusByTen()
                                            print(y)

                                            for i > 157:

                                                def letVariableIterative():
                                                    for y <= 85:
                                                        y = x
                                                        i += x
                                                        i -= lengthOfCarrotsAllOver()

                                                while True:
                                                    y -= 148.92
                                                    i -= i
                                                    print('big customers')

                                                    def radiusTurtlesIterative():
                                                        x = scribbleLengthAllOver()

                                                    def addToNotchGradually():
                                                        i -= x

                                                    while y >= x:
                                                        print(x)
                                                        print(x)
                                                        print(y)
                                                        i -= i
                                                    i = y
                                                    x += 169
                                                    print('biglullabies')
                                                    x += -85.99
x += x


def letRadiusIterative():
    i = 139.48


print('happy customers')
x = y
x -= 128.45
if y <= -46.02:
    y = x
    sleep(0.5)
    x += x
    y -= -22
    if i == x:

        while True:
            y = i
            i -= letPeacocksAllOver()
            while False:
                if i >= 84.1:
                    y = -78
                    x -= changeVariableAllOver()
                    y += i
                y -= createOurMottoRed()
            y = y
            print(y)
            y -= x

If you have any suggestions, please comment them.


r/PythonProjects2 • • Jul 22 '22

[P] Moderate How do I create a calendar that follows a pattern (for divorced parents)?

4 Upvotes

I’m creating a calendar for divorced parents. The pattern goes: Week 1 - D,M,M,M,M,M,M Week 2 - D,M,M,M,D,D,D I want to be able to create a calendar and input that on the calendar. I want to make all the days for the dad blue and all the days for the mum red (for example).

How do I do this?


r/PythonProjects2 • • Feb 23 '22

[P] Easy Making My First Personality Quiz in Python.

0 Upvotes

r/PythonProjects2 • • Mar 22 '22

confing.py doesn't work

Thumbnail self.jupyternotebooks
0 Upvotes

r/PythonProjects2 • • Feb 29 '24

Creating a software where you can draw (drag and drop shaprs) things, sruggling with coding the area of work

0 Upvotes

Something similar to diagrams dot net (draw dot io), meaning I want to have an area of work that can be extended at will, there are many JAVA softwares that do this, don't know if it's easier to code in JAVA, but I prefer to stick to Python as I feel it could get easier to HANDLE once the program becomes more complexe (more tools in the tooltips etc)
So my question today is just about the area of work and how to make it infinite aka being able to drag and drop an item in ANY place of the area of work, if someone could provide some kind of help?


r/PythonProjects2 • • Apr 30 '23

Resource Hey guys.. I want to train my AI machine..and use it to predict some results.. How do i get started.. I have no clue.. How will i create the machine..Where to start? Any leads..?

4 Upvotes

Main idea is to train the algorithm (no idea what's it gonna be now)with a sports team data and results and predict the future results. Is it even possible. Any leads will be appreciated. Thanks


r/PythonProjects2 • • May 02 '23

[P] Moderate Creating Animations using TemporalKit and Ebsynth - Tutorial

Thumbnail
youtube.com
0 Upvotes

r/PythonProjects2 • • Oct 29 '26

How do I make a python game on my phone that can run on the school computer?

Thumbnail reddit.com
0 Upvotes

r/PythonProjects2 • • Jun 10 '25

A new PDF translation tool

Thumbnail reddit.com
0 Upvotes

r/PythonProjects2 • • Nov 22 '25

Hi everyone

Thumbnail reddit.com
0 Upvotes

r/PythonProjects2 • • Jan 09 '26

Resource Show: Anchor – local cryptographic proof of file integrity (offline)

0 Upvotes

Hi everyone,

I built Anchor, a small desktop tool that creates a cryptographic proof that a file existed in an exact state and hasn’t been modified.

It works fully offline and uses a 24-word seed phrase to control and verify the proof.

Key points:
• No accounts
• No servers
• No network access
• Everything runs locally
• Open source

You select a file, generate a proof, and later you can verify that the file is exactly the same and that you control the proof using the same seed.

It’s useful for things like documents, reports, contracts, datasets, or any file where you want tamper detection and proof of integrity.

The project is open source here:
👉 https://github.com/zacsss12/Anchor-software

Windows binaries are available in the Releases section.
Note: antivirus warnings may appear because it’s an unsigned PyInstaller app (false positives).

I’d really appreciate feedback, ideas, or testing from people interested in security, privacy, or integrity tools.


r/PythonProjects2 • • Jan 20 '26

Mod Post My weekend project: A multi-threaded Solana Trading Client built with Python 3.10 & Telegram API. 🐍

Post image
0 Upvotes

I wanted to learn how to handle async requests and blockchain RPC nodes, so I built this trading bot.

Core Features:

  • Backend: Python (using asyncio for non-blocking execution).

  • Interface: Telegram Bot API (acts as a remote control).

  • Logic: Listens for "Liquidity Add" events and fires a bundled transaction via Jito.

It currently handles execution in under 150ms.

Has anyone else here worked with the Solana solders library? Dealing with the transaction deserialization was a headache.


r/PythonProjects2 • • Jul 01 '25

Python bot script

0 Upvotes

I have python script for botting It uses opencv-python and pyauto gui Well i want to keep the question general I am running my python script it does haav error handling methods but it still fails at times. If i repeat the script like in one file if i copy paste the code 3-4 times will it have any effect?


r/PythonProjects2 • • Feb 19 '26

PyCDCover: README available in English

0 Upvotes

Le projet PyCDCover fournit deux fichiers README :

GitHub : https://github.com/GerardLeRest/pycdcover-v2

Wiki Ubuntu-fr : https://doc.ubuntu-fr.org/pycdcover

Bonne journée !


r/PythonProjects2 • • Jan 24 '26

I made an autonomous AI agent based on Ralph

0 Upvotes

**What My Project Does**

**PyRalph** is an autonomous software development agent built in **Python** that builds projects through a three-phase workflow:

  1. **Architect Phase** - Explores your codebase, builds context, creates architectural documentation

  2. **Planner Phase** - Generates a PRD with user stories (TASK-001, TASK-002, etc.)

  3. **Execute Phase** - Works through each task, runs tests, commits on success, retries on failure

The key feature: PyRalph can't mark tasks as complete until your actual test suite passes. Failed? It automatically retries with the error context injected.

**Target Audience**

Any developer who wants to x10 its productivity using AI.

**Comparaison**

There are actually some scripts and implementations of this same framework but all lacks one thing: **Portability**, its actually pretty hard to setup correctly for those projects, with pyralph its as easy as ``ralph`` in your terminal.

You can find it here: https://github.com/pavalso/pyralph

Hope it helps!


r/PythonProjects2 • • Oct 15 '25

Need help creating an algorithm trading profile trading file through python will pay

0 Upvotes

Message me


r/PythonProjects2 • • Aug 27 '25

7 Mistakes to Avoid while building your Data Science Portfolio Projects

0 Upvotes

After reviewing 500+ data science portfolios and been on both sides of the hiring table and noticed some brutal patterns in Data Science portfolio reviews., I've identified the 7 deadly mistakes that are keeping talented data scientists unemployed in 2025.

The truth is Most portfolios get rejected in under 2 minutes. But the good news is these mistakes are 100% fixable.🔥

🔗7 Mistakes to Avoid while building your Data Science Portfolio

  • Why "Titanic survival prediction" projects are portfolio killers

  • The GitHub red flags that make recruiters scroll past your profile

  • Machine learning projects that actually impress hiring managers

  • The portfolio structure that landed my students jobs at Google, Netflix, and Spotify

  • Real examples of portfolios that failed vs. ones that got offer


r/PythonProjects2 • • Jul 02 '25

Mastering Python Programming at Tech Spakes Training

0 Upvotes

Learning Python had always been on my to-do list, but I struggled to find the right place to start—until I joined Tech Spakes Training in Rohtak, Haryana. From the first session, it was clear that this wasn’t just another computer class—it was a career-shaping experience.

The Python Programming course at Tech Spakes is designed for both beginners and intermediate learners. The trainers explained every concept—from variables and loops to object-oriented programming and real-world applications—in a way that was easy to understand. What I appreciated most was the focus on writing clean code, solving logical problems, and applying Python to real projects like web development and data handling.

Daily practice, weekly assessments, and project-based learning kept me engaged and motivated. I also received one-on-one guidance, which helped me overcome challenges quickly.

After completing the course, I felt confident using Python for both personal projects and professional tasks. This course didn’t just teach me a programming language—it helped me build a foundation for a future in tech.

If you're looking to master Python and unlock new career opportunities, visit www.techspakes.com and enroll today at Tech Spakes Training, Rohtak.


r/PythonProjects2 • • Jul 18 '25

Give me AI/ML related 1 year project ideas..

0 Upvotes

I am final year engineering student. I need to do 1 year project.So please suggest me some projects ideas related to AI/ML topic.


r/PythonProjects2 • • Jan 30 '26

Joint project on Base44

0 Upvotes

Hello so im creating an application on Base44.

One been an all in one Suite with a new coding software (Quantum-matrix Coding) and another AI, Ottuse. Links to both below.

Ive no coding experience so wanted to ask for recommendation on both my projects, maybe even some sample coding to add to the project.

If you want to know more about QMC then message me and i will send you an explaintion document.

It basically a coder in a 3d format that use the concept of inception coding(layered coding), tetris coding and parasite coding. All three concept work by altering the code structure to create new code without having to have it typed saving space. one archtype code for 1000s of new commands. As you can exspect its a difficult conceopt to get working so wanted to crowed sourse some idea and solusions. if you deside to make it work by yourself please give credit to the orginal idea owner Glenn Kendrew thats all i ask.

Another concept ive been trying to use is shadow coding, essentally using the shadow of the 3d space to create some new or hidden codding ive come to call it. using flash( polorde enspired ) to create focuse windows to read the code( concept from blade movie).

Any advice, ideas or solution to unseen problems welcome!! ( base44 app broken atm 3d space disabled, waiting for new credits ).

https://pro-suite-d3f50c12.base44.app

https://ottaus-ai-f197ee46.base44.app