#tools-and-devops

1 messages Β· Page 12 of 1

astral apex
#

I don't know what that means

#

But.... I don't think so?

south marsh
#

I'm not sure what this section is trying to explain then

astral apex
#

That you can use a context manager to automatically remove the temp file when you exit it

south marsh
#

what temp file

#

I'm just trying to read the file as-is

vapid hedge
#

hi everyone is there anyone who have experience in maya Python Scripting or mel? i need some small help.

obsidian moat
#

whats up

obsidian moat
#

keep up

misty elk
#

I'm new to git and I'm trying to reset back to an old commti (just learned that revert doesnt work like that). When I reset things work but it's only locally- how would I push those to the main branch? I can't stage commit push as I have some conflicts and I don't think it works like that in general.

rapid sparrow
#

in this case you can always git push --force-with-lease

#

in order to overwrite history

#

if u aren't single contributor, don't do it. main/master branch is supposed to be not overwritten in its commits

#

git revert commit is only allowed in them with working in collaboration with others

#

u are allowed overwriting history in feature branches u own only (if working in collaboration)

misty elk
#

im the only contributor i only use this repo to backup my notes

#

"fatal: The current branch main has no upstream branch."

rapid sparrow
#

okay, then it is legit

rapid sparrow
misty elk
rapid sparrow
misty elk
#

on branch main nothing to commit working tree clean

#

hmm

rapid sparrow
#

copy answers ^_^ git already highly likely told you how to fix this error

misty elk
#
fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin main

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
rapid sparrow
#

do you not have main branch remotely?

#

did u push repository to remote before?

#

what is default branch? is it master or main

#

also, how can u created this git repository πŸ˜„ was it created manually via git init, or you git cloned it from remote

misty elk
#

it's main

#

i made a repo in a folder then moved the .git files into my note taking app folder (obsidian)

#

cause i followed a tutorial

rapid sparrow
misty elk
#

github desktop client

#

so same thing as if i did git init

rapid sparrow
#

So, what can u see if you photo your remote GUI?

misty elk
#

it shows my repo

#

the main branch

#

with the bad commit i made

rapid sparrow
#

can u show more precisely πŸ˜„

rapid sparrow
misty elk
#

nah i have the id of an old commit from yesterday. i want to just take that commit and make that my new main branch

#

so yeah i think thats what you mean

rapid sparrow
misty elk
#

I made a commit yesterday (which didnt have conflicts) and i want to revert all changes i made since that commit yesterday. so i essentially want to remove the current files and replace them with the ones from the commit yesterday

rapid sparrow
#

anyway, looks like u wish to overwrite remote completely with your new local state created via git init to remote
deleting remote completely and overwriting with your current local state, correct?

misty elk
#

yes

rapid sparrow
#

okay, then just use git push --force --set-upstream origin main

misty elk
#
error: failed to push some refs to 'https://github.com/stillmygithub/myreposname.git'
#

when i use that command

rapid sparrow
#

πŸ€” lazy to create repository replicating this situation

#

git push --delete origin/main ?

misty elk
#

ahh i get what you mean i dont have a repo with the old commit

rapid sparrow
#

yeah, u have different initial commit starting your tree

misty elk
#

thanks for the help man i got to go sleep or i will be dead tomorrow. hope i figure it out. have a good night!

rapid sparrow
#

then u will be able to push git push --set-upstream origin main

zinc flint
#

does anybody here know about using printers with python and could maybe help me? I need to be able to print a pdf (or postscript) from a printer and configure the settings for the print without admin permissions. Basically what word does when you wanna print a file. How can I do that? I have the win32print library but I can't figure out how to do it without admin perms since the only way i found it works is with "SetPrinter". I would really appreciate any help!! Sitting on this problem for a while already and can't find anything

mint cipher
#

Having trouble to deploy a very simple flask app to fly.io. Not sure how to fix. Error is gunicorn not found from bash and I don't understand why its missing or what I can do to install it on fly.io. Help!

thin jasper
#

you might run a pip freeze there to check if its there

mint cipher
wind cosmos
#

hi! for create libraries what do you recommend? poetry, hatch, pdm?

tawdry needle
#

(note: you should run pip-compile inside the docker image to ensure that the platform and os specifics are reflected correctly)

worldly hornet
worldly hornet
tawdry needle
tawdry needle
worldly hornet
#

Cool, I really need to dig into Poetry and learn more of the depth of the tool. Thank you for the nudge. I agree, pinning and locking dependencies is a good pattern, even for solo projects.

wind cosmos
#

thanks for your answer, i'll continue my research, but hatch has one vote πŸ™‚

tawdry needle
#

hatch feels a bit like a "WIP" project still

#

and some things like exporting a locked requirements.txt requires extra work, whereas it's just included in poetry

wind cosmos
#

ah ok, i've heard about poetry too

#

poetry is easier?

tawdry needle
#

it has more things built in, which might be equivalent to easier

worldly hornet
#

Poetry is what we use at our company. It works well, but I'm a super shallow user.

wind cosmos
#

i need to create a simple library for internal use so i need something to create that in very little time

#

i will research peotry

#

poetry*

#

thanks!!!

thorny shell
#

I use poetry all the time and recommend it, fwiw

willow pagoda
# wind cosmos hi! for create libraries what do you recommend? poetry, hatch, pdm?

for the various libraries ive written, pip + setuptools is pretty easy to use especially with recent improvements like better dependency resolution and adoption of the pyproject.toml standard, though that's not to say i disapprove of the other options

for example, here's the minimum needed to make a package installable: ```toml

my_package/

init.py

...

pyproject.toml

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "my-package"
version = "1.0.0"
dependencies = ["click>=8.1.7", ...]

Installing for development: pip install --editable .``` see also setuptools quickstart, package discovery, and MANIFEST.in if you use data files

to be fair you still need a separate tool for managing virtual environments (venv), and if it's going on a package index you also want to build distribution files (build) and upload those distributions (twine or ci/cd like trusted publishing), so the convenience of one tool might be an easier choice for you

quartz bough
#

Is anyone using VSCode Devcontainers with Python?

rapid sparrow
quartz bough
rapid sparrow
#

if nobody answers -> then may be your question is not providing all necessary info, or having overly specific problem nobody dealt with, or 100 other reasons why it could be happening

#

based on you still not asking the question, i predict problem with formulating your question πŸ˜„

rapid sparrow
quartz bough
viral marlin
rapid sparrow
#

my usage did not require this config

#

may be we aren't even using same plugin

rapid sparrow
quartz bough
#

I tried with flake8 and autopep8, neither did format manually or on save.

#

Pylint, works though

rapid sparrow
#

and may be describing how u launch it

quartz bough
rapid sparrow
quartz bough
rapid sparrow
quartz bough
#

I think we're talking different things

rapid sparrow
#

well, can't say for sure since u don't link (or screenshot) what u use.

quartz bough
#

I already pasted the gist with what I use.

rapid sparrow
#

I just use it differently

#

never made devcontainer.json

rapid sparrow
rapid sparrow
#

nevertheless fun feature to try i guess πŸ€”

#

i have some question if i can define different containers though

#

hmm...

#

no, docker-compose is more reliable and IDE cross platform

#

not going to make dependency on obscure IDE plugin configuration

ancient grove
#

Guys has anyone ever faced this issue when building a ci/cd pipeline in azure app service using GitHub actions. IT was working before but its saying ive hit the artifactsΒ quota. I already implmeneted some solutions in some stack overflow posts like including a step to delete the artifacts and setting the log retension period to 1 day. The delete artifacts step is not giving any errors, but this is still coming up

sly crypt
#

I have a GitHub workflow in which mypy tests fail on the Windows part of the project.


on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    name: Mypy
    steps:
    - uses: actions/checkout@v1
    - name: Set up Python 3.11
      uses: actions/setup-python@v1
      with:
        python-version: 3.11
    - name: Install Dependencies
      run: |
        pip install mypy
    - name: mypy
      run: |
        mypy slodon/

it's because of the line runs-on: ubuntu-latest, what is the best of fixing this error?
Should I just change the run according to the system?

run: | mypy slodon/windows
run: | mypy slodon/linux?

ancient grove
sly crypt
ancient grove
# sly crypt maybe?

yeah, i am not too experienced with github workflow configs. but this is something i will do . if you are trying to run it for both windows and linux, just define 2 files

sly crypt
royal cipher
#

Hi, I'm trying to merge and I got some conflicts and since they are determined to be complex I cant resolve them thru the web editor. The problem is that I can't re-produce it like I can't get to the point in my local vscode environment where I could see my merge conflicts and I'd be able to resolve them, how can I reproduct the conflicts locally so I can solve them.

thorny shell
#

ensure that your two local branches are at the same commits as the branches you were originally trying to merge.

royal cipher
thorny shell
#

I just told you how

#

did you not understand?

royal cipher
#

Solved it now

#

thanks

#

Now I merged it btw, but something's wrong with mypy, It just doesnt show up for some reason.

name: Mypy

on: [push, pull_request]

jobs:
  linux:
    runs-on: ubuntu-latest
    name: Mypy-linux
    steps:
    - uses: actions/checkout@v1
    - name: Set up Python 3.11
      uses: actions/setup-python@v1
      with:
        python-version: 3.11
    - name: Install Dependencies
      run: |
        pip install mypy
    - name: mypy
      run: |
        mypy slodon/slodonix/slodonix/exceptions
        mypy slodon/slodonix/systems/wayland
        mypy slodon/slodonix/slodonix/slodonix_wayland.py
        mypy slodon/slodonix/systems/x
        mypy slodon/slodonix/slodonix/slodonix_x.py
        mypy slodon/slodonix/slodonix/tween.py
        
    windows:
      runs-on: windows-latest
      name: Mypy-windows
      steps:
      - uses: actions/checkout@v1
      - name: Set up Python 3.11
        uses: actions/setup-python@v1
        with:
          python-version: 3.11
      - name: Install Dependencies
        run: |
          pip install mypy
      - name: mypy
        run: |
          mypy slodon/slodonix/slodonix/systems/windows
          mypy slodon/slodonix/slodonix_windows.py
#

@thorny shell

willow pagoda
#

you can also look in the actions tab to see if github recognizes your workflow file but cant parse it

royal cipher
#

ohh wait

#

you're right

willow pagoda
#

the joys of 2 space indentation

royal cipher
#

πŸ˜„

royal cipher
royal cipher
willow pagoda
#

or if you want the linux/windows job to run based on which files were changed, i'd probably separate them into two workflows and use the paths: option for the push/pull_request trigger types
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push ```yaml
on:
push:
paths:
- 'slodon/slodonix/slodonix/systems/windows/**'
- 'slodon/slodonix/slodonix/slodonix_windows.py'

