#tools-and-devops

1 messages ยท Page 60 of 1

upper oyster
#

Yeah you can't use git reset

#

That won't work because the history after the reset commit still exists and is still shared

sand thistle
#

so the only way is to sort through these changes

#

the problem is that there are so many, literally it was a branch dedicated to refactoring

#

that got pulled into the test branch prematurely

#

and i accidentally commited over with this pulled version

#

my master branch is up to date

#

so id like to just replace the current test branch, with the content of the master branch

#

ive done so locally

#

by deleting the test branch

#

and pulling from the remote master branch, after recreating test

upper oyster
#

But the test branch is also a shared branch, right?

sand thistle
#

shared, yes other people have access

#

and pull/push to it

upper oyster
#

So you can't just delete it if others are using it

sand thistle
#

i tried to reset the head

#

to the prior commit

runic patrol
#

this is what happens when I use git push --all in the pycharm terminal```py
To https://github.com/ChiliPy/fuck-me.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/ChiliPy/fuck-me.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.

upper oyster
#

You can use something like git cherry-pick instead

#

If you cherry pick a commit

#

It should recreate any commit you specify but at the tip of the branch

#

Which is what I think you want. You want to basically undo all the changes in the branch, but you need to do so in a way that doesn't fuck up existing shared history

#

I think cherry-pick would do it

sand thistle
#

its only 1 commit ahead

upper oyster
#

Yeah but that doesn't matter

#

If it's shared history you need to keep it

#

Otherwise you'll cause issues for the next person who wants to commit on top

#

If you cherry pick your original commit, that should do it

sand thistle
#

ok

#

The --no-commit option will execute the cherry pick but instead of making a new commit it will move the contents of the target commit into the working directory of the current branch.

#

i guess i do have to commit though

upper oyster
#

Yeah, you can use that option if you are unsure of the final result

#

But obviously you will have to commit it eventually

sand thistle
#
         \
           e - f - g Feature```
#

the problem in the example

#

is not equivalent

#
         \
           e - f - g Feature```
upper oyster
#

So you don't have to cherry pick from another branch

#

You can cherry pick any commit, I believe

sand thistle
#

so you're saying i could

#

e - f - g Feature move f ahead of g

upper oyster
#

Yes I believe so

sand thistle
#

but wouldnt the ideal solution be to get rid of g

upper oyster
#

No lol

#

There is a golden rule of Git

#

One that you must never break if you are working with others

#

Never change shared commits!

#

If commit g was only on your machine, it would be no problem

#

You could git reset to e and get on with your life

sand thistle
#

but that only matters if anyones pulled

upper oyster
#

But if commit g is shared, it must stay there

#

Well eventually someone will want to commit on top of the branch no?

sand thistle
#

so then i recommit

#

ahead of the bad one

upper oyster
#

No but the history is messed up

#

It's not the same commit object

sand thistle
#

but cherry picking messes up the history anyway?

upper oyster
#

No it doesn't

#

e f g still exist

sand thistle
#

but how, in this situation im literally pulling an old commit ahead of a new one

upper oyster
#

f is still there in history

#

You create an f'

#

So e f g f'

sand thistle
#

i see

upper oyster
#

f is still in Git history

#

f' is a brand new commit object, but with contents of f

sand thistle
#

ok cool

#

mind if you walk me through this?

upper oyster
#

Lol sure

sand thistle
#

i found the sha

#

i need

upper oyster
#

Ok

#

I would suggest reset to the tip of the branch first

#

And then do the cherry pick

sand thistle
#

git reset sha for the tip?

upper oyster
#

I think you can reset to HEAD

#

I think lol

#

If you do git log

#

Is HEAD pointing to the tip of the branch?

#

Heck, even if it isn't, you can just reset to the tip of the branch using the SHA

sand thistle
#

uhh

upper oyster
#

The idea is that you want to be equivalent to the GitHub state of the branch

sand thistle
#

doing git log

upper oyster
#

Actually scratch what I said

#

You want to git reset to the last commit from GitHub

#

For your branch

sand thistle
#

yea

#

so just git reset sha

upper oyster
#

So the origin equivalent of your branch

#

Yeah

sand thistle
#

ok

#

done

#

went onto the test branch on my github

#

found the commit from that branch that i want to go back to

#

copied the sha

#

git reset sha

upper oyster
#

Yeah, that should bring you to the tip of the test branch from GitHub

#

And then you can cherry-pick the commit and place it on top

sand thistle
#

ok

#

just fyi

#

im cherry picking the same sha

upper oyster
#

Ok

#

Btw

sand thistle
#
You are currently cherry-picking commit 057b4df.

nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git cherry-pick --skip'
upper oyster
#

Huh

#

Wasn't expecting that lol

sand thistle
#

uhh

#

idk how to proceed

upper oyster
#

did you reset to the correct commit?

#

Perhaps you resetted one commit too far back

sand thistle
#

uhh

#

i looked at the commit i want to move to

#

i copied the sha

#

i did git reset sha

upper oyster
#

oh you don't want to reset to the commit you want to move to

#

if you have e f g

#

and you want to go to e f g f'

#

Then you reset to g and then cherry pick f

sand thistle
#

ohh

upper oyster
#

Btw did you say it was just one commit behind?

sand thistle
#

so

#

lets say

#

a b and c

#

im at c

#

my commit that i want to be the new tip of my code

#

is a

upper oyster
#

right

#

so if you are already at c you don't need to do any reset

#

and then you just cherry pick a

#

to create a b c a'

#

Btw, how many people are working on the test branch?

sand thistle
#

a few

#

why

upper oyster
#

so, if you wanted to make it so that master and test were the exact same commit object

#

then you could do git reset a and then force push it

#

However everyone would have to delete their test branch and recreate it

#

because you rewrote shared history

sand thistle
#

ok

#

so

#

hold on

upper oyster
#

so that is an option if you communicate that to people who are working on test

sand thistle
#

lets stick to one thing

upper oyster
#

lol ok

sand thistle
#
error: could not apply 057b4df... working on db issues
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
#

seems some merge conflicts

#

i resovled them

#

but its talking about a path

#

it means just git add the filename im assuming

upper oyster
#

yeah

sand thistle
#

yeah but like..

#

this version that im on

#

the tip

#

it still has all the code and stuff that im not trying to commit

upper oyster
#

What code? The code on top of the cherry pick?

sand thistle
#

i have a b c

#

i reset to c

#

c has code i dont want

#

i cherry pick a

#

fix merge conflicts

#

but now there's still the content from c

upper oyster
#

are you talking about stuff you didn't commit previously?

sand thistle
#

no

#

im talking about stuff

sand thistle
#

use the symbols a b c

#

so i know what you mean

upper oyster
#

so, if you are at c, you may have also started developing on top of c

sand thistle
#

no

#

its not uncommitted changes

#

i reset to c

#

that means i have the code that exists at c

upper oyster
#

Not quite

#

because by default a git reset does not wipe away all uncommitted changes

#

you can have soft, mixed and hard git reset

#

by default, git reset is mixed, which means that all staged changes are unstaged

#

but they aren't completely removed

#

they still exist in an unstaged state

sand thistle
#

i see

upper oyster
#

if you really want to get rid of those changes, you can do this

#

First do a git stash to save a snapshot in case you screw things up

#

then, you git reset --hard to c

#

That will reset to c and remove all changes, even those ones that were unstaged previously

#

then you can cherry pick again

#

if you commit the cherry pick, then you could reapply your unstaged changes by doing git stash apply

#

if you wanted to

sand thistle
#

ok so

#

i did a hard reset

#

to the tip

#

then tried to cherry pick

#

and ok fixed the merge conflict

#

but what i was saying, and trying to explain

#

is

#

since i am on c

#

the garbage commit

#

i still have the code from c

#

even if i fix the merge conflicts

#

literally the code im looking at in my ide, is that of c

#

which is not what i want to add

upper oyster
#

so how are you fixing the merge conflicts? When you have a merge conflict you basically want to take the a version completely

#

you don't want to keep anything from c

sand thistle
#

yes

#

but i only have merge conflicts in one .py file

#

my models

#

the system is flagging only a merge issue on a

upper oyster
#

ok

#

Once that's fixed though, everything should look like a

sand thistle
#

it does not

upper oyster
#

hmm, not sure how that's happened then

#

This is literally what cherry pick is meant to do, recreate the contents of a

sand thistle
#

alright thank you

#

i have to go now

upper oyster
#

OK

#

Sorry I couldn't help completely there

sand thistle
#

9ts ok appreciate the time

tight moss
#

Hi everyone, I have a question which I think falls under tools-and-devops : after uninstalling poetry, does this mean that all the dependencies from the apps/venvs made using poetry also got deleted? or do i now have to hunt around for them? i think i pulled the trigger too soon ^^;

#

it does say here https://stackoverflow.com/questions/50267732/what-will-happen-to-packages-installed-when-the-virtual-environment-is-deleted that YES they do get deleted, but this is my first time with poetry. i have previously used virtualenv and virtualenvwrapper ๐Ÿ™‚

leaden ruin
night quest
leaden ruin
#

ty

#

url = 'https://accounts.spotify.com/login/password'
PostAtma = {"username": data[0], 
            "password": data[1]}```
Traceback (most recent call last):
  File "/storage/emulated/0/Download/spotify-checker/spotify.py", line 36, in <module>
    "password": data[1]}
IndexError: list index out of range
candid kayak
heavy knot
#

hello when every i open my python file it just closes rightaway

pearl jungle
heavy knot
#

how do i fix

#

its a txt file

#

@pearl jungle

pearl jungle
heavy knot
#

idk

#

how do i change

rancid schoonerBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

sly sleet
#

@heavy knot um just rename it?

#

and if you double-click from file explorer or whatever

#

the window is going to close when the program ends

#

so instead run it from command prompt/powershell

vital epoch
#

hey folks, is there a way or a tool to inspect what's occupying memory at any point in time? I can use trace malloc to identify what's allocated during a certain period of time, but I expect much of that to be garbage collected after the work is done. Ideally I could find a tool that let's me snapshot exactly what's taking up memory at one point in time so that I can verify that I'm not hanging onto stuff that should have been GC'd

rugged hare
vital epoch
#

appears to be yea

#

it looks like I'm probably not dropping some references that I should be dropping

#

but I'm not sure how to track them down

rugged hare
#

@vital epoch what does your program do?

vital epoch
#

generally coordinates a few independent processes via socket communication and sends some REST request up to the cloud

#

leans very much on asyncio

#

I'm wondering if maybe, when I asyncio.create_task if I need to be explicit about how and when to clean that task up

#

is there a way more generally to just see where I'm holding references?

#

interesting, when I use python's gc module to print stats, I often see this: gc: done, 460 unreachable, 0 uncollectable, 0.0596s elapsed

#

very curious to see exactly what is unreachable

frozen anchor
#

I have a Github action that connects to a database. I don't want the DB information to be public.
For my dev and prod environments, I use env variables and would like to be able to do that on a github action as well.

I have set up an environment in github, lets call it myenv. How do I tell my github actions worker to select that env for the action?

postgres:
        image: postgres:13
        env:
          POSTGRES_USER: ???
          POSTGRES_PASSWORD: ??? 
          POSTGRES_DB: ???

what do I have to enter here?

Does this also allow for os.getenv or are there more steps to take?

'NAME': os.getenv('DATABASE_NAME'),
'USER': os.getenv('DATABASE_USER'),
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
rugged hare
#

@frozen anchor you can create secrets in your repo, and use them in actioins

uncut quartz
frozen anchor
rugged hare
#

i guess you'll need differently named secrets for each environment? How many wilil your action be using?

frozen anchor
#

for now the 3 env variables for the DB but once I implement more test cases that number will increase.
Different names for each env sounds off tho - lets say I have 2 github actions workflows that need the same env variables named differently - for example access to the DB with different permissions - that would not be possible. I doubt that this is the case tbh

rugged hare
#

why would more test cases need more environemnt variables?

frozen anchor
rugged hare
frozen anchor
#

found it tho, it is the environment keyword, overlooked that I guess

frozen anchor
rugged hare
#

i guess i don;t understand what your X different environments are.

#

or why your REPLY_USERNAME needs to be a secret for your tests

#

you can set environment variables in your tests, not in actions

frozen anchor
#

well, it does not have to be secret for those - but as the project is public I prefer to not give away that much information of how my backend looks like

rugged hare
#

is your code public?

frozen anchor
#

yes, hosted on github

rugged hare
#

what information are you trying to not give away?

#

if your code is public, why do you need any secrets for the tests?

frozen anchor
#

using env variables for the tests is perhaps overkill, you are right about that

#

but I don't want to make another conditional in settings.py.
I want to have it managed via env variables in all cases like this:

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql',
            'NAME': os.getenv('DATABASE_NAME'),
            'USER': os.getenv('DATABASE_USER'),
            'PASSWORD': os.getenv('DATABASE_PASSWORD'),
            'HOST': '127.0.0.1',
            'PORT': '5432',
        }
    }

and not

if DJANGO_HOST == 'github_action'
....
    'NAME' = 'postgres'
rugged hare
#

ok, so you will have a half dozen variables.

frozen anchor
#

I have these variables for dev and prod either way, so I don't think it matters that much if I use env vars for actions as well.

rugged hare
#

right, it's fine to have some secrets for actions, but you were talking about needing more and more as you added tests. i dont see that happening.

#

also, btw, a db password for tests? what db are you connecting to?

#

it's very common to have a tests settings file

frozen anchor
rugged hare
#

i see

frozen anchor
#

So, you are right and I should not use secret env variables. Instead I went for

    env:
      DATABASE_USER: postgres
      DATABASE_PASSWORD: postgres
      DATABASE_NAME: github_actions
pallid cove
#

hi, i have a data engineering question. i am storing and updating many pandas dataframes

#

hdf5 looks ideal, but im concerned with corruption

#

is something like storing each dataframe as a sql blob a more reasonable strategy?

weary parcel
#

Hello, I'm looking for someone who knows a lot about the selenium python's tool and especially about loading DRM-protected content in headless mode

#

gonna sleep asap feel free to dm or ping me btw

weary parcel
#

@rugged hare some browser automation stuff, i used to test my program in "classic" selenium mod because i thought that headless mode was working the same, but apparently headless mode doesn't have feature that classical one have that's why i want to learn more about how to make things like protected contents works

rugged crescent
spiral valve
#

someone got tips for pycharm

buoyant atlas
#

Hi

#

did anyone installed application that has setup.py in docker image?

night quest
buoyant atlas
#

i figured this out, somehow run pip install .

#

did not install requirements that i specified in setup

night quest
#

Can you show your setup.py and setup.cfg?

buoyant atlas
#
from setuptools import setup, find_packages


def read_req():
    with open("requirements.txt") as req:
        content = req.read()
        requirements = content.split("\n")


setup(
    name="task",
    version="0.1",
    packages=find_packages(),
    include_package_data=True,
    install_requires=read_req(),
    entry_points="""
        [console_scripts]
        task=task.cli:cli
    """,
)
night quest
#

Your read_req doesn't return anything

buoyant atlas
#

you are right ๐Ÿ˜„

#

thanks

night quest
#

Your welcome!

proven arch
#

hey does anyone know the best coding software to use

night quest
deep estuary
#

Hey folks! Just a note that we've added a channel for editors and IDE discussion! #editors-ides

steep sonnet
#

Hi guys , i'm trying to deploy an app to apache2 with mod_wsgi but i'm getting an ImportError , and I don't know why ? May I get some help?

#

And tha'ts the apache conf

abstract roost
#

hello

#

i need bit of a help

#

how can i create a future order takeprofit

ember canopy
graceful patio
#

well the text has been removed

#

from the post

candid kayak
#

What are your opinions on pipenv vs poetry?

#

for whatever reason pipenv seems to error out for me with an odd error (says path not found pointing at an old install of python that I've since deleted), and have been using poetry only

#

Am I missing out on anything great that pipenv offers that poetry doesn't?

short peak
#

I tried poetry in one project and I liked it. The only thing I'd love to see is to handle run as npm/yarn does so we can be able to simply run regular cli commands through poetry

candid kayak
#

๐Ÿค”

#

I've liked poetry so far too fwiw, just wanna know if I should be using pipenv for some cases or if they're comparable on all fronts

fossil finch
#

Hello, I would like to ask something if what I'm doing is correct, this is basically a like a insert and get items list with redis caching

POST item in the list
-get the data
-insert in database
-insert in redis cache (with key of user_id_items_list)

GET all items list
-check if user_id_items_list exists
-if it exists, returns the cache value
-else, do query
-save the result of list in the redis cache with key of user_id_items_list

stray pine
#

Hi, is there an extension in vscode that automatically generates getter and setter methods?

ember canopy
#

Basically I'm trying to automatically prune my requirements.txt down to just the immediate dependencies of the app

#

I don't want to list all of their dependencies as well

#

So for example, I want to list flask but not werkzeug

#

But this is an old project I inherited with a lot of deps so I'm wondering if there's a way to automate it

heavy knot
#

A good Calculator

#

Program make a simple calculator

This function adds two numbers

def add(x, y):
return x + y

This function subtracts two numbers

def subtract(x, y):
return x - y

This function multiplies two numbers

def multiply(x, y):
return x * y

This function divides two numbers

def divide(x, y):
return x / y

print("Select operation.")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")

while True:
# Take input from the user
choice = input("Enter choice(1/2/3/4): ")

# Check if choice is one of the four options
if choice in ('1', '2', '3', '4'):
    num1 = float(input("Enter first number: "))
    num2 = float(input("Enter second number: "))

    if choice == '1':
        print(num1, "+", num2, "=", add(num1, num2))

    elif choice == '2':
        print(num1, "-", num2, "=", subtract(num1, num2))

    elif choice == '3':
        print(num1, "*", num2, "=", multiply(num1, num2))

    elif choice == '4':
        print(num1, "/", num2, "=", divide(num1, num2))
    break
else:
    print("Invalid Input")
ember canopy
heavy knot
#

I am new here

ember canopy
#

This is for python related tooling and devops style tasks so no

sly sleet
#

if you're writting getters/setters for ordinary attrs, you're doing something wrong

graceful patio
#

and for your actual question, i've often wondered about this

#

never found a good way other than just starting with a fresh venv and installing everything again

#

doesn't seem to be a way to tell pip freeze to do that

ember canopy
#

yeah I guess I could iterate over the requirements and see which ones are listed as deps of others

sly sleet
#

@ember canopy hm checkout pipdeptree

ember canopy
#

๐Ÿ˜ฎ

#

That looks like it'll be hella useful, thanks @sly sleet

sly sleet
#

np

tired sluice
#

Hey all. To learn Python i'm working down a list of 50 project idea's. I was planning on using GitHub to store them and keep track of everything. Is there an easy way to organise my learning projects, i.e, folder directories, or should I just prefix my repo's with python-learning or something?

night quest
# tired sluice Hey all. To learn Python i'm working down a list of 50 project idea's. I was pla...

I recommend to split your work into multiple repositories. When you are going to find a job then you can select few of them and send as attachements. If someone is going to be interested then is able to check all of them. When you have all in single repo then you have fewer repos but you should write some guideline what your repo contains because directories like game-2d or example-gui-calculator don't have enough information like used technologies.

tired sluice
night quest
#

However being descriptive is also good for you because after some time you can easily find interesting part of code even if you don't remember directory name

tired sluice
#

Very helpful. Thanks mate

night quest
#

Your welcome

stray pine
candid bobcat
#

hey, i need some help. I have something to do in turtle, you can call it the sun. it consists of 120 elements and must be in a square. I can make this so-called sun, but I don't know how to make this 'trace' from the right side of the square. can someone help me?

ivory perch
#

Is this where we discuss about sphinx?

night quest
ivory perch
#

I have an issue regarding the creation of documentation using sphinx. Sphinx runs fine on my local machine and generates API documentation using autosummary, but not on docker (Gitlab CI). It throws a warning saying failed to import (and no autosummary API documentation appears). Here is my project: https://gitlab.com/rebornos-team/fenix/libraries/analyzing. Since the documentation is generated fine on my computer, I think it may be a problem with Gitlab's package versions. I am not sure

#

On Gitlab CI/Docker:

#

On my local machine:

#

In order to help me troubleshoot, you can clone the project locally and try the documentation generation yourself (I even have a script there in the documentation directory). This is open source

night quest
#

Have you tried to run it inside Docker container manually?

ivory perch
#

That is a good idea. Let me set it up

night quest
ivory perch
#

I just realized I have no idea how to set it up. I downloaded Docker and I pulled the Python image

night quest
#

Add something like -v $PWD:/code to create volume from current directory

ivory perch
#

Thanks. I will run it. I have never used Docker by myself. Always through Gitlab CI

night quest
ivory perch
#
$ docker run --name FenixTest -it python:3.9-alpine bash
Unable to find image 'python:3.9-alpine' locally
3.9-alpine: Pulling from library/python
ba3557a56b15: Pull complete 
ffd49e023448: Pull complete 
46ec0d464620: Pull complete 
44e992cdfdac: Pull complete 
7c71687af071: Pull complete 
Digest: sha256:95217fdd1431fe6230e033513670673c81a50debdb0065e54cbda261f3d76528
Status: Downloaded newer image for python:3.9-alpine
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "bash": executable file not found in $PATH: unknown.
ERRO[0010] error waiting for container: context canceled 
#

Lol. I have bash. I am on Arch Linux

night quest
#

There are no bash inside container

ivory perch
#

Ah..

night quest
#

You are trying to run Alpine

#

Use sh

ivory perch
#

Too late. The container is running. Can I still enter a shell?

night quest
#

-it is shorthand from --tty and --interactive

night quest
ivory perch
#

It is apparently not running. It has to be removed

night quest
#

You can check status with docker container ps --all

ivory perch
#

It says created.

night quest
#

Try docker run --name FenixTest -it python:3.9-alpine sh

ivory perch
#
$ docker run --name FenixTest -it python:3.9-alpine sh
docker: Error response from daemon: Conflict. The container name "/FenixTest" is already in use by container "cc9dbb7fcf2f3c142eecef8ab50e072cae47a824de096b1e9b951129c2647a27". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
#

Nevermind. Removed and restarting

#

Will test. The container is up. Thanks @night quest ๐Ÿ™‚

night quest
#

Have you attached volume?

ivory perch
#

I did not. I downloaded my project from git and ran everything in the CI script.

#

Same issue as in Gitlab. I am testing it on a virtual machine now

night quest
ivory perch
#

Ah...How can I mount another directory?

night quest
ivory perch
night quest
ivory perch
#

I do not know what a working path is, but I don't think so

night quest
ivory perch
#

I changed to the project directory and used PWD

#

So I generated the web pages for documentation. I need to test them. How can I get those files back on my host system?

ivory perch
#

Yes

night quest
#

It's already in

ivory perch
#

Oh

night quest
#

When you mount directory to Docker container you can easily interact with them from host or container

#

There are docker cp command too

ivory perch
#

Thanks. It seems like the problem only happens in that docker image. Even if I use the same project directory on my computer

#

I will have to see if there is an unstated dependency that I have installed on my local machine that docker image won't have

ivory perch
#

So. The problem is solved. There were two things: (1) pipenv,was not installing all the dependencies (especially the ones that are needed to check imports) from the lockfile because the lockfile was outdated. (2) The public folder in Gitlab CI was not empty and some files would not be updated

#

Thanks @night quest !

ivory perch
#

Thanks for all your help ๐Ÿ™‚

night quest
#

Your welcome!

stable orbit
#

I can install a private repo from Gitlab with pip install -e git+https://gitlab.com/user/project#egg=project. I've heard that with using tags, I can get a specific version. Is it possible without tokens, like this? git+https://${GITLAB_TOKEN_USER}:${GITLAB_TOKEN}@gitlab.com/user/project.git@{version}, but without token just like I did before?

sand thistle
#

!paste

heavy knot
#

why is it telling me "position" is not accessed?

leaden tartan
heavy knot
leaden tartan
#

can you also include the line numbers in the screnshot?

heavy knot
#

nvm it works

candid juniper
#

@toxic bough Do you happen to use mac?

toxic bough
#

i dont

candid juniper
#

Linux or Windows?

toxic bough
#

pyenv works on mac
use homebrew to install it

#

Im on linux

candid juniper
#

Ok cool so a similar platform at least, usually the tools work mostly the same between linux and mac

#

Are there any other tools you use on linux you suggest I look into?

muted notch
#

Anyone familiar with Step Functions and choice conditions? Need to validate something real quick.
Is this the correct way to satisfy 2 conditions using the And operator?

"check-job-complete": {
    "Type": "Choice",
    "Choices": [
      {
        "Variable": "$.training_job.status",
        "StringEquals": "Failed",
        "Next": "training-job-failed"
      },
      {
        "Variable": "$.training_job.status",
        "StringEquals": "Completed",
      },
      "AND:"
      {

      {
        "Variable": "$.training_job.model_name",
        "StringEquals": "web-annotation-extractor-${environment}",
      },
      "Next": "training-job-completed"
toxic bough
#

for managing dependencies and virtual environments

candid juniper
#

I am a bit confused with all these similar sounding tools ๐Ÿคฏ

#

So pyenv is for managing my python installs and pipenv is for managing libraries and virtual environments? So pipenv replaces virtualenv?

toxic bough
toxic bough
candid juniper
#

thanks

#

it is a bit overwhelming ๐Ÿ˜‚

lucid tangle
#

ok frogive me here, first time using heroku and flask at a much more advanced level

#

here is my directory

#

and in my procfile i have ```bash
web: gunicorn decaturSite.api:api

#

but heroku dumps errors, give me a sec

#

idk what im doing wrong.... ive been trying different combinations with no luck :((

lucid tangle
#

nvm

full heart
#

is there a library that can recognizee screen colors?

heavy knot
#

i think he's doing a series on like open csv or something rn

#

that can do image recognition

thorn geyser
#

Is PyDatalog still being maintained now...?

wooden ibex
smoky fog
#

How I can run my github repo in heroku?

frigid light
#

You'll have to link your github and select the repo

#

assuming it has all the necessary files you should be good to deploy

#

@smoky fog

smoky fog
#

Idk I just have config.json and main.py lol

#

@frigid light

frigid light
#

Cool

smoky fog
#

I need anything else?

frigid light
#

read the docs

smoky fog
#

My thing doesnโ€™t clone tho

#

@frigid light

#

I did got clone and the link

#

But it doesnโ€™t clone

#

โ€˜gitโ€™ is mot recognized as an internal or external command, operable or batch file.

frigid light
smoky fog
#

I have git setup idk lol

frigid light
#

Try running it then

#

or perhaps you never added it to path

smoky fog
#

Ah idk how to fix :/

frigid light
#

Well, you can always learn

smoky fog
#

I installed github

#

Still have the same problem idk if its in the path :/

frigid light
smoky fog
#

It aint even letting me uninstall github to install again and add to path @frigid light

frigid light
#

You do not need github installed to use git

#

git is different from github desktop

smoky fog
#

Ok

#

@frigid light why it aays bash: cd: too many arguments? Any idea?

frigid light
#

then put that in quotes : cd "new folder"

#

next time an error comes up try googling it

smoky fog
#

Its a folder already tho

#

Ok

frigid light
#

I see

#

*I meant change directory not create (my bad)

smoky fog
#

Ok

smoky fog
#

I thought heroku login was a command

#

git add . command says fatal: not a git repository

smoky fog
#

@frigid light another gir process seems to be running in this repository............ remove the file manually to continue

#

Yeah I saw something crash

steel sundial
#

I hope this is the correct channel, if not I am sorry and would appreciate it very much if you could point me to the correct one.

My Question:

Does anyone have a link to some good documentation or tutorial, regarding packaging EXTRAS? How to structure the project, where to put the extras, how to declare them. Generally how to create a package, that has extras.

I can't seem to find really find anything that explains it from the ground up. I found a lot of info, how to declare extra dependencies and how to install packages with extras, but sadly not much else and I want to check if I am just bad at searching ๐Ÿ™‚ .

hushed orbit
#

How to setup a git config file and remote urls for multiple github accounts / repos.
I have a seperate account for work and personal github. Tried setting up a config like

# githubPersonal
Host personal
        HostName github.com
        User git
        IdentityFile ~/.ssh/id_rsa_personal

# githubWork
Host work
        HostName github.com
        User git
        IdentityFile ~/.ssh/id_rsa_work```
and an remote origin `git@work:companyname/repository.git`
However it ended up creating a new branch on a repo for my github user, on a random project.
night quest
hushed orbit
#

If you're referring to the .git part, is just forgot to add that to the message. My bad

night quest
hushed orbit
#

Oh yeah, I am using repository, not branch. Just brainfarted

#

For some reason set my remote url to my own repo.. changed it, let's see how that goes

#

It's trying to push to git push origin branch:branch ๐Ÿค”

#

manually writing git push origin branch will work, so i guess it's a vs code issue now

night quest
#

~/.ssh/.config:

Host github
    User git
    HostName github.com
    IdentityFile ~/.ssh/keys/github_rsa
$ git remote -v
gh    github:nickname/project.git (fetch)
gh    github:nickname/project.git (push)

Works perfect

#

git fetch gh

hushed orbit
#

yeah i think it's something vsc has setup

#

or cached

#

idk tbh

jade dagger
#

any idea to login google account using .chrome() selenium?
i've try cookie method but it doesnt work for me

inner pollen
thorn geyser
fickle finch
#

I am looking for a way to publish my project to github. As the project is a command line tool (with the possibility of future gui) I was wandering should I distribute it with PyPi or require users to cone and run? Another question is how exactly should I figure out all of the dependencies for requirements .txt if I go with the latter?

vale wedge
#

anyone here aware of a json pretty printer that allows to compact display certain objects (im trying to get diff friendly but compact serializations of openapi specs)

inner pollen
fickle finch
#

@inner pollen wow thanks a lot!!!

vale wedge
#

@fickle finch it tends to be a good sport to publish via pypi if its a command so people can install in their own environments, if it turns out to be a gui, publishing as installable/startable artifact as well

fickle finch
#

One note, one main audience will be of no technical knowledge so i want it to be the easiest way for them possible

vale wedge
#

whats the use-case the tool gaters towards?

fickle finch
#

Basically I combine 2 existing tools to help language learners work with local media files in order to extract audio and sentences

#

And send them to the other learning program

vale wedge
#

then its important to know about the tools/systems of the target audience, linux/windows, cli savy or not

fickle finch
#

I thinks it shouldn't be a problem as long as python3 is installed

#

I used path lib so I think I am covered

#

Apaer from that ther should be no issues

vale wedge
#

so if a recent python 3 + pip is the only requirement, then having something that can be pip installed easily might be nice

fickle finch
#

I see

#

Yea

#

They would also need git if I go with github

#

As the only option I mean

vale wedge
#

if you know for sure that most of the users use something like windows, or a specific linux distro, it may also be a good idea to package for that in addition

fickle finch
#

Thats is something I am conflicted about

#

Almost all windows users use windows 10

#

They can get wsl running in 10 minutes as long as they know how to use a mouse

#

And it would take me a lot of time to figure and maintain the packaging thing

vale wedge
#

in that case having a pip package + a wsl howto is a fair starting point

#

later on if a gui is being added it may be sensible to bundle it as a app

fickle finch
#

Yea I doughty about using gooey for that as its a nice wrapper around argparser

#

But wsl doesn't have X running

#

Command line options are not that complicated I will wait for the feedback before messing with gui

vale wedge
#

yup start simple, then expand

fickle finch
#

Thanks a lot for the insight! Really helped me a lot

vale wedge
#

happy to help, good luck with helping your future users

wanton haven
#

Hello i'm trying to find a good programming environment for Python

#

does someone maye has tips for something easy to start with for a beginner

hearty wind
#

hi is there a way to display hindi characters in vscode integrated terminal?

sly sleet
#

@hearty wind you might have to change the terminal font

ionic jungle
#

how to detect motion gesture in python using OpenCV

cobalt ibex
#

can anyeone with selenium expereince pm me?

turbid hollow
#

Hi @ all

#

i can't find the switch statement, does it have another name

#

it could look something like:

switch b:
  case a:
  case b:
  case c:  
sly sleet
#

@turbid hollow python doesnt have switch

#

there's also pattern matching coming in 3.10, which is arguably more powerful than switch

foggy haven
#

Depending on how you structure a if elif else ladder, it can look pretty much the same as a switch case.

floral prism
#

is this the right channel to get help about installing pynput and/or activating conda enviroment

marsh folio
#

is there a reasonable way to install pyenv system-wide so that we can all share a common set of virtualenvs? is it a terrible idea? my boss wants me to set it up this way but i can't google up any authoritative discussion about it and i'm starting to suspect it's a bad way to operate

azure hornet
#

you typically want venv(s) per person, or people will stomp on each other's dependencies

reef latch
#

i'm trying to setup a private repo to be pip install-able--my setup.py looks like

from setuptools import setup


setup(
    name='Foo',
    description='A learning experiment',
    url='git@github.com/myOrg/foo.git',
    packages=['src.foo'],
    install_requires=[],
    extras_require={},
)

and i'm able to pip install it, but none of my files wind up in the target virtualenv--am i missing something? fwiw my directory looks like:

โ”œโ”€โ”€ Makefile
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ setup.py
โ””โ”€โ”€ src
    โ””โ”€โ”€ foo
        โ”œโ”€โ”€ __init__.py
        โ””โ”€โ”€ external_requests.py

but when i pip install it, the install succeeds but the import fails. anything obvious?

tawdry needle
#

@reef latch ```python
from setuptools import find_packages, setup

setup(
name='Foo',
description='A learning experiment',
url='git@github.com/myOrg/foo.git',

packages=find_packages('src'),
package_dir={'': 'src'},

install_requires=[],
extras_require={},

)

#
  1. use find_packages to automatically resolve all package names, there's almost no reason not to use this
#
  1. if you really wanted to manually specify, the package name here is foo, not src.foo. that is what find_packages('src') returns. if you don't believe me, cd to your project top-level and run this:
python -c 'from setuptools import find_packages; print(find_packages("src"))'
#
  1. you forgot package_dir
#

packages is a list of package names, package_dir is the location of each package

reef latch
#

thanks, very thorough! appreciate ya

tawdry needle
#

you're welcome and bless you for caring about packaging

#

if you want to be really thorough, add this pyproject.toml file alongside setup.py:

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

this tells the pip that is installing your package how to install it; e.g. if you need cython at install time then you can specify it here. this also lets you specify a minimum version of setuptools if you need a more recent feature or if you want to blacklist a certain version with a bug, etc.

#

@reef latch ^

reef latch
#

thank you so much! amazing

ember wren
round berry
#

As my first introduction to containerization, I'm putting together a simple website using docker. I'm not entirely clear on what the structure of one of these instances should be. I've got Nginx, Node.js backend, PostgreSQL, and Letsencrypt I want to use, generally, would I be deploying all of these to a single docker instance?

inner pollen
short peak
round berry
#

What kinds of things impact the budget?

ember wren
#

i like to push button instead of running commands, im sure im not alone

short peak
short peak
#

e.g. app can't be down, you might want to implement replicas. Need to handle thousands of requests per second, you might want to have several instances running. Your team requieres different environments for QA the app

round berry
#

Makes sense to me, I certainly don't foresee such large demand

#

And in this case, Nginx and the web server should be separate containers?

#

And what is the benefit of having separate containers? At least, aside from spreading out load

short peak
#

you can manage deployment separately

#

split point of failure

#

makes easy to manage each piece independently

#

I don't think main reason for that is the performance though it also helps to scale

round berry
#

Hmm, fair enough

#

And regarding Nginx and the web server? Should those be separate? I don't really have an application layer separate from the webserver atm

short peak
#

nginx is a web server

#

if you don't have a need to have your app and the web server in different boxes/containers, then don't ๐Ÿ˜„

round berry
#

Ahh, i see

#

Heh, this is good practice, i at least don't foresee needing to scale but it will be a learning opportunity. Thank you!

short peak
#

sure ๐Ÿ™‚

inner pollen
foggy haven
heavy knot
#

it dosnt let me convert py to exe

#

any1 can help

final swallow
final swallow
primal basin
#

if i have two services that require a postgresdb, do i make one or two postgres services in my docker-compose?

#

and how should i map out hte ports so they dont collide?

final swallow
#

Ports are defined in docker-compose too

#

Are both services running their own db? If you are just deving on your local id put both dbs in the same PG instance

primal basin
#

metadata store for both services

#

so run docker-compose --scale postgres=2 ?

#

wha about the ports

final swallow
#

in your compose file you will define each service with what ports you want them to run on

primal basin
#

ahh ok so the default port is 5432 (i believe) for hte second one i can make up any port ,say 5433?

inner pollen
# heavy knot any1 can help

Can you elaborate more? There is a library named cx_freeze that can be used to generate exe binary from python source code.

final swallow
#

if so id stick both dbs in the same pg instance

primal basin
final swallow
#

yeah in that case just run one pg container and create two dbs

primal basin
final swallow
#

in your compose file in the pg service bind a local folder mount into the container. This way your data persists

#

Example:

services:
  db:
    image: postgres
    ports:
      - "5432:5432"
    volumes:
      - /local/path:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
primal basin
devout temple
#

after running git add ':!<folder>', I still see a few directories that are untracked (under Changes not staged for commit). The idea is to go into each folder and run git add . manually?

austere brook
#

I'm looking for a software development project management tool that helps me estimate the total man hours required for our backlog of issues. Perhaps even slotting them into a calendar, where they do not overlap, so that I can see how far out they extend.

Does anyone know of a tool like that?

austere brook
austere brook
#

slack doesn't do that

#

but thanks for the help

short peak
#

you're right, but you can tweak the filter in that page according your needs

blissful ice
#

Question: setuptools has a mechanism for defining optional features / extras via extras_require, which doesn't affect the package content, just it's dependencies, right? Is there a way to declare a module in a package as optional? E.g. include namespace/module_a.py only if extra-feature "a" is selected for install?

vale wedge
#

if you want to split up a package for features, split it into multiple packages that you can put into the feature requirements of the main one

blissful ice
#

I was afraid of that. It feels like splitting up packages is a bit overwhelming though. For instance, I have a project with a protocol definition, client code, and server code. In order to distribute a client package I'd need to separate and maintain 3 different code bases? I hoped I could get away with something like pip install mypackage[client].

fickle finch
#

I tried to add a GUI to my otherwise terminal tool. I tried Gooey but got disappointed by the lack of the documentation and the flexibility I need compared to standard arg parser. What alternatives do I have? I would like to have some predefined widgets like radio buttons, file inputs, dropdowns... and be able to combine them. I also want to be able to monitor the state of one widget in order to turn on/off the other ones

vale wedge
#

@blissful ice just ship it together, and have the parts that lack dependencies fail ?

#

@blissful ice its entirely ok to have the parts that lack dependencies fail, just add a little extra that adds a extra note to the import errors

carmine briar
#

Hi,
When I try to clone a repository from internet to my HDD it copies all the files contained in the master Repository I want to just clone a subfolder of a repository Is this possible? If yes, then how?

heavy knot
#

You can also do a shallow clone if you are not interested in the commit history

carmine briar
heavy knot
#

For shallow clone i think its just adding --depth 1 to the git clone command

carmine briar
carmine briar
heavy knot
#

No idea sorry I only use the cli ๐Ÿ˜…

carmine briar
heavy knot
#

If you want but I wont know anything more about the desktop app

tiny dove
#

Hello all

#

I have a challenge getting my API built using Django-REST framework to run on Docker

#

On the local machine, once I run manage.py runserver, the server runs and the app works accordingly

#

But from docker I get this error when I try to use the app with postgres in docker

#

I get this error -

#
django.db.utils.OperationalError: could not translate host name "postgresql" to address: Temporary failure in name resolution
#

PS - I am working on Windows OS

night quest
#

Paste some code

tiny dove
#

My docker-compose.yml

#

My project structure -

#

The dockerfile for the API -

#
FROM python:3

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        postgresql-client \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app/api
COPY requirements.txt /app/api
RUN pip install -r requirements.txt

EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
#

Dockerfile for the frontend -

#
FROM node:13.12.0-alpine

WORKDIR /frontend

COPY package.json /frontend
RUN npm install 
RUN npm install react-scripts@3.4.1 -g 
COPY . ./
EXPOSE 3000

night quest
#

You can inspect it using docker inspect ...

tiny dove
#

I got this -

NETWORK ID     NAME                                DRIVER    SCOPE
c8f74f76e832   bridge                              bridge    local
5e01270c53c9   host                                host      local
070efbf04ddf   indie-tour-app_db-net               bridge    local
ae9cddca6a4f   indie-tour-app_default              bridge    local
7d9e9753173f   none                                null      local
#

..when I did docker network ls

#

@night quest hello ๐Ÿ‘‹

night quest
night quest
#

As you can see you have two bridge networks in your project

#

default is default network - each container is attached to it

tiny dove
#

Yes.

night quest
#

Unless you change configuration in docker-compose.yml

#

Then you must explicitly set

  networks:
    - one
    - default
tiny dove
#

So what can I do to have a single bridge network bridging all parts of the app

night quest
tiny dove
#

I'm sorry, I'm a beginner at docker, so a lot of things are confusing

#

Forgive my ignorance

night quest
night quest
#

You don't need to create different bridge network I think - because you have default

tiny dove
#

@night quest Man, It now works

#

I'm so elated!! ๐Ÿ˜‚

night quest
tiny dove
#

Been battling this since Monday ๐Ÿ˜‚ ๐Ÿ˜ญ

night quest
#

Remember that internal containers don't have access to the Internet

tiny dove
#

Yes.

#

I have a question though

night quest
tiny dove
night quest
#

Don't worry

tiny dove
#

I went to the swagger doc for the api on docker

night quest
primal basin
#

whats the general rule for building a docker-compose file with regards to number of services within a single docker-compose/
are there diminishing returns or confusion as it gets larger and larger?
most of the examples i see online have only a handful of services, mine is becoming like 15 services...i am wondering if this is bad practice

tiny dove
hexed oasis
#

I have a question for the channel: have you ever/do you currently use a monorepo? We're looking into the possibility of converting from multirepo at work. If you have tips, or can advise on any common pitfalls to avoid that would be awesome to hear

final swallow
#

Yeah id say docker-compose is great for a single app stack. Anything larger or complex you'd prob want to use Kubernetes

primal basin
#

i will look into kubernetes, i havent touched that or helm before

final swallow
#

helm is a tool to template and deploy yaml

hexed oasis
#

He's right, learn Kubernetes first if you've not touched it before ๐Ÿ˜„

tiny dove
#

Please how do I migrate models (Django) to docker?

#

I have the db and api linked now but I have to migrate my models to the dockerized postgres db

final swallow
#

exec into the django container and run your migrations

#

docker exec -it <container name> bash

worldly drum
#

Hey, not sure if it's the right channel but i'll try
I'm working on a micro-service within few other micro services
I'm trying to manage dependencies correctly, right now using requirments.txt
the problem is that requirements.txt is only handles top level requirements and i also want to handle sub dependencies (sort of equivavlent to package-lock.json with npm)
I made a little research and read some about pipenv
does any one have experience with it? can recommend? have other recommendation?
Thanks in advance

tiny dove
#

Greetings brethren

#

So I found a way to migrate models to docker

#

But I want a situation where when I do a compose build I run migrations to check if there are changes to the model

#

Currently I was able to create ta bash script, run it in my dockerfile, then call that bash script in my docker-compose

#

It builds as expected

#

However, when I attempt running docker-compose up -d and I get the container in question, I see the particular image I'm trying to run migrations on restarting severally

#

In my migrations.sh file -

#!/bin/sh

python manage.py migrate
python manage.py makemigrations

Docker file for api -

FROM python:3

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        postgresql-client \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app/api
COPY requirements.txt /app/api
RUN pip install -r requirements.txt

EXPOSE 8000

COPY migrations.sh /migrations.sh
RUN chmod +x /migrations.sh
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
#

In my docker-compose.yml file for the service api -

#
api:
    restart: always
    container_name: api
    entrypoint: /migrations.sh
    command : 
      - python manage.py runserver 0.0.0.0:8000   
    build: ./api
    links:
      - postgresql:db
    volumes:
      - ./api:/app/api
    ports:
      - "8000:8000"
    depends_on:
      - postgresql
    networks:
      - database
      - default
night quest
final swallow
vale wedge
#

Ideally migration happens in separate containers and their deployment is planned so that they enable deployment to the services without migration disruption at code update time

pure galleon
#

import smtplib, ssl

port = 587 # For starttls
smtp_server = "smtp.gmail.com"
sender_email = "diksaratower@gmail.com"
receiver_email = "diksaratower@gmail.com"
password = input("Type your password and press enter:")
message = """
Subject: Hi there

This message is sent from Python."""

context = ssl.create_default_context()
with smtplib.SMTP(smtp_server, port) as server:
server.ehlo() # Can be omitted
server.starttls(context=context)
server.ehlo() # Can be omitted
server.login(sender_email, password)
server.sendmail(sender_email, receiver_email, message)

Everything works on my computer, but when I give the program to a friend, he gets an error. hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf7 in position 7: invalid start byte

frozen anchor
pure galleon
frozen anchor
graceful moat
#

Hi guys I'm quite comfortable with Python Flask API but was wondering how I could deploy a python backend in the cloud (AWS etc.)

#

I'm assuming I can process data and have backend python data processing methods

#

so I can call the api from another place in my ReactJS app

frozen anchor
graceful moat
#

can anyone point me somewhere

graceful moat
inner mesa
#

Do I have to cite the copyrights of a gohugo theme that has an MIT license? In other words - can I just change that text on the bottom?

vale wedge
#

@spark fjord im preparing the next iteration of setuptools_scm - dropping support for eol python versions - wondering what to use as minimal setuptools version supported

round berry
#

I'm again using docker for the first time, with docker-compose specifically. I've got a github repository of the form

docker-compose.yml
web/
   server.js
   Dockerfile 

I've got several services running through docker compose, if I want my node stuff to be synced with my github repository, should I do that within the web service, or should I be doing that outside/between my docker-compose up?

tawny temple
round berry
tawny temple
#

Yeah but maybe node has something that supports auto reloading your files, like the Django dev server does

spark fjord
#

@vale wedge I'm not aware of any constraints you need to apply. Projects can select minimum Python versions based on the features they need. I'd only specify a minimum Setuptools version if setuptools_scm has a requirement on a specific feature.

primal basin
#

any idea why my postgres service wont docker-compose down? i keep getting: ERROR: for postgres UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=70) ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.

#

docker logs returns database ready to accept connections

spark falcon
#

does anyone know the FEN string for chess board before any moves are made?

sinful fox
vale wedge
heavy knot
#

Hello, does anybody know how python applications can make files ?

vale wedge
heavy knot
vale wedge
heavy knot
vale wedge
heavy knot
vale wedge
heavy knot
#

well i basically have a problem with app not working

#

i runned in shell or something like that, and it worked fine, but when i compiled it into app, it basically didnt worked

#

does app need some special perms to do that ?

#

should i also post the app ?

vale wedge
#

my time for helping is unfortunately up, and it seems like you keep asking incomplete questions and leave out the real issues and key details for whats actually wrong, so good luck

heavy knot
tiny dove
tiny dove
# final swallow Agreed. Best to leave your migration commands out of the Dockerfile. If you want...

I tried to mimic what was in that stackoverflow link -

api:
    restart: always
    container_name: api
    #entrypoint: /migrations.sh
    command : python manage.py runserver 0.0.0.0:8000   
    build: ./api
    links:
      - postgresql:db
    volumes:
      - ./api:/app/api
    ports:
      - "8000:8000"
    depends_on:
      - migrations
      - postgresql
    networks:
      - database
      - default
  
  migrations:
    container_name: db_migrations
    command: python manage.py migrate --noinput
    build: ./api
    links:
      - postgresql:db
    volumes:
      - ./api:/app/api
    depends_on:
      - postgresql
    networks: 
      - database
      - default

That was what I have currently in my docker-compose file

#

But each time I build and do compose up, I notice for the db_migrations image I get this error -

tiny dove
#

Hmm, interesting.

#

So I made changes to the migrations service -

migrations:
    container_name: db_migrations
    command: python manage.py migrate --noinput
    build: ./api
    links:
      - postgresql:db
    volumes:
      - ./api:/app/api
    depends_on:
      - postgresql
    networks: 
      - database
#

And I got the expected message from the migrations image -

Operations to perform:
Apply all migrations: admin, auth, contenttypes, indieco, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
...etc
ionic pagoda
#

Hey there. Anyone aware of a way to have commands like docker build and docker push on a windows PC without having to install full docker desktop?

tiny dove
#

I checked the mount for db_migrations and it was mounting to the right path. But checking the port, I noticed this -

Port
8000/tcp
Not binded
tiny dove
#

More observations. Turns out the problem is not with the migrations. I removed the migrations service and spun the container

#

I checked the api service and got this -

#

It's a connection issue. Not sure why it connects, then I do a compose-down and rebuild and compose up and get the errors I'm seeing

#

Do I need to restart Docker?

#

Lemme try that

tiny dove
#

Restarted. And everything (without the migration service) works as it should

#

Added the migration service and we are back to the connection issue

#

I observed that when I decided to add -
restart: always to the migration service, I first got an error, then I got the successful migration message after a restart. But the service just kept on restarting

tiny dove
#

Smh, just decide to work alone with the api service and add a second command

#

So I removed the migrations service

#

And in the api service, just added

#
command : bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
#

*facepalm why didn't I think of this before?

fierce sun
#

Hi, we are working off of a manufacturer provided repository, but would also like to setup a local repo to track our changes to the manufacturer rpo

#

what is the best way about this? I read something in regards to manifest files. Is that better than adding multiple remotes to the repo?

primal basin
#

can i get some docker help? this is my error ERROR:flask_appbuilder.security.sqla.manager:DB Creation and initialization failed: (psycopg2.OperationalError) could not connect to server: Connection refused Is the server running on host "postgres" (172.18.0.5) and accepting TCP/IP connections on port 5433? my port is currently port:5433 is the error msg telling me to change it to ports: "172.18.0.5:5433" instead?

analog kiln
#

So, as I was digging around the interwebs, is there no better way to enforce the order of containers in docker-compose? I have a rabbitmq container that takes some time to start. I found healthcheck, that seems to have no effect. Only solution I found was using sh scripts in the containers.

tiny dove
analog kiln
#

That exists, but only starts the containers in certain order. But doesn't wait for them to be available.

#

So I need combination of depends-on and my own scripts?

visual ridge
#

Hi please help. I was using github desktop and I accidently switched branches. It changed like almost every file. How do I revert?

vale wedge
spark fjord
vale wedge
#

I strongly recommend taking one of the help channels for your case, i can't help atm as i gotta run now

sly sleet
#

@visual ridge just switch branches again back to what it was before

visual ridge
sly sleet
#

so it worked?

visual ridge
#

no the changes arent there

wooden ibex
#

You could put retry in there or just crash the container and let docker restart the container

#

Network issues happen

primal basin
#

can i get some docker help? getting this error:

    Is the server running on host "superset_db" (172.22.0.5) and accepting
    TCP/IP connections on port 5433?``` 


my ports for it: `ports: - "5433:5432"`
#

i have two postgres services, the error is happening on my second postgres service

wind salmon
#

I'm trying to package a CLI app as a standalone executable using PyInstaller. I don't have a Linux OS so I used Vagrant to package it, taking the CentOS 7 box since the server where the executable will run is also CentOS 7.

I was able to create a standalone executable and it ran successfully with a fresh CentOS 7 Vagrant machine (no python3 dependencies installed). But when I run the executable in the server, it gives me this error:

[user@server ~]$ emails_automation/emails --help
[22874] Error -3 from inflate: unknown compression method
[22874] Error decompressing _asyncio.cpython-38-x86_64-linux-gnu.so
Failed to write all bytes for _asyncio.cpython-38-x86_64-linux-gnu.so
fwrite: Bad address

Both VM and actual server has same glibc version:

VM:

[root@localhost emails]# ldd --version
ldd (GNU libc) 2.17

Server:

[user@server ~]$ ldd --version
ldd (GNU libc) 2.17

Any pointers?

vale wedge
#

The unknown compression errors seems relevant

split stag
#

Guys, what is the best python library you know for animation??

vale wedge
split stag
split night
#

would anyone know why git is ignoring json files that arent in gitignore?

blissful ice
#

Hi, I'm trying to package a compiled library for easy installing with pip / setuptools but I don't know where to start. In Conda there are non-python packages for installing data to local /lib /include /bin folders. Does pip allow to do something like that or is this a conda-only feature?

dusty maple
random dawn
vale wedge
blissful ice
#

Allright, I knew conda was being advertised as being more 'open' for distributing non-python packages in comparison with pip. But I faintly recall someone saying that this isn't the case for "modern" pip anymore, given that there are wheel packages like cudatoolkit etc.

dry knoll
#

Btw, what's devops and where can I learn about It? Thx a million

vale wedge
arctic flicker
#

is it at all possible to log the shell in pycharm?

#

i.e. both commands and output

arctic flicker
#

i.e. saving those into a file after each run

arctic flicker
#

ok, rephrasing: Is it at all possible to include the debug console input when saving to log?

arctic flicker
#

or else, is there any IDE that can do this?

heavy knot
#

Hi, I'm working on tool that checks MD5 hashes .. and I wonder if it's possible in python to make update just the variable with hashes on screen without having to clear whole screen

night quest
heavy knot
silver marlin
#

Hello everyone.
I just finished my first tool in Python today (I started learning Python recently). It works, but I don't know if there are a lot of begginer mistakes, or things that can be improved. Do we have here in the community any type of code reviewing? There are any online tools to check the code?
Thanks ๐Ÿ™‚

heavy knot
#

you can try that

silver marlin
silver marlin
heavy knot
#

I see

vale wedge
#

if you have it on github, you can just send a link and ask for suggestions ^^

silver marlin
#

I made the following project as part of my Python learning. This is my first tool. Can someone give me feedback about it?
https://github.com/gh-rboliveira/fillnewcopy

short peak
#

I'd suggest to don't version your python environment (your env folder)

silver marlin
short peak
#

though 1st one is probably the most used one

silver marlin
ebon swift
#

Is it possible to improve the flow of coders by designating one person to carry out all merge conflicts?

wooden ibex
#

though merge conflicts can indicate poor branching practices

silver marlin
crystal agate
#

hey, does anyone have an experience connecting to a docker mysql image from a django app in the same container ? I tried with different hosts from the app but it keep giving me:

2003: Can't connect to MySQL server on '0.0.0.0:3306' (111 Connection refused)

ebon swift
#

@wooden ibex do you have any recommendations if we were to look to improve our branching practices?

wooden ibex
#

We do Main -> Development -> Feature branching

ebon swift
#

@silver marlin I thought this too, but I'm trying to be open to the other point of view because I understand the value in staying in the zone when coding rather than coming out of it to fix conflicts. But I worry we're going to hit problems if only one person is fixing conflicts

wooden ibex
#

main is stable tagged prod code

#

development is test stable (hopefully) code

#

feature branches are developers currently working on something and may break at any time, generally two developers do their best not to touch same part of code but push into each other branches

ebon swift
#

At the moment we're doing Main -> dev -> subtask of story branching

wooden ibex
#

in that case, how are you having conflicts, are devs not talking and touching same parts of code?

ebon swift
#

Yes

wooden ibex
#

seems like the fix is easy then

#

devs should talk

ebon swift
#

This is one of the suggestions I've put forward yep.

I feel like integration is a pain rather than easy, but also that trying to avoid doing it regularly and ourselves probably leads to worse pain. It seems like that's the general feeling from what I've read, but is there something I can show as evidence?

Also if anyone has arguments to support the other side they're equally welcome

#

And by anything I can show as evidence I guess I mean something particularly well regarded or compelling

wooden ibex
#

but in general, I doubt there is hard and fast rule you can point to

#

people problems rarely have that

ebon swift
#

Ok, no worries. Thanks ๐Ÿ™‚

narrow folio
wooden ibex
vocal quiver
#

Hi, I installed docker today with the defaults settings and after this installation I get this message. I don't get what they are saying in the message, Thanks

tawny temple
#

Install wsl2 by following the link they provide

#

I guess Docker uses wsl2 as its back end by default but it's complaining cause you haven't installed wsl2

silver marlin
#

Hello,

I created from a script an executable file with pyinstaller:
pyinstaller --onefile --windowed myscript.py

It runs on my computer, it runs on another colleague's computer, but not in a third colleague's computer. We all have Windows 64bits.
Anyone is aware of this problem and how to solve it?

sinful kettle
#

Who uses replit btw

brittle mist
#

hello,
i am trying to settup docker to be used to automatically update my bot from my repo on github.
what kind of packaging should i use for it?
are the depensiencys automatically added to it?
and how can i automatically start the wb.py file?

raven forum
#

I want the server to transmit sound from the browser or from the video player, how can I do this? (I already have a server and a client ready, I just do not understand how I can catch the sound and play it on the client, I use the socket library for the server)

heavy knot
#

How do i begin creating devOps tools?

north reef
#

What is Git Credential Manager? it is in my github authorized apps and it says it was last used within last week. Should I revoke its authorization?

tawny temple
#

It's what saves your git credentials. I believe it's a Windows-only thing that comes with the standard Windows git installer.

#

Well, it may not exactly be that, since I don't believe it communicates with GH. But maybe it is something related.

#

I haven't used this new "core" version, since by the time it was released I had already moved on to using SSH keys.

primal basin
#

stupid question but when i am writing config files inside a compute engine VM, do i leave localhost as is or do i replace localhost with internal or external IP?

#

the default config file example
druid.host=localhost

visual ridge
#

Hi, I used a script to auto commit to save my work. I want to merge all the commits to the latest commit I make, how can I do that?

tawny temple
#

If these commits have already been pushed, then you'll need to do a force push. This is because a rebase will rewrite history, and such pushes are normally rejected.

#

That is why this kind of git workflow is generally not advised. But if you're working alone on your branch then you do you.

visual ridge
tawny temple
#

Yes, there is a way and I just explained how.

visual ridge
#

Oh I thought you said oldest

tawny temple
#

The command takes the oldest commit, so it knows where to start from

#

It starts from the oldest and goes until the newest

visual ridge
#

Ah ok

tawny temple
#

If you have so many commits, a rebase may be too tedious

#

You could also do it with git reset

visual ridge
#

Alright, ill go with rebase since I want to be safe. So for example a SHA for a commit is 5c4ee8549644a3cf041b30f0245894c2674679c8 which is the one from where I want to start sqaushing from. So I would do git rebase -i 5c4ee8549644a3cf041b30f0245894c2674679c8

tawny temple
#

When you rebase, you have to individually mark every commit you want to squash. With a reset, you just specify the oldest commit and it will remove all those commits and then keep the changes unstaged (or staged with git reset --soft). So you'd lose the commits but not the actual changes within them.

#

Yeah, that is correct

visual ridge
#

Ah

tawny temple
#

Thought I always forget if the commit hash is exclusive or inclusive ๐Ÿ˜„

visual ridge
#

So if I specify a commit 3 days ago (5c4ee8549644a3cf041b30f0245894c2674679c8). I made 10 commits from then. Then it would erase the 10 commits and that commit I specified with the --soft flag but I would not lose any changes. I would use git reset 5c4ee8549644a3cf041b30f0245894c2674679c8 --soft

#

Thanks alot

tawny temple
#

The hash may have to be at the end of the command

#

That's how I always do it anyway

visual ridge
#

Ah alright, so it will do what I intend it to? (by that I mean would it would erase the 10 commits and that commit I specified with the --soft flag but I would not lose any changes )

tawny temple
#

Yes. If you're worried you can create a backup branch: ```py
git checkout -b mybackup
git switch originalbranch
git reset ....

visual ridge
#

Alright, last time I did that it pulled the backup branch and I lost all my changes, thats why I used that auto commit script lol. Ill just do git stash and switch

tawny temple
#

Can you stash committed changes?

visual ridge
#

Dont think so. the commits that have not been pushed will persist if I switch or they will be destroyed

#

sorry for being so paranoid but this is how i lost 1 week of code

#

And I have just rewrote

tawny temple
#

Well if you're ultra paranoid, copy and paste the .git folder

#

But yes, the commits should persist. They'll just be on another branch.

finite fulcrum
#

your reflog should keep track of almost everything you do in case you mess it up

tawny temple
#

Well. You'll have them on both your backup and original branch.

visual ridge
#

Ah alright

#

\Thanks alot

#

Also, one more general question that I couldnt find the on the web. I usually push my code with varaibles that the user should configure when they git clone it. However, when I pull it I lose the the variable that I defined. So basically what I want to do is when I git pull I want some of the part of code remain unchanged. How to do that?

tawny temple
#

Don't check in that file. Add it it .gitignore.

#

Instead, add in your documentation that users need to create the files themselves. Tell them where to create it and what the format is.

#

If you think it helps, you can commit an example or template file with a different name so users can copy and rename it to the right thing then go from there.

visual ridge
#

It is in the readme.md to paste your token there

tawny temple
#

Don't hard-code your token. Read it from a separate file that solely contains the token

#

Or read it from an environment variable

visual ridge
#

and add that to .gitignore?

#

got it

tawny temple
#

Or read it from command line arguments

#

Yes

visual ridge
#

Also I used the reset thing which squashed 60 commits into one commit that I made 3 days ago. However, that commit isnt descriptive so I would like to make one more commit and squash the already sqaushed commit into the one I make. So the normal squash command can do that correct?

tawny temple
#

Use git rebase -i HEAD~1 and then replace "pick" with "r" for the commit shown

#

Then it will open your text editor and let you enter a new commit message

visual ridge
#

Crap, i squash 60 commits to one and switched branches. Now changes are all messed up

#

I opened reflog and I want to go to

#

the one i squared

tawny temple
#

What do you mean it's messed up?

#

Switching branches is a harmless operation

#

Just switch back.

#

Switching branches doesn't mutate commits on the branch you're leaving.

visual ridge
#

I switched to backup branch and did git reset.
I switched to main and now its messed up.

I brought the changes with me instead of leaving them on backup branch. Just how do I revert the commit I squared

#

the changes messed up main

#

it tried to merge them or something

tawny temple
#

Did you use git switch or git checkout?

visual ridge
#

git checkout

tawny temple
#

That shouldn't carry over changes. In fact, it complains if you have uncomitted changes.

#

sorry, I'm just having trouble understanding how this could happen

visual ridge
#

I do not know, I used the github desktop thing..

tawny temple
#

!!!!!

#

Okay, that's a significant detail

#

I do not use that app so I cannot help you with it. I am only familiar with behaviour of git via the command line.

visual ridge
tawny temple
#

Is your backup branch still intact?

visual ridge
#

think so

#

ill copy it and delete the .git folder

#

just to be safe?

weak tendon
#

any good resource to learn about openstack for cloud apis? Thankyou

tawny temple
#

Don't delete the folder.

visual ridge
#

Okay

visual ridge
tawny temple
#

Yes it probably stll exists somewhere

visual ridge
#

i did git reflog

#

i did git reflog

#

it says this:

#

when i try to revert

tawny temple
#

Revert is probably not the right command. You'd need to rebase. What are you trying to do right now?

visual ridge
#

Nothing, I just want to revert it to that command

#

commit*

tawny temple
#

And discard everything after it?

visual ridge
#

yup

tawny temple
#

git reset --hard <commit> would do that.

visual ridge
#

just to make sure

#

If I do git reset --hard 1020f4c it would revert to that commit and discar everything after it?

tawny temple
#

Yes

#

It only affects the current branch though

visual ridge
#

it worked

#

thanks

tawny temple
#

You're welcome

visual ridge
#

should i use switch or checkout?

#

to be safe

tawny temple
#

Either works but switch is a relatively newer command designed to have a more narrow focus, and therefore a simpler interface, than checkout

visual ridge
#

how does git stash work? if i change for example greeting.py Hi to Hello and I run git stash it would save Hello and i can just run git stash pop?

#

Also if I have changes on the main branch but I want them to be pushed to feature branch then how would I do that?

heavy knot
#

hi

vocal quiver
steep temple
#

Is it possible to make a webinterface to remotely execute code on a Rasberry pi 4?

steep temple
#

My Plan is to host a local Webserver on a Rasberry pi 4 and then control it trough that webinterface

steep temple
night quest
steep temple
#

Access to shell

#

Like just remotely access the shell

night quest
#

You can install Jupyter and there is access to shell remotely

steep temple
#

But can I put that on a Webserver?

night quest
#

Jupyter is available via browser, is it what are you asking for?

steep temple
#

The plan is that the Webserver automatically starts and I get shell access on startup

#

And if possible I want to create a WiFi from the Rasberry pi so that I can connect anywhere

night quest