#tools-and-devops

1 messages · Page 78 of 1

ripe tendon
#

just a general direction

craggy locust
#

I’m looking to generate Python code

idle flare
#

ok here is some generated python code

pass
#

I generated it with print('pass')

ripe tendon
#

raylu, could you give me a general tip about that? please 😄 I want to hide admin login page from users

craggy locust
#

You have no indentation

idle flare
#

@ripe tendon just check if the logged in user is a superuser?

ripe tendon
#

i mean, restrict access to admin LOGIN page, not admin-only pages

#

so if user tries to connect to /admin, he gets 404 or something

#

just allow one IP or stuff - that was the way I wanted to do it in nginx, but I dropped nginx

#

is that even a popular thing to do? I received "-admin login page available to everyone" feedback on a recruitment task, and I think that's what it meant?

#

or maybe I should just change the admin login page url? 🤔

rancid schoonerBOT
#

:incoming_envelope: :ok_hand: applied mute to @heavy knot until <t:1652187927:f> (9 minutes and 59 seconds) (reason: burst rule: sent 8 messages in 10s).

ripe tendon
wispy arrow
#

Hello there!
So I have a VPS, setup with docker and nginx, but I'm using github and want to automatically deploy my app to my VPS on push
How can I build an image and run it as a container on my VPS all automatically and remotely from github actions?

idle flare
rich remnant
#

I have a bare metal build machine, it was previously running on an Intel 11400, but I just switched it to an AMD 5600 based system .. generally speaking everything works fine, except for some reason specifically pypi downloads inside docker are awfully slow

like poetry install takes maybe a minute for 90 packages on host, after 10 minutes it has installed something like 5 on the docker image

#

apt and pnpm seem to download things just fine

idle flare
#

@rich remnant I guess you gotta narrow down the problem. is it network, disk, cpu, or just lack of parallelism? (use btop, iftop, vmstat, htop, perf) are you using the same version of poetry?

short peak
rich remnant
#

but it runs fast on the host for the same project for the same lockfile

short peak
#

can you tell what's consuming most of the time? for me is determining dependencies if lock file is missing

rich remnant
#

I mean it's just saying it's installing dependencies and then it freezes for minutes at a time for each of them, network traffic stays incredibly low, that's how much I know so far

idle flare
#

bad docker volume configuration? maybe the host is writing files to a different drive. docker system prune --volumes?

rich remnant
#

there's just one drive

#

I tried docker system prune -af

idle flare
#

-af doesn't include --volumes

short peak
#

mm if you are using volumes, make sure your binding is not vanishing the lock file

rich remnant
#

I get to this point very fast

#

and then it takes 2 min to install this package, and 2 min to install the next one

#

and so on

#

I'm just rebuilding the base image but it had no such issues on my cloud agent or 11400 based machine

idle flare
#

btop, vmstat, htop, perf

rich remnant
#

I mean *top isn't telling me much, they tell me that not much is going on

idle flare
#

ooh interesting. ok, perf or strace

wispy arrow
rich remnant
#

so what exactly with perf?

#

ah hm

#

I guess it's running pip

idle flare
#

yeah, gotta strace -f

#

I was gonna ask whether pip itself is slow

wispy arrow
#

@idle flare There is multiple ways I could do this but im not sure which to use, for example I could deploy the source code to the VPS and then run a script in the VPS than handles the images and containers
But a cleaner way I think is to somehow build the image on github actions and only copy the final image to the VPS and somehow run it there and remove the old one
Something else a lot of people were doing was uploading it to dockerhub but I don't understand how that helps

rich remnant
#

so this seems to be what it's doing during the download, which .. looks like a download

#

pip install pyasn1 seems to pretty much freeze

idle flare
#

@wispy arrow yep, you need a container registry somewhere to upload the image to. dockerhub is a popular choice. otherwise, aws ecr, azure container registry, etc.

rich remnant
#

sigh

#

one possible issue could be ipv6 again

#

it seems to be giving me headaches all the time

idle flare
#

@rich remnant it... looks like it's failing a bunch of ipv6 addresses and is going to try ipv4 eventually

#
pypi.org has address 151.101.64.223
pypi.org has address 151.101.192.223
pypi.org has address 151.101.128.223
pypi.org has address 151.101.0.223
pypi.org has IPv6 address 2a04:4e42::223
pypi.org has IPv6 address 2a04:4e42:600::223
pypi.org has IPv6 address 2a04:4e42:400::223
pypi.org has IPv6 address 2a04:4e42:200::223```
rich remnant
#

I've noticed a lot of random issues with ipv6 in the past months, particularly with docker, and I've unsuccessfully been trying to completely disable it

wispy arrow
# idle flare <@531492597319860226> yep, you need a container registry somewhere to upload the...

So the steps are (and then ill figure out how to do them)

1 - Build the image on github automatically during the github action/pipeline
2 - Upload the image to a container registry (dockerhub for example)
3 - (somehow get the image from the docker registry to my VPS) ?
4 - (on my VPS, remove the old image and stop container, somehow get the new one from the container registry and run it) ?

Im not sure bout the last 2, I don't specefically know how I'm gonna deal with the registry

idle flare
#

do you have an IPv6 address on the host? do you get $ curl -6 pypi.org -i HTTP/1.1 301 Moved Permanently

ripe tendon
rich remnant
#

yeap

#

works fine on host

#

but docker is terrible and has lots of ipv6 issues

idle flare
#

@wispy arrow you take the version you uploaded and use the ssh-action thing I linked before to docker pull registry.tld/yourproject:123abc && docker stop thingy && docker run -d thingy:123abc

rich remnant
#

HUZZAH

#

so one of my earlier attempts to get the ipv6 stuff working was to set up some ipv6nat thing that everyone kept telling me fixes the ipv6 nonsense, but now I modified /etc/docker/daemon.json and set ipv6: false and restarted docker, builds are fast now

#

one reason I hate ipv6 is that it's easy to be blind to the small changes in the ipv6 addresses - to me it looked like one address repeating, not a different address on every line LUL

#

thanks for the help

idle flare
#

another problem solved with strace!

rich remnant
#

yeah strace is a life saver

rich remnant
#

one of the big shockers is that btop can show me my core temps when it seemed like nothing else could LUL

heavy knot
#

In git, HEAD~ is the same as HEAD~1 right?

rapid sparrow
full bronze
#

Also the same as HEAD^

night narwhal
#

ayo guys! is proxlight legit and safe?

rapid sparrow
# heavy knot In git, HEAD~ is the same as HEAD~1 right?
#

TLDR: HEAD^ = HEAD^1 = HEAD~ = HEAD~1 are equal
and HEAD^^ = HEAD~2 are equal
yet HEAD^^ != HEAD^2 != HEAD~2 arent equal

#

because HEAD~2 selects not the grandparent of the commit

#

it selects second parent of the current commit if i get it right

#

in a situation when due to the merges, the current commit has more than one parent on top of it

heavy knot
#

Ooh yeah, I found that SO question earlier and didn't fully understand the use of ^2 (or ^3 ^4) hachuDank

grizzled fjord
#

I'm using pybind11 to write bindings for a large CMake-based C++ project (it will soon be open source, but it's not yet quite ready) that takes somewhere between 15-30 minutes to compile.

I want to write support for creating wheels/pip package, but it's not clear to me whether I could also run "pip something" straight from the build output after CMake has already done the job (that is: immediately after cmake --build .), or if I really need to make pip install rebuild the whole project from scratch.

Could someone provide a few hints? I wasn't able to google anything relevant so far. All examples I found simply run CMake as part of git clone my-project && cd my-project && pip install .

rapid sparrow
#

Anyway, git checkout HEAD~ moves to where the HEAD is right now, to one random gradparent higher, which considered as still main branch

#

and HEAD^2 moves HEAD to left ;b To the second parrenting commit

#

If we will try git checkout HEAD^2 from main which has only one parent, then we aren't allowed to move, because C7/main has only one parent

#

we can even chain stuff like that 🙂 I remember it is one of the exercises from this visual tutorial

#

git checkout HEAD~^2~ moves us to commit C2 (from the original main/C7 commit)
xD in the end ~ is step higher in commit history, and ^ a step to the left or right in the direct parent commit

rapid sparrow
#

How to update Pipenv package to specific version without making update of everything not unnecessary related?

serene notch
#

hey guys, junior question. I see mkdocs site folder is usually part of the .gitignore file. I want to publish a project in our private github containing a mkdocs generated html file. Is /site folder a bad practice to point my README file to ? Like, for detailed documentaion, go to <url_site/index.html>

rapid sparrow
#

which can be deployed from selected folder directly from repository, the easy way which you should do
or as artifact from pipeline job, a bit more complicated way

#

create folder docs in repo, put .nojekyll file into it, put your generated html files into it and turn on github pages from /docs

#

it will be deployed on to the right of your repo

serene notch
#

nice

#

thanks again @rapid sparrow . I will try that out

ember ridge
#

Hey, how can I generate an random string with numbers and letters?

limber perch
#

I’m tasked with setting up an extensible alerting/monitoring system, some third-party services and some in-house stuff. Do you folks have thoughts about that? Would love to be able to write Python to check someone’s API and send alerts to Slack, etc.

rapid sparrow
rancid schoonerBOT
#

@rapid sparrow :white_check_mark: Your eval job has completed with return code 0.

0e9f27a632819886
smoky compass
#

I'm trying out VSCode (coming from ST, due to the seeming lack of solid black integration) and I am wondering why Pylance seems unable or unwilling to detect a broken relative import.

I have:

from . import mymodule

Except that mymodule does not exist and there is no error indicated

#

And in fact switching to an absolute import doesn't break either:

from mypkg import mymodule
ember ridge
#

Hey, if i use this code ```py
from colorama import Fore

print(Fore.GREEN + "123")

it will print green in the consol of VS. But when i run the py file without VS i get this insted of the color: ```py
 ←[32m123 ```
#

How can i set the color there?

sly sleet
#

lemme find the SO thread

#

ok so you can use one of the tricks from https://stackoverflow.com/questions/16755142/how-to-make-win32-console-recognize-ansi-vt100-escape-sequences
or just use a better terminal app (I'm partial to Windows Terminal)

ember ridge
#

Thanks!

heavy knot
#

Yo I installed with pip the pyautogui module I can't import it in my script it returns me that there is no pyautogui module how should I import it?

cosmic breach
#

Hey so I've been trying to complete this lab on github actions, and I'm stuck at the last step i.e. pushing the built docker image to ghcr.io through. But I keep getting:

Error: buildx failed with: error: failed to solve: unexpected status: 403 Forbidden

I've tried everything (seems so) but of no use.
I've also done the steps mentioned here https://github.com/docker/build-push-action/issues/463#issuecomment-926229761

Workflow file: https://github.com/CyberCitizen01/github-actions-for-packages/blob/add-dockerfile/.github/workflows/cd-workflow.yml

Any ideas?

GitHub

Troubleshooting Pushing to GHCR seems to randomly resulting in 403s in the last 24 hours. Rerunning the GH action seems to resolve things (partially). Behaviour See above. Failure message : buildx ...

#

Kindly ping to reply ^

idle flare
#

@cosmic breach it looks like your latest commits passed. are you still having trouble?

cosmic breach
#

Yes thank you, I've solved it.

wispy arrow
#

I'm using NGINX and I Just found out that my website can be accessed from the VPS's ip plus port
how can I stop it from letting any traffic if its not through the domain/sub domain?
I don't want traffic to be let in through the IP

brazen forge
#

but if you really want to forbid access through just the IP address, maybe throw an error if the Host header isn't the correct domain or is an IP address

cosmic breach
wispy arrow
warped latch
#

I got figure out how to get certbot added to this docker-compose.yml project with django, nginx, and postgres...

golden lynx
#

If anyone is working in configuring docker, please let me know, want to discuss

wind salmon
#

In docker, when would one only ever use the option -i without -t , and vice-versa?

quasi star
#

Are there any well known Python Bluetooth Libraries?

rapid sparrow
#

like... docker run -it ubuntu:20.04 /bin/sh

#

both, -it is necesary in order to have shell working in a valid way

rich remnant
quasi star
rich remnant
#

from what device

rugged flame
#

Does GitHub use branch descriptions in any way?

brazen forge
quasi star
rich remnant
#

and you'd want to use the python library .. on the raspberry pi?

#

iirc the bluez libraries worked fine on raspberry pi .. but it all depends on what exact thing you want to do, "connecting" is not very descriptive of what you want to do .. https://pypi.org/search/?q=bluez

quasi star
rich remnant
#

bluez might be what you want then

quasi star
rich remnant
#

I don't know that much, I looked into them, found that a lot of them were kinda terrible and had huge limits for what platforms they support and what they can do, but bluez seems like it's possibly the best for you .. you'll need to read up for yourself

quasi star
#

K ty

south marsh
#

How do I configure my setup.py to be compatible with PEP 508?
My install_requires: ["NodeGraphQt @ https://github.com/jchanvfx/NodeGraphQt/archive/9e6f95244d98b0d97b38f0b45c74c6c4057a18ad.zip"]
which should be compatible with https://peps.python.org/pep-0508/
but when installing with pip: File "/home/mart/.pyenv/versions/3.9.7/lib/python3.9/site-packages/setuptools/dist.py", line 455, in __init__ _Distribution.__init__(self, { File "/home/mart/.pyenv/versions/3.9.7/lib/python3.9/distutils/dist.py", line 267, in __init__ getattr(self.metadata, "set_" + key)(val) File "/home/mart/.pyenv/versions/3.9.7/lib/python3.9/distutils/dist.py", line 1227, in set_requires distutils.versionpredicate.VersionPredicate(v) File "/home/mart/.pyenv/versions/3.9.7/lib/python3.9/distutils/versionpredicate.py", line 114, in __init__ raise ValueError("expected parenthesized list: %r" % paren) ValueError: expected parenthesized list: '@ https://github.com/jchanvfx/NodeGraphQt/archive/9e6f95244d98b0d97b38f0b45c74c6c4057a18ad.zip' [end of output]

tawdry needle
#

i think you should just specify the package name there, and then use requirements.txt to pin the exact url

#

e.g. in setup.py you have install_requires=['NodeGraphQt'] and then in requirements.txt you have https://github.com/jchanvfx/NodeGraphQt/archive/9e6f95244d98b0d97b38f0b45c74c6c4057a18ad.zip

#

that said, this definitely should be valid according to pep 508

#

but i'm not sure if setuptools itself supports pep 508

#

pip does

#

in fact i am pretty sure it does not support pep 508

#

im not sure if url dependencies are even technically supported anymore

#

they aren't mentioned in the docs, other than the deprecated and now-unsupported "dependency links" feature

south marsh
tawdry needle
#

it depends on what your needs are

south marsh
#

well yeah but if I want to publish this on pypi I need to specify this dependency somehow

tawdry needle
#

if this is something you want to distribute and you expect people to install directly from pypi, then yeah

#

try just specifying the URL, maybe with #egg=

#

im not sure what formats are accepted by setuptools

#

the docs dont seem to specify

south marsh
#

somehow adding #egg=NodeGraphQt seemed to make it parse correctly

#
ERROR: NodeGraphQt@ git+https://github.com/jchanvfx/NodeGraphQt.git@9e6f95244d98b0d97b38f0b45c74c6c4057a18ad#egg=NodeGraphQt from git+https://github.com/jchanvfx/NodeGraphQt.git@9e6f95244d98b0d97b38f0b45c74c6c4057a18ad#egg=NodeGraphQt (from kaudio==0.0.1) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
tawdry needle
#

it's hard to be sure with setuptools, there doesn't seem to be any spec and the docs are not that thorough

#

If you depend on a package that’s distributed as a single .py file, you must include an "#egg=project-version" suffix to the URL, to give a project name and version number. (Be sure to escape any dashes in the name or version by replacing them with underscores.) EasyInstall will recognize this suffix and automatically create a trivial setup.py to wrap the single .py file as an egg.

In the case of a VCS checkou, you should also append #egg=project-version in order to identify for what package that checkout should be used. You can append @REV to the URL’s path (before the fragment) to specify a revision. Additionally, you can also force the VCS being used by prepending the URL with a certain prefix. Currently available are:

#

that's the doc

#

idk about the @ pep 508 support though

#

it might be ignoring everything up to and including the @ for all i know

south marsh
#

I'll just check back a few revisions for when there was still a setup.py

tawdry needle
#

i almost wonder if you should vendor this into your own package tree...

#

since you're pegging to a specific commit, seems like a reasonable use of a git submodule

south marsh
#

I'd rather not, it's already fairly massive with the native code, the stubs, etc

tawdry needle
#

fair enough

pastel jacinth
#

I accidentally deleted my .git folder but I have a public github repo of it. Is there a way I could get it back locally?

subtle quarry
pastel jacinth
subtle quarry
tropic olive
#

getting no build stage in current context when building my docker image

#

any idea?

#

this is my first time with docker so idk

brisk lake
#

dockerfile?

tropic olive
#

kek

#

just this one cmd

#

im typing witg one hand

brisk lake
#

hm maybe you should ask in #dev-contrib specifically, since this is a pydis project

#

have you tried pulling the image first?

tropic olive
#

yes

#

it works on my local machine

#

not heroku conatiners doe

pastel jacinth
placid glen
#

I have questions about CMake. I'd like to make some local utilis libraries that I could include in any projet in the future. To include this, I've modify CMAKE_PREFIX_PATH to point to the place where all my libraries will be. I'm pretty sure this is a bad way to do. What's the best way to do that pls ?

deft yacht
cosmic breach
#

Any free resources/services to play with kubernetes, helm etc?

brazen forge
#

Katacoda

ashen fog
#

anyone have a good goto for adding git commit hooks to a repo?

brazen forge
#

or husky

ashen fog
#

yeah, wanting a tool that wouldn't require node though

bronze lodge
#

Hey 👋 any cool module to generate clips from audio files?

brazen forge
#

!pypi pre-commit

rancid schoonerBOT
ashen fog
#

thanks, I'll take a look

placid glen
#

@left girderno, I'm very new to CMake, I'm struggling a bit

#

but even with that, i'm struggling to understand where and how you're supposed to configure the usefull pathes

#

like, let say I have X projects depending on Y libraries, and I'd like to have all those dependancies in a specific directory. I want all of the projects to know where to find those dependancies, so where should I put that path ? As an env variable maybe ?

left girder
#

are you on linux? @placid glen

placid glen
#

w$

left girder
#

dang. how did you install all the deps into the directory?

#

if you were on linux I'd say source whatever file that sets up the environment (associated with whatever tool you used to package everything up), or just manually make a bashrc that adds to the appropriate PATH variables, I'm not really sure about windows... maybe some other folks have some ideas...

placid glen
#

most of the time it's precompiled or compiled manually (C/Cpp lib)

left girder
#

ah

#

I guess the question becomes... how to create a script in windows that temporarily adds stuff to path variables

placid glen
#

that I can do

left girder
#

oh, well do that 🙂

#

with all your custom libraries

placid glen
#

but then, should I invoke that script in every CMakeLists I make ?

left girder
#

nah just source it at the start, I think it'll be okay

#

oh

#

I generally invoke such scripts before I run cmake

#

I guess is what I'm saying

placid glen
#

yeah that's what i'm used to also, but I don't like it much

#

like

#

I have some scripts to start vscode because I need some env vars to be setted when I'm coding

#

I though CMake would allow me to change that

left girder
#

personally I think it's better to set up the environment the way it needs to be and then run cmake instead of hardcoding any paths to deps... it's more portable

placid glen
#

yeah

#

but for example : let's say you want your build dir to be outside the project directory, and you want all of your project to be built inside that dir

left girder
#

ok

placid glen
#

how would you setup the path to that dir ?

left girder
#

cmake /path/to/build/dir

placid glen
#

in a way that you don't have to always put that in every CMakeList you make

#

ok

left girder
#

well, that's after you've run it once, now that I think about it

#

you want to cd /path/to/build dir; cmake /path/to/source

#

I have to think about it, because I've just made little build scripts for projects with this stuff in it rather than doing it manually haha

placid glen
#

x)

#

I can't beleive I'm struggling so much with cmake lol

left girder
#

that's a good book, btw

placid glen
#

thanks

left girder
#

but yeah, cmake is like a whole thing haha... I've been using it for years and I still feel like newbie

heavy knot
#

Hello, do you have a discord like this one, but for devops/docker?

placid glen
#

@left girderI've found an acceptable solution for what it is worth. In the settings of the extension "CMake Tools" of VScode, it's possible to set env variables that will be passed to the compiler and/or the cmake configuration; and there's also a field to defined a default build directory. By combining the 2 I was able to automaticaly set the build output dir to some external directory.

pallid lynx
#

Is there anyone here that's used both shared and dedicated CPU instances on a cloud provider? I need to do some CI pipelines that need a lot of processing, and I'm wondering if the upgrade to dedicated would be worth trying

#

Specifically I use Hetzner, though I'm fine with experience from any cloud provider

buoyant atlas
#

Is there any way to specify which subscription ID I want to use in DefaultAzureCredential

from azure.identity import DefaultAzureCredential
az_credential = DefaultAzureCredential()

I'am loged with az login

rancid raven
#

I have 2 python repositories; I would like to link repo B to repo A where whenever someone clones repo A, they get the latest version of the files from repo B that has been linked internally, how do i go about this?

thorny shell
#

🙂

rancid raven
#

Is it possible to have the contents of a symlink file shown when committing to a github repository? I just need the contents to be there so that when the workflow tests are run, the necessary symlink files are available

thorny shell
#

what do you mean by "shown"?

#

for that matter, what do you mean by "committing to a github repository"? commits happen locally, usually, unless you're doing something via their browser UI

brave wagon
#

does anyone know how i can make an anaconda env with a custom path and a custom name?

subtle quarry
cyan scarab
#

I have setup a git repository locally and connected it to a remote repository

#

online it shows that there is one branch

#

however locally if i run "git branch -r" it shows two branches

#

origin/master and origin/main

#

i did have a master branch remotely but i deleted it

oblique gazelle
#

AHAHAAH LMFAOOO yessss i hate this problem

#

See

cyan scarab
#

is it difficult to solve

oblique gazelle
#

GitHub has changed their default branches from master to main

cyan scarab
#

right

oblique gazelle
#

So idr how to fix the master vs main problem but you can change the default branch so that next time only the main branch will be the default branch and not the master branch

cyan scarab
#

?

#

so i cannot fix it

oblique gazelle
#

No

#

You can

#

Just rename master to main

#

git checkout master

#

git branch -m main

#

Done

#

Also make sure to delete main branch first

#

git -D main

cyan scarab
#

no but locally it thinks that there are two remote branches when there is only one

oblique gazelle
#

Yea so locally, delete the main branch. Locally, rename the master branch to main branch

#

Also, @cyan scarab have you done a lot of commits on the master branch?

cyan scarab
#

no

#

ive only started this project

oblique gazelle
#

If you've just initialised a new git then are you fine with deleting the git?

cyan scarab
#

so im probably just gonna nuke it and start over

oblique gazelle
#

Yea ale

#

Alr

#

Soo

#

git config --global init.defaultBranch main

#

Type this in git bash

#

Or terminal

cyan scarab
#

what does that do

oblique gazelle
#

This will make sure that every new git init will make a main branch (not master branch) and thus in this way you will be able to push to GitHub easily

cyan scarab
#

right thank you

#

ill try that now

oblique gazelle
#

Sure lmk if it worked or not

cyan scarab
#

i need to use git remote add origin "url" right

oblique gazelle
#

I usually don't do anything like that

#

I just create a new repository on GitHub

cyan scarab
#

i have that

#

i want to pull from it right?

oblique gazelle
#

Then git clone repository.url

cyan scarab
#

oh yeah

oblique gazelle
#

Then upon opening the repository locally, this will automatically set the origin to the repo url and the branch will be set to main

oblique gazelle
cyan scarab
#

i used clone

oblique gazelle
#

No

#

Oh

cyan scarab
#

i think it worked

#

yeah it did thank you very much

#

that was driving me nuts cheers again

oblique gazelle
#

Noice noice

heavy knot
#

Pycharm or Visual studio?

#

and why?

thorny shell
#

visual studio code

#

why? because I suspect -- with little evidence -- that it's more-frequently maintained, and has better extensions

#

(also iirc pycharm is basically Eclipse, and I hate Eclipse)

iron basalt
#

more comparable to intellij idea, not much to do with eclipse

#

why do you suspect that a first-class python ide is less maintained than a plugin for visual studio code? or number of plugins

thorny shell
#

🤷 prejudice, really

iron basalt
#

i repeatedly find pycharm's tooling and type analysis more powerful than vsc with the python plugin, but both are fine

#

probably wouldn't recommend visual studio though (as mentioned in the question)

finite fulcrum
#

I found vscode's git interface fairly lacking when I used it for a dsl that didn't have support in pycharm

#

though it should be better for types with pyright, as pycharm sucks at that

thorny shell
#

ah I always use my own weirdo interface for git

#

wouldn't dream of using anything else

iron basalt
#

yeah i find pycharm's git integration to be fantastic, i even used it for conflict resolution on a typescript project that i was writing in vsc

#

though vsc seems to have very powerful git plugins, i just never learned how to use them neutralcharli

thorny shell
brazen forge
#

git diff/mergetool is all I use 🙃

brisk kettle
brazen forge
#

yep

left girder
#

if the git mergetool doesn't work, I use vim 😄

brazen forge
#

well, I use vimdiff as the git mergetool 🙂

long raft
#

is it just me

#

or is this a LOT better than pyenv

#

hot damn

brazen forge
#

asdf does use pyenv for Python

#

but yes, it's better than having to manage pyenv, nvm, etc. separately

long raft
#

the problem with pyenv isn't the backend

#

the problem is that the CLI API is awful IMO

#

so a wrapper around the pyenv backend is exactly what I want IMO

hallow forge
#

Which linter do you recommend besides mypy/pylance? I want a linter which also tells me about logical errors etc.

hallow forge
#

Maybe some common gotchas which should be avoided

#

or if brackets are missing

brazen forge
#

try flake8-bugbear, but not sure if it detects those kind of errors

left girder
#

I use pylint and black

#

if you have a syntax error, pretty much any linter worth it's salt is going to catch that

#

if you do accidentally if foo instead of if bar and foo is defined, so there's technically no error... I'm not sure if a linter is ever going to help you with those sorts of problems... though good suite of tests likely would

thorny shell
#

<@&831776746206265384> ^^

dark grove
#

What's up?

thorny shell
#

message has already been deleted

#

from Lolzz#4574

dark grove
#

Ah, another mod saw similar message in another channel. Thanks for the head up, though.

wooden ibex
# long raft https://github.com/asdf-vm/asdf

From “wow, that’s a ton of work”, it’s nifty. From practical POV, it’s not. Few people program in this many languages and this probably doesn’t cover all the edges cases. Also, Docker exists.

long raft
#

I totally disagree

#

If I am programmign on my local machine

#

I don't want to route my local development through a docker container

#

I don't want to execute say, unit tests for example

#

inside a remote docker container

#

I want to do my TDD in my local operating system for minimum latency

#

second

#

I literally built python 3.7 from source the other day

#

because I despise the Pyenv api

#

and deployed it

#

so a better API for older versions of python than pyenv allows me to make python 3.7 venvs easily per project

#

and Pyenv is quite honestly rubbish

wooden ibex
#

so don't use it

wooden ibex
#

most people run their production software in Docker, it makes sense to have environment that is very close if not exact to environment it will be running in.

long raft
#

I am a big fan of remote development

#

100%

#

I love to do integration tests, builds, etc etc, in remote

#

however

#

Just keep in mind you shouldn't do everything in remote if that makes sense.

wooden ibex
#

local running docker isn't really remote that much

long raft
#

yeah, but still

#

I just have a bunch of stuff that isn't set up for my production workflow as it were

#

also, you can just run asdf inside your docker container ROFL

long raft
#

to manage your environments. Our dev environment actually has a 3.7 venv and a 3.9 venv and a 3.10 venv

#

So actually maybe using ASDF to manage those is a good thing

#

or at least generate the old venvs

wooden ibex
#

then again, we don't do a ton of python development at work so maybe it's required under some weirdness, all our Python Dev is dev containers

long raft
#

Containers are good

#

the problem with containers is that you need to have a container orchestration system

#

and my work is a bit dogshit and doesn't have K8s or equivalent

wooden ibex
#

we don't use k8s that much either

long raft
#

are you doing everything with Docker Desktop?

#

tbh I think running local containers defeats the entire point

wooden ibex
#

Nope, Azure App Services

long raft
#

oh well same difference

#

K8s, Azure's Fargate equivalent. It's all the same.

#

IMO I think the best workflow is

#

you do TDD on local

#

then you commit to a feature

#

then you just have CICD pull your remote branch rebuild the container and deploy your container

#

or, it pulls your feature branch and deploys the branch straight into a live container

#

but the TDD in local is the lowest latency development workflow you can have, and TDD promotes brilliant best practice

floral epoch
#

hey guys, does pip install pillow work for you?

#

i get only errors

plain onyx
indigo zenith
warped latch
#

I was looking at repos for dockerizing django with postgres... one of the projects I found implemenets redis with celery by default. And I'm left wondering, what is this for? I'm reading on what celery and redis are and I still dont grasp why and when you would need this.

brazen forge
#

if you want to have execute regular tasks, Celery is one way to manage that with Python

#

unrelated, but if anyone has any experience migrating from Terraform to Pulumi, have you seen any benefits/drawbacks from migrating?

warped latch
#

having a redis server was not part of my app structure but when i look at production environment builds they all have one. i will have to figure out why i suppose.

rapid sparrow
brazen forge
#

the main pain point with TF for us is managing the common modules

#

I get that it works, but it's not intuitive for newcomers

#

with Pulumi, I hope it'd be less of a learning curve, because the modules would just be managed like we manage for the actual app services

rapid sparrow
brazen forge
#

EKS with Helm

#

TF is being used for all the other stuff

rapid sparrow
brazen forge
#

like provisioning RDS, Elasticache, LB, etc.

#

and we're gonna be having new folks joining the team

#

so wanted to check out if using something like Pulumi would be beneficial for us

rapid sparrow
#

Or even searching channel history

#

This topic is from times to times often discussed there

#

A lot of people are in similar shoes there

kind tinsel
#

Why is setting up all the tools and installation of packages harder than to actually code something?

#

Nothing ever works... only after hours of trying to figure out why pip does not work, why this, why that...

#

-+

thorny shell
#

welcome to programming

tawdry needle
#

the other issue is that there are a lot of different ways to set things up that depend on your specific situation and needs

tawdry needle
brisk cape
#

Hi, I'm trying to execute a shell command using subprocess. My command needs some arguments which contains the = character (that's the equal character). When this character is present in a argument, everything after the = is removed. Example:
subprocess.run(['/path/to/command', '-arg example=/path/to/something_else'])
When my command execute, it says:
command: unknown flag: -arg example
Everything to the right of = is removed. Is there any way to escape the = character or otherwise get this to work as I want?

thorny shell
#

I'd try subprocess.run(['/path/to/command', '-arg', 'example=/path/to/something_else'])

#

it depends on the command itself really

brisk cape
thorny shell
#

💐

floral epoch
#

the main issue is
The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.

#

I installed zlib

#

still not working

thorny shell
#

yeah but you need headers, whatever zlib package you installed might not have them

#

what operating system do you use?

floral epoch
#

windows 10 pro

thorny shell
#

doesn't pillow have binaries for Windows?

sullen path
#

Hi guys do you know if schedule of a github action should be in master to work, because for now I am testing it in PR and it doesn't schedule. The whole action is in PR and yeah.

#

Do you know how to actually test the scheduler inside the PR before merging 😄

tawny temple
#

I recall testing out actions in PRs before merging them. So it should work. However, I believe you'd need to allow PRs to trigger the action.

#

Like ```
on:
push:
branches:
- main
pull_request:

To trigger for both main pushes and PRs.
#

If you don't want PRs to trigger then I suppose once you've tested it you can remove that part.

sullen path
#

Another question is it better to have that action which I use to make the pr with the new file from latest release in the repository where I need the file or the repository where I update the version?

tawny temple
#

Sorry, I don't understand the question. Can you rephrase?

sullen path
#

I have repository A which contains some deployment file which can change in diffrent versions of the repository, and I have repository B which uses the deployment file of reposiotry A, I want to keep updated this deployment file for the latest version of repository A. What I have done is I have written action that is triggered by cron job every 2 hours or so (in repository B which is dependant of repository A) which fetches repository A, gets the file (from latest) version and opens a PR in repository B with the changes.

tawny temple
#

Okay, so you're asking whether it's better to put the action in repo A or repo B?

#

And by action what you really mean is a workflow, right?

sullen path
#

yeah

tawny temple
#

I would argue it's better for it to be in repository B

#

Since which files repo B needs is the business of repo B. Repo A shouldn't be concerned with who or what needs its files.

sullen path
#

And I should check on push to v* tag right and then just make PR

tawny temple
#

I guess the only exception might be if the sole purpose of repo A is to house that file.

tawny temple
sullen path
#

But really I want to check if repo B actually is creating a tag and if creates a tag create a PR to Repo A with this file from the current version

tawny temple
#

But I thought the file was on repo A and you wanted repo B to get the update?

sullen path
#

ahhh

#

yeah

#

mb

#

So I should do regular checks on repo B if repo A has new version and make PR

tawny temple
#

Actually, you made a good point there even if not intentionally

sullen path
#

Not to activate action upon creating new Version in repo A which creates PR on repo B

tawny temple
#

If the workflow is on repo B then you need to periodically poll repo A for changes. However, if it's on A, it can trigger upon release.

sullen path
#

From this standing point I think it is better to make pr on release not to poll for it because it is useless

signal hill
#

Who uses a MacBook Air for coding and do you like it?

thorny shell
#

I use an M1 and love it, but ... that's not what you asked

#

I also use an ordinary x86 and kinda dislike it ... also not what you asked

half grotto
#

Not sure if this belongs in this channel, but hoping someone can help. Is there anything special that needs to be set up on a remote PowerShell terminal session for Python's console/CLI stuff? Trying to install an app via Poetry and getting a UnicodeEncodeError which traces back through clikit, cleo, and poetry\console. This exact command works fine on a local PowerShell session.

thin jasper
#

Still wondering why there is a #unix but not a #windows channel

thin jasper
#

.

thorny shell
#

!

tawny temple
latent canyon
#

how to create a django superuser from dockerfile

indigo zenith
# latent canyon how to create a django superuser from dockerfile
heavy knot
#

is the project structure stored in git object blobs? as in, when you git add a file the parent directories of the file itself is stored in that blob

iron wolf
#

how can i make a telegram bot to read allll the messages from a specific channel ?

brazen forge
tawdry needle
#

yep, every git commit points to a "tree" which is how git represents your directory

#

a directory tree can contain other directory trees (i.e. a directory can contain other directories), as well as file objects

#

but each one gets a unique hash

#

and there are plumbing commands you can use to inspect their contents

wet lotus
#

Hi. Does anyone have experience in both AWS Lambdas and Azure Functions? I'll be migrating some stuff soon and I'm wondering about Lambda Layers. Some comparison says that bindings are the equivalent but then Azure's github says that they use bindings that are written in .net...? That really doesn't sound good to me, in AWS I just had common python code in my layer... :c Could someone point me in a direction where to look for real layer equivalent or something?

deft yacht
barren epoch
#

@worn pilot are u here?

worn pilot
#

ok

barren epoch
#

i installed git on android

#

with termux

#

and clone gist

worn pilot
#

oh heh 🙂

barren epoch
#

and now i want to edit txt file and then push

#

but it didn't work

#

i get this error

worn pilot
#

do you have write permission on the repo on github?

barren epoch
worn pilot
#

oh ok, so that's a yes, you do have permission

barren epoch
#

where i can chech?

#

check

#

how

worn pilot
#

do you have a key you generated on the android?

#

are you using keys and ssh?

barren epoch
#

no

#

i regenerated token for PC

worn pilot
#

I don't really understand how tokens work

barren epoch
#

i enter token instead of password

#

i set username and token

worn pilot
#

and you also use that method on the non-android machine?

barren epoch
#

i try this on PC and work but on android problem is not with push to github, problem is that i can't edit file

worn pilot
#

hmm. I don't know enough about git to help with this

#

I can tell you about a community where you can ask though

barren epoch
#

is problem here?

worn pilot
#

I also hang out on irc, on irc.libera.chat in channel #git

barren epoch
worn pilot
#

you don't need to be added, you can just join

barren epoch
#

how?

#

where is it

worn pilot
#

umm, do you want to get an irc client or do you want to use their web interface?

barren epoch
#

web

worn pilot
#

ok one sec, I'm getting the address now

#

try going to libera.chat

#

it's not discord, it's much older

#

let me know when you get connected, and what it makes your nick

barren epoch
#

how to connect?

#

is there discord channel?

#

i think web is difficult

worn pilot
#

just go to libera.chat from your web browser

#

the channel you want is #git

barren epoch
#

then?

subtle quarry
latent canyon
warped rock
#

an someone help me to convert my python code to an .exe

warped latch
#

I'm a little disappointed that I put so much effort into getting my docker-compose project perfect to throw up django, postgres, nginx, cloudflare tunnel, redis... and now I get started with learning DigitalOcean to find that they don't support docker-compose. They can translate apps made with a Dockerfile into something they all their "App Platform" but like... if I would have known this, I would have spent all this time learning their "App Platform" and not how to get docker compose just perfect

And now im thinking, do I even still want to use Digital Ocean if it cant just deploy from docker-compose directly.

Does anyone have any advice for where I should get my cloud service?
I know that places like heroku and whatever will let you serve a free python app, but Im more interested in learning learning a cloud service that is a little more... reputable for real apps.
[4:11 PM]
I know that i dont want to do Azure. There is what else? AWS? Linode?

idle flare
#

@warped latch just get a regular digitalocean droplet and run docker-compose on it

#

docker-compose is for development and hobby projects. it only runs on a single machine. serious deployments orchestrate (horizontally scaling) containers across multiple machines, which is what DO app platform, GCP GKE, AWS ECS, etc. are for

warped latch
#

I see. I didn't realize docker-compose was not intended for large workloads, not that this app im working on requires a large work load at this point. But I see.

#

I also realized that... yeah, there is even a droplet in the marketplace that is called "docker" and it has docker compose on it and is set up for just that.

#

Horizontally scaling... I dont understand that concept. Is taht like horizontal escalation of privileges vs vertical?

#

in prv escalation, horizontal is like... enumerating another host or getting another username. Or getting access to another user that does not have higher priviledges but has other connections.

#

so horizontal scaling is... some way of spreading the work load across different virtualized systems?

#

how is that different from containers in docker?

pine fern
#

i have an aws question.

if it says launch time: 16 hours, does that mean the instance will turn off automatically after that time?

pine fern
#

update: i checked the logs and found out the instance wasnt mine

#

i was 🤏 this close to shutting it down tho

brisk kettle
#

lmao Rex

pine fern
#

they should not have given me aws access

#

i know like negative knowledge

#

and like im worried im going to leave instances running

#

over the weekend

brisk kettle
#

what's wrong with leaving them?

pine fern
#

whats wrong with leaving compute resources running when youre not using them?

#

besides like

#

spiraling costs?

#

im just an intern. ill be the first to be let go if something unexpected happens

#

💀

brisk kettle
#

hehe. i similarly have negative knowledge about this

pine fern
#

im not alone

#

anyway

#

boss man said i should try to do my ML stuff with sagemaker serverless

#

even tho that service came out like

#

..

#

last month

#

hes like "you can learn"

#

"also it would save me from a heart attack"

#

(in case i end up accidentally leaving instances running and eat up costs)

#

hes got a point

#

@analog kettle help me deploy my model

#

stelercus knows how to do ML things in production

analog kettle
#

What

analog kettle
#

What is happen

pine fern
#

idk anythingggg

#

why am i expected to do things

analog kettle
#

I don't like awa

#

Aws

pine fern
#

stel you know what happened today?

#

i showed boss man a vector database

analog kettle
#

A perfect ice cube

pine fern
#

and how you can use it for semantic search

analog kettle
pine fern
#

with vector indexing

analog kettle
#

What vector database

pine fern
#

and then boss man was like

#

lets try to create our own

#

for our own search engine since our search engine is from 1995

analog kettle
#

Why did he want you to create something that exists

pine fern
#

and i was like idk man id have to do it on sagemaker

#

and create an api endpoint

#

and do things outside my comfort zone

pine fern
analog kettle
#

Anyway I'm never in charge of setting up the aws environment, because that would require money stuff. And I'm not important enough to be managing project funds.

pine fern
#

throw stuff at peeps

#

like im pretty sure devs make apps here end to end or at least the team size is small

#

so when i suggest ML model stuff, theyre like

#

we like this

#

lets try it for ourselves

#

and then i cri

#

i cant even fine-tune my models or test hyperparameters

#

theres no time

analog kettle
#

Anyway, the vector search thingy we're using for one of my projects is called Weaviate

pine fern
analog kettle
#

It's new, I think. There are no stack overflow answers for it

pine fern
#

while i still have the free tier

analog kettle
#

You have to dig through their slack server

pine fern
#

interesting interesting. might check that one out

analog kettle
#

I think imma ask stack overflow questions about it on an alt

#

And then answer them on my main

#

By copying answers from the devs in their slack

pine fern
#

i brought up milvus to my boss in case we wanted to create our own

#

vector database

#

but i also will do research into that one

analog kettle
#

It uses GraphQL

#

For queries

pine fern
warped latch
gloomy condor
#

Hi guys, I've got a question regarding Docker multi-stage build. I think I understand well the concept if I were to build for instance a python wheel and then copy it over to my final Docker Image.
Today I found myself in need of installing Git from source. So I need to install a few libraries, run the usual make all and make install. But I'm not sure if there would be a clever way of compiling on the builder stage image but install in the final image. If the explanation is not very clear, I'm happy to elaborate.

tawny temple
#

Like ```dockerfile
COPY --from=builder /git/output/git /usr/bin/
RUN chmod +x /usr/bin/git

gloomy condor
tawny temple
#

I'm not sure. Looking at its makefile, the install command is quite involved, but I'm guessing it's mostly taking care of dependencies that are only required by certain commands.

wooden ibex
solemn fog
#

im very new to k8s and trying to run a large sharded discord bot in k8s. Im wondering a couple things:
is there a way to set up one deployment that each pod has different incrementing env vars? (i know thats not normal) i saw statefulset, but wondering if thats how
and is there a way to have shared storage that all pods can get to, so i can do git pulls into it/reload cogs and not have to rebuild/redeploy with every small change that gets pushed

silent sedge
#

Having a single volume mounted read-write in multiple places is unusual, most platforms don't support it

#

so is having the code in a volume instead of the image

#

Incrementing env vars is also a no, they will have different hostnames but those won't be numbered

#

If you want them to know how many there are and who's in charge of what, you'll need an external coordination system like etcd

#

(or use a statefulset and manage that yourself)

solemn fog
#

hmm ok
was just hoping to not have 60 deployments all the same just one env var changed between them

silent sedge
#

If you want stable identities you need a statefulset

#

They won't be told how many of them there are though, or how many of them are currently up

solemn fog
#

can pass total in with env var and they dont need to know how many are up, there all working independently

#

so statefulset sounds like what i need to look at

gloomy condor
# wooden ibex Why wouldn't you rely on packages?

Because I’m stuck momentarily with Debian Buster for my image which only provided Git v1.2.20. But I need functionalities from more recent versions.
I fully agree that the long term solution is to upgrade the base image.

mystic void
gloomy condor
gloomy condor
wary pike
#

Hey, to those of you who are familiar with Jenkins and specifically JenkinsAPI from python -
I'm trying, using python-jenkins to connect to my server firstly, i've seen the basic API:

import jenkins
server = jenkins.Jenkins(url=.., user=.., password=..)
server.get_version()

But I can't get pass that - i.e the authentication.
Any help on the exact details I need to provide there?
Also seen in their documentation that you can log with a token - https://www.jenkins.io/doc/book/system-administration/authenticating-scripted-clients/
and I generated one for myself - but can't seem to find the API for that connection.

brazen forge
wary pike
brazen forge
#

From Jenkins version 1.426 onward you can specify an API token instead of your real password while authenticating the user against the Jenkins instance. Refer to the Jenkins Authentication wiki for details about how you can generate an API token. Once you have an API token you can pass the API token instead of a real password while creating a Jenkins instance.
from the docs

#

are you passing your user password or API token?

wary pike
wooden ibex
gloomy condor
wooden ibex
#

I guess if you have worlds largest monorepo

#

But generally the build server handles the git clone and it should be more modern then container.

#

Or grab modern git container in multi stage build process. When it comes to build, KISS is paramount.

latent canyon
#

Hey , I have 2 docker-compose files , one for production and one for local development ( framework : django).I want to upload my code to dockerhub , so how do I build my image.

dusty trail
#

from the GitHub docs:

Note: With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository.
is there any way to allow workflows run on pull requests to access secrets?

#

if not, what is the proper way to do this? i have some tokens used for testing, and github actions needs access to those tokens, including when run on a pull request

latent canyon
#

Should i study Ansible ?

quaint sedge
#

Hi

#

I have this virtual env with a like 3 scripts selenium

#

i wwant my friend to be able to launch the scripts

#

how can i achieve this using docker?

wooden ibex
indigo zenith
tawny temple
#

But pay attention to the warning in red

left girder
#

super handy way to install the various python cli tools you know and love https://pypa.github.io/pipx/

wooden ibex
left girder
#

yeah pipx just installs each tool in it's own environment. I haven't used poetry. I've been playing around with pyenv lately, it seems neat

wooden ibex
left girder
#

I do care

#

🫂

#

I normally just used venv or conda, but pyenv seems neat. I like the idea of per-project python versions without having to activate them each time

thorny shell
#

that could activate your virtualenv for you e.g.

vocal quiver
#

How can I kill a server ran using nohup?

brazen forge
#

nohup just means you can't send it a SIGHUP, you can still terminate it with SIGTERM or kill it with SIGKILL

vocal quiver
#

and how do i get the process id of it

brazen forge
#

using top or ps

thorny shell
brazen forge
#

and terminate/kill it using kill

brazen forge
vocal quiver
# brazen forge using top or ps

hmm ```
8842 ttys000 0:00.10 -zsh
8851 ttys000 0:00.06 /Library/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/Python
9431 ttys001 0:00.19 /bin/zsh --login -i

#

the server is running at 127.0.0.1:8000

#

is there a command to kill a process running at that port

brazen forge
#

you could get the process using lsof

#

lsof -i :8000 should work IIRC

vocal quiver
vocal quiver
#
docker-compose -f docker-compose.yml down -v 
docker-compose -f docker-compose.yml up -d --build 
docker-compose -f docker-compose.yml exec web python manage.py migrate --noinput ``` why do I get this error even though I have a valid `Dockerfile`? ```
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount255036992/Dockerfile: no such file or directory
ERROR: Service 'web' failed to build : Build failed
glad cosmos
#

hey guys, is someone familiar with azure pipelines and yaml configuration by any chance?

#

i'm getting this error when trying to deploy

#

ERROR: Incorrectly formatted environment settings. Argument values should be in the format a=b c=d

brazen forge
vocal quiver
#
version: '3.8'

services:
  web:
    build:
      context: ./apps/backend/
      dockerfile: Dockerfile
    command: gunicorn backend.wsgi:application --bind 0.0.0.0:8000
    expose:
      - 8000
    volumes:
      - ./apps/backend/
    ports:
      - "8000:8000"
    env_file:
      - ./apps/backend/.env
    depends_on:
      - db

  db:
    image: postgres:13.0
    volumes:
      - postgres_data:/var/lib/postgresql/data/

  redis:
    image: redis:alpine

  nginx:
    build: ./nginx
    ports:
      - 1337:80
    depends_on:
      - web

volumes:
  postgres_data:
tawny temple
#

The name of the Dockerfile is case sensitive even on Windows apparently so make sure the capitalisation matches what you specified in your compose file

tawny temple
vocal quiver
tawny temple
#

Is it located in the current working directory?

vocal quiver
#

yeah

#

file structure

tawny temple
gentle solstice
#

Ooh, doing nginx with your backend?

vocal quiver
vocal quiver
wintry basalt
#

What are the pros and cons of using devcontainers vs venv?

gentle solstice
#

pro: You get a fresh environment each run

#

con: You get a fresh environment each run

glad cosmos
# tawny temple Haven't used Azure Pipelines in a couple years but if you share your yaml file I...
# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker

trigger:
- main

resources:
- repo: self

  variables:
   # Container registry service connection established during pipeline creation
   dockerRegistryServiceConnection: 96c34e35-6e1a-43c0-a766-fd1b67336806
   imageRepository: pipeline
   containerRegistry: amrteam.azurecr.io
   dockerfilePath: $(Build.SourcesDirectory)/Dockerfile
   tag: $(Build.BuildId)
   resourceGroup: resourcegroup-amr
   containerAppsEnv: managedEnvironment-resourcegroupam-9d1e


stages:
- stage: Build
  displayName: Build and push stage
  jobs:
  - job: Build
    displayName: Build job
    pool: Default
    steps:
    - task: Docker@2
      displayName: Build and push an image to container registry
      inputs:
        command: buildAndPush
        repository: $(imageRepository)
        dockerfile: $(dockerfilePath)
        containerRegistry: $(dockerRegistryServiceConnection)
        tags: |
          $(tag)

- stage: Deploy
  jobs:
    - job: Deploy
      pool: Default
      steps:
        - task: AzureCLI@2
          displayName: Deploy app to Container App
          inputs:
            azureSubscription: azureamrv2
            scriptType: bash
            scriptLocation: inlineScript
            addSpnToEnvironment: true
            inlineScript: |
              #!/bin/bash
              az config set 'extension.use_dynamic_install=yes_without_prompt'
              az provider register --namespace Microsoft.App
```yaml
#

i coudn't attach the full yaml due to character limit 😦

#

and this would be the error that pops up at deploy stage: ERROR: Incorrectly formatted environment settings. Argument values should be in the format a=b c=d

tawny temple
#

This seems to be an error coming from the azure CLI rather than from Azure Pipelines itself

#

In other words, your actual YAML format is fine you just have an incorrect arg for az container create

#

Admittedly, I have never used the azure CLI

#

Actually, I am not sure where that error is coming from. Apparently it is related to the --environment-variables argument but I don't see you using that anywhere

glad cosmos
#

i thought it might be related to this one

#

--environment

tawny temple
#

I don't even --environment documented anywhere. Only --environment-variables

glad cosmos
#

my bad

#

it was

#

conterinapp instead of container

wooden ibex
#

**DevContainers: **Pro, your Dev Environment is truly isolated, Con: It's around docker so it's compute and disk usage is higher then venv VEnv Pro: Nothing extra is needed beyond Python. Cons: It's just file isolation. If you are using VSCode and have decent computer. DevContainers is the way to go.

#

You just leaked your registry info?

idle flare
#

<@&831776746206265384> I think you may want to preemptively delete the message on the meantime

latent canyon
#

I'm running django on docker with postgres as my database.Will migrate command create postgres database for me.

tawny temple
#

No, it will not create the database. It has to be created beforehand. In fact, you need to specify it as part of the connection string; it won't even be able to connect if the db doesn't exist yet I am pretty sure.

#

But I believe with the postgres container you can use some environment variables to have it automatically create a db and user

latent canyon
#

The error i got is OperationError , FATAL role "username" does not exist

runic dock
#

Hey can anyone help me I am trying to build a music player which will play only the audio from youtube. The audio will play in background insted of opening vlc

#

Any Ideas?

#

Like : I will input the name and the program will search YouTube and after getting desired result it will play in the background instead of opening vlc

vocal quiver
#

I have a postgres database running on docker but my django application isnt able to connect to it ```yml
db:
image: postgres:13.0
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=
- POSTGRES_PASSWORD=
- POSTGRES_DB=

vocal quiver
#

yeah

latent canyon
#

I got an operationalError , FATAL role "username" does not exist.

vocal quiver
# vocal quiver yeah

in logs it says this though ```
2022-06-02 13:34:44.155 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432

2022-06-02 13:34:44.155 UTC [1] LOG: listening on IPv6 address "::", port 5432

2022-06-02 13:34:44.163 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"

2022-06-02 13:34:44.171 UTC [66] LOG: database system was shut down at 2022-06-02 13:34:44 UTC

2022-06-02 13:34:44.181 UTC [1] LOG: database system is ready to accept connections

vocal quiver
#

But i can connect to it using compose exec db psql --username=postgres --dbname=abc

latent canyon
#

Yeah found it.

vocal quiver
cosmic breach
#

What's the connection string you have configured in your django app?

cosmic breach
vocal quiver
dusty depot
#

Hey there! When I am running or debugging cpp code, I always get this "warning". How can I auto give permission?

graceful light
#

This is the planned features for my Python auto-deployment template repo, can I get some critique / recommendations on my stuff so far?

  1. poetry for managing 3rd party library downloading and versioning (replaces pipenv since it doesn't allow for setting min/max Python runtime versions)
  2. vermin for checking the minimum required Python runtime necessary for the project (for use with poetry to specify min/max supported Python runtime versions)
  3. pipreqs for quick and easy generation of a requirements.txt file based on the source code (for easily installing said modules through poetry)
  4. black for formatting
  5. isort for sorting imports
  6. flake8 for finding errors and linting the code
  7. pre-commit for running tools 4-6 automatically on a commit
  8. Generate template pyproject.toml file based on all the previous libraries/tools with some specific rules for black / isort / flake8
tawny temple
#

Sounds fine but keep in mind vermin is not a guarantee that your codebase will work with an older Python version. Ideally you should have a test suite and run that through a matrix with the versions you want to support.

#

Also you shouldn't bother supporting a Python version that's EOL even if you technically could currently.

#

I suppose since this is a template you can't really take care of the testing stuff but maybe you could set up some CI stuff for that. I dunno.

graceful light
#

My mentality for using it is to just be able to easily say "this project works with python versions X to Y" for people who want to run the project from source instead of the compiled/built executable I provide in releases. The goal would be to see what the newest stable release of Python is supported and build based off of that

#

IE: if vermin reports my project is compatible with Python 3.4 to 3.10, then only build a 3.10 version for releases, and provide the min/max Python version supported by the code
Offering support for older python versions is a different story - I'd just go with "if the version is deprecated then don't ask for support"

tawny temple
#

How is it being distributed?

graceful light
#

Compiling the code with cython, packaging it into an executable for different platforms (Windows, Linux, MacOS), and then generating a release with those files

tawny temple
#

Is the intention though to still allow one to install from source as a package?

graceful light
#

You mean through pip / pypi? That I haven't looked into since the apps I'm writing that'll use this auto-deployment template aren't really libraries, they're more so standalone apps (typically with a GUI)
Not sure if that kind of thing would be worth deploying through pypi

tawny temple
#

Not necessarily through pypi, just if it's a Python package that can be installed with pip

#

If not, then I suppose it doesn't matter as much what the minimum version is. I was going to say that if it's a package then the min version should be what you intend to support.

#

Which would still be a good idea anyway

graceful light
#

I suppose making it distributable in a way that's installable through pip, like generating wheels to include in the GitHub releases or to put them on pypi, wouldn't be a bad idea
Adding another feature task to my project
Thanks for the advice!

latent canyon
#

How to use sqlite3 as a volume in docker (django)

tawny temple
#

Have you looked at that yet?

latent canyon
#

yeah , can't find the what i need though

tawny temple
#

Have a look at the section "Start a container with a volume"

#

When you create a volume, you specify a path. This is a path within the container which will be a volume. You should configure django to write the sqlite database file within that volume's path.

#

And that's pretty much it.

latent canyon
#

how do configure sqlite3 as a volume.

waxen gull
#

I'm reading up and trying to understand this DigitalOcean's Functions service but I don't understand this GB-seconds thing. Can someone dumb it down for me?

#

It seems like RAM but isn't?

tawny temple
#

It's the amount of memory the function uses over a period of time

waxen gull
#

So 90,000 GB-seconds is... what just 90,000 GB? in a second?

#

So if my function only uses 1 GB per second, then I can run that function 90,000 times in a month?

tawny temple
#

For example, the function can use 2 GB over 10 seconds, which results in 20 GB-seconds used, or it can use 1 GB over 20 seconds, which also results in 20 GB-seconds used.

#

So with 90,000 GB-seconds, the function can for example use 90,000 GB in one second, or 1500 GB over one minute.

waxen gull
#

That helped

#

Thanks

#

So follow up question. How do I find out how much memory a function is using?

#

I think I've figured it out

shadow crow
#

Is commit squishing generally considered bad?

#

I noticed that I'm having a hard time browsing the history on squashed projects.

#

It's also harder to analyze the master branch history with automated tools that measure some code metrics

wooden ibex
brazen forge
#

having a good PR process helps too

#

we squash merge PRs

#

but that's only a good idea if you ensure PRs have a small set of changes

shadow crow
#

Yeah, sometimes you stumble upon a giant 2000 line commit... And it is just a squashed PR from a long feature branch

tawny temple
#

I don't think there is a general consensus. I don't squash because I think having the individual commits around is useful information. They may contain comments on why a specific change was made.

#

And yes, if the squashed commit results in a huge diff, it's difficult to go through.

finite fulcrum
#

From a history standpoint I'd much rather see the individual commits around a commit after jumping to it through blame/whatever, instead of squashed features and having to do more work to see what was being done and why

shadow crow
#

as opposed to: "it's going to stay in trunk for 75 years. I better name it properly"

#

Or maybe I just work in a team where it's common to name commits with nonsense?

tawny temple
#

I think a team should follow a commit style just like they follow some coding style

#

I agree that sort of attitude can lead to difficulties in reviewing PRs

shadow crow
#

We don't even have a written-down coding style, besides the linters we run in CI

dusty trail
#

im trying to clone a private github repo on a headless debian os. ive installed git credential manager, pass and a bunch of other things it told me to but i still dont understand how to make git accept my login info

tawny temple
#

Would have been simpler to use an ssh key I think

#

No need for a credential manager or whatever pass is

#

Just create an ssh key and add it to your gh account then use the ssh url to clone the repo rather than cms https url

fleet portal
#

hey can anyone help me with a calculator project

#

i would like some help
with a calculator project im doing
im struggling with a on/off button
the project is that when the off button is pressed
you cannot use the calculator like its off and the bar where the numbers show turns blank

buoyant hedge
#

Hi All, would love to know your feedback on the idea of using Pycharm over the cloud? What are your thoughts?

indigo zenith
indigo zenith
buoyant hedge
indigo zenith
thorny shell
#

I use visual studio code in an azure instance -- I bet that's roughly the same thing. It's tolerable.

buoyant hedge
indigo zenith
#

You want to make sure you're using a workspace in the right geographical zone... We have workspaces on the east coast of the US and people on the west coast complain

thorny shell
#

It's kinda like being underwater

buoyant hedge
thorny shell
#

otoh it's cheaper than buying a whole different computer just for Windows

buoyant hedge
#

Yes exactly

#

Would love to hear your feedback on Neverinstall. Have been building it for a while

thorny shell
#

never heard of it

buoyant hedge
thorny shell
#

ah but for that I'd have to
a) try it
b) remember to get back to you

Both those things seem unlikely themselves; but combined, it ain't never gonna happen

buoyant hedge
buoyant hedge
indigo zenith
#

I can see how it might be useful for others though... I'll recommend it if I come across anyone

buoyant hedge
thorny shell
#

I can vouch for that

#

I'm very set in my ways

wooden ibex
thorny shell
#

I generally make tons of small and stupid commits, whose comments have lots of swear words in them.
When I finally figure out what I'm doing, I squash 'em a bit and clean 'em up.
Once I create a pull request, I generally squash further, although not always

wooden ibex
#

Yea, you can also squash certain commits inside branch but no one got time for that. Also, some git servers might get cranky about branch history rewrite.

thorny shell
#

some do, some don't; some let you allow or prohibit that by policy

#

where I work we use ADO and the rule seems to be: if I created the branch, I can do all kindsa crazy #*($& to it. But if someone else created it, I can only do normal pushes. That seems sane

mystic void
#

It also helps to work from a branch in a fork rather than a branch in the main repo

#

You can nuke it from orbit, you can force push all you want and get it ready prior to creating to pr/mr

#

and you don't end up with a bunch of branches in unknown state in the main repo

thorny shell
#

we don't fork where I work; the concept doesn't really exist

#

I only make forks when I'm using github, and want to contribute something upstream, and the project wants a pull request

mystic void
#

you don't use a DVCS?

thorny shell
#

I use git

#

which is indeed a distributed version control system

#

by "fork" I mean: you go to some UI like github.com, look at the page for some repo, and click a button that says "fork", and it clones the repo on the server, under my name.

#

I do "git clone" all the time, but that's on my laptop, not on the server

#

either ADO doesn't have that feature, or (more likely) my employer just hasn't enabled it, or it's there and I've never noticed it 🙂

#

I imagine ADO will get end-of-lifed in a while, since Microsoft owns github, and most people would probably rather use github

wet dune
#

Im making a tool that bypasses the ability to run wget as root without a password in a linux machine (useful for ctfs) and i need to run an http.server with os without actually showing the output
Serving 0.0.0.0 on port 8000 etc. In simple words run it in the background?

#

how can i do that

#

Actually got a second problem. I need to use os to gain an ssh connection to the victim and in parallel start the http.server from the attackers machine

smoky aurora
#

hey folks, anyone know how to install python from a downloaded layout? the documentation surrounding python installs kind of sucks..

#

does the presence of adjacent MSIs cause the installer to use them instead of downloading?

thorny shell
#

I just run the installer and click "Next" until it's done

#

never bothered with anything else

smoky aurora
#

dealing with hundreds of small, Internet-unreliable devices

thorny shell
#

ah. Good luck

smoky aurora
#

the docs just suck in this regard. I can see the layout generated from my unattend.xml, but I'm not sure if I now have to re-copy my xml next to the new executable it generated or if that's automatically incorporated somehow

thorny shell
#

not that you asked, but: my hunch is that this is really hard, and the sensible thing to do is cough up some $ and pay for a professional product that does this for you

smoky aurora
#

pfft. it's not that hard, it's just poorly documented to discovery

#

silent installs aren't novel and this is just an MSI wrapper wrapper

tawny temple
#

Though it's technically not a proper installation

#

But maybe you're okay with that

smoky aurora
#

appreciate the link, but no clue what they're doing there

#

I'll be testing this in a VM without network access just to ensure I get it right

#

was hoping someone else went through the process and documented it better than the official site, but everything online is off-topic and gaming the SEO which is frustrating as all hell

#

you google "python, X" anything and you get crap clickbait from towardsdatascience or similar spam domains

solemn fog
#

does minikube have an api access? as i cant get subprocess.run way to work

chilly hazel
#

anyone use qtile?
Im unable to spawn firefox in two different workspaces, im able to spawn firefox twice but they spawn in the same workspace

gray salmon
#

Does anyone have experience with pyinstaller and encoding errors?

#
    (module, co) = self._load_module(module_name, pathname, loader)
  File "C:\Users\Shane\PycharmProjects\gc2toTGC\venv\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2143, in _load_module
    src = loader.get_source(partname)
  File "<frozen importlib._bootstrap_external>", line 783, in get_source
  File "<frozen importlib._bootstrap_external>", line 566, in decode_source
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa9 in position 386: invalid start byte
#

my app opens/edits/reads a .txt file to store settings, I added encoding="utf-8", errors='ignore' everywhere it's called

#

if you google UnicodeDecodeError: 'utf-8' pyinstaller this issue has been around for years, none of the fixes suggested worked using latest pyinstaller 5.1

heavy knot
wooden ibex
solemn fog
wooden ibex
#

Oh, that should be fine

solemn fog
latent canyon
#

Has anyone encountered this error before , "<static_files> was blocked due to MIME type {"text/html"} mismatch {X-content-options : nosniff)
Tech stack : django app running on docker with nginx as reverse proxy and gunicorn as my web server.

rancid schoonerBOT
#

:incoming_envelope: :ok_hand: applied mute to @young badger until <t:1654544254:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).

smoky aurora
foggy stratus
#

Is it ok if I post a link to my blog about Terraform? I am studying for Terraform cert and writing a blog about it. Let me know if anyone is interested 🙂

barren epoch
#

does someone has isea what happening?

rapid sparrow
#

Invalid URL to repository in git remote

#

I think the second reason

#

U a supposed to use SSH

#

Https way was disabled I think

fervent ridge
#

@small jay could you go over how docker works? bcs im really lost here

gentle solstice
#

Ideally, you would push to your own forks, then do a pull request.

brazen forge
gentle solstice
#

It's only an issue if someone pushes something you pushed previously to a non-github service, like gitlab

heavy knot
fervent ridge
#

can someone explain to me how to use docker? i have legit no idea what it is or anything about it but ive been told i should use it so that my code doesnt downgrade to discord.py 1.7

visual oxide
fervent ridge
#

i asked why one minute it was working fine and the next minute it said discord.ui wasnt a thing, and i was told that its bcs it downgraded to v1.7 and that i should use docker

visual oxide
#

Oh they weren't being very helpful there.

fervent ridge
#

actually they were

#

i had to go and by the time i got back they had left discord thats all

visual oxide
#

You probably want a couple of tools, eg is your discord bot code in git?

#

And do you use a virtual environment per project you do?

fervent ridge
#

git? as in github? and what do you mean virtual enviornment?

visual oxide
#

Ah right so you definitely want to start using a virtual environment per project you do, before worrying about docker.

fervent ridge
#

but what is that

visual oxide
fervent ridge
#

@visual oxide at
bash: tutorial-envScriptsactivate.bat: command not found

#

i ran tutorial-env\Scripts\activate.bat in the shell

visual oxide
#

Are you on Linux?

fervent ridge
#

no

visual oxide
#

Or WSL or similar?

fervent ridge
#

wth is that

visual oxide
#

What's your OS?

fervent ridge
#

WSL?

#

OS?

#

pls stop using abbreviations

visual oxide
#

Operating System, like Windows, Macos, Ubuntu, Solaris etc?

visual oxide
#

Can you show a screenshot of your terminal?

fervent ridge
visual oxide
#

The shell

fervent ridge
#

this is everything xD

#

@visual oxide

visual oxide
#

Not sure exactly what you're running, but follow the instructions for Unix or MacOS

visual oxide
#

Sure

fervent ridge
#

look good?

#

@visual oxide what does this mean:

#

Activating the virtual environment will change your shell’s prompt to show what virtual environment you’re using, and modify the environment so that running python will get you that particular version and installation of Python. For example:

$ source ~/envs/tutorial-env/bin/activate
(tutorial-env) $ python
Python 3.5.1 (default, May  6 2016, 10:59:36)
  ...
>>> import sys
>>> sys.path
['', '/usr/local/lib/python35.zip', ...,
'~/envs/tutorial-env/lib/python3.5/site-packages']
>>>
visual oxide
fervent ridge
visual oxide
#

So you'd run python

#

Then do import sys

fervent ridge
#

just in the shell

visual oxide
#

Then do sys.path

#

Yep

fervent ridge
#

i ran python -m pip install novas in the shell and got this:

  File "<stdin>", line 1
    python -m pip install novas
              ^
SyntaxError: invalid syntax
#

@visual oxide

#

i gtg eat rq ill be back soon

visual oxide
#

You'll need to run that in bash not in the python repl

wet dune
#

hey yall

#

I just finished making a python ssh id encoder/decoder for a vulnhub begginers room im making. Basically the player will have to reverse engineer this program (will make it obfuscated after) and decrypt the rsa key that gives him access to root. Need your opinion on it

#

Part1

from cryptography.fernet import Fernet 
import base64
def generate_key():
    #Store the double base64 encoded key
    with open("key.en", "wb") as f:
        key = base64.b64encode(base64.b64encode(Fernet.generate_key()))
        f.write(key)
def read_key():
    with open("key.en", "rb") as f:
        key = base64.b64decode(base64.b64decode(f.read()))

    return key
def generate_passwords():    
    fernet = Fernet(read_key())
    with open(".pass.en", "rb") as f:
        passwd = base64.b64decode(f.read()).decode('utf-8')

    return fernet, passwd
def read_rsa():
    with open("id_rsa", "rb") as f:
        contents = base64.b64decode(f.read().decode('utf-8'))
    # Returns bytes 
    return contents
def encrypt_rsa():
        data = read_rsa()
        print(data)
        with open("id_rsa", "wb") as f:
            f.write(base64.b64encode(generate_passwords()[0].encrypt(data)))
def decrypt_rsa():
    data = read_rsa()
    print(data)
    with open("id_rsa", "w") as f:
        print(base64.b64encode(generate_passwords()[0].decrypt(data)))
        f.write(base64.b64encode(generate_passwords()[0].decrypt(data)).decode('utf-8'))
#

Part2

def prompt():
    prompt = str(input(    "Options:\n" +
                          "1\tEncrypt rsa file\n" +
                          "2\tDecrypt rsa file\n" +
                          "3\tExit\n\n: "))
    if prompt == "1":
        if check_password():
            print("[-] Encrypting id_rsa . . .")
            encrypt_rsa()
            print("[+] Encryption completed succesfully .")
    if prompt == "2":
        if check_password():
            print("[-] Decrypting id_rsa . . .")
            decrypt_rsa()
            print("[+] Decryption completed succesfully .")
    if prompt == "3":
        print("[!] Exiting")
        exit()
prompt()
pallid orbit
#
error: failed to push some refs to 'https://git.heroku.com/my-portfolio-webpage.git ```
#

had this error since yesterday checked google and stack overflow as well, can't seem to find a fix for it

#

if anyone can help that would be very much appreciated

brazen forge
#

is there any output above or below this?

gentle solstice
#

Tried git push heroku master -f?

hard gyro
#

guys how would one intergrate monthly payment instalments for telegram using python
please help

rapid sparrow
wet dune
rapid sparrow
#

you should really make it DRY

#

also, why you have double base64 encoding? 🤔 base64.b64encode(base64.b64encode

#

ah, an obfusaction part

#

mm no, just no.

#

I think this exceise is a waste of time

#

instead of trying to reverse it