jobs:
windows:
...``` (not entirely sure if the glob pattern in that example is correct)

royal cipher
rancid schoonerBOT
#

.github/workflows/build_releases.yml line 164

if: matrix.info.os == 'windows-2019'```
astral apex
#

The only project I know of that does it pulls the info from a matrix

#

You might be able to access that information from like the github context without a matrix

willow pagoda
#

i was thinking of a matrix too, but im not sure how you'd use different commands for that mypy step, assuming the goal is to merge the two jobs into one

sly crypt
#

(I'm working with him)

astral apex
royal cipher
willow pagoda
# royal cipher The problem now is that on the mypy-linux workflow for some reason I'm running t...

im not sure why it checked the windows files, but apparently mypy can recognize platform assertions on a module level:
https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks

import sys

assert sys.platform != 'win32'

# The rest of this file doesn't apply to Windows.```

it might be easier to add those assertions and then have the workflow lint the entire package at once, then you don't need to update the workflow for new modules and you can use a matrix instead of OS-specific jobs

gentle solstice
#

because sys.platform is a constant

smoky vigil
#

is python version 3.11.5 is stable , iam developing a webapp in django

rapid sparrow
subtle quarry
#

Is there any tool to test concurrent POST calls? I split terminal window to like 40 panes and sync typed POST command that way. But there must be a better way?

rapid sparrow
#

<@&831776746206265384> we have continued having FU problem for your awareness

sage cradle
white adder
#

hi guys

#

not sure if this is the right channel to post this in but i'll go ahead

#

i'm converting a python project into an .exe file

#

for this purpose i'm using pyinstaller

#

however i get this error when i launch the exe

#
Traceback (most recent call last):
  File "kiesel_gui.py", line 3, in <module>
    import kiesel_simulator
  File "PyInstaller\loader\pyimod02_importers.py", line 391, in exec_module
  File "kiesel_simulator.py", line 5, in <module>
    import seasonality_builder as src
  File "PyInstaller\loader\pyimod02_importers.py", line 391, in exec_module
  File "seasonality_builder.py", line 4, in <module>
    import holidays
ModuleNotFoundError: No module named 'holidays'
#

i had the same problem with openpyxl (i'm using pandas in the py files) and i was able to solve it using a thread from stackoverflow

#

but for the holidays module there is no previous thread on the internet, can someone help me ?

#

this is the command that solved it for openpyxl

#
pyinstaller main.py --hidden-import openpyxl.cell._writer
subtle quarry
white adder
#

yes of course

#

@subtle quarry

subtle quarry
#

Nice

white adder
#

yeah i checked again right now

#

the pb comes from pyinstaller and holidays

subtle quarry
#

Then probably pyinstaller doesn't support it. Don't know. Maybe you need to remove this package from your scrifor pyinstaller

white adder
#

scrifor ?

#

well i was thinking,

#

since i'm using a conda virtualenv with all my packages

#

isn't there a way to include all packages from the venv in pyinstaller ?

subtle quarry
#

Don't know don't use pyinstaller that often . Actually used it once

#

Are there any other packages that you use for that script and they work?

willow pagoda
#

if hidden import worked for openpyxl, does adding --hidden-import holidays work too?

white adder
#

@willow pagoda first thing i tried

#

and it failed

#

this is why i came here

#

ok we are getting somewhere

#

i tried another time

#

i placed myself in the anaconda env i used for this project

#

and ran my pyinstaller command

#
pyinstaller kiesel_gui.py --onefile --hidden-import openpyxl.cell._writer --hidden-import holidays -w
#

when i launch the exe

#

i get this error

willow pagoda
# white adder

i tried reproducing on linux using a tweaked version of their quickstart example and got the same No module named 'holidays.countries' error, and judging from their source code it seems to mostly be python modules and some locale data files so i went with --collect-all to bundle whatever was missing, now the script appears to run correctly py $ pyinstaller main.py --collect-all holidays ... $ ./dist/main/main date(2015, 1, 1) in us_holidays = True date(2015, 1, 2) in us_holidays = False us_holidays.get('2014-01-01') = "New Year's Day"

white adder
#

oh

#

you just added --collect-all holidays to my command ?

willow pagoda
#

im not packaging the same code that you're running so it wouldnt make much sense to use your pyinstaller command

willow pagoda
#

but try replacing the --hidden-import holidays with that

white adder
#

ok

#

ok i launched the command

#

brb

#

ok thank you, the gui launches now

#

the only pb is that it doesnt do the simulation i want it to do and there should be a matplotlib window popping when i press some button and it doesnt for some reason i dont know

#

maybe to debug i can take off the -w flag and have aterminal window to see the logs?

#

bro it's impossible to see the logs in a terminal... this thing driving me crazy

#
72046 INFO: Looking for dynamic libraries
C:\Users\ianne\anaconda3\envs\kiesel\Lib\site-packages\PyInstaller\building\build_main.py:194: UserWarning: The numpy.array_api submodule is still experimental. See NEP 47.
  __import__(package)
74755 INFO: Extra DLL search directories (AddDllDirectory): []
74755 INFO: Extra DLL search directories (PATH): []
80622 WARNING: Library not found: could not resolve 'impi.dll', dependency of 'C:\\Users\\ianne\\anaconda3\\envs\\kiesel\\Library\\bin\\mkl_blacs_intelmpi_lp64.2.dll'.
80626 WARNING: Library not found: could not resolve 'sycl6.dll', dependency of 'C:\\Users\\ianne\\anaconda3\\envs\\kiesel\\Library\\bin\\omptarget.sycl.wrap.dll'.
80626 WARNING: Library not found: could not resolve 'msmpi.dll', dependency of 'C:\\Users\\ianne\\anaconda3\\envs\\kiesel\\Library\\bin\\mkl_blacs_msmpi_lp64.2.dll'.
80626 WARNING: Library not found: could not resolve 'impi.dll', dependency of 'C:\\Users\\ianne\\anaconda3\\envs\\kiesel\\Library\\bin\\mkl_blacs_intelmpi_ilp64.2.dll'.
80626 WARNING: Library not found: could not resolve 'msmpi.dll', dependency of 'C:\\Users\\ianne\\anaconda3\\envs\\kiesel\\Library\\bin\\mkl_blacs_msmpi_ilp64.2.dll'.
80626 WARNING: Library not found: could not resolve 'pgmath.dll', dependency of 'C:\\Users\\ianne\\anaconda3\\envs\\kiesel\\Library\\bin\\mkl_pgi_thread.2.dll'.
80631 WARNING: Library not found: could not resolve 'pgc.dll', dependency of 'C:\\Users\\ianne\\anaconda3\\envs\\kiesel\\Library\\bin\\mkl_pgi_thread.2.dll'.
80632 WARNING: Library not found: could not resolve 'pgf90.dll', dependency of 'C:\\Users\\ianne\\anaconda3\\envs\\kiesel\\Library\\bin\\mkl_pgi_thread.2.dll'
#

i noticed that in the logs of my pyinstaller command

#

maybe that's what makes my matplotlib button not run

sudden mesa
#

Hey, I really want to get started with learning microservices and kubernetes . I've had decent amount of experience building applications using monolith or 3-tier architecture using python (django mostly with some fastapi), golang and a little typescript and have used docker as well. Could someone some good resources to get started?

rapid sparrow
rapid sparrow
# sudden mesa Hey, I really want to get started with learning microservices and kubernetes . ...

as for architecture and microservices.
from your description i got a feeling of insufficiency to build monoliths at the necessary level yet.

Recommendation to read Clean Architecture first, in order to have better hang of structure manipulation at a single application
understanding better code gathering into reusable packages and structuring stuff in general
In order to utilize at full capacity, u need to use Golang.
Or if u want to try in python, Mypy in python in strict configuration can help, and usage of Pydantic + smth like Django Ninja/FastAPI
Best trying it in Golang first though, it is just far easier to do it there

Then u could read materials like From monolitoh to microservices and Building microservices

#

Microservices create additional problems (wormhole of addtional problems)... decreasing problems with code validation for correct cross service communications is a huge boon.
That is why recommended the stuff regarding tech i recommended

#

WARNING: Don't build microservices until u really learned to write scalable code of a monolith. Microservices create A LOT of additional problems.

rapid sparrow
#

P.s. I hope u learned unit testing to a good level πŸ€” I can drop some books for that too

latent bison
#

RE: Pipenv up-grade issues

Status: (Just a novice pipenv/virtual environment user) I've been using pipenv to manage a few project's dependencies the last year while diving deeper into Python. I was recently using a version of Pipenv for a few months, without upgrading it. All was fine. Then the other day I decided to up-graded Pipenv when my IDE wouldn't recognize new ve's that I created. After up-grading pipenv and dependencies and running pipenv install in a project created by an IDE I was presented with a long list of "issues" being displayed in my cmd window culminating in a permission error - not being allowed to access some postgres data files.

Question: I did not experience this issue weeks ago with the older version of pipenv when creating a new environment, why am I now presented with pipenv wanting access to postgres data files when to my knowledge access to some postgres files were not required previously?

Thanks for the help.

thorny shell
#

can't imagine that's anything to do with pipenv itself

#

I'd look carefully at the IDE

latent bison
# thorny shell I'd look carefully at the IDE

ahh.... not sure how an IDE effects installing a pipenv ve via pipenv install in a project other then the initial and un-populated project was created by the IDE, but it does appear that the sub-category of the IDE (Eclipse) hasn't been supported for about a year. You may be onto something though with your suggestion and I may now be faced with a bigger issue in the middle of a class that I'm trying to complete, switching IDEs. (pulls hair out meme)

thorny shell
#

in my experience, IDEs are more trouble than they're worth, unless you're using the same one every day

#

very very complex

latent bison
# thorny shell very very complex

it does seem that way especially for someone that isn't a systems expert and/or enjoy staying abreast of the whole dev environment.

#

how I recover/transition to another dev environment mid-educational class experience when I need to focus on some python libraries will be....

thorny shell
#

it doesn't help that VSC and Pycharm change notably as time passes 😐

#

presumably those changes are meant to be improvements, but they're disorienting

heavy knot
#

Can someone help me put my discord bot code from replit to put it in a vps, i bought a vps but idk how to put my code in

misty otter
#

Which VPS did you buy?

thorny shell
#

hoping it's *nix and not Windows

misty otter
#

Honestly I highly doubt they bought one as they instantly sent the message

#

Can't purchase a VPS in ~15 seconds lol

thorny shell
#

with lightsail, it's not out of the question

astral apex
#

Can't you?

misty otter
#

For a beginner who had no clue what a VPS was I would say it's unlikely

thorny shell
#

true true

#

.oO(why had I never come across PEP 9001 before)

misty otter
#

It's the final style guide for python

#

Objectively the best

thorny shell
#

clearly

#

I read a paragraph or two before scrolling back up to check the publication date

cobalt dome
rapid sparrow
# cobalt dome a topic that i am moving from <#291284109232308226>

that depends 😁 both paths are available

  1. U can ask for client credit card
  2. u can charge client for money u spent on their server resources (putting this money into invoice to them)

That depends on

  1. Your hiring contract type, are you employee? Are you b2b enterpreneur? are you freelancer

if you are employee, first path i think is obligation
freelancer... both are usable paths
enterpreneur can utilize both paths too. Depends on his scale of entrereneurism and desired scope of services to provide

#

So for example... if in the end u are just full time working for someone, first path is prefered
if you are only providing services but not working for them, second path can be prefered (in order to make client more depended on you and providing more obfuscated end result, just giving end result, the working service)

cobalt dome
#

We are just two friends trying to do some biz, and will do some biz in the future too, so yeah freelancer.

rapid sparrow
#

i would say for freelancers and enterpreneur, this is all depending on client requirements. I would not be closed to all options and may be even having for each client different way

cobalt dome
#

Also that scale of entrepreneurism bar is pretty low because I hate tinkering with AWS billing, account managing, organization such so

cobalt dome
rapid sparrow
#

u just limit the scope of clients u agree to work with

#

and it is completely fine

cobalt dome
#

ooooooooh that is sensible

rapid sparrow
#

i refuse to work for any money with NFT for example (even if offered 200% of current income)

cobalt dome
#

yeah i can limit that too

#

like i can decide one principle, we are dumping aws bills on you sya

rapid sparrow
#

Freelancers /enterpreneurs can be having exactly presenting web sites that least services they can provide 😁
or they can just tell it during negotiation with clients, your choice

#

it is your responsiblity to extract requirements out of client

#

and to make client to agree to certain contract of what will be done and how much will be paid

cobalt dome
#

yeah, unfortunately

#

i will dump all these talking parts to my friend

#

i hate any kind of client interaction and I didnt expect to have this many

rapid sparrow
#

for freelancers and enterpreneurs it comes by design (interacting with clients)
employees aren't really escaping this thing too btw, development is a team work.
Any dev from middle rank is expected to interact with other people and extract requirements (mostly from other devs)

cobalt dome
#

i will dodge any role that requires human interaction in the future lmao

#

there is too much to unpack

#

thanks for all tips

strong bison
#

PS C:\Users\Isteyak\Downloads> docker -v
Docker version 24.0.6, build ed223bc
PS C:\Users\Isteyak\Downloads> docker ps
error during connect: this error may indicate that the docker daemon is not running: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json": open //./pipe/docker_engine: The system cannot find the file specified.
PS C:\Users\Isteyak\Downloads> history

Id CommandLine


1 docker --start-service
2 cd Downloads
3 docker run hello-world
4 docker info
5 docker info
6 docker logs docker-desktop
7 docker logs docker-desktop
8 "Docker Desktop Installer.exe" install
9 "Docker Desktop Installer.exe" install
10 Start-Process 'Docker Desktop Installer.exe' -Wait install
11 start /w "" "Docker Desktop Installer.exe" install
12 start /w "" "Docker Desktop Installer.exe" install
13 docker run redis
14 docker -v
15 docker ps

#

no mattr wat i cant set up docker in my p

#

pc

mint cipher
rapid sparrow
indigo zenith
strong bison
strong bison
#

So weird it works now still curious but don't have time to research on what really went on, Dockr app starts without err and Dockr PS command doesn't give err either

scarlet coral
#

hey guys does can someone help me with tkinter?

#

I'm done with the introduction of python

#

and now I'm trying to implant a python project

#

but since I want to make a graphical interface for it

#

I need tkinter

#

but I'm getting overwhelmed with the concepts and subjects of tkinter

#

so i can use any help

indigo zenith
# scarlet coral so i can use any help

I would try a tutorial or two to start, maybe like this https://realpython.com/python-gui-tkinter/

If you're still stuck share some of your existing code in a help channel #β“ο½œhow-to-get-help

In this tutorial, you'll learn the basics of GUI programming with Tkinter, the de facto Python GUI framework. Master GUI programming concepts such as widgets, geometry managers, and event handlers. Then, put it all together by building two applications: a temperature converter and a text editor.

hoary veldt
#

Hi guys! Anyone here developing in VSCode using devcontainers? I'm trying to set up kind of a template project for an backend/API application. It been some time since i developed using Python so I could need some input on how to configure my dev environment correctly.

alpine horizon
#

how do I reset the whole .git folder to its current state in the remote repository?

rapid sparrow
rapid sparrow
alpine horizon
#

I tried to create a new branch from an old commit git checkout -b new_branch commit_hash but for some reason its content is not matching the content of that commit hash

#

not sure how I fix that

#

in fact its content is exactly the same as the latest commit from the branch of commit_hash

rapid sparrow
#

it is really bad reseting branch used together with others to older commits

#

u should use only git revert in those situations

#

reseting is good only.. if u just reset local state to remote
or u reset your personal feature branches to older commits, then it is fine

alpine horizon
tranquil current
#

my github copilot subscription is not working as a student even though I have the student devleoper pack

#

does anyone have the same issue?

hoary veldt
#

how do I set up venv in a devcontainer? should this be done in the Dockerfile or a post-script from the devcontainer.json?

hexed osprey
#

i wanna make a bot that saves all the unknown number in a group that i am member of. the bot will keep running when mobile start and look for unknown number. If get one then save the number to google account with a string. How can I aproch this.

rapid sparrow
hoary veldt
rapid sparrow
hoary veldt
gleaming thunder
#

what are afew tools to use python

sharp flame
#

anyone here good with fixing circular improts?

#

imports*?

hasty seal
#

Hi!
I am trying to move back to a dev role (I was a backend developer ~10y ago) and took the chance to write some tools with python that help me on my daily work. Is there a channel where sharing the repo for these tools is more appropriate?

rapid sparrow
lusty orchid
#

how to send messege in messenger using py

hasty seal
#

Some servers don't allow these type of posts, and have a dedicated #showcase channel for it.

rapid sparrow
rapid sparrow
#

for the goal of..
having questions regarding design of app in software design
or for career channel as presentability for resume
or smth, just not adds

hasty seal
#

thanks!

indigo zenith
indigo zenith
heavy knot
#

can anyone crack a py file that is as app ? if ye dm me

rancid schoonerBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

nova wadi
#

Hi,
Can I share a Django bnased premium admin template here?

Or just open source projects are allowed?

thorny shell
#

wish I knew

indigo zenith
#

A lot of people seem to like KodeKloud but I don't have a subscription. Most of my AWS learning has involved study books for their certifications.

hazy echo
hazy echo
willow drift
#

Guys is learning devops and cloud computing where the money is at? I am noticing at work the guy doing all the cloud stuff seems to be the most important. He built all the infrastructure and pipelines using terraform, boto3 and other stuff I don't understand too well. He designed it in a cost effective way

#

By using kubernetes and microservices. If I learnt how to build infrastructure in a cost effective way is that the most important thing from a business perspective

rapid sparrow
gaunt valve
#

.devcontainer multi workspaceMount

Hello, has anyone here worked with devcontainers and knows how or if it is possible to mount two folders into the workspace?

somethign like this, but the problem is, that workspaceMount only takes in a string:

{
    "name": "Python 3",
    "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
    "features": {
        "ghcr.io/akhildevelops/devcontainer-features/pip:0": {}
    },
    "postCreateCommand": "pip3 install --user -r tracker/requirements.txt",
    "workspaceMount": [
        "source=${localWorkspaceFolder}/tracker,target=/workspace/tracker,type=bind",
        "source=${localWorkspaceFolder}/utils,target=/workspace/utils,type=bind"
    ],
    "workspaceFolder": "/workspace"
}

rapid sparrow
#

best decision for dev containers in my opinion

gaunt valve
rapid sparrow
# gaunt valve also for a mono repo?

potentially yes. If u will manage making everything launchable from same single forwarded project folder and having launchable all your monorepo processes just under different command path, it will make you simpler life yeah

#

having single docker image is kind of simpler

#

kind of fits monorepo. monorepo = monoimage πŸ˜„

indigo zenith
heavy knot
#

Can someone code a small thing for me? I will explain it in Dm and I think it will only take around 20-30min to code

tawdry needle
ancient grove
#

Hi guys, I have successfully setup jenkins and github, so that each time i push new changes to the v1 branch it will trigger a jenkins pipeline to build and push the image to dockerhub. now i have another vm where i pull the image and run it, and i have a service which would check periodically to pull and restart my docker container if the dockerhub image is updated by the jenkins pipeline. Now when its restarting the api is down for some minutes, I know a solution would be to use a load balancer , but i just want to be sure if this is an appropriate way or is there a better way. I already tried using azure app services but its impossible to disable the default url azure assigns an app instance. So ive decided to setup jenkins and host the api in a vm, then use cloudflare tunnel to proxy requests from a subdomain to the server

astral apex
# ancient grove Hi guys, I have successfully setup jenkins and github, so that each time i push ...

Why does it take multiple minutes to restart?
Are you not pulling the image before you restart?

What's wrong with having the app.azurewebsites.net domain floating out there?
I use App Services at work, and it gave me a webhook to hit to prompt an update.
So I have a GitHub Actions workflow that builds and publishes the container, and then hits the webhook to prompt the App Service to download the new container.
And it waits to recycle the container until it's ready, it still finishes all in progress requests, so you don't really have any downtime there.

I'd really recommend that automated workflow that's all-in-one place if you're just looking for the simplest workflow.

ancient grove
#

yes i understand but we are also trying to cut down costs because we have several applications to deploy and doing that in one vm at the moment i think is a great choice as supposed to creating 3-4 azure app services for it

#

also we are paying for github enterprise subscription

#

I am currently researching for a better option, from what ive seen we might have to throw in ks8 into our workflow

astral apex
astral apex
astral apex
ancient grove
astral apex
#

No I -- I didn't say you have to
Just that it doesn't really add any benefits to building containers other than the additional minutes

astral apex
#

Is there a compliance reason?

#

Is that the main reason you're not using them?

ancient grove
astral apex
#

You ran out of storage on GHEC?

ancient grove
ancient grove
#

artifacts storage

astral apex
#

How big is your container?

ancient grove
#

we were using the free plan and our github actions minutes was almost used up

ancient grove
# astral apex How big is your container?

no, not the size, as you use github actions it will keep track of your usage and in freeplans there is a limit to how many minutes and storage you can use, it refreshes every month

astral apex
# ancient grove hmm... i see, maybe you can give me idea how to setup our workflow, its a really...

Here's my open-source repo that I have an App Service: https://github.com/letsbuilda/api.letsbuilda.dev

Here's the workflow: https://github.com/letsbuilda/api.letsbuilda.dev/blob/main/.github/workflows/docker-build-push.yaml
It runs this reusable one: https://github.com/darbiadev/.github/blob/main/.github/workflows/docker-build-push.yaml
Which caches the build to and publishes to the GitHub Container Registry
And then after that hits the webhook to prompt Azure to get the new container

Nothing required but the one GitHub repo for the entire build process
And then nothing but a webhook required for the entire deployment process

ancient grove
#

okay i see

astral apex
#

It's a public container, so no creds
But if it was private you'd add a PAT here
AFAIK there's still no packages support for fine grained tokens, so you still have to use the classic PATs

ancient grove
#

one question, i already have jenkins setup and it works file, i think i can still use that with dockerhub and azure

astral apex
#

Yeah
You can manually update in Azure
Or have Jenkins hit the webhook

ancient grove
#

i do not understand, if i deploy a new azure app service and set the source to be a container image instead of github project, I think azure will watch the container registry and pull my new image once i push to it

#

right ?

#

currently jenkins will push the built image to dockerhub

astral apex
ancient grove
#

wow, i didnt know that

#

anyways now that i know that it works, ill try it out

astral apex
ancient grove
#

what are your thoughts on using kubernetes ?

astral apex
#

Kubernetes is great

#

But it requires management

ancient grove
astral apex
#

If you only have one or two containers, just make the App Service for the simplicity
But if you start getting into many containers, it's time for Kubernetes

ancient grove
#

when i turn that proxy switch on, it gives me another error like bad gateway or so

ancient grove
#

please i will ping you after some hours, incase i tag you

astral apex
#

That's my thing
When I had Kubernetes, I had to setup NGINX, I had to setup Cert Manager, I had to setup ingresses and services and deployments
When I tried out App Services I said "hey here's my container" and it said "okay I'm done"
I didn't even believe it at first. Coming from Kubernetes, I couldn't believe it was that simple
It was a big sigh of relief to not have to deal with all that crap anymore

ancient grove
#

yes app service really simplifies the process

#

ive been using app services for some time now and its been great

astral apex
#

But I'm not bashing on Kubernetes.
It definitely has it's place.
I'm the infra lead at https://vipyrsec.com/ and we just switched to K8s (from App Services BTW)

#

Lots of containers and it was going to be a pain to make that many App Services

brazen forge
#

just

astral apex
#

Yes?

#

Also BTW, App Services will kill your container if it doesn't respond to HTTP requests

astral apex
#

So it's a non-starter for non web apps

brazen forge
#

(just poking fun at the fact we've been on k8s for quite a while :P)

ancient grove
#

i will definitely learn ks8 soon

#

@astral apex i really appreciate your time

astral apex
#

Of course, happy to help

astral apex
ancient grove
#

haha, i dont know why azure didnt provide a way to remove this default domain

#

it would have been great to use an ip address

astral apex
#

Not sure
But what's wrong with it being there?

ancient grove
#

its making me feel like i have a backdoor to my server , 😁

#

the main api domain is protected with cloudflare

#

if anyone finds out that there is an azure variant they can just make requests to that one

#

right ?

astral apex
#

true

ancient grove
#

yes, because i also do that when im web scraping

#

so you see its a bit concerning

ancient grove
#

i actually implemented the solution in this blog more than 2 times

#

for some reasons its not working for me

astral apex
#

huh

ancient grove
#

it didnt workout for me

#

they solution is basically to enable access to the sire only by defined ip addresses

#

then you will add all cloudflare's ip addresses

#

i did all that but its still saying that azure blocked my request

ancient grove
# astral apex

how do i tell azure to pull the images from dockerhub when i push a new image to dockerhub with thesame tag ?

#

I have turned on ci/cd but its not automatically pulling the new updates from dockerhub

astral apex
#

So when you're ready to update, you send a POST to the webhook

ancient grove
#

okay

#

so i have to do that manually like write code for it ?

#

maybe i will just include that in my jenkins pipeline as the last stage

rancid schoonerBOT
#

.github/workflows/docker-build-push.yaml lines 22 to 28

deploy:
  needs: build-push
  runs-on: ubuntu-latest
  if: ${{ github.ref == 'refs/heads/main' }}
  steps:
    - name: "Update deployment"
      run: curl -X POST '${{ secrets.DEPLOY_WEBHOOK }}'```
ancient grove
#

thank you

ancient grove
#

i also sent the request manually from postman

#

but i didnt notice anything

#

@astral apex it gets triggered if i toggle ci/cd on/off

#

but when i send post request to the webhook it doesnt work

astral apex
#

Huh

#

How?

ancient grove
#

see here

astral apex
#

Look right

#

What do the logs say?

#

Do they have a bunch of crap about invalid characters because you didn't quote the URL?

ancient grove
astral apex
#

Huh
Not sure
Do you get a response?

ancient grove
#

Nope

#

When I send in post man its just empty response

ancient grove
astral apex
#

I normally see the responses

ancient grove
#

yes

#

here its sending

ancient grove
ancient grove
astral apex
#

My guess would be you need to quote the URL

ancient grove
astral apex
#

Not really sure with Postman

#

Don't use it much

ancient grove
#

@astral apex I think using docker-swarm or kubernetes would solve this issue

#

they offer automatic image update

astral apex
ancient grove
#

cos the only issue im having right now is updating the image when i push to dockerhub and still keeping the server running

astral apex
ancient grove
#

im talking about imagePullPolicy - always

#

what do you think ?

astral apex
rancid schoonerBOT
#

kubernetes/manifests/dragonfly/mainframe/deployment.yaml line 19

imagePullPolicy: Always```
ancient grove
#

oh

#

is there a way to tell it to start by sending request to some webhook

#

*to restart

astral apex
#

I have it in all of my deployments
I still have to manually login and kubectl rollout restart deployment/mainframe --namespace=dragonfly to actually trigger that pull

ancient grove
#

okay

#

maybe i can write a webhook in flask or fastapi

#

to call that command

#

do you think that would work ?

astral apex
ancient grove
#

okay

#

will this load balance all traffic, because remember the aim is to update the containers without causing downtime

#

is this the case ? @astral apex

ancient grove
astral apex
astral apex
ancient grove
#

Okay

#

Bro, I honestly dont know what to do

astral apex
#

AFAIK Kubernetes will always automatically try to gracefully restart

#

You can see when I restarted the bot the old instance stayed "running" while the new one was "pending"
And Kubernetes didn't start "terminating" the old instance until the new instance was "runnning"

#

Stayed? Staid?
Anyways

ancient grove
#

So its load balancing the operations

astral apex
astral apex
#

There are multiple types of load balancers, but this is not that
There is only one container at a time, so there is no balancing between them
Right therory, wrong term

ancient grove
#

I may use ks8

astral apex
ancient grove
#

That was the webhook thing . When I call the web hook it gives me 403 forbidden error

#

I already checked , there are no ip restrictions

astral apex
#

Huh
Yeah
Not really sure there
I'd work on that one first

#

Because you already have it running
Before trying to go down the road of setting up a whole 'nother system

ancient grove
#

Yh

mystic void
#

k8s is a complex beast

ancient grove
astral apex
#

Why do you use Jenkins?

#

I literally threw my server away after I got rid of Jenkins

ancient grove
#

Its easy to use I think

astral apex
#

It was tainted

#

Couldn't trust it anymore

ancient grove
astral apex
#

(not really I just replaced it with a newer one)
(but Jenkins was really annoying)

mystic void
astral apex
#

Just got everything I needed from GitHub Actions, with a lot less effort

ancient grove
astral apex
#

Don't really remember the details, it's been... 6 or 7 years since then

ancient grove
mystic void
#

or drone ci

ancient grove
#

We were using app services, but its expensive

#

Not app services, I meant github actions

astral apex
#

Are your VMs cheaper than GitHub?

#

How many minutes do you use?

#

If you already have the resources available, you could also look into self-hosted runners

ancient grove
#

I am not sure but we are running other workflows apart from our api

#

Okay

#

I see

#

But Why not jenkins?

astral apex
#

Just one more thing to keep track of and figure out

ancient grove
#

What?

astral apex
#

Doesn't really matter all that much

ancient grove
#

Idk Why its just almost impossible to trigger a webhook

ancient grove
#

Ive been setting an Authorization header all this time 😩

astral apex
#

nice

#

Why?

ancient grove
#

Was a mistake

astral apex
ancient grove
#

I just tested it, after pushing to dockerhub, when I send the request from postman, it pulls the updated image and restarts the container without downtime

split crypt
#

Hi! I'm working on developing a simulation tool for underwater gliders in python and have lately been stuck on an issue. I am required to solve ODEs in my code, but I keep getting different plots when I use scipy.integrate solve_ivp(), odeint(), and RK45(). The matlab function ode45 works well but I am unable to get the same results on python. Any help would be greatly appreciated!

split crypt
#

sorry, I wasn't sure which channel I should post it in

rapid sparrow
#

We just have them with already provided autoscaling solution... and enjoy free gh

ancient grove
#

I solved my issue anyways, after 18hrs of debugging

ancient grove
#

The issue Why the curl was not sending was because I didnt wrap the url in quote

astral apex
#

Happy to help fir7

ancient grove
#

Haha

#

Took me tons of hours to realize

astral apex
#

Oof
Good job getting it fixed

ancient grove
astral apex
ancient grove
#

I added the asuid

#

But azure app service is saying its not able to find the cname

astral apex
#

I think you have to leave proxying off for the initial setup

ancient grove
#

Ok

#

I disabled proxy and it passed now

astral apex
#

Double check for typos and accidental spaces and all that

#

Oh good

#

Yeah, I generally wait half an hour or so for the DNS and the SSL to get propagated a bit before I enable proxying

#

Should be fine whenever though

ancient grove
#

Did you select ip based ssl

astral apex
#

Uhh

#

No

ancient grove
#

Or sni ssl

astral apex
#

SNI I’m 99% sure

#

I didn’t change the defaults

ancient grove
#

Ok

astral apex
#

The one that’s not the default needs extra configuration

ancient grove
#

Ok

royal silo
#

I currently only have a main branch, if I commit all changes of main branch, then create a new branch rewrite where everything is completely different; there are new folders and files, and then I commit the changes to that branch. Now when I come back to main the folders from the rewrite branch (everything else is as expected) are still there. How do I correctly handle this situation?

brazen forge
#

you committed on main and then created a rewrite branch
so main also has the commit
you'll need to hard reset main to the previous commit

#

switch to main and then do
git reset --hard HEAD~

royal silo
#

I also heard from SO answers that Git does not track folders, how true is that?

brazen forge
#

yeah, it doesn't track empty folders

#

a common way to track empty folders is to make a .keep or .gitkeep file in them and track that

royal silo
#

I undid two commits, but the impl folder is still there, this folder is from the rewrite branch. What I found out just now is that impl is filled with empty folders with no files that exists in the rewrite branch's impl folder

brazen forge
#

check for hidden files
ls doesn't show them by default

royal silo
royal silo
#

fixed it

ancient grove
# ancient grove

@astral apex i selected ip based ssl for the proxy option to work. Ip based ssl means ill use the certificates from cloudflare and to hide the ip address you have to select this option in the SSL/Tls Tab for your domain on cloudflare

royal silo
#

so i worked a huge amount of hours, like 8 hours, then I stashed my changes, but then my laptop had an unfortunate shutdown, now that I come back, all those files are empty and the stash record is missing.

#

did i lose all my files to corruption?

rapid sparrow
# royal silo so i worked a huge amount of hours, like 8 hours, then I stashed my changes, but...

git stash list

       list [<log-options>]
           List the stash entries that you currently have. Each stash entry is listed with its name (e.g.  stash@{0} is the latest entry, stash@{1} is the one before,
           etc.), the name of the branch that was current when the entry was made, and a short description of the commit the entry was based on.

               stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
               stash@{1}: On master: 9cc0589... Add git-stash

           The command takes options applicable to the git log command to control what is shown and how. See git-log(1).

from git stash --help

split crypt
#

I've been using the scipy solve_ivp() function to solve a few ODEs. Can anyone tell me why my plots are tracing backwards? The x-axis is time

indigo zenith
solemn osprey
#

For some reason storing 30 gb of metrics on S3 causes Thanos to waste about 500 gb of S3 traffic daily. What settings should I look into to reduce traffic consumption?

timid schooner
#

I want a little help from anyone with a simple problem in a tool I make!

rancid schoonerBOT
#

failmail :ok_hand: applied timeout to @dim tusk until <t:1696446189:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).

The <@&831776746206265384> have been alerted for review.

hidden atlas
#

What do devops do in python? kinda a question but eh

willow pagoda
hidden atlas
#

I wanna purse a carrer in devops but I legit know nothing about programming

#

Someone told me to do the aws and azure certs

willow pagoda
#

hmm there much more qualified individuals here that can answer that

#

though it might also be more appropriate to talk about in #career-advice

hidden atlas
#

Okay

rapid sparrow
# hidden atlas What do devops do in python? kinda a question but eh

Scripting glue for CI CD means
Cloud provider lambdas that help to augment infra with more custom solutions
Configuring monitoring systems
Making dev tools
Configuring release/deployment system

If they are free of infra stuff and have strong enough backend side then
Using as means to debug databases
Writing libraries, backend
Doing pretty much backend duties if necessary

#

In my current company DevOps engineer is for good half is pretty much backend developer.

When I get tired of too much infra, I grab more backend, more pure dev duties

When I just wish to relax a bit more, I go and solve some infra thing like fixing autoscaling

rapid sparrow
#

I know a guy that wishes to do 80%+ or even purely infra only stuff. Apparently he worked in place that provided it to him. That is weird to me, there is always stuff in between
Or as I said I prefer to take a break from infra only duties from time to time and just to code some application, more dev project

hidden atlas
#

Ill prob do the same if im dev ops

#

Will get tired of infrastructure

rapid sparrow
#

Development is kind of more creative u know, involves different set of brain working.
Taking care of infra stuff is going over monitoring systems to find out about issue, reading more docs and writing more simplistic infra code. Different workflow a bit

Both duties have their own merits but I would not have wished only one set of them

#

Or even Ops duties. Helping to people and taking care of Ops can be nice. I am altruistic enough. But gets tiresome if doing too much too

#

Preferring to do it only as small part of a day and not every day then I can enjoy it, in getting feedbacks of thanks 😁

hidden atlas
#

How many hours you be working in a day?

hidden atlas
rapid sparrow
#

8-/+. Not sure exactly.
I have flexible schedule, sometime I work more, sometimes less.
I just try to have done enough to write down 40 hours made of work during a week.
Still figuring out work balance thing

#

Sometimes day can last 12 hours. I am bad at my time management, personal problem pretty much

#

Often enough I start day only during middle of a day though

hidden atlas
#

You get to choose your own working time?

rapid sparrow
#

Yeah. Very flexible schedule.
Highly preferably I would work 8 hours in same day with start and end at any part of a day with any pauses.
In the end it is important only reporting 40 hours during a week, so I can even jiggle hours to other days if necessary

#

I need to appear at morning standup though

hidden atlas
#

That would be 1 thing that I would hate the meeting

#

how are they?

rapid sparrow
#

And I am expected to answer... relatively fast enough (within an hour?) During normal workday time

rapid sparrow
#

I got used to that

hidden atlas
#

Oh that is fine then

rapid sparrow
# hidden atlas how are they?

Kind of even nice. I am fully remote, during stand-ups i have at least some live communications with humans and see my colleagues

hidden atlas
#

What about the ops part?

#

dont you have to be in person

rapid sparrow
#

Pure Slack

#

I just pick stuff I can help there with, that got my interest

#

Other team members pick stuff they are able to solve

#

That makes eventually good enough coverage of solved problems

#

Doing it when wishing to slack off from main duties πŸ˜‰

hidden atlas
#

You will have something you said you did lol

#

for them meetings atleast

rapid sparrow
#

Infra meltdown somewhere

#

Then it becomes not optional but needed being solved as soon as possible

hidden atlas
#

those moments can be stressful right?

rapid sparrow
#

Important to eat and drink in time πŸ™‚

fresh mesa
#

how to write socket pytho that can ddos a server

hidden atlas
rapid sparrow
hidden atlas
#

but that may come with some downsides too

#

company finna hate you for taking it

rapid sparrow
#

I ll check our docs

#

Usually we report 1x rate any time

#

And as I said important only having 40 hours per week

#

So, If I did more today I can be more lazy tomorrow

hidden atlas
#

Why you staying at 40?

#

8 hours or so a week finna only be 5 days

rapid sparrow
#

That is why 40 hours

hidden atlas
#

oh that is weird

#

you cant go above it 40?

rapid sparrow
#

Any overtime for that must be agreed upon with manager for us.

#

We can, some people are crazy to work much more. I don't wish so

#

I need time for personal life beraucracy and for self studies and some just for personal mental health

hidden atlas
#

damn but fr if you need time you should get everything done early since you said you was starting work late

rapid sparrow
hidden atlas
#

Some days are good days waking up early

#

You wake up with so mch energy out of no where

rapid sparrow
#

I am owl. My energy is somewhere at middle of day, evening and sometimes during nights

#

Bless flexible schedule to be friendly for that

hidden atlas
#

im the opposite my energy is gone after 5pm or so

rapid sparrow
#

Often enough that can make me many times more productive during certain times

#

Flexible schedule fully remote work with mind work, important to put effort, not showing imitation of effort

hidden atlas
#

yea

#

Ima go ahead to sleep now

#

maybe we can talk tmr

#

It was nice talking with you

rapid sparrow
#

Likewise

mighty anvil
#

pytube: I have a frustrating couple of issues with pytube: when I do from pytube import YouTube, Channel Channel is white and unseen (see img) ; I can use YouTube, but not Channel...anyone seen this and resolved? https://i.imgur.com/KSeFbmn.jpeg
I have tried installing pytube AND pytube3. I have tried removing the cache and installing/deinstalling both
from pytube3 doesnt work
yet https://pytube.io/en/latest/user/channel.html seems to show I can expect to be able to use Channel functionality

royal silo
#

I am trying to backup some of my dotfiles to github. I initialized a local git repository in my home directory. How do I ignore all other files except those in a few selected folders in .config/ folder?

rapid sparrow
rancid schoonerBOT
#
Our youtube-dl, or equivalents, policy

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
brazen forge
#

tl;dr: we're not gonna help you with that

royal silo
mighty anvil
#
  1. Is there a better place to ask my question? I've tried here and Unofficial Django. 2. How can I see my recent posts (on any server) I quite often lose track of what I have posted where!
mighty anvil
#

What is anyone else using to interact with Youtube Playlists and Channels (I don't need to download vids, I just want the easiest way to get playlists and thumnails and channel latest vids including shorts)

real hedge
#

Does Python have a way to auto reload the browser after changes on file system?

rapid sparrow
sacred nacelle
#

I'm working on a package called ess which has a number of subpackages. We are currently in the process of splitting those up into separate repositories to help with maintenance. And we are considering making ess a namespace package to keep the existing structure from the user's perspective. However, we noticed that PyPI does not allow the name 'ess'. (But we have so far deployed to conda and it is fine with the name.) So my question is, can it cause problems if we have a namespace package with a name that is forbidden by PyPI? We would call the various subpackages, e.g., esssans for ess.sans. And we might have a meta package essdr (or similar name) that can be used to install the various subpackages with, e.g., pip install essdr[sans].

indigo zenith
real hedge
#

However, I'm curious about other solutions not requiring node.
SSE or websockets could be used in python to detect file changes and send a SSE/WS event to the browser to perform a reload

#

What I'm creating is a JS framework like react.

#

My JS framework doesn't need node to compile and has zero dependencies! πŸ‘€

rotund wyvern
#

Hey folks, is anyone messing monorepos with multiple pypi packages being pushed? I'm wanting to pursue this via rye actually but i might be a bit in the bleeding edge.

strong bison
#

In WSL, whenever I type in this command:

I always get this:
[+] Building 0.2s (2/2) FINISHED                                                                         docker:default
 => [internal] load build definition from Dockerfile                                                               0.1s
 => => transferring dockerfile: 2B                                                                                 0.0s
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 2B                                                                                    0.0s
ERROR: failed to solve: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount3246307496/Dockerfile: no such file or directory```
#

how can i fix this issue

rare anvil
#

does anyone know what I need to do to configure the launch.json used for the vscode test debugger? (the one used when I click the second button on the right there)

#

I need to make justmycode into false

brazen forge
#

that'll open the .vscode/launch.json file in your project where you can configure the Just my code setting

brazen forge
wide vessel
#

hi guys

#

I have problem with my VSC someone help me ?? Ithx

rare anvil
#

Like I've tried changing the justmycode in my launch.json, but it isn't taking for the vscode test debugger

#

In fact even with an empty launch.json, debugging still works. how can I change launch.json config that vscode uses?

hollow bay
#

So, i was searching about making a python library to a specific chemical engineering work. is this the right chat to talk abou it?

thorny shell
#

maybe, if your questions are about which tools to use to help you

rapid sparrow
thorny shell
#

but if you're, e.g., wondering how to structure it, maybe this

hollow bay
#

nice, i'll ask it there. Thank you guys!

willow pagoda
# hollow bay So, i was searching about making a python library to a specific chemical enginee...

continuing discussion from #software-architecture message since here is more appropriate for package management, i recommend reading:

in short, pyproject.toml is the newest standard for declaring project metadata, and setup.py and setup.cfg are the older methods specific to setuptools

Setuptools automatic discovery mentions two common project layouts:

  • src-layout
    project_root/
        src/
            my_library/
                __init__.py
                ...
        pyproject.toml
    
  • flat-layout
    project_root/
        my_library/
            __init__.py
            ...
        pyproject.toml
    

there are arguments for one vs the other, but personally i stick with src-layout and use editable installs during development

#

this is what a setuptools-based pyproject.toml might look like: ```toml

pyproject.toml

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "my-library"
version = "0.1.0"
dependencies = ["numpy>=1.26.0", "sympy>=1.12", "matplotlib>=3.8.0"]

description, readme, license, classifiers, etc.after this, organize your scripts into a [package](<https://docs.python.org/3/tutorial/modules.html#packages>) following one of the above layouts, then adjust your imports as necessary (e.g. `from my_library.submodule import function`), and do an editable install so you can test the package:sh

/project_root $ pip install --editable .```
as per the tutorial you can use build and twine to build and publish your library, and for build systems other than setuptools they may have a command-line tool that can do this for you like poetry

#

some additional links beyond those are:

  • MANIFEST.in, if you have any non-python files that your package should include
  • Console Scripts, if you want to register some function as a command-line program for convenience
  • PEP 440 and SemVer for version naming conventions (SemVer's major.minor.patch scheme is the most important to know, everything else you should refer to PEP 440 since both documents are not entirely compatible)
  • berconpy if you want an example of my project structure
hollow bay
#

oh my, i thought it was a little bit simpler

#

but let's go, i'm gonna try it

#

thanks guys

rapid sparrow
tranquil phoenix
#

I'm in the process of researching code-signing certificates. My goal is to sign an application that has versions for Windows, Mac OS, and Linux. What are some good cross-platform code-signing certificate providers that work for signing Windows, Mac OS, AND Linux applications?

mighty anvil
rapid sparrow
fathom veldt
#

Hello can i import libs from another file but when i use class or def?

indigo zenith
latent bison
#

Recently my system's antivirus/security software apparently started to block > pytest activities and cause some warning message to be posted in my Powershell window. From the warning messages it seems to do something with accessing cache file/folder. Is this normal? Is there something "new" occurring with pipenv and or pytest ?? Thanks!

rapid sparrow
rapid sparrow
#

Is it possible to turn on logging level and having it seen for specific smth at DEBUG level
without turning DEBUG for every single third party library?

astral apex
rancid schoonerBOT
#

src/mainframe/server.py lines 78 to 84

# Disable uvicorn's logging
for _log in ["uvicorn", "uvicorn.error"]:
    logging.getLogger(_log).handlers.clear()
    logging.getLogger(_log).propagate = True

logging.getLogger("uvicorn.access").handlers.clear()
logging.getLogger("uvicorn.access").propagate = False```
rapid sparrow
# rancid schooner `src/mainframe/server.py` lines 78 to 84 ```py # Disable uvicorn's logging for _...

it did not work

def configure_logger(log_level: str) -> None:
    root_logger = logging.getLogger("")
    root_logger.setLevel(logus.log_levels_str_to_int[log_level])
    ch = logging.StreamHandler()
    ch.setLevel(logus.log_levels_str_to_int[log_level])
    if settings.LOG_JSON:
        formatter = logging.Formatter('{"time":"%(asctime)s","filepath":"%(name)s","level":"%(levelname)s","content":%(message)s}')
    else:
        formatter = logging.Formatter('%(name)s:%(levelname)s: %(message)s')
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    logus.my_lib_logger.setLevel(logus.log_levels_str_to_int[log_level])
    logus.my_lib_logger.addHandler(ch)

@pytest.fixture(scope="session", autouse=True)
def turn_debug_logging() -> None:
    loggers = [
        logging.getLogger(name) for name in logging.root.manager.loggerDict
        if name.startswith("lib_name") or name.startswith("lib_name") or name.startswith("lib_name")]
    for logger in loggers:
        logger.handlers.clear()
        logger.propagate = True
        logger.setLevel(logging.CRITICAL)
        configure_logger("DEBUG")

setting everything to CRITICAL worked though

#

actually no

#

it made weird logging duplication for some reason

#

...python logging is difficult. sigh

rapid sparrow
# astral apex <https://github.com/vipyrsec/dragonfly-mainframe/blob/main/src/mainframe/server....

i am heavily confused

    loggers = [
        logging.getLogger(name) for name in logging.root.manager.loggerDict
        if name in ["lib1","lib2","lib3"]]
    for logger in loggers:
        logger.handlers.clear()
        logger.propagate = True
        logger.setLevel(logging.WARN)

I expected this code to disable loggers...
...for some unknown reason it makes for remaining library amount of logging records duplicated proportional to amount of disabled libs

#

it is not really remotely expected behaviour, is it? πŸ˜„

#

I know!

#

i need to print threading, process name just in case. lets check if those are forks or not

astral apex
#

Huh
That’s weird
Yeah it’s a giant pain
I don’t really understand it either
Sorry I can’t be of more help

rapid sparrow
#

printed thread and process names. ID seem to match. yay to no fork bombing.
%(thread)d-%(process)d:%(asctime)s:%(name)s:%(levelname)s: %(message)s

139791544246272-834601:2023-10-11 23:10:34,930:lib_name.status:DEBUG: setting success in django storage >>> task_id=9901825a-06f2-43c5-b8c2-de7a895f9a99
139791544246272-834601:2023-10-11 23:10:34,930:lib_name.status:DEBUG: setting success in django storage >>> task_id=9901825a-06f2-43c5-b8c2-de7a895f9a99
139791544246272-834601:2023-10-11 23:10:34,930:lib_name.status:DEBUG: setting success in django storage >>> task_id=9901825a-06f2-43c5-b8c2-de7a895f9a99
#

that means it is pure logging smth πŸ€”

#
def configure_logger(log_level: str) -> None:
    root_logger = logging.getLogger("")
    root_logger.setLevel(logus.log_levels_str_to_int[log_level])
    ch = logging.StreamHandler()
    ch.setLevel(logus.log_levels_str_to_int[log_level])
    if settings.LOG_JSON:
        formatter = logging.Formatter('{"time":"%(asctime)s","filepath":"%(name)s","level":"%(levelname)s","content":%(message)s}')
    else:
        formatter = logging.Formatter('%(thread)d-%(process)d:%(asctime)s:%(name)s:%(levelname)s: %(message)s')
    ch.setFormatter(formatter)
    root_logger.addHandler(ch)

    logus.mylib_logger.setLevel(logus.log_levels_str_to_int[log_level])
    logus.mylib_logger.addHandler(ch)

for logger in [logging.getLogger(_log) for  _log in ["factory", "faker", "lib3"]]:
    logger.handlers.clear()
    logger.propagate = True
    logger.setLevel(logging.WARN)
configure_logger("DEBUG")

same bug with this

rapid sparrow
#

that is the reason for logging duplication :/

astral apex
#

Oop

rugged bobcat
#

Hi guys,
I guess most of you know by now about the latest curl vulnerability. Which tools are you guys using to find the Python dependencies that have this vulnerability? I want to do a quick scan on multiple services. I was thinking about using Black Duck but if there's a better tool I am open to suggestions. I would prefer tools that integrate nicely with poetry and pipenv. Thank you!

arctic python
#

hi guys, I am currently starting to learn more about repo structure by reading some opensource repos.
there's one folder named /contracts I can't get a hang of it.
What does this folder usually storing? is it abnout types, protocols, etc??

brazen forge
arctic python
# brazen forge could you share any repos you've seen this directory in? (<#782713858615017503> ...

yes sure. sorry if I get to the wrong chat πŸ˜„
this is one repo I saw: https://github.com/microsoft/promptflow/tree/main/src/promptflow/promptflow
and this as well: https://github.com/dbt-labs/dbt-core/tree/main/core/dbt

GitHub

Build high-quality LLM apps - from prototyping, testing to production deployment and monitoring. - microsoft/promptflow

GitHub

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications. - dbt-labs/dbt-core

#

tried to read from their "how to" doc but seems to be leaving this folder out. So I can't really quite get what is their organisational purpose.

brazen forge
#

those looks like dataclasses (which might also be DB models)

arctic python
#

so it's more like a datastructure that the repo want contributors to follow?

#

thanks πŸ™‚

brazen forge
#

kinda, those are structs that are used across the project

arctic python
#

thank you

tawdry needle
# arctic python thank you

these are "data contracts" used in various parts of the application. it's a little idiosyncratic to use it as the folder name, but it's not bad. you might also see it called "models", as in the standard data models used throughout the application.

arctic python
#

ah that makes sense πŸ™‚ thanks yeah. I saw /models more than contracts probably because it closely related to Pydantic/ ORM.

tawdry needle
#

right, i don't think that distinction is always clear, but maybe it's established practice to distinguish "external data models" and "internal data contracts" in some areas. i don't see those two things as particularly distinct concepts.

imo a contract is something that applies to the interface between two functions or components, consisting of the model(s) that are accepted and returned from that function, as well as pre- and post- conditions. so "contracts" isn't my favorite name for what you see in the dbt repo, and i prefer "models".

arctic python
#

another related question, if I have some abstract protocols. Do I still put it here? or is there some folder name I should be using to indicate that?

tawdry needle
#

in the python stdlib, types is used for concrete types (like ModuleType) and typing is used for abstract types (like Generic), but i think that's partly because types long predated typing. i don't know what the names would be if we were to reinvent both of those things at the same time.

quiet harbor
#

Im writing this script to move my mouse (its not for antik afk if you want we can talk in a VC about what im exactly doing) inside games, my cursor moves when im tapped out but when i tap in games it doesnt move

#

sorry if this is the wrong channel i didtn found a better one for this

sage escarp
#

guys how do you ship desktop applications with python?

#

is installing python on the host computer mandatory?

thorny shell
#

In practice, yes.

There are tools that purport to turn your python code into a standalone executable, but I've never gotten one to work.

flat lotus
#

I have, it's quite easy. The majority of these tools just take the python executable, your app, the standard lib, and put them into a zip

knotty osprey
#

What's the best way to handle creating alembic migrations in a dockerized app? Having to spin up a container with an attached volume and a configurable command for the message seems like overkill, is it the only way?

#

it honestly seems easier to just manually make the version file and run it, is there any reason I shouldnt do that and manually fill out the previous/next variables?

rapid sparrow
#

i would have ran command in another terminal, docker-compose up postgres that raises it with forwarded ports for my host machine
and just run migrations commands locally (that i recorded into taskfile.dev). So final command would have been like task makemigrations

#

if it was my work project, i would have put commands to make migrations into docker-compose service of application. service would have been named makemigrations
colleagues only would have needed to run docker-compose run makemigrations for them to be generated (it would have raised db for them, ran application correctly and did everything for them)

astral apex
rancid schoonerBOT
#

entrypoint.sh line 5

python -m alembic upgrade head && python -m uvicorn src.mainframe.server:app --host 0.0.0.0 && exec "$0"```
rapid sparrow
#

i think making migrations should be one off command in https://taskfile.dev/ or as docker-compose service.
I would not be doing that in staging or prod

#

because generating migrations is like writing code... it should not happen in prod, it is part of dev env writing code for me.

#

i would have ensured with CI that they are correct for usage in staging/prod, that i made all migrations and they will work for our staging/prod db

#

i will be always git committing all my files of migrations from my dev machine

#

generating migrations in docker as long as docker is on my host is fine to me.

#

Docker is just another... more feature rich venv alternative to me 😁

#

docker running in staging/prod will not have command present to deal with migrations in any way automatically... at serious projects at least. Only at dev env.

knotty osprey
#

Thank you @rapid sparrow and @astral apex , this is a personal project so I'm not terribly worried about running the migrations (though I am trying to use this project as 12-factor practice). It's writing the migrations that has become cumbersome since I've just had to start up a container and run the alembic revision command. Taskfile.dev is new to me, I'm gonna take a look at that

rapid sparrow
# knotty osprey Thank you <@370435997974134785> and <@285152779465654272> , this is a personal p...

if u need to raise container to run alembic revision.
U could define docker-compose yml

x-definitions:
  app: &app
    build:
      context: .
    volumes:
      - ".:/code"
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      APP_DATABASE_HOST: postgres

version: '3.8'
services:
  postgres:
    image: postgres:13
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres
    ports:
      - 5432:5432
    healthcheck:
      test: [ "CMD", "pg_isready", "-U", "${PG_USER:-postgres}" ]
      interval: 3s
      timeout: 3s
      retries: 5

  app:
    <<: *app
    command: bash

  makemigrations:
    <<: *app
    command: alembic revision --args
#

then creating migrations will be just docker-compose run makemigrations, it will create them for you in your project folder then. Without any extra commands. It will await postgres raising completion and then will run them

#

i prefer to utilize taskfile though (and using to localhost port forwarded localhost), not liking to work from within containers unless necessary (or making it as more easy to replicate dev env for other collegues)

heavy knot
fresh patio
#

#bot-commands

fierce vale
#

How is this password genorator?

import random
op = ("y")
while op == ("y"):
cho = input(" 8 or 11 char:\n---------------\n ")
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","[","]",">","<","/","!","@","#","$","%","^","&","*","-","_","1","2","3","4","5","6","7","8","9","0"]
y = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
print("---------------\n your pass is:\n---------------")

if cho == ("8"):
    a = random.choice(y).upper()
    b = random.choice(y)
    c = random.choice(y)
    d = random.choice(alphabet)
    e = random.choice(alphabet)
    f = random.choice(alphabet)
    g = random.choice(alphabet)
    h = random.choice(alphabet)
    fill = (a+b+c+d+e+f+g+h)
    print("   ", fill)


if cho == ("11"): 
    a = random.choice(y).upper()
    b = random.choice(y)
    c = random.choice(y)
    d = random.choice(y)
    e = random.choice(y)
    f = random.choice(alphabet)
    g = random.choice(alphabet)
    h = random.choice(alphabet)
    i = random.choice(alphabet)
    j = random.choice(alphabet)
    k = random.choice(alphabet)
    fill = (a+b+c+d+e+f+g+h+i+j+k)
    print(" ", fill)

print("---------------")

op = input("  again? y/n\n---------------\n       ")
print("===============")
heavy knot
#

so instead of have to make a big ass list you can just do

alphabet = string.letters + string.digits 

#
  • it’ll randomize and u can choose how long u want the password
fierce vale
#

I'll try. I didn't know how to

fierce vale
#

I can't get it to pull items out of the string. lists

fierce vale
#

I figured it out

#

import random
import string
e = int(input("digits in pass:\n---------------\n "))
print("---------------")
a = string.digits + string.ascii_letters + string.punctuation
b = random.sample(a,e)
c = ""
d = c.join(b)
print(d)
print("===============")

#

I shortend it a little...

fathom ledge
#

Hi everyone!

#

Can I ask questions here?

thorny shell
#

yes, ideally if they're about tools and Dev Ops.

#

If it's a general "plz help me with my python homework" question, then #1035199133436354600 is the place

#

@fathom ledge ^^

fathom ledge
#

It’s about building a docker image but I already have a lead. Thank you!

alpine horizon
#

can a running process see if an ENV variable was added (globally, by a different process)?

#

in Ubuntu

agile stag
#

Hey guys


Traceback (most recent call last):                                              |
  File "/app/main.py", line 7, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

I get this message on my uBuntu console after running my Docker image

#

I’m not sure how. Maybe it’s because of my Dockerfile

#

My docker file


# Use the official Python base image
FROM python:3.9-slim

# Set the working directory inside the container
WORKDIR /app

# Copy your application files into the container
COPY . /app

# Copy the requirements.txt into the container
COPY requirements.txt /app

# Install project dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of your project files into the container
COPY . .

# Set the command to run your Python application
CMD ["python", "main.py"]

brazen forge
#

also, you're copying your application/project files twice

#

the first COPY instruction is unnecessary and actually harming the layer caching

brazen forge
agile stag
brazen forge
#

anyway, that's not the issue at hand

brazen forge
agile stag
brazen forge
#

oh

#

well, that's where the requirements go

#

like requests

agile stag
#

I see

brazen forge
#
requests==x.y.z
#

best practice is pinning the packages to an exact version as well

#

…and the versions of the transitive dependencies as well

alpine horizon
agile stag
#

Do user input programs not work in a Docker image?

astral apex
#

You can make Docker execute a CLI, and pass in the args you give it to the CLI

#

But most of the time containers will be running web servers or batch jobs that don't need input

agile stag
#

All right. thanks for the info

rapid sparrow
#

you can hook yourself into container as

  • docker exec -it container_id_or_name bash(or sh) if it is present
    • to get into shell and accessing some scripts from inside
    • useful for average python Django application to access manage.py
  • docker attach --sig-proxy=false container_id_or_name
    • run commands directly in current stdin of a container and exit with Ctrl+P,Ctrl+Q combination (container needs to be launched opened for stdin + tty manipulations!)
    • useful for game servers like Avorion game server or Minecraft server
      docker-compose with opened stdin for attachment is launched with flags
    stdin_open: true 
    tty: true
#
  • and the most perverted option, you can even run GUI applications in container. And access them with
    • forwarding your GUI into container
    • or just using remote desktop options
#

while first two are more or less used (especially the first one is very common in python and other dynamic languages world), the third one is extremely perverted option πŸ˜…

#

The easiest option to hook yourself into stdin of container directly, just to run it with tty/stdin enabled as docker run -it stuff
although docker-compose run smth, with written options for that is very straightforward too

fathom ledge
#

Is it normal for a docker image to take hours to build? Literally hours.

Everything else is building fast but it’s the venv with the problem.

I get the message β€œconnection reset by peer” when pip downloads a dependency that needs find compatible with the and the rest and it can take about 30 mins to resume download and move on to the next requirements in the requirements.txt file

rapid sparrow
#

any VPN works really badly with docker often enough

#

alternative reason could be that you are trying to install stuff not meant to be installed. And u have too weak PC to compile it
i remember some sentry versions require a lot of compiling building and should not be installed
Also installing psycopg2 is not prefered. better installing psycopg2-binary. Monitoring CPU consumption should be enough to confirm this theory

astral apex
#

My container can build in like 30 seconds

#

Though normally it takes a bit over a minute

#

It doesn't heavily depend on what you actually do inside your container though

astral apex
#

a dependency that needs find compatible with the and the rest

#

So you have incompatible dependencies that pip is trying to reconcile?

#

Fixing your dependencies would make it to where pip doesn't have to try to fix them for you, so you can skip that step entirely

fathom ledge
#

Oh, because I have airflow and my ML-pipeline in a venv. Some stuff that I use with tensorflow extended is not compartible with airflow

fathom ledge
#
FROM apache/airflow:2.7.2-python3.8

USER root

WORKDIR /ml-system

ENV PYTHONBUFFERED=1

RUN apt-get update && apt-get -y upgrade && \
    python3 -m venv /ml-system/tfx-pipelines/venv

COPY requirements.txt /ml-system/tfx-pipelines/venv/requirements.txt
    
USER airflow

RUN /bin/bash -c "source /ml-system/tfx-pipelines/venv/bin/activate"  \
    && pip install --no-cache-dir --verbose -r /ml-system/tfx-pipelines/venv/requirements.txt

RUN pip install --no-cache-dir "apache-airflow==${AIRFLOW_VERSION}"

I haven't even copied the files to the container :/

fathom ledge
fathom ledge
dusky fjord
#

Do you run a local instance of a large language model (llm) to help you write python code? Which flavor do you use? I've been running oobabooga (https://github.com/oobabooga/text-generation-webui) on a debian box and I'd like to run a 34B gguf model (preferably from https://huggingface.co/TheBloke) to help me code. I guess I'd use the llm mostly as a search engine replacement(? other suggestions welcome). If I'm not using python, then I'm probably using java.

What type of huggingface model do you like?

CodeLlama-34B-GGUF (Code completion. Infilling),
CodeLlama-34B-Python-GGUF (Python specialist. e.g. https://huggingface.co/TheBloke/CodeLlama-34B-Python-GGUF),
CodeLlama-34B-Instruct-GGUF (Code completion. Infilling. Instructions / chat.)

or some type of other flavor, e.g.

CodeFuse-CodeLlama-34B-GGUF or
speechless-codellama-34b-v2.0-GGUF?

I mainly code file/data manipulation, mathematical and machine learning type stuff. What model type would be good to choose?

GitHub

A Gradio web UI for Large Language Models. Supports transformers, GPTQ, AWQ, llama.cpp (GGUF), Llama models. - GitHub - oobabooga/text-generation-webui: A Gradio web UI for Large Language Models. S...

agile stag
#

Apparently, there’s some networking involved when it comes to building a Docker image. I have a program that connects to my local mySQL server on my local machine.

I built a Docker image file for it, pushed it to my Docker Hub, went on my Linode VM, pulled the Docker image from my Docker Hub, ran the image and now the program can’t connect to the mySQL server on my Linode πŸ€”

small jay
#

Perhaps your MySQL server is blocking certain IPs?

agile stag
small jay
#

No, the MySQL sever I mean

agile stag
#

I have mySQL installed both on my local machine and virtual machine

small jay
#

Oh you're running both your application and linode on the same machine?

agile stag
small jay
#

Right, but is the MySQL server running on the Linode VM?

agile stag
small jay
#

What did you configure the target address of the DB to be in your application?

#

Also perhaps you could use docker compose to help make the networking easier

agile stag
#

It’s connecting to the hostname β€˜localhost’

#

In my program which is in reference to the localhost on my local machine.

small jay
#

Can you show us the Python code that connects to your database?

agile stag
#

But every login credential is default on both mySQL servers

#

Password to connect to the database is exactly the same

#

Database names are exactly the same on both mySQL servers

eager rose
fathom ledge
# eager rose funnily, one of the projects i work on had CI run for about an hour each time 😩...

I still can’t figure out which ones are causing the problems, I even left it building overnight πŸ˜‚.

Pip is doing something called β€œbacktracking” to resolve dependencies but it can take a very long time and it’s a hit or miss.

Someone on Reddit recommended using conda for machine learning deployments to manage dependencies and venvs instead of what I’m doing.

I’ve been learning tons, that’s for sure!

agile stag
#

Now I’m wondering if a containerized application trying to connect to a mySQL server on a machine is even practical.

#

Maybe I should containerize the mySQL server as well as the application? πŸ€”

#

Maybe my program is within the realms of the container and there’s no way for the application to connect to anything outside of the container

rapid sparrow
agile stag
rapid sparrow
# agile stag I’m trying

Any ran docker creates by default bridge sub network within which is runs. It is assumed other containers will join same network name for sharing network access between each other by DNS names

#

If u want to access localhost present MySQL, simple solutions could be

  1. binding container to network host. It will disable bridge functionality
astral apex
#

I hate Docker DBs
Mostly because I didn’t understand what I was doing and lost some data

rapid sparrow
#
  1. or running MySQL binded to 0.0.0.0
#

It will listen to all networks then

agile stag
rapid sparrow
#
  1. or u can just run MySQL in container that joined same network. P.s. all containers defined in compose, share one network by default (equal to protect current folder name + default suffix) and can address each other by service name as DNS hostnames
agile stag
#

I still can’t connect to the db. I do have the hostname named as β€˜localhost’ and the program is written for it to connect to a server named β€˜localhost’.

Since it’s inside of a container, I’m thinking the program is trying to connect to the localhost of the Docker container instead of the mySQL server on my Linode VM.

rapid sparrow
# agile stag This is what I did.

May be issue in that u create docker subnetwork after MySQL was already binded prerhaps. If u would have created docker network in advance, MySQL would have auto discovered it during binding operation

agile stag
#

Do you know if I can configure the network in my container on Docker HUB?

rapid sparrow
rapid sparrow
agile stag
rapid sparrow
#

Ah, that one. Capital letters confused me. Thought it is program name

agile stag
#

i build my Docker image from my local machine, push it in there and then pull it out from my Linode VM

rapid sparrow
rapid sparrow
# agile stag Oh ok. Good to know.

Launching containers in host network has disadvantages btw. Containers launched in this way are no longer network isolated (from each other and from host). If they bind any port, it is directly same port gets binded at host. Port forwarding is no longer needed

#

Just as warning that simplest solution has its cons

#

So, u can get easily container start prevented if it tries to bind port that was already taken

cerulean hollow
#

Does anyone have experience with using the Terraform CDK for Python in Azure? If so, is it easier to use and read than HCL?

rapid sparrow
#

it is very consistent and static typed

#

you aren't promised to have not a shitty code written by infra devs in Terraform CDK

#

more comfortable, yeah, may be. But highly likely it will not benefit your long term maintanability

agile stag
#

How long does it take for a docker image to run that’s trying to connect to the host’s MYSQL server?

tawdry needle
# agile stag How long does it take for a docker image to run that’s trying to connect to the ...

This question is lacking context. But in general creating a connection to a database should be relatively fast, much less than 1 second unless there are some connection limits in place or the database server is under heavy load.

If you are just running mysql on your own machine and trying to connect to it from inside a container image, it should be just as fast as any other connection, you wouldn't see noticeable overhead. So if you are developing an application and it's taking several seconds trying to connect to the database, something has not been set up correctly

agile stag
#

My program creates a log file. It’s built into a Docker image. When I run the image and it creates the the log file, where does it put it and how can I access it?

rapid sparrow
#

Docker is not meant to be used with logging files. It is dirty possibility(u can), but not the right way compatible properly with docker ecosystem

silent sedge
#

Is there a metrics collection/storage solution that allows for syncing/backfilling devices that are only online some of the time?

Like a way to have a device record metrics, and sync it into a central database when it comes online, to be queried from Grafana?

#

Prometheus doesn't support backfilling at all, other TSDB I found don't seem to have a sync feature either

agile stag
rapid sparrow
agile stag
#

It appears the command for that is docker logs

eager rose
#

the best way to log using containers is just printing to stdout

rapid sparrow
# agile stag How do I access the Docker log file?
  1. yes, `docker logs containerIDorName is a regular way.
  2. default logging can be further augmented with usage of logging options
    https://docs.docker.com/compose/compose-file/compose-file-v3/#logging
    https://docs.docker.com/config/containers/logging/configure/
  3. docker ecosystem solutions can collect log for you into their databases and show with navigation in GUIs
  • Loki / Grafana solution (raisable as single docker-compose)
  • or just running container directly in AWS with some means, lightsail, elastic beanstalk, ecs, or eks
  • kubernetes solution for logging aggregation (Loki, PLG solution is again deployable as Helm) and etc
  • we use at work datadog for logging collection from all docker containers running at aws ecs

Docker ecosystem logging solution support autodiscovery. They could be collecting just straight from all discovered containers automatically

eager rose
#

docker logs doesn't print out logs from a file, though. it's just the stdout isn't it?

rapid sparrow
#

so... so it is reading from file

eager rose
#

err, yeah, but not a file the user is creating

rapid sparrow
#

you can read limited history

rapid sparrow
eager rose
#

to do that you would probably need to exec into the container and read it that way

rapid sparrow
eager rose
#

yeah

rapid sparrow
little yacht
#

I need guidance to learn kubernetes, infra Management and efficient microservices communication. I have good experience with python.
can someone guide me where i can practice, i am confused.
if someone can list some resource / technologies where to focus that will be pretty helpful.
plz tag me when reply to this message.

slim maple
#

There should be some k8s books that explain the main concepts, and helm is just a templating/release management tool really

rapid sparrow
slim maple
rapid sparrow
rapid sparrow
#

just feed it kube config, and it will connect to whatever u wish

#

check first page for all authorization choices

slim maple
#

Why would I use terraform for k8s if I just need to do some templating?

#

E.g. replace a couple of values, run a for loop, etc

rapid sparrow
slim maple
#

Aren't k8s manifests type safe?

rapid sparrow
#

terraform is great tool in team among many devs because it is ultra consistent.

rapid sparrow
rapid sparrow
slim maple
#

As of statefulness that's really not that good of an upside, since you mostly use k8s to deploy your applications

slim maple
#

Just use git

rapid sparrow
#

git is not answer to everything, it only shows diff to previous its commits/tags (we can't be always responsible and rely on that nobody made manual changes)

slim maple
rapid sparrow
#

there are always manual changes drifting around.

slim maple
#

It seems that it can be useful for cluster components but for apps I'd prefer helm

rapid sparrow
#

seeing diff in to what is Really running in prod is very valuable

slim maple
#

Plus that's what probably 90% of people use

slim maple
rapid sparrow
#

updated already something to other thing

#

changed smth. and etc

slim maple
#

Doesn't sound like a tool problem to me

rapid sparrow
#

terraform will build plan in comparison to real state currently running

slim maple
#

Solution is as simple as "don't change anything manually"

rapid sparrow
#

there is always... state.... problems to what is really now

#

terraform allows to verify, your plan was deployed and clear now

#

and see that thing you deploy is next, going to change things compared to prod things now

rapid sparrow
slim maple
#

Ok

rapid sparrow
#

we try to achieve at this point... in 99% we do things as a code

#

but there is always 1% of stuff that can be done due to emergency or experiments or whatever

slim maple
#

Experiments should probably not be done on a live cluster

rapid sparrow
#

mostly i have problem with someone applying stuff from pull request not manually

#

but PR was not merged yet

#

but i discovered it only during terraform plan

rapid sparrow
# slim maple Ok

Also, not all stuff is locked in versions always... that makes terraform plan building changes just from having downloaded newer stuff
What will be changed just from you applying same code :/ (helps to lock stuff to versions if possible)

slim maple
#

That's just not useful for me

rapid sparrow
#

well... those are problems for a lot of infra

#

for small stuff it can be not a problem