#tools-and-devops

1 messages Β· Page 66 of 1

thorn sentinel
#

This looks like suggestions on how to format python code though - I am not pasting python code πŸ™‚

#

@deep estuary
This is what I am getting when putting pyenv virtualenv-init into my terminal:

# the following to ~/.bashrc:

eval "$(pyenv virtualenv-init -)"
deep estuary
#

interesting

#

what if you run pyenv virtualenv-init -

#

I assume you have restarted your shell since installing

thorn sentinel
#

Yes sir

deep estuary
#

hmmmmmmm

thorn sentinel
#

It also seems to very expansionist, whereby it started to claim that my system python is the one I asked it to install, rather than my initial native version

#

EDIT: while in the project directory and in my $HOME, the which python command points to the same file. However, when in $HOME once running the python command it shows the system version, while in the project folder it shows the correct one I wanted

#

I love my job πŸ˜›

deep estuary
#

hahahaha

#

that's weird

thorn sentinel
#

My initial thought was that pyenv would create a symlink to my native python binary, but no

#

Ok upon reading the docs, it seems that an additional .python-version file is created which holds only the python version (duh!) on the folder level (?)

deep estuary
#

ahhh yeah that rings a bell

thorn sentinel
#

So upon removing this file from my home, the versions seems to work correctly, albeit the which command still shows the same thing

#

lol

#

That seems to be a good temporary solution and I am too tired to deal with this nonsense any more tonight - @deep estuary you've been a star - thanks!

deep estuary
#

haha no problem

thorn sentinel
#

I'll think dearly about you next time I am dealing with something ridiculous like this πŸ™‚

velvet spire
#

hmmm

#

so say i commited a branch

#

its named ci because I'm bad at names

#

the main branch has gotten a new commit since i branched off from it, and I'd like to add that commit to my work

#

is the proper command git rebase main ci

#

no, the proper thing is a merge commit because its already been pushed

deep estuary
#

git merge main

velvet spire
#

yeah

deep estuary
#

you can git merge main and git rebase to rebase the commit onto your branch and avoid merge commits

velvet spire
#

oh?

#

and then push it?

deep estuary
#

yea

velvet spire
#

and that won't rewrite history??

#

i had to go into reflog earlier today because i uh, erased 7 commits by doing a rebase and then pushing :)

#

….why is docker just not.

#
> docker-compose up
/usr/local/bin/docker-compose: 1: /usr/local/bin/docker-compose: Not: not found
#

ah

deep estuary
#

a bit of a long example, but: asciinema rec

#

wow useless paste

velvet spire
#

its because this ```sh
% where docker-compose
/usr/local/bin/docker-compose
/usr/bin/docker-compose
/bin/docker-compose

velvet spire
#

that makes some sense but

#
#

just memorizes what you said

#

:)

deep estuary
#

lmfao

velvet spire
#

bad @signal cloak

#

welp

#

time to deal with docker while i wait for that pr to be merged

#

docker-compose version 1.21.0, build unknown

#

lovely.

deep estuary
#

which pr

velvet spire
#

modmail

deep estuary
#

ah

velvet spire
velvet spire
#

okay whatever

#

i gave up kinda

velvet spire
heavy knot
#
def run():
    a = wifi_var.get()
    b = vectom_var.get()
    g = subprocess.Popen(["ettercap","-T","-S","-i","wlan0","-P","dns_spoof","-M","arp:remote",f"/192.168.1.1//",f"/192.168.1.13//"])
    
def stop():
    
    g.terminate()
#

this is my error

#

it says

#
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.9/tkinter/__init__.py", line 1884, in __call__
    return self.func(*args)
  File "/home/gromax/Documents/python/main.py", line 15, in stop
    ro = g.get()
NameError: name 'g' is not defined
#

what should i do??

queen shoal
#

read about scopes on functions

rancid schoonerBOT
#

Scoping Rules

A scope defines the visibility of a name within a block, where a block is a piece of python code executed as a unit. For simplicity, this would be a module, a function body, and a class definition. A name refers to text bound to an object.

For more information about names, see !tags names

A module is the source code file itself, and encompasses all blocks defined within it. Therefore if a variable is defined at the module level (top-level code block), it is a global variable and can be accessed anywhere in the module as long as the block in which it's referenced is executed after it was defined.

Alternatively if a variable is defined within a function block for example, it is a local variable. It is not accessible at the module level, as that would be outside its scope. This is the purpose of the return statement, as it hands an object back to the scope of its caller. Conversely if a function was defined inside the previously mentioned block, it would have access to that variable, because it is within the first function's scope.

>>> def outer():
...     foo = 'bar'     # local variable to outer
...     def inner():
...         print(foo)  # has access to foo from scope of outer
...     return inner    # brings inner to scope of caller
...
>>> inner = outer()  # get inner function
>>> inner()  # prints variable foo without issue
bar

Official Documentation
1. Program structure, name binding and resolution
2. global statement
3. nonlocal statement

orchid raptor
#

hey guys im setting my environment variables on a digital ocean droplet
on bash_profile
all the environments are okay except for my mongo uri
export MONGO_URL_PRODUCTION=mongodb+srv://......
i cant print all the others but this one
no white spaces

deep estuary
rapid sparrow
#

argh.

#

I am trying to set password for redis

#

and connect from django

#

the first part goes well, but django just refuses to auth

#
version: '3'

services: 
    redis:
        image: "redis:alpine"
        command: redis-server --requirepass mypass
        ports:
        - "6379:6379"
        volumes:
        - ./redis-data:/var/lib/redis
        - ./redis.conf:/usr/local/etc/redis/redis.conf
        restart: always
#

tested with redis-cli

#

AUTH mypass works

#

trying to auth in different ways in django... but no idea what is wrong

#

always this redis.exceptions.AuthenticationError: Authentication required

deep estuary
#

what are you trying in django?

rapid sparrow
#
CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": f"redis://" + ":mypass@" + f"{DOCKER_IP}:6379/0",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
        },
    }
}
#

i tried to auth like that

deep estuary
#

hm, yeah, I'd assume that's correct

rapid sparrow
#

and

CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": f"redis://" + f"{DOCKER_IP}:6379/0",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            "PASSWORD": "mypass",
        },
    }
}
#

I think I already tried all the different ways

deep estuary
#

have you tried without the leading : on the first one? sometimes I see that not being implemented well

rapid sparrow
#

redis://default:mypass@adreess/0 tried too

#

AUTH default mypass works from console

deep estuary
#

in your first example you would be generating something like redis://:mypass@10.0.0.0:6379/0

#

which is valid but not always implemented

#

as per the docs though that looks valid

#

so

#

hm

rapid sparrow
#

hmm

#

ops

#

it works

#

bwhaha

#

I get it

#

it is some problem of auth with django redis lock library basically

#

basic cache functionality authed as I can see

#

and it works too now. authentificated. Yay

#

πŸŽ‰

#

just to be sure I made password from 64 symbols πŸ˜‰

#

it should be enough against brute force

bright cipher
#

Hi guys
How can I execute command inside Python in command line

for ex. if I execute python then I need to execute x=10 and y=2

#

In command line

sly flare
#

Hey! I'd like to a build a small environment using Docker, and Docker compose alongside with Github actions and such, however.. I'd like to use Django but I'm not sure how I could run the migrations automatically, do you have any suggestions?

last anchor
#

Hey Everyone!
A celery & devops related question: currently I'm looking into celery+redis to run a task queue and to run periodic tasks.
This system is setup like this:

  • One DB server
  • Multiple docker container instances running django

The periodic tasks mainly consists of fetching data trough a web api and putting it into the django DB.
Question: if I have for instance 5 docker instances running, will it trigger 5 times the periodic task per interval? If yes: how do I prevent this?

rapid sparrow
#

just make sure you don't have 5 beat task initializers πŸ˜‰

#

if you will have only 1 celery beat, and 5 celery workers, the task would be taken by first free worker in theory

#

celery beat creates the task

#

workers process them

last anchor
rapid sparrow
#

whatever way to initialize only one celery beat

#

hehe, it would be your dockerized task creator πŸ˜‰

#

the leader of the group

last anchor
#

Thanks!

rapid sparrow
#

u a welcome

deep estuary
# sly flare Hey! I'd like to a build a small environment using Docker, and Docker compose a...

we have a custom manage script for https://pythondiscord.com/ that gets called in docker and runs migrations https://github.com/python-discord/site/blob/main/manage.py

GitHub

pythondiscord.com - A Django and Bulma web application. - site/manage.py at main Β· python-discord/site

rancid schoonerBOT
#

site/deployment.yaml lines 21 to 31

livenessProbe:
  httpGet:
    path: /
    port: 8000
    httpHeaders:
      - name: Host
        value: pythondiscord.com
  failureThreshold: 2
  periodSeconds: 30
  timeoutSeconds: 5
  initialDelaySeconds: 10```
sly flare
#

Oh, wow. Thank you! πŸ˜„

dusty jewel
#

I have a 132gb flashdrive in my computer w/ not much localstorage left. After changing to linux. How do I free up space by transferring things to the flaskdrive?

heavy knot
#

hello is there a discord server dedicated exclusively to devops?

deep estuary
#

not to my knowledge

flat path
#

Hello! Does anyone know of a way to do a blobless / treeless clone with GitHub's actions/checkout ? Some searching revealed nothing beyond custom bash scripts :/

deep estuary
#

maybe I should make one 😎

#

hmmmm interesting question

flat path
#

Unfortunately I can't get away with a shallow clone because setuptools-scm needs the commit (or tag?) history to generate the distribution version.

deep estuary
#

by default it should be fetching the latest commit only

#

i'm not sure how to pass in the args that would make it truly treeless/blobless though (or if there is a way with the action, there is not an option I can find)

flat path
#

Hmm yeah it doesn't look possible then, not the end of the world, thankfully the repo I'm cloning isn't that big (psf/black) but it would be nice if I didn't have to clone the *whole* repo. Thanks for searching!

bright cipher
rapid sparrow
balmy heron
#

some questions here as i understand docker more (and sorry for all these amateur questions, just picked docker up today):

  1. is it sensible to have separate dockerfiles for running a dev server and a production server.
  2. if i were to have tests such as cypress running with docker, should i have another dockerfile for that, or should i somehow put it in a docker compose with the dev server
  3. from looking at some open source projects on github, i saw some people who uses something like api.Dockefile or Dockerfile.api what are those for? and what are the differences?
    thanks!
burnt ibex
balmy heron
#

i see, thanks for the response!

orchid raptor
#

hey
im using pm2 serve build --spa
but pm2 is still running as a static page server
im getting this error

0|static-p | [2021-07-29T11:45:44.247Z] Error while serving /home/master/frontend/build/app/home/dashboard with content-type text/plain : ENOENT: no such file or directory, open '/home/master/frontend/build/app/home/dashboard'
0|static-p | [2021-07-29T11:45:45.497Z] Error while serving /home/master/frontend/build/app/home/dashboard with content-type text/plain : ENOENT: no such file or directory, open '/home/master/frontend/build/app/home/dashboard'
0|static-p | [2021-07-29T11:45:46.761Z] Error while serving /home/master/frontend/build/app/home/dashboard with content-type text/plain : ENOENT: no such file or directory, open '/home/master/frontend/build/app/home/dashboard'
0|static-p | [2021-07-29T11:45:47.337Z] Error while serving /home/master/frontend/build/app/home/dashboard with content-type text/plain : ENOENT: no such file or directory, open '/home/master/frontend/build/app/home/dashboard'
0|static-p | [2021-07-29T11:45:47.653Z] Error while serving /home/master/frontend/build/app/home/dashboard with content-type text/plain : ENOENT: no such file or directory, open '/home/master/frontend/build/app/home/dashboard'
0|static-p | [2021-07-29T11:45:47.825Z] Error while serving /home/master/frontend/build/app/home/dashboard with content-type text/plain : ENOENT: no such file or directory, open '/home/master/frontend/build/app/home/dashboard'
0|static-p | [2021-07-29T11:46:06.703Z] Error while serving /home/master/frontend/build/dashboard with content-type text/plain : ENOENT: no such file or directory, open '/home/master/frontend/build/dashboard'
0|static-p | [2021-07-29T11:46:09.550Z] Error while serving /home/master/frontend/build/dashboard with content-type text/plain : ENOENT: no such file or directory, open '/home/master/frontend/build/dashboard'
#

pm2 status

β”Œβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ id  β”‚ name                       β”‚ namespace   β”‚ version β”‚ mode    β”‚ pid      β”‚ uptime β”‚ β†Ί    β”‚ status    β”‚ cpu      β”‚ mem      β”‚ user     β”‚ watching β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 0   β”‚ static-page-server-8080    β”‚ default     β”‚ 5.1.0   β”‚ fork    β”‚ 1204     β”‚ 2m     β”‚ 0    β”‚ online    β”‚ 0%       β”‚ 38.0mb   β”‚ master   β”‚ disabled β”‚
β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
final cliff
#

Quick question about Docker: so I have a container that runs a Postgres database, and uses the host's filesystem to store the database: what happens if I have two of the same postgres container running? Will they share the same underlying database on the file system?

leaden tartan
#

Interesting question tho because in theory this could start data races while writing

final cliff
#

yep, that's why I'm asked πŸ™‚

brazen locust
#

Hi all,

Two months ago, our team switched from Java and Javascript to Python.
We love the language, but we had some hard times setting up our dev environment, i.e. some devs had troubles installing tools like poetry on their machines.

In Java land, gradle introduced the gradle wrapper scripts; *nix and windows gradlew scripts that download (and cache) the desired gradle version on the fly when running a command.

https://github.com/houbie/python-wraptor tries to achieve the same for Python based tools.
You just add the shell scripts to your repo, configure your tools in pyproject.toml and prefix all commands with pw, f.e. ./pw poetry install, ./pw jupyter notebook
The optional px script and command aliases shorten your commands; f.e. open your favorite Jupyter notebook with px nb from any subdirectory in your project.

The wrapper scripts make sure that all devs use the same version of tool for a specific project.
It can also help tutorial authors: your audience only needs to have python3 on their path and can skip the hassle of installing numerous other tools.

On the first invocation, python-wraptor creates a tool/version specific virtual environment in ~/.python-wraptor/venvs and delegates the command.
When multiple projects use the same version of a tool, it only gets installed once, and cleaning up is just a matter of rm -r ~/.python-wraptor.

Check out the https://github.com/houbie/python-wraptor code and the https://github.com/houbie/wrapped-pi example project and please share your thoughts...

GitHub

CLI wrapper for automatic installation of Python tooling - GitHub - houbie/python-wraptor: CLI wrapper for automatic installation of Python tooling

GitHub

Easily install Python tools and command aliases. Contribute to houbie/wrapped-pi development by creating an account on GitHub.

rapid sparrow
#

any idea how to check if proxy is alive in python

#

requesting some web site looks like not good solution

#

as an option requesting myself, but it is not comfortable to use in local development

#

clarification: checking my own squid proxy server

#

so if additional config changes required, it is possible

#

oh yes, I guess I could just check is the port is listening

#

it should be good enough for start

#

nice, it works.

#

nvm

hardy breach
#

πŸ˜… I am facing some issue, unable to push the code to github

hexed ermine
#

lol I have no idea about github too

deep estuary
hardy breach
deep estuary
#

yeah, you can't push your token to github publicly or anyoe can login and become your bot

#

you should store it in an environment variable or secure config file outside your github project

hardy breach
#

ohh

#

so shall I make a private repo?

#

I have no idea

barren iron
#

Specifically Google "environmental variables in python"

hardy breach
#

oh

#

I published it on public repo by mistake, what if I do the same on private repo

barren iron
#

If it's on a public repo, you are going to have to start over, since git stores history.

#

On a private repo, it's not a problem but definitely bad practice

burnt sail
#

Hi, I making a bruteforcer for caesar encryption but I have a problem

alphabet = 'abcdefghijklmnopqrstuvwxyz'

If my input are: HeYhOwArEyOu, the alphabet will not work, but if it is in lowercase it will, so I edited the alphabet by aAbBcCdDeE etc...
It's working but it's print 51 key instead of 25, someone have an idea ?

warm pollen
trim kettle
#

Long time follower of the discord, first time writing. I'm starting a back-end coding educational program in two months. Does anyone have a suggestion on what laptop to buy? (Only for coding, maybe watching netflix at tops).

vague silo
#

i like my macbook. joe would probably claim the same. i think going for any laptop with linux / macos is a solid choice

thick willow
#

anyone familiar with circleCI ? # This assumes pytest is installed via the install-package step above

#

how do i do this?

rapid sparrow
final cliff
#

Is there a similar tool for Python like PM2? https://pm2.keymetrics.io/

Advanced process manager for production Node.js applications. Load balancer, logs facility, startup script, micro service management, at a glance.

vague silo
vague silo
rapid sparrow
#

The biggest laptop screen is what, 17 inches?
This is the size of pc desktop screens fifteen years ago

vague silo
#

sorry to hear you've had a bad experience with laptop screens. i've been using my laptop for 7 years, and had absolutely no problems with it. i guess it ends up depending which laptop you choose

#

that said, i don't think that the point of the question was to discuss screen size or number, just which laptop was good for development

rapid sparrow
#

No laptop, no problem.
System unit is essentially cheaper too

#

Since you can choose without videocard with good specs

vague silo
#

i'm not sure how "no laptop" is an answer to "does anyone have a suggestion on what laptop to buy", but fair enough

rapid sparrow
final cliff
#

@vague silobtw you can use PM2 with any type of apps not just Nodejs, I just don't want to add js stuff to my codebase πŸ˜„

#

too bad we don't have a tool like this in python

vague silo
rapid sparrow
#

Better than pm2

vague silo
#

i think the general notion of managing process startup / shutdown with possible dependencies is a good fit for systemd. can also manage logging for you, and restarts the service on failure. starting multiple instances is also relatively easy

final cliff
#

javascript is gross

#

@vague silowhat if you don't have access for systemd? on heroku for example

#

then the only way is using docker

vague silo
#

what specifically are you looking to host here?

rapid sparrow
vague silo
#

from how I understood heroku the last time I used it, you deploy one app per ... heroku deployment unit, from whatever that was. I could be wrong though

vague silo
final cliff
#

it handles everything

#

depending on your config file

rapid sparrow
#

But when we essentially need it?

#

Only for development

final cliff
#

I'm just too lazy to learn docker πŸ˜„

vague silo
#

how does docker "handle everything"? how do i send gunicorn a reload signal via docker?

final cliff
#

btw it's a discord bot + postgres + flask

vague silo
final cliff
#

I'll just learn docker, never had the time, so maybe now πŸ˜„

vague silo
#

also, docker and systemd fulfill very different purposes. systemd, at least pid1, is primarily concerned with managing service lifecycle, whilst docker is primarily concerned with packaging apps in an easily distributable format. running docker images is just part of it

rapid sparrow
#

Dunno, compose makes stuff running comfortable

#

Restart there is just
docker-compose restart

vague silo
#

how do I tell docker compose to stop one service if another service dies after startup?

rapid sparrow
vague silo
#

so manual labor. excellent

#

so anyways, the point i'm trying to make is not that docker or docker-compose are bad, or that systemd is perfect. the point i'm trying to make is that there's no one-size-fits-all tool, they all just have different strengths and weaknesses, and thanks to open source software you can choose for yourself which one suits your usecase the best.

rapid sparrow
#

There is actually better way

#

In docker yaml write between services things like

Next container depends on containers...

#

Hmm, I ll give example

rapid sparrow
# vague silo how do I tell docker compose to stop one service if another service dies after s...
version: '3'

services: 
    django:
        build: .
        container_name: django_service
        command: >
            bash -c "python manage.py makemigrations
            && python manage.py migrate
            && python manage.py runserver 0.0.0.0:8000"
        volumes: 
            - .:/app/
        ports:
            - 8000:8000
        environment: 
            - DEBUG=1
            - DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1
            - CELERY_BROKER=redis://redis:6379/0
            - CELERY_BACKEND=redis://redis:6379/0
        depends_on: 
            - redis
    celery-worker:
        build: .
        container_name: celery_worker
        command: celery -A fampay_youtube worker -l INFO
        volumes: 
            - .:/app/
        environment: 
            - DEBUG=1
            - DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1
            - CELERY_BROKER=redis://redis:6379/0
            - CELERY_BACKEND=redis://redis:6379/0
        depends_on: 
            - django
            - redis
    celery-beat:
        build: .
        container_name: celery_beat
        command: celery -A fampay_youtube beat -l INFO
        volumes: 
            - .:/app/
        environment: 
            - DEBUG=1
            - DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1
            - CELERY_BROKER=redis://redis:6379/0
            - CELERY_BACKEND=redis://redis:6379/0
        depends_on: 
            - django
            - celery-worker
            - redis
    redis:
        image: "redis:alpine"
#

you are looking for depends_on apperently perhaps

vague silo
#

depends_on deals with startup and shutdown order, not runtime monitoring

vague silo
toxic bough
#

!pban 317314122280599554 troll

rancid schoonerBOT
#

:incoming_envelope: :ok_hand: applied purge ban to @bold comet permanently.

quick night
#

Lmao

quaint saffron
#

!pban 525274040013946902 Despite being warned and having your advertisements removed countless time, you still continue to spam them

rancid schoonerBOT
#

:incoming_envelope: :ok_hand: applied purge ban to @upbeat inlet permanently.

velvet spire
#

@deep estuary have you ever used wrangler on a raspberry pi?

#
>>> wrangler publish --verbose
Warning: webpack's output filename is being renamed to worker.js because of requirements from the Workers runtime
:sparkles:  Built successfully, built project size is 6 KiB.
Error: Something went wrong with the request to Cloudflare...
Authentication error [API code: 10000
#

wrangler whoami successfully reports who i am

velvet spire
#

ok

#

well

#

regardless

#

I'm not even on the pi anymore

#

problem is...
wrangler whoami says I'm signed in and who I am

#

got any ideas?

deep estuary
#

try deauthenticate and reauthenticate

#

it looks like the token has the wrong perms

velvet spire
#

ah

#

its uh

#

an easy fix

rancid schoonerBOT
#

github-filter-worker/wrangler.toml line 3

account_id = "502aea548379e08369697540cc0bb0d1"```
velvet spire
#

:)

deep estuary
#

yeah that will also make things not work

velvet spire
#

yep changed it to my account and it works

deep estuary
#

YMMV using that worker

#

unless you have honeycomb

velvet spire
#

yea

#

figured that out lol

velvet spire
deep estuary
#

i should add a WL for that

velvet spire
#

yea

velvet spire
deep estuary
#

lol

#

there are things after that i added are't there

velvet spire
#

yes

#

i mean i reverted and then resolved the issues

#

so like

#

git revert …

#

hm ferris_think

#

very nice

#

https://discord.com/api/webhooks/${id}/${token}/github?wait=1

#

was just wondering if i needed to have /github in the webhook lol

#

hell yea

#

500 ftw

velvet spire
velvet spire
#

well

#

so the github config is right

#

time to see why the code itself errors

#

darned honeycomb

velvet spire
#

nice

velvet spire
final cliff
#

I'm still wondering why python-dotenv is not part of the offical library

velvet spire
rancid schoonerBOT
#

github-filter-worker/src/index.ts line 34

request.tracer.addData({```
deep estuary
#

yeah

#

that's hooneycomb

sly flare
#

Hi! Do you guys have any thoughts on this?
https://kompose.io/
It comes in handy, after learning the whole docker-compose syntax πŸ™‚

velvet spire
#

lmfao

velvet spire
deep estuary
#

kompose is fun

velvet spire
#

Since you're probably wondering what I did, @deep estuary, I ended up just using honeycomb for that worker, lol

#

It's not on any public repo, I only cloned the repo, changed the project id to my workers, and then published it.

deep estuary
#

lol

velvet spire
#

Oh, I also spent way too long debugging why it was erroring

#

Spoiler: HONEYCOMB_API is not the same as HONEYCOMB_KEY

sleek temple
#

i make website in django i already host after..........I am facing big issues on Websurfer ISP.
I'm just buying Hosting Domain.
Everything is ok but I can’t open my website from Websurfer ISP
From my mobile network it can access like Ncell , NTC, World link and other network but can't access from
Websurfer ISP
Any Solution Please..

sly flare
#

Hey!
I'm just exploring Kompose, and came across something that I don't really undestand.
If I specify the service type to be LoadBalancer, shouldn't it automatically expose the IP of the service?
Because the Kompose docs says: kompose.service.expose defines if the service needs to be made accessible from outside the cluster or not.
So, I'm not sure whether I should set it true or not, or that the LoadBalancer sets it automatically true.
https://kompose.io/user-guide/

deep estuary
sly flare
#

Alright, thank you! πŸ˜„

deep estuary
#

I can see what we use for the LB here

#

hmmm

#

as far as I can see expose is more important for NodePorts

#

give it a whirl though!

sly flare
#

Yeah, in the example they used NodePorts , but not exposed the service's IP, so that's what confused me πŸ˜„

pastel meadow
#

dont know where to ask - so here will do , is there a way tou use a python module to intercept usb data ? using W10 and Ubuntu i want to eavesdrop on a UPS ( power backup ) -- if power fails do a shutdown to Raspi , that thing , this thing ... bla bla

velvet spire
#

hey @deep estuary , how did you configure the settings in honeycomb for the github proxy worker?

#

(use the correct org name if that isn't what you use lol)

rancid schoonerBOT
#
Missing required argument

content

deep estuary
#

!remind 2h this

rancid schoonerBOT
#
Okay.

Your reminder will arrive <t:1627854495:R>!

velvet spire
#

!remind 2h bored, might as well

rancid schoonerBOT
#
Nah.

Sorry, you can't do that here!

velvet spire
#

I legit hate you sometimes @rancid schooner

deep estuary
#

okay here

#

@velvet spire

rancid schoonerBOT
#

@deep estuary

It has arrived!

Here's your reminder: this.
[Jump back to when you created the reminder](#tools-and-devops message)

velvet spire
#

i can't set . for those values

#

like

#

i can set it to trace

#

but not to trace.trace_id

lucid crown
#

how to i install github repo with git?

rancid schoonerBOT
#
Absolutely!

Your reminder will arrive <t:1627922371:R>!

burnt ibex
sly flare
#

Hey! I have a question about Kubernetes.
I think I'm trying to understand the whole picture.
When I deploy an app to Kubernetes, it will schedule to run the app containers in pods on a Node, that's fine. But where does the concept of "replicas" come into the picture?
I thought Kubernetes has a self healing mechanism by default. Or is it for nodes only? Bit confused what happens when only a single Pod fails and not a whole Node.

deep estuary
#

so if you have a web app with 3 replicas then 3 pods will be created

#

If you have health checks then failing pods will get restarted

sly flare
#

How do I set health checks?

deep estuary
# sly flare How do I set health checks?
sly flare
#

I see, thank you! πŸ˜„

grand gale
#

Though you can even automate the amount of replicas with scaling rules

velvet spire
rancid schoonerBOT
#

@deep estuary

It has arrived!

Here's your reminder: this.
[Jump back to when you created the reminder](#tools-and-devops message)

deep estuary
rancid schoonerBOT
#
Can do!

Your reminder will arrive <t:1627940993:R>!

velvet spire
velvet spire
#

uh

#

since you haven't sent yet (thankfully) also the triggers config kinda thing would be helpful too

rancid schoonerBOT
#

@deep estuary

It has arrived!

Here's your reminder: this.
[Jump back to when you created the reminder](#tools-and-devops message)

grand gale
#

rip

velvet spire
grand gale
#

yeah

velvet spire
#

i wonder who the new server owners is gonna be /s

grand gale
#

lol

velvet spire
#

okay

#

i think i figured it out

deep estuary
#

lol, I'm on holiday

velvet spire
#

ah lol

#

well

#

i figured it out anyways lol

#

actually added an extra value so i get info on the github users too

#

found a bug as well

velvet spire
deep estuary
#

I have a P90 trigger over 1s

velvet spire
#

P90?

#

oh

#

290ms here

deep estuary
#

P90 is liiike

#

if you took all request durations and lined them up and removed the top 10%, the average of the remaining points

velvet spire
#

ah

#

πŸ‘€

#

why are most requests taking over 1 second

deep estuary
#

lol

#

pydis site always wins

velvet spire
deep estuary
#

looks about right

velvet spire
#

its slightly different

velvet spire
#

i triggered 100 events in the past 8 hours

deep estuary
#

you can do that without

velvet spire
#

jeez

deep estuary
#

lol

velvet spire
#

doesn't change that it still has a bug

#

with shipit

deep estuary
#

that bug is discord end

#

I've inspected the payloads

velvet spire
#

so

#

i don't think its a bug.

deep estuary
#

it's the way that github treats fields from github

velvet spire
#

I think its intentional.

deep estuary
#

I mean no, not bug, intended behaviour, but not intended in our favour

#

I did ask

#

It's not a bug, nor is it something intentionally filtered, just the way that github hooks work

velvet spire
#

ah

#

the reason i thought it was intentional is because slack and github webhooks cannot be sent to threads

heavy knot
#

hello, I'm new on git(hub) and i don't understand well somethings

#

It only for training to git, not a real project

#

have two branch, master and bet

#

two files, main and bet

#

i accidentaly commited in the wrong branch

#

and remodified files after

#

tried this to fix it but now i'm completly lost

#

pls pin me

tawdry needle
#

i also encourage you to use this command: git log --graph --oneline --decorate . it can give you a very useful high-level overfiew of your repository

#

it sounds like you have two branches, main and bet

#

these are not files

#

every git commit is a snapshot of your files. a branch is just a label that points to a specific snapshot of your files

#

so your options are:

  1. change where the branches point
  2. copy commits from one place to another
velvet spire
tawdry needle
#

you can fix pretty much any git mistake that way

tawdry needle
velvet spire
#

jeez

#

that's

#

wow

#

TIL

tawdry needle
#

a lot of people assume what you said, but that's now how it works. that's how "patch-based" version control systems work, such as darcs and pijul. but those aren't exactly popular. and they aren't git.

velvet spire
#

(also I'm just here because poetry is taking a long time to resolve my dependencies because I cleared the cache because I wanted to see what would happen)

heavy knot
#

it just for testing so i don't exactly know exactly what i want to change, just go in bet branch with my last change and eventually make my last commit to come with me

velvet spire
#

git is great

tawdry needle
heavy knot
#

master branch

velvet spire
heavy knot
#

main is the file

velvet spire
#

:)

tawdry needle
#

ah

#

i don't like or trust these git cheat sheet things

#

they encourage non-understanding

velvet spire
#

well

#

i'll explain the whole thing

#

but

tawdry needle
#

case in point: i think that's one of the worst ways to fix the problem

velvet spire
#

why?

tawdry needle
#

it's messy

#

lots of steps

velvet spire
#

how would you do it?

#

i uh

heavy knot
tawdry needle
#

either cherry-pick the commit, or just swap around the branch pointers with git branch -f

velvet spire
#

git branch -f?

#

how does cherry-pick work?

tawdry needle
#

if you have conflicts you have to resolve them one way or another, either during stash apply or cherry-pick

heavy knot
#

like i said , i'm just starting and i'm lost

tawdry needle
#

cherry-pick literally copies a commit and makes a new commit with a new parent

velvet spire
#

jeez poetry took 300 seconds to resolve dependencies

heavy knot
tawdry needle
#

@heavy knot this happens because the version of games.py that is in the stash is different from the version of games.py that is on the master branch, and the differences cannot be resolved automatically

heavy knot
#

but the stash come from master

#

i want to put it in bet branch

tawdry needle
#

ok then. the version of games.py that is in the stash is different from the version of games.py that is on the bet branch.

heavy knot
#

ok, i try somthings

tawdry needle
#

please don't try random things

#

let me read your screenshot

#

it is very difficult to read a screenshot

#

what does git status show? @heavy knot

heavy knot
#

just after what i done in the other picture

tawdry needle
#

ok, good

#

do you physically see games.py in your files right now?

#

and do its contents look correct?

heavy knot
#

and before it

#

actually yes

#

i see it

tawdry needle
#

ok

#

"deleted by us: games.py" means something along the lines of "there is no file named games.py in the current branch, but you created this file through a merge or stash pop/apply"

#

so you can git add games.py and proceed as before

heavy knot
#

ok, i need to do somthing now, i will see it if work just after

tawdry needle
#

the "would be overwritten" message happened because games.py did not exist in the bet branch, so switching to bet would delete games.py, and git did not want to let you do that

#

if you did git add games.py main.py before git checkout bet, you might not have needed to perform the git stash operations

heavy knot
#

ok, i undestood, and thanks

heavy knot
tawdry needle
#

it would not commit them

#

the index exists separately from the commit that your branch points to

#

the index is basically a special commit a special snapshot of your code that is ready to be turned into a commit, but is not a commit yet

heavy knot
#

ok

tawdry needle
#

yes, now you can git commit

#

you might want to add __pycache__/ to your .gitignore file

#

my gitignore file for python projects always has at least these entries:

__pycache__/
*.py[cdo]
*.egg-info/
burnt ibex
#

Is there a way to clone a repo without any git stuff at all, only the actual code?

#

I'm not looking for --depth as that still keeps it as a git repository

#

I don't want a repository involved at all, just code

#

I know I can just rm -rf .git but I'm curious if there's a better way

velvet spire
heavy knot
#

so now it work

velvet spire
#

the other way is to download a zip from github, if its hosted there

burnt ibex
heavy knot
#

do the .gitignore already exist or should i add it

tawdry needle
tawdry needle
heavy knot
#

ok

#

and just write the name of the file in ?

tawdry needle
burnt ibex
tawdry needle
#

yeah, git itself doesn't have the ability to let you do this

tawny temple
#

Make it into an alias and you won't even know :)

heavy knot
#

the file can be .gitignore.txt ?

tawny temple
#

No, it has to be .gitignore

heavy knot
#

so .gitignore.gitignore ?!

tawny temple
#

No

#

.gitignore verbatim

heavy knot
#

if i create a text file and replace the name by .gitignore, it should work?

#

need to go eating

tawdry needle
#

just make sure it is only .gitignore, not .gitignore.txt

iron basalt
#

if you're struggling to save a file as .gitignore on windows I think the trick is to save it as .gitignore.

#

and then the trailing dot disappears

#

or something....

burnt ibex
#

.gitignore works fine for me on Windows (11)

iron basalt
#

afaik the default notepad wont let you save a file named .gitignore because it thinks it's extension only

#

and doesnt have a "name"

burnt ibex
#

Notepad worked fine for me as well πŸ€·β€β™‚οΈ

iron basalt
#

🀷 maybe I'm just wrong then

#

i remember being in emotional distress because I once had to rdp into a windows server and save a dotfile there

#

and something wouldnt let me

heavy knot
#

thanks for all

#

now it work

heavy knot
#

a last question, the tutorial that I follow in not clear on that point: how to merge branches or to bring back commits from a branch

#

pls pin me

tawdry needle
heavy knot
#

that

#

it's good

heavy knot
#

when it work ?

#

need to be executed from master or other branch

#

@tawdry needle

heavy knot
#

i just downloaded docker and linux on my windows pc. I made a project from the linux terminal for docker, now how to open this project from IDE from windows?

tawdry needle
heavy knot
#

Ok

heavy knot
#

not quite sure if this is the right place but i wanted someones help with git/github

#

recently installed and set everything up on a clean machine

#

created a new repo and cloned but every time i pull i get:

#
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
#

now that's fine and all but this is on a brand new repo

#

why do i need to rebase?

#

for every new repo?

tawdry needle
#

read the warning message carefully

#

git wants you to set some settings. the defaults changed a few years ago and they want people to make an explicit choice, they don't want people to rely on the defaults.

heavy knot
#

oh okay

tawdry needle
#

it also tells you which one the default is

heavy knot
#

i haven't ever seen it before but i guess my machine hasn't update git in a hwile

tawdry needle
#

or you have the setting already set

#

in my opinion you should use the default, i think the warning is unnecessarily scary and the only people who want to change that setting are people who already know about that setting

heavy knot
#

that's why i asked cause i was worried i did something wrong

tawdry needle
#

but it's good practice in reading git's helpful but dense warnings and hints

heavy knot
#

i'm not that good with git so even though i read it i assumed i did something

tawdry needle
#

newbies tend to see a wall of text and freeze up

heavy knot
#

cause i had never seen it before

tawdry needle
#

with git, the best thing you can do is get up, take a deep breath, walk around for a minute, then come back and read the message πŸ™‚

#

the first 3 steps are necessary btw, otherwise the 4th step doesn't work

heavy knot
#

so thought maybe i had also changed something in the background to cause this

#

haha

#

thanks git is really scary to me for some reason, and it feels like an endless wall of CLI options

#

thank you for answering my worrying self, glad to know i hadn't done something without realising

#

i'll set it up and happily get on with my day thank you!

tawdry needle
#

GUIs are generally even worse, and in my experience aren't helpful unless you already know the CLI

heavy knot
#

lol i watched a video by corey scafer ages ago and it left me feeling better about it

#

but there's so much out there

#

and i'm fine with the normal workflow

#

cause it's just me on my own projects

#

but when something goes wrong i haven't a clue lol

tawdry needle
#

it helps a lot if you understand how it works under the hood. it's so simple that once you learn it, you're going to get annoyed at the CLI for being so complicated

heavy knot
#

lol

#

i've read a little bit and watched a few videos, comparing to svn or non distributed systems

#

and it made sense

#

and simple

#

but i have yet to read up on rebasing and anything else outside of commit/add/init/pull/push

#

so the concept is simple lol

#

but resources around git have just scared me away from learning more lol

tawdry needle
heavy knot
#

thank you, i'll definitely have a read through as i know it's something i need to know

tawdry needle
#

you need to read it slowly and carefully, but it is the best single resource, other than the manual pages. there are also a handful of very useful and high quality stackoverflow answers

#

as a rule of thumb, the longer the SO answer, the more useful it is

heavy knot
#

haha that is good advice

#

i've got quite a few SO bookmarks

tawdry needle
#

always read the comments too. beware answers with arguing in the comments

heavy knot
#

100% i always like to read opposing arguments, get a lot of out of it like reading bad reviews on good products

#

πŸ˜›

tawdry needle
#

good

heavy knot
#

thank you again for answering earlier

vast lark
#

So I forked this repo on github, and cloned it to my machine
Is there any way I can check to see if my fork is up to date with his repo from the git bash? Do I just need to set the upstream to his repo?

leaden tartan
sly sleet
#

you can just do git pull to sync local w/ the repo

heavy knot
#

what does it mean exactly, because i don't know when and where i created a conflit, and how to fix it

#

The reflog

night quest
#

You need to manually select which code you prefer

heavy knot
#

but i don't see where the conflit was created

heavy knot
night quest
night quest
heavy knot
night quest
# heavy knot

As you can see games.py is not ready to be commited

#

Open this file

#

You should see something like

<<< ...
XYZ
=== ...
ZYX
>>> ...
heavy knot
#

yes, i see it

night quest
# heavy knot yes, i see it

So you need to manually select which code you prefer (maybe both?) and then git add games.py and git merge --continue as far as I remember

heavy knot
#

I choose by deleting the other part ?

night quest
heavy knot
#

ok

#

I'm a bit lost (maybe because I'm frensh)

night quest
#

The commit message is okay

heavy knot
#

so i write commit okay ?!

night quest
heavy knot
#

and now it's good ?

night quest
#

Looks okay for me

heavy knot
#

just a little last question, what does --continue

night quest
heavy knot
#

yes

night quest
#

The third syntax ("git merge --continue") can only be run after the merge has resulted in conflicts.

#

So when you have merge conflicts you resolve conflicts on your own

#

And just tell git to "continue merging"

heavy knot
#

ok, thanks for the help and explanation

night quest
#

πŸ‘

agile saffron
#

anyone help me to encode py

vast cloak
#

I'm having trouble mounting my sqlite database folder as a volume for my docker container (the project is a discord bot).

For obvious reasons I want my sqlite database to be persistent and before I was using docker I was just running the bot on my PC and my database's folder was just in the same directory and I know that your supposed to be able to mount a folder in your build dir as a volume which would appear in the same place in the container.

It's been a week or so, so I don't quite remember the steps I took to try and mount my database's folder but I just remember not being able to get it to work. Sorry if I'm explaining this poorly.

glass ruin
#

can anyone help me with installing talib in python visual studios?

#

i have been at this issue for the whole day

#

it says it is installed but it wont import to visual studio

leaden tartan
vast cloak
#

yes

orchid raptor
#

anyone has experience deploying on digital ocean droplets. I just started a new droplet and the memory is constantly at 30% with nothing installed. is this normal?

rapid sparrow
leaden tartan
rapid sparrow
#

how to share a folder between two containers in docker-compose
with consideration that a new file could appear in this folder during runtime
as an easy solution I see so far... just tying volume in both to the same filesystem where I run docker compose
I am just not sure, is it possible to tie volumes directly between containers, skipping the third member in this chain?

short flame
#

Well hello there. To start off i want to say that i am totally new to this topic. But lets get to the problem. Me and my collegues now use github. There we are working on a python project runninh on an ubuntu server. But we still need a proper way to run our program. Also we want to get updstes we make to easily run on our server by just a button press. I have read alot about deployment etc. But i still cant really get my hands on it. I would really appreciate any help

rapid sparrow
#

not promising the graphical button, but update would be quite easy in one command
git pull && docker-compose up -d --build

short flame
#

And would it be possible to do that with github actions?

rapid sparrow
#

then it would be with graphical button

#

you are right)

#

I just did not reach that stage yet%

short flame
#

Ok so then im gonna learn docker ig

rapid sparrow
#

because those both technologies basically use docker

short flame
#

Well another question is it possible to run multiple programs like that with docker?

rapid sparrow
short flame
#

So we have 2 totally seperate projects we are working on. Both running on the same server

rapid sparrow
#

as long as they are

#
  1. not having the same container names
#
  1. aren't having conflicts in final exposed to be outside of containering system ports
short flame
#

Well those programs are already runnibg at the same time so they shouldnt conflict

#

:D

rapid sparrow
#

I run dozens of containers on just my pc πŸ˜‰

short flame
#

So then i would setup 2 docker containers one for each program

rapid sparrow
#

to have full sandbox for testing

rapid sparrow
#

if the program needs dependency, redis, celery, nginx, or even postgres

#

we can put them in docker-compose file to be run at the same time with your web application container

#

(the octopus in the picture named docker-compose)

short flame
#

Well its not a web application

raw moth
#

Guys, is it possible to create a Streamdeck with python and tkineter?

rich wave
#

Looks like a dead channel

#

I'll leave my question here anyway

#

How do I request access to a group in gitlab?

#

And also can I put them as a reviewer when making a merge request?

rich wave
#

Dead channel indeed

heavy knot
#

@night quest @tawdry needle

#

They help me yesterday

night quest
heavy knot
#

See above

night quest
heavy knot
#

Not dead

half grotto
#

Hey all, hoping this is the channel for it - wanting to set up a multi-user environment for analysis, automation, and ETL tasks but operate in an org with strict Windows-based security. Is there any place that I could go (reddit or similar) to post my full question and get some feedback?

heavy knot
#

Hi does anyone use coc for neovim?

supple venture
#

Why not use lsp when they are supported by default in the nightly build?

gritty fox
#

hi i'm very new to git and github (started a few hours ago) i'm trying to collaborate with a friend of mine. so i cloned a private repo of his to my pc with git clone

#

i made a few edits to one of the files, and then i git add . and git commit it too

#

when i try to git push it, it gives me the following error:

#

error: src refspec master does not match any

#

any help is appreciated, thanks

leaden tartan
#

You probably renamed yours to master

gritty fox
#

so when in the folder of the repo, git branch shows me main

#

with an * in front of it

leaden tartan
#

That means you have uncommitted changes

#

Use git commit -am "commit message"

#

This will add all files to staging area and then create a commit with commit message as the commit message.

supple venture
#

What is git branch output?

#

Just showing main? Where is the * at?

gritty fox
#

hi, so earlier i was doing git commit origin master and it wasn't working, switched master to main and it worked

#

thanks @leaden tartan and @supple venture

bitter vine
#

devops confuses me a lot

#

could someone tell me in general what it is

#

like im see these graphs online but it is still confusing

supple venture
supple venture
bitter vine
#

thank you, ill give it a read

rugged tiger
#

hey guys, i am really new to programming and am trying to make a web app, i am building the application front end in svelte and backend in fast api. i have noticed that svelte needs nodejs to run and fast api requires uvicorn, so my question is that, while deploying my app will my app require both node.js and uvicorn for frontend and backend seperately, in which case wouldn't i be better of using nodejs for backend too in order to reduce the load on backend since i can avoid running uvicorn completely and run backend and frontend both on node.js itself? sorry if this is a noob question, since i am new to the scene i havent got much idea about anything, any help is appreciated.

arctic flicker
#

Is there any way to make PyCharm save input and output from the debug console to log?

topaz aspen
#

How do you typically install a version of python on a docker image? Locally I tend to use pyenv, this is on mac OS, is that the typical approach within a docker image too?

seems that it might be a bit clunky, is deadsnakes used instead of this?

#

so im wondering if i wanted to install 3.9.1 specifically, rather than 3.9.6 or whatever

finite fulcrum
topaz aspen
#

i installed with deadsnakes, but then i have python as python3.9 instead of python πŸ€”
i can create an alias to alias python="python3.9", this feels pretty fragile tho (I'll have to update it when using 3.10 etc)

tawdry needle
#

Pyenv does work on mac fwiw

#

Could also build from source i suppose. You're using a macos docker image? Seems unusual

shell isle
# rugged tiger hey guys, i am really new to programming and am trying to make a web app, i am b...

Svelte only requires node.js on your development machine, not on the server. It compiles your svelte code to plain old .js files, which you can put in a "static" folder, alongside your css files and images.
To serve the static files: During development, you would typically use your backend framework's dev server to serve both the backend functions and the static files. In production however, you would let the http server (eg nginx) deal with static files directly rather than send requests for them to your python app: http://www.uvicorn.org/deployment/#running-behind-nginx
So, choosing to use python or js for the backend is nothing to do with performance, it's just a question of preference. If you're new to programming, you may want to do the backend in js so you don't have to learn two languages at the same time. Python is nicer to work with though - maybe we're biased around here ;). Svelte is pretty cool btw, good choice!

rugged tiger
# shell isle Svelte only requires node.js on your development machine, not on the server. It ...

I tried serving the compiled files using a python http.server but it just showed a directory structure, I think it might be because I am using svelte kit and during compilation it uses an adaptor to specific platform, currently nothing is available for any python platform, the 2 main ones are for node js and to make a static website, but static doesn't work for me so I tried node adapter and it says that the output is a fully contained node app, I checked the build folder and ran it using node and it worked fine, however you are correct that it only has js files so I do not know if I can serve it with ngnix, ps: it does not have index.html in the build??, BTW I learned python too and built most of the backend in fastapi, and I liked how simple and straight forward many things are πŸ™Œ

velvet spire
#

wish me luck

rapid sparrow
#

I had pull requests which I.... continiued for year until they were accepted%

#

or became a part of graveyard

velvet spire
#

this is my own project lolol

rapid sparrow
#

well, then no problem

velvet spire
#

yeah

#

thing is...

#

104 conversation

#

I had over 67 unresolved comments earlier

#

now its 20 lolol

velvet spire
#

why was that so tiny lol

rapid sparrow
#

fixed

velvet spire
#

so uh

#

most of them were big changes

#

55 of those commits were from a different person

topaz aspen
#

I might try pyenv, wasn't sure if it seemed overkill given there's only one version to use, so was curious what was typical. Pyenv is fine though

west sundial
#

Is there a way to seperate dev dependencies and production dependencies by a tool?

iron basalt
#

both pipenv and poetry allow this

#

alternatively if you maintain a requirements.txt you can include requirements-dev.txt in your repo too

#

or another filename of your choice

tawdry needle
topaz aspen
#

yea i like it, wasn't sure if there was some other approach for docker or something

dense stream
#

some noob question - how to get rid of:

/usr/local/bin/python3 /Users/xxx/Downloads/sublime/python/web_scraping.py
xxx@Mac-mini-xxx sublime % /usr/local/bin/python3 /Users/xxx/Downloads/sublime/python/web_scraping.py

from visual studio code's terminal and leave only the code output part? Just like its by default in sublime text when using "Build"?

velvet spire
#

@supple venture beep

#

what do you think of environs?

#

!pypi environs

rancid schoonerBOT
velvet spire
#

it seems better than

#

!pypi python-dotenv

rancid schoonerBOT
supple venture
#

Looking into it

#

(never used environs before)

#

just heard of it

velvet spire
#

found it earlier, its dependent on marshmallow

#

note: this is entirely topical, since configuration variables have to be set depending on environment :)

#

and marshmallow has an SQL Alchemy bind

supple venture
#

I have been pydantic from a while btw, and coudl you open up a bit on seems better than python-dotenv

velvet spire
velvet spire
#

!pypi marshmallow

rancid schoonerBOT
#

A lightweight library for converting complex datatypes to and from native Python datatypes.

supple venture
#

interesting, better than python-dotenv, similar to pydantic

velvet spire
#

ye, that's what I was thinking

#

And by wrapping marshmallow, we can have very nice structs

tawdry needle
#

Pydantic is like marshmallow+attrs at the same time

tawdry needle
velvet spire
#

wdym?

#

!pypi attrs

rancid schoonerBOT
heavy knot
#

What Python tools do I need to develop a 3D game?(except the ursina library)

brazen imp
#

Hey, I am trying to set up verified commits in Git using GPG key.
These are the steps I have followed:
https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/generating-a-new-gpg-key
https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/adding-a-new-gpg-key-to-your-github-account

Now when i want to sign it as the following link suggests:
https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/signing-commits

I get an error which is:

error: gpg failed to sign the data
fatal: failed to write commit object

When googlin' I found this on SO:
https://stackoverflow.com/questions/41052538/git-error-gpg-failed-to-sign-data/41054093

Only the answers provide a bunch of info which I don't really know whats wrong or right.
The thing I also do not understand is the whole GPG(1 & 2).

I am setting it up in Linux (Raspberry Pi).

tawdry needle
#

@brazen imp GNU Privacy Guard aka GnuPG aka GPG is an implementation of the PGP system. GPG is so common that a lot of people use GPG to mean PGP (it doesn't help that the names are so similar). GPG 2 is the current version of GPG.

#

so my initial question is: did you actually install GPG?

brazen imp
#

Yes, otherwise i could not create the GPG key

tawdry needle
#

fair enough

#

and you see your key in the output of gpg --list-secret-keys --keyid-format=long?

brazen imp
#

Yep, that results in 1 key

tawdry needle
#

and do you also see that key in git config --global user.signingkey or git config user.signingkey?

brazen imp
#

let me check!

#

I see it in both of them.

tawdry needle
#

hm

#

you went through the troubleshooting steps in that stackoverflow post?

#

might also be worth making sure there isn't accidentally some whitespace in your git config

brazen imp
#

Well, the thing is when i try to set the gpg2 as main and run that gpg2 command it says that gpg2 isnt found.

#

I also find it tricky when they ask to install new stuff or delete folders.

#

I did try this:

run echo "test" | gpg2 --clearsign, to make sure gpg2 itself is working```
#

but that didnt work; resulting in gpg2 command not found

#

And since i try to on my Pi I would suggest that the newest software is on it

tawdry needle
#

@brazen imp maybe on your system gpg is GPG 2

#

i can't remember what it is in debian

brazen imp
#

When i remove the 2 it works lol

#

brew is for Mac right?

#

I also noticed that I had to use my noreply github mail instead of my primary mail. Is this correct?

#

Note: When asked to enter your email address, ensure that you enter the verified email address for your GitHub account. To keep your email address private, use your GitHub-provided no-reply email address. For more information, see "Verifying your email address" and "Setting your commit email address."

tame lodge
#

which vps is better in case of storage? Galaxygate or vultr?

stable cloak
#

Okay, I'm not sure if I dreamt this up or not. Is there way to have pyenv work directly with pipenv or Poetry? I could swear that one of those two had a built in way to work with pyenv

brazen imp
#

@tawdry needle i think i fixed it TF 🀣

#

NONOOORB

stable cloak
#

Deep breaths

brazen imp
#

AARGH

#

i dont get it lemon_angrysad

#

now i get that a private mail will be published with commiting

#

wth

#

Well, almost fix lol

#

but i dont get it

#

Why would you give up as global your no reply email?

#

nvm.

#

I fixed it :)))))

velvet spire
#

@stable cloak pipenv has built in support

#

Poetry doesn't

#

But you don't need the intergration for poetry

#

For poetry, just run pyenv local 3.8.11 3.9.6 or whatever versions you need

#

Then you can use poetry env use 3.8 and poetry env list

stable cloak
#

Gotcha, cheers

iron basalt
#

pipenv should find pyenv-installed pythons on its own

#

you were probably thinking of that

stable cloak
#

Yeah I think so

velvet spire
velvet spire
#

what does git prune do?

tawdry needle
velvet spire
#

well

#

git complained and told me to run it

#
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.
tawdry needle
#

weird, never had that problem before. maybe just run git gc?

velvet spire
#

i ran git-prune.. Β―_(ツ)_/Β―

tawdry needle
#

it's not a dangerous operation, unless you were actively trying to undo a rebase or something

velvet spire
#

ah

silent oracle
#

Do you guys recommdnd me to use Crehana?

#

To Learn Phyton?

rapid sparrow
#

as alternative in the case when no one was able to answer

heavy knot
#

okay, thanks

rapid sparrow
#

I remember seeing tutorial where in few steps minecraft...ish thing is made in ursina

#

repo for that could be cool to see

rapid sparrow
#

All right.

#

Who deault with payment gateway systems (if I named them right)

#

Stripe and e.t.c.

#

are there some weird requirements with them

#

like required residency in country X?

supple venture
#

Sometimes in my commits message, I like to include ` backticks to highlight functions/vars etc. But when i do that zsh takes it as an eval command for example "Add documentation for `my_function`" so zsh evals my_function

#

how can i not make it do that

burnt thunder
#

use core.editor instead of -m

west sundial
#

Hey! I'm using pre-commit and I want to ignore a dir by using exclude but when I commit a file in migrations dir, it's still running hooks. How can I solve this? Here is my .pre-commit-config.yaml

default_language_version:
    python: python3.9.6

repos:
-   repo: https://github.com/psf/black
    rev: 21.7b0
    hooks:
    -   id: black
        exclude: ^migrations/
        args: ['--line-length=79']
-   repo: https://github.com/PyCQA/isort
    rev: 5.9.3
    hooks:
    -   id: isort
        exclude: ^migrations/
tawdry needle
#

i always get nervous with unquoted strings in yaml

leaden tartan
#

markdown must kill you then

proud python
#

Does postman provides good documentation for API. If yes why when doing some research, I found always that swagger and openAPI and few other are always more recommended.
It is a documentation that must be prepared for a front-end developer to ingrate the services in front.

supple venture
burnt thunder
#

actually, use single quotes

tawdry needle
tawdry needle
proud python
tawdry needle
mighty yoke
#

i know its difficult

devout quail
#

Any tips where do i start with managing ML models?

#

Preferebly some local frameworks maybe?

velvet spire
#

<@&831776746206265384>

shadow crow
#

!rule 5 HI @midnight briar, we will not help with that

rancid schoonerBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

lyric tulip
#

Good day everyone, I am wondering how you all approach integrating your front-end with your back-end source without putting everything in the same project. For instance, looking to use React on a small portion of my site. How can I keep my React code in another project, but have easy access to development?

lyric tulip
#

So what I mean by this is, say I have my main website thats FastAPI etc. I want to serve React on a particular route, but don't want the raw tsx files etc in my FastAPI project. Whats the best way to be able to keep them in separate projects but develop against it? I'm working with React and right now doing oauth so I'll need a server to help broker the response

#

I understand for deployment I could just copy the build results... Is there a workflow that you've found works for rapid development?

leaden tartan
lyric tulip
#

I've heard of those (git submodule I'm assuming). I'll need to look into it more

#

does it add it as a dependency? It wouldn't pollute my project with the code, right?

leaden tartan
#

No its just one or more git projects inside another

#

I'd share a link but it's a private repo

lyric tulip
#

no worries

#

so it does look like it commits it

#

I can see this is still some separation though

leaden tartan
#

Yes they are separated

#

Look into how submodules work

lyric tulip
#

ok

leaden tartan
#

It's a fairly easy concept

lyric tulip
#

is it easy to develop on, or you have to commit/push each change to test?

#

also looking for QoL on dev'ing haha

lyric tulip
#

I change a source file in the React project. Do I need to commit and push it for the backend to recognize the change?

leaden tartan
#

No you have to just push it to the remote

#

But yes you have to update the parent git project to recognize these new commits

lyric tulip
#

ok

rich remnant
#

for use in a pre-commit script I'd like to use Python to write a cross-platform compatible check to detect files that should have the +x mode set, e.g. various scripts with shebangs, *nix binaries for various architectures

mimetypes.guess_type() seems worthless for that, it says none for all curl-aarch64 etc. binary files I gave it, it detects foo.sh as application/x-sh but when renamed to foo it says None, so it seems to just guess based on extension

GNU file utility in linux would be perfect, but it doesn't exist in Windows

#

I found some library for telling me if a file is "binary", as in it says a JPEG is a binary, so that doesn't take me very far either

#

googling for "executable" gives me checks for "if the executable flag is set"

#

basically I'd want results similar to grepping this output for executable

#

that's cygwin file if you're wondering

#

most search results for "python elf" are some malware analysis things

#

some python-libmagic thing exists, but it crashes on install, hasn't been updated in 5 years

#

python-magic is more recent, installing works, import magic quits the python interactive shell

#

seems to depend on some separate binary libraries that can't be installed easily via pip so not a starter

velvet spire
#

@rich remnant have you looked at pathlib and os yet, both of which are part of the stdlib?

rich remnant
#

please be more specific, what part of pathlib or os do you think offer detection of the contents of files?

velvet spire
#

!d pathlib.Path.stat

rancid schoonerBOT
#

Path.stat()```
Return a [`os.stat_result`](https://docs.python.org/3/library/os.html#os.stat_result "os.stat_result") object containing information about this path, like [`os.stat()`](https://docs.python.org/3/library/os.html#os.stat "os.stat"). The result is looked up at each call to this method.

```py
>>> p = Path('setup.py')
>>> p.stat().st_size
956
>>> p.stat().st_mtime
1327883547.852554
velvet spire
#

!d os.stat_result

rancid schoonerBOT
#

class os.stat_result```
Object whose attributes correspond roughly to the members of the `stat` structure. It is used for the result of [`os.stat()`](https://docs.python.org/3/library/os.html#os.stat "os.stat"), [`os.fstat()`](https://docs.python.org/3/library/os.html#os.fstat "os.fstat") and [`os.lstat()`](https://docs.python.org/3/library/os.html#os.lstat "os.lstat").

Attributes:
rich remnant
#

and how does stat() tell me if the file is actually a binary ELF executable without the +x mode set?

#

or foo is a #!/usr/bin/env perl script with no +x set?

velvet spire
#

Read the os.stat_result

rich remnant
#

I am pretty familiar with stat()

velvet spire
#

One of its attributes is st_mode which I think is what you want

rich remnant
#

I've now several times specified I don't want to know if the +x mode is set

#

I want to know the if the contents of the file are indicative of it being an executable

#

because I want to write a pre-commit hook that makes them +x when the developer adds something to the repo and forgets to +x it

velvet spire
#

Ah

#

Its 3:34 am sorry for misreading your request lol

rich remnant
#

no worries πŸ™‚

velvet spire
#

Afk

rich remnant
#

this looks almost hopeless enough to just delegate the problem to pipelines to automatically run file on a predictable Linux environment and commit a +x change when appropriate

#

but I don't really like that option

#

the libmagic source is apparently only available via ftp://, ftp support has been dropped from browsers a while ago LUL

heavy knot
rich remnant
#

I think I could work with that, thanks!

#

oh hm

#

custom implementation of the detection, seems a bit unreliable

#

maybe I could use the logic in it to just detect ELF binaries and then write some custom shebang detection to go with it

radiant herald
#

Any Pylint (or other similar tools) experts in here?
how would you go about catching errors like these:

    def func(arg_one, arg_two, kwarg_one="default"):
        pass

    func(positional_one, keyword_one)

In this case, the user is "forgetting" to specify arg_two, but the linters would pass this since both positional args are filled. Any suggestions on how to catch this?

#

I could imagine this being fixed by not allowing keyword arguments to be specified positionally like above, but how would I do that?

rich remnant
#

oh there's annotation for explicitly kwarg or positional args

#

so afaik just change it to

def func(arg_one, arg_two, *, kwarg_one="default"):
  pass
radiant herald
#

@rich remnant Thanks, that would fix it yes, But I hate how it looks haha

rich remnant
hybrid flare
#

hey guys, may someone help me please. I know linux in not python but probably someone here uses linux, I want do install linux in my windows 10 computer but I don't know the best way to do it

rapid sparrow
#

anyway, I recommend using rufus to make USB installer from downloaded linux distro

#

i went with just Ubuntu, quite friendly OS.

#

some people would disagree with me though, but that's totally because somepeople aren't satisfied with GUI

#

but for developers GUI is a really secondary thing to use in my opinion, so... ubuntu makes the job quite well in providing easy to use console installations

hybrid flare
#

ok thx

rich remnant
#

Install Linux as in replace Windows, or in addition to Windows?

If you want to dual-boot it will likely be nothing but a pain, you need to disable secure boot etc. for Windows to get Linux to boot, and Windows will happily try to make your Linux unbootable every time there's a major update which is a few times a year

If you want to replace Windows you still need to disable secure boot and prepare for a lot of pain with hardware support etc.

Running Linux in a VMware/VirtualBox VM is super easy though, assuming you have Hyper-V disabled and so e.g. don't use WSL2, if you do you're pretty screwed - Hyper-V is the least compatible worst performing hypervisor available for this kind of things and basically incompatible with VMware and VirtualBox, and when in rare scenarios it's technically compatible those other hypervisors run at laughably slow speeds comparable to pre-hardware accelerated virtualization making the VM practically unusable

thorn wharf
#

hey guys, I want to create a conda env in docker. This is my code

       conda init bash &&\
       conda create --name layoutlm python=3.7 &&\
       conda init bash &&\
       exec bash &&\
       echo "source activate layoutlm" > ~/.bashrc &&\
       pip install -r requirements.txt

when I run the container and do pip freeze, the requirements are not installed.

How can I solve it ?

unique magnet
#

say somebody committed their API key to a PR on my project, how could I completely remove that commit from git's history and remove all references to it, so it can't even be checked out?

night quest
unique magnet
#

oh, so there's no way to permanently remove commits?

burnt thunder
#

I believe you can rebase and force push, but it will break everyones clones

night quest
#

Some commits can be still available, even without being part of any branch

unique magnet
#

yeah, that's the problem, so git doesn't actually provide a way to remove the commits completly?

burnt thunder
#

sort of not really

unique magnet
velvet spire
#

Your strat is contacting github and asking them to delete the commit

night quest
burnt thunder
#

yeah, that would probably work

velvet spire
#

But honestly just reset the token.

burnt thunder
#

they are quite eager to not have credentials in the repos

night quest
#

Token should be revoked regardless to the commit removing process

#

#forsecurity

unique magnet
#

yeah, that makes sense, thanks for the suggestions

night quest
velvet spire
#

Depending on the branch, force pushing is not always a viable option

#

Oh wait I misunderstood nvm

night quest
#

This token should be treated as compromised

velvet spire
#

Yes

night quest
#

πŸ‘

supple venture
#

git reset --soft HEAD~1 to remove the last commit

#

--soft so that the difference stays (but it is not git added yet)

#

to completely remove it you can use git reset --hard HEAD~1

#

HEAD~n is how many commits back do you want it to go

night quest