#tools-and-devops

1 messages · Page 42 of 1

heavy knot
#

where all 12 have their own image

tawny temple
#

In that case, some can be separate containers like I just mentioned, and others will probably need a custom image that you write.

heavy knot
#

ok

tawny temple
#

Like you'd just pick an OS base image and install everything else onto it yourself

heavy knot
#

I see

#

in my case, I have a python app that uses mongodb, so if I want to use a python base image, how do I get mongodb on there?

#

can I use both base images?

tawny temple
#

No, only one base image

#

A database doesn't need to be in the same container as your app really

#

Just run mongo as a separate container

#

And communicate with it over the local network

#

Docker Compose is helpful for managing multiple containers

heavy knot
#

ohhhhhh

#

that's why all of the base images are different

#

cuz yo have 1 container for python app

#

uses python base image

#

1 container for db, uses db base image

#

ohhhhh

#

it's distributed a bit

#

so how do you like

#

wrap all of the different containers in 1 app

#

besides creating a new docker id

tawny temple
#

You don't and you shouldn't generally

#

You can use Docker Compose to help manage that

#

It can make it easy to start all the containers together

#

but they're still separate containers

heavy knot
#

but like what if you have this app that has a db container, and you have another app that also has a db container, how do you tell them apart

#

I don't want to name the containers like app1-db and app2-db

tawny temple
#

By naming them differently, that's how

heavy knot
#

ok

#

so with my gitignore

#

I got it from github's gitignore templates

#

does python have a dockerignore template as well

tawny temple
#

I don't know, maybe

#

You could just use the same template you used for gitignore perhaps

#

The way I like to do it is ignore everything and then manually make exceptions for the files needed.

heavy knot
#

what should be ignored

#

should the .git folder be ignored?

#

how do you use docker and github?

tawny temple
#

Yes, the .git folder should be ignored.

#

Like I said, I ignore everything with * then add exceptions for what I want to keep.

heavy knot
#

what should I keep?

tawny temple
#

Like, the code needed to run your program

#

Things like that

#

If it's not needed to run the app, then you don't really need it in the image.

#

Maybe include the license if you want

heavy knot
#

ok, so in my case, that's the run.py and the package

#

wait if I exclude my package

#

how about the pycache inside the package?

tawny temple
#

No, that's not needed

heavy knot
#

so how do I exclude that

#

since it's inside the directory

tawny temple
#

Something like **/__pycache__

#

I suggest you read the docs on it

heavy knot
#

so what are the differences in use between the github repository the docker repository

tawny temple
#

Docker repositories are for publishing Docker images

#

I think GitHub recently added support for Docker repos too actually

#

But it's separate from the code repo of course

heavy knot
#

when I go the the docker hub thing

#

I can't see the source for the docker repo

tawny temple
#

Because Docker Hub is for Docker images, not for source code

heavy knot
#

so what happens when you docker push then?

tawny temple
#

It pushes the image to a Docker repo

heavy knot
#

but doesn't the image contain the source code?

#

so *.pyc should ignore pycache files right?

tawny temple
#

The image does contain the source code yes

#

Yes pyc files can be ignored. I suggest you ignore stuff and just try to run the program to see if it works if you have doubts.

heavy knot
#

I mean will *.pyc ignore pycache files

tawny temple
#

Oh I don't know

heavy knot
#

oh

tawny temple
#

In any case it would only ignore files in the root

#

You need **/*.pyc to ignore all of them

#

Beyond Go’s filepath.Match rules, Docker also supports a special wildcard string ** that matches any number of directories (including zero). For example, **/*.go will exclude all files that end with .go that are found in all directories, including the root of the build context.

heavy knot
#

I don't really understand what a wildcard string is

#

and I did read that

tawny temple
#

It gives the definition right after it names it

#

that matches any number of directories (including zero)

heavy knot
#

I guess I didn't understand what that really meant

#

so for docker cp, you can only copy files to containers, but I need the file there before I run the container

tawny temple
#

Ah yeah

#

You'll have to override the command used

#

So with docker run, you'd make it execute bash or something rather than letting it use the cmd you defined in the dockerfile

#

And once you copy the file over you could run the python command manually

heavy knot
#

can I copy the file in the dockerfile?

tawny temple
#

But then it would be saved in the image

heavy knot
#

like run docker cp as a command in the dockerfile

tawny temple
#

No

#

For one, it's a command that has to run from the host, not from within the container. And second, even if it worked, it'd cause the config file to be saved in the image, which you wanted to avoid.

heavy knot
#

right ok

#

I don't want to have to manually run the python command tho

tawny temple
#

Then stop using a config file and use env vars

#

At least for the sensitive information

heavy knot
#

how do I use those with docker?

tawny temple
#

-e option for docker run

heavy knot
#

oh docker run, I was doing docker container run

tawny temple
#

Never heard of that. Is it an alias?

heavy knot
#

ig

#

wait whats this option then? --env-file

tawny temple
#

My guess is it can load environment variables from a .env file

heavy knot
#

is there a way for that to work with yml

tawny temple
#

No

#

It's a different format

heavy knot
#

oh

#

how do I use the env file in my python file

tawny temple
#

Theres a library that can load them called dotenv

#

I don't think you need that though

heavy knot
#

yeah so what does --env-file do

#

does it create the env variables automatically

tawny temple
#

Yeah

#

It creates them from what it reads in the file

heavy knot
#

so then how do i use them in python then

tawny temple
#

You just need to then read them in your program with secret = os.environ["SUPER_SECRET_THING"]

heavy knot
#

os.environ huh

#

what does environ mean

tawny temple
#

Short for environment

heavy knot
#

oh lol

#

so with all of those dfferent options in docker run, is there a way to automatically add the options

tawny temple
#

You could create a shell script

heavy knot
#

like when you do docker run myapp it like, already knows to do --env-file and stuff

tawny temple
#

Or use docker-compose

#

If you're planning to add mongo anyway you'll want to use docker compose

heavy knot
#

ok

#

so what is docker compose, and what is it for

tawny temple
#

Basically an easy way to run multiple containers

#

It uses a yaml file in which you specify all the options for the containers

heavy knot
#

oh ok

#

so how is it useful for just 1 container

tawny temple
#

Not super useful I guess but you may prefer using yaml over a shell script 🤷‍♂️

#

It may support some stuff that docker run doesn't but I don't think so. As far as I could tell it's pretty analogous to docker run

heavy knot
#

I see

#

how is it used?

tawny temple
#

docker-compose up would start all containers defined in the yaml

heavy knot
#

so the compose file is just a yml version of docker run

tawny temple
#

I guess

#

It has some extra stuff to support multiple containers

#

Like specifying dependencies

#

E.g. website depends on database container running

heavy knot
#

right ok

#

that makes sense

#

so the docker-compose file goes in the root directory of a repo?

tawny temple
#

docker-compose by default looks in the current directory for the file, so generally it makes sense to put it in the root of the repo

#

However, it is possible to specify a different path to the file

#

It's just not convenient

heavy knot
#

ok yeah that makes sense

#

so what is required in a docker compose file

#

how is it made up

#

I know you have the version as the first key

#

but what else

tawny temple
#

Don't the docs have some examples?

#

You define "services" which are basically your containers

heavy knot
#

yeah the examples are quite confusing to me

tawny temple
heavy knot
#

here's what I was able to gleen:

version: "3.7"
services:

  image_name?:
    env-file: ".env"
#

oh woah, I was totally looking in the wrong place huh

#

is there a reason why the working directory is usr/src/app

#

on the official python image

tawny temple
#

I dunno, maybe it's a convention

heavy knot
#

alright

#

ok so rn my docker run command looks like this: docker run --rm --detach --name offthedialbot --env-file .env offthedialbot:latest
so should my docker compose look like this?

version: "3.7"
services:
  offthedialbot:
    build: .
    image: offthedialbot:latest
    env-file: .env
tawny temple
#

You need to specify the name of the image

heavy knot
#

oh is that not the same as the name of the service?

tawny temple
#

No, don't think so

#

Service name can be whatever you want

#

You'd also want to specify build

heavy knot
#

what is required for me to set in my service

#

also what would I set build to?

tawny temple
#

I think the minimum would be either specifying an image or a way to build it

heavy knot
#

is it better to do build or image?

tawny temple
#

Do both

heavy knot
#

wait how does that work

#

oh wait I found it

#

like this?

#

so does docker-compose automatically look for this?

#

or do you have to specify?

tawny temple
#

It does automatically look for it

heavy knot
#

so I don't even need to specify the env file thing in my docker compose yml?

tawny temple
#

Correct

heavy knot
#

alright that's sick

#
version: "3.7"
services:
  offthedialbot:
    build: .
    image: offthedialbot:latest
#

so is this all I need?

tawny temple
#

Try it and see if it works

heavy knot
#

so docker-compose builds the image right?

#

well that didn't work

tawny temple
#

It builds if the image doesn't exist yet

#

Otherwise you can build it with docker-compose build

heavy knot
#

wait docker-compose up doesn't automatically build the image?

tawny temple
#

It does if they don't exist yet

heavy knot
#

oh hmm

#

so if I were to go onto a new machine

#

I would do git clone my repo

#

then create the .env

#

then docker-compose up

#

right?

tawny temple
#

Yes

heavy knot
#

so what's the purpose of docker hub in all of this?

tawny temple
#

To download prebuilt images

heavy knot
#

so that isn't nessecary for me

#

wait the name of the image is offthedialbot_offthedialbot_1

#

why is it that?

#

actually, if I don't need to ever push my image to docker hub

tawny temple
#

Specify container_name if you want to change it

heavy knot
#

then is it fine if I have config.yml in my image?

tawny temple
#

Yes

heavy knot
#

:O

tawny temple
#

Though it's good practice to not include credentials in it anyway

heavy knot
#

but I like my ymls lmao

tawny temple
#

🤷‍♂️

#

Is your yaml solely for credentials?

heavy knot
#

yeah

#

@tawny temple is there a way to specify that I want to do docker-compose up --build but inside of docker-compose.yml

tawny temple
#

No, don't think so

#

You can create a shell alias for the cmd if it bothers you

heavy knot
#

nah its fine

#

actually wait

#

so remember when you helped me set up that whole CI thing

#

I need to change that now right?

tawny temple
#

I don't remember

#

If you want to deploy the image then probably yes

heavy knot
#

oh, well anyways, the workflow file look like this:

name: Continuous Integration
on: 
  push:
    branches:
      - master
jobs:
  build:

    name: Deploy
    runs-on: ubuntu-latest
    steps:
    - uses: appleboy/ssh-action@master
      with:
        host:  ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        key: ${{ secrets.KEY }}
        envs: GITHUB_SHA
        script: cd ~/offthedialbot && source .venv/bin/activate && git fetch && git checkout $GITHUB_SHA && pip install -r requirements.txt && systemctl --user restart offthedialbot
#

so I'll probably need to change the script part right?

tawny temple
#

You want it to use the image instead of git?

heavy knot
#

well the image won't be on docker hub

#

so I would git clone it

#

then build and run the image

tawny temple
#

I don't really see the point of using Docker if you're going to do that

heavy knot
#

well I don't need to install python, since it's in the image

#

I also don't need to worry about venvs

tawny temple
#

I suppose

heavy knot
#

and requirements.txt is also taken care of

#

oh and the systemctl script gets super simple

tawny temple
#

Though since you're not building image in Ci you can't take advantage of the CI being able to notify you if a build fails and cancel the deployment

heavy knot
#

wait no I am tho

#

I git clone, build image, run image

#

actually way

#

if I run the image detached

#

will it stop if I log out

tawny temple
#

No I don't believe it would

heavy knot
#

so I don't even need systemd then right?

#

that simplifies things as well

tawny temple
#

It may still be useful for automatically starting the container

#

or restarting it if it fails

#

But that's not something I'm experienced with

heavy knot
#

hmm

#

is there a way to set docker containers to run with that sort of behavior?

tawny temple
#

I don't know. You'll have to research it yourself or get help from someone else.

heavy knot
#

ok

heavy knot
#

@tawny temple So I fixed up the CI, and it actually deploys, so I need to install the database now.
But just copying the mongodb install directions don't work

#

it says systemctl not found

tawny temple
#

Why don't you use a docker image for it

heavy knot
#

ohh

#

it still doesn't work

#

I added it as a service in my docker-compose but it still has an error

#

pymongo.errors.ServerSelectionTimeoutError: mongodb:27017: [Errno -2] Name or service not known

#

this is my docker-compose-yml:

version: "3.7"
services:
  offthedialbot:
    build: .
    image: offthedialbot:latest
  mongo:
    image: mongo
tawny temple
#

Does that mean your connection is failing?

heavy knot
#

idk

tawny temple
#

Which host are you connecting to?

heavy knot
#

what do you mean?

#

self.client = MongoClient("mongodb://mongodb:27017/")
this?

tawny temple
#

Yes

heavy knot
#

well that's what it is

tawny temple
#

I don't know what the default port for it is but the host should be mongo since that is what you named your service

heavy knot
#

ohhhh

#

also that's the default port yeah

#

so when I do docker images I get a bunch of images that look like this:

<none>              <none>              0793232e344a        44 minutes ago      1.04GB
<none>              <none>              4f905f46b7b2        2 hours ago         1.36GB
<none>              <none>              36623f60d28a        2 hours ago         1.04GB
#

how do I remove these?

tawny temple
#

docker rmi <id>

heavy knot
#

I have to do each one

#

damn

thorny shell
#

you can script it

#

something like docker images | awk '{print $3}' | xargs docker rmi

#

untested, warning

heavy knot
#

I know with other things theres like a prune command or smth

tawny temple
#

docker rmi $(docker images -q) would be simpler

#

That would remove all images

heavy knot
#

oh sick

#

I did it!!

#

I created a fresh VM and did the commands

#

all I had to do was clone the repo, create the config, and do docker-compose up --build

#

and boom, everything

#

woaahhhh

#

docker is cool

rare mirage
#

You can squash them with the previous commit and pretend that nothing happened
@warm pollen Nice. Thanks.

obtuse saddle
#

What's best Pycharm keymap that works both on Linux Mint and Windows 10?

#

I used VS keymap (since i was a bit familiar with it), but it had plenty of conflicts with system hotkeys

frank compass
#

default keymap

obtuse saddle
#

Intellij IDEA Classic?

#

I used VS keymap, but it had some conflicts on Linux Mint, so I'm looking for a replacement.

heavy knot
#

default keymap

vivid cargo
#

atom keymap is awesome, i use it all the time

north latch
#

I am using pycharm...whenever I try to add all the files in my directory, I get a popup that says "Confirm Force Add Directory"...The following directory may contain ignored files. Do you want to force add it? " I just always hit cancel, but is this expected? Is it just making sure that the files in my .gitignore that I really want to ignore them?

sand thistle
#

sooo i have to take all my separate scripts

#

and put them all on git

#

and potentially merge a few repos

#

im curious what the best practices are

#

do you usually keep separate branches for similar scripts that may potentially work together

#

or what's the best practices for using branches? Am I just to be as creative as I want.

blazing condor
#

one project typically uses branches for development on different features

sand thistle
#

ah cool

#

that makes sense

#

so then merging branches shouldn't be that uncommon

blazing condor
#

that is very common

sand thistle
#

I have to reinstall my computer and so I'm going to back up all my scripts first

#

I messed up my PATH file

blazing condor
#

that's what PRs are

sand thistle
#

PR?

blazing condor
#

a pull request - a request to merge a branch into another one

sand thistle
#

ah

blazing condor
#

.issue 813 bot

signal cloakBOT
blazing condor
#

here's an example of a currently open PR

sand thistle
#

not sure what I'm really looking at to be honest

#

it's some text on caching

finite fulcrum
#

Don't mind the text

#

The pr is linked to a branch that's x commits in front of the tracked branch (commonly master)

#

It's kept separate while in development, then after it's finished (and reviewed) it's merged with the tracked branch; moving the commits there in some form

sand thistle
#

oh so you guys are like debating wether or not to merge

finite fulcrum
#

it allows people to review the changes, you to keep track of them etc.

sand thistle
#

I see

#

im reading this thing on how to merge

blazing condor
#

i've never merged two repositories together before

#

seems interesting

sand thistle
#

it just seems like the next logical step though doesn't it?

sand thistle
#

having difficulties pushing something to aremote repo

tawny temple
#

CAn you elaborate on the difficulties?

sand thistle
#

tried to do git push origin master

#
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.
tawny temple
#

It means your local branch is out of sync with the remote

#

The remote has changes which you lack locally, and you also have some local changes which the remote doesn't have.

sand thistle
#

I mean I added a readme I guess

#

it's my first push to this remote repo

tawny temple
#

Did you try pulling?

sand thistle
#

not yet

#

it's just git pull

tawny temple
#

Yes

#

You may need to set up the branch to track a remote if you haven't done so yet

#

Git will let you know if you need to do that

sand thistle
#

i added the url

#

and logged in

#

not sure

#

so i did git pull origin master

tawny temple
#

Now try to push

sand thistle
#

uhh

#

i did

#

git push origin master

tawny temple
#

And?

#

Did it work?

sand thistle
#

nope

tawny temple
#

Same issue?

sand thistle
#

yep

#
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
#

so i guess git pull again?

tawny temple
#

What happened when you pulled earlier?

sand thistle
#

it's actually a bit different

#
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.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
tawny temple
#

Can you see which commits you're missing if you compare the remote log to the local one?

sand thistle
#

uhh

#

well I'm not sure what I'm supposed to look for

#

like my remote one just has an initial commit with a readme

tawny temple
#

And locally?

sand thistle
#

my local one just said ```initial commit, completed xyz_script

tawny temple
#

So remote and local each have one commit?

#

But they are different commits?

sand thistle
#

looks like it

#

I didn't think that mattered

tawny temple
#

Did you amend a commit or something?

#

No it absolutely matters

#

You need to make changes on top of the history of the remote, otherwise you break the history.

sand thistle
#

yikes

tawny temple
#

You could do a force push, but that is generally not something you should be doing, especially on the master branch and if you're collaborating with others.

sand thistle
#

so

tawny temple
#

You could either reset your local branch to be even with the remote and just re-create the commit. If you would like to save your changes before resetting you could do that to by stashing it first.

sand thistle
#

I'm trying to figure out where I went wrong.

tawny temple
#

Well how did you create the commit?

sand thistle
#

I started locally then tried to do a remote push

tawny temple
#

There's a lot of in between steps you left out

#

Go into more detail

sand thistle
#

i don't use git often

#

basically i just did git ini

#

init

#

touch gitignore

#

then added my files etc to the .txt

#

then git add .

#

then git commit

#

wrote my title

#

and so on

tawny temple
#

Did the remote already exist before you did git init?

sand thistle
#

then i tried to set up the remote

#

no i create the remote after

tawny temple
#

No I mean

#

Did you already have a repo with a commit on GitHub before you started working on it locally?

sand thistle
#

no

#

oh you mean any?

tawny temple
#

I mean the specific one you are working on

sand thistle
#

then no

tawny temple
#

OK so go on about creating the remote

sand thistle
#

maybe the way I created the remote repo and tried to link it

#

I'm not certain all the steps I took to be honest

#

I'll try to be specific

tawny temple
#

When you create the repo on GitHub it may do an initial commit by adding a readme or a license

#

You could disable that by unticking two boxes

#

But if you left them ticked, then that's probably where the remote commit came from

sand thistle
#

that's what I said earlier though, yes that's what happened

tawny temple
sand thistle
#

i said it's probably cuz I have a readme

tawny temple
#

OK, sorry. You mean this?

#

like my remote one just has an initial commit with a readme

#

It wasn't clear whether you made that commit.

#

I assumed you made it

sand thistle
#

i did

tawny temple
#

Did you push it?

sand thistle
#

when i created the online repo

#

yes

#

like once i created the repo and copied the url

#

then i did

#

git remote add origin <urlgoeshere>

tawny temple
#

So GitHub did not automatically create a commit for you when you create the repo on their website?

thorny shell
#

don't think so

#

might be an option though

tawny temple
#

Yeah it's what I have pictured above

thorny shell
#

they might make an initial commit with a README, but that'd be optional if so

sand thistle
#

it's just an initial commit

tawny temple
#

If that's what happened, then I can make sense of the situation and how local and remote are out of sync

#

So you pushed one commit yourself and now are trying to push a new commit? If yes, how did you create the second commit?

sand thistle
#

i didn't push anything to the remote repo

#

that's why im getting this out of sync issue

tawny temple
#

But you said you did earlier when I asked you

#

So, the situation is: there is a total of one commit each on the remote (GitHub), and one commit locally. They are two different commits. You never successfully pushed from local to remote. Therefore, the remote commit was very likely created when the repo was created. I've been trying to confirm but you've been saying that you created it rather than GitHub.

#

So, I am confused.

sand thistle
#

therefore, the remote commit was very likely created when the repo was created.

#

i manually went into github created a repository

#

when you do so, you are given the optino to add a readme

#

that's when the remote repo created the inital commit on github

tawny temple
#

Ok, got it. That's what I was trying to confirm earlier.

#

The reason things went wrong is that you never pulled from the remote before you started working locally. If you cloned the repo rather than using git init, you would have had that commit locally and avoided problems. This is cause git clone pulls changes from the remote but git init creates an empty repo locally.

sand thistle
#

i started working locally and then tried to push to remote

tawny temple
#

If you used git init you'd have to do git remote add origin ... and then git pull and only then could you start your work

sand thistle
#

i store things locally then when im ready i push to the remote repo usually, i rarely push to remote though

#

trying to do that more

tawny temple
#

My point is that you needed to add the remote and pull as soon as you did git init.

sand thistle
#

i mean i didn't change the code

tawny temple
#

If the remote repo was empty, then you could have done it whenever you want.

#

But you did, you created a commit.

sand thistle
#

but because there's a readme?

tawny temple
#

The one you're trying to push now

sand thistle
#

i mean i didn't change the code

#

But you did, you created a commit.

#

im confused here

tawny temple
#

Huh?

sand thistle
#

what do you mean

tawny temple
#

What are you even trying to push if you never made any changes?

sand thistle
#

my code is done

#

i want to put it on github

#

i am going to reinstall my computer

tawny temple
#

Then you did change code

#

You made changes to the repo

#

you're trying to add something that did not exist before

#

that is a change

sand thistle
#

i didn't change code though, you keep saying this. my code is finished.

#

i added an online repo

tawny temple
#

But the remote doesn't have code

#

It's only local

#

As far as the remote is concerned, it's getting something new. Hence changes.

sand thistle
#

yes but when you're explaining this

tawny temple
#

Let's put it this way, you made changes to the repository, not to the code.

sand thistle
#

you're not being specific

#

thank you

#

that's specific

#

alright so im still stuck though

tawny temple
#

Just do a force push unless you really care about saving that readme on the remote

sand thistle
#

idc about that tbh

tawny temple
#

What do you mean? As in, you're not sure if you want to keep the readme. Or that you don't know how to force push?

sand thistle
#

force push, im googling it now

tawny temple
#

git push -f

sand thistle
#
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

#

looks like i gotta set the upstream?

#

i don't want to screw this up, as you can see debugging git pushes is a bit difficult for me

tawny temple
#

do git branch -u origin/master

#

Then do git push -f

sand thistle
#
Branch 'master' set up to track remote branch 'master' from 'origin'.```
#

what did you jsut do here

tawny temple
#

Set the upstream for the branch

sand thistle
#

that worked btw, but im curious for my own knowledge

tawny temple
#

So when you pull and push it will automatically use origin/master if you leave it unpsecified

sand thistle
#

i see

#

so what should i have done, what caused this error. Simply by opting to add a readme file when i created the online repo?

sand thistle
#

ive never had to clone a remote repo just to push

#

either way the point is to have a blank remote repo

#

the concept of having to pull from the remote before I started working normally seems backwards to me

#

you have to make code first, then share it. That's how I kind of look at it.

#

so I don't understand why by default people would pull from something that's already remote/shared

#

even if it's blank

#

i mean i guess to work on something already in progress >.<

tawny temple
#

That's how the git history works, it's built on top of older history.

#

If you try to push with a different history, git won't be able to reconcile it

#

Like, in your situaiton, git was thinking "the remote says xyz is the first commit, but this person trying to push is saying abc is the first commit"

#

It would not think "I have xyz and this person is pushing abc, so I'll add abc after xyz"

heavy knot
#

do you need to do git fetch before you git checkout

#

because I know git pull automatically fetches

#

does git checkout automatically fetch as well

#

is there a way to specify that you want git checkout to fetch?

tawny temple
#

It does not automatically fetch

#

And as far as I know there's no way to specify to fetch

#

You could create a git alias for it though

heavy knot
#

ah, so I have to do git fetch && git checkout

#

thats sus

tawny temple
#

Yes

#

I have an alias that uses something similar

#

It's perfectly fine

heavy knot
#

huh

#

ok

sand thistle
#

I see thank you Mark

#

on a separate note: im curious though, i suppose I need to use a branch in my situation. I want to group several scripts together that work with a specific software, but my scripts might not necesarily integrate into one piece of software.

#

if that makes sense

#

basically my scripts won't expand on the functionality of each other

#

they're just different solutions for different problems, stemming from the same software that I'm trying to build around

#

I don't think having separate repos make sense

#

like is it common practice to have several .py files on separate branches?

#

they don't necesarily have anything to do with the "master" branch

tawny temple
#

You can do it however you want if it's just for personal use

#

But as far as best practice is concerned, to me having orphaned branches seems like an abuse of the branch feature.

sand thistle
#

hmm

#

I'm concerned that when people will lok at the repo I'll give off the impression that I don't know what the best practices are

#

and like for example

#

if I was building a scraper for several websites, with the intent of gathering specific data based around a category of things

tawny temple
#

IMO branches should be used for development, not just for storage.

sand thistle
#

that seems to be the common practice

tawny temple
#

In your case I'd just create subdirectories for the different groups of scripts

sand thistle
#

subdirectories?

tawny temple
#

Folders

sand thistle
#

oh you mean in my IDE>

#

?

tawny temple
#

Not necessarily your IDE, I mean the file structure of the project

#

Like in the root directory of the repository there could be several folders each containing different groups of scripts

#

But really if they're so unrelated then they should be in separate repositories

sand thistle
#

idk how to make subfolders in the root of the repo

#

let me google

#

well these scripts are really to provide extra functionality to an old antiquated COBOL emulator

tawny temple
#

Which OS are you using?

sand thistle
#

mac

#

unix

#

i saw this post, but it's for the web browser

tawny temple
#

So if your repo is cloned to ~/my-repo then :

cd ~/my-repo
mkdir some_dir_name
mkdir another_dir
#

and so on

sand thistle
#

i mean i already pushed my script to a remote repo

#

can't now insert a folder at the root

#

it says online the git repo should be stored under .git folder in my project

#

i see no such folder

tawny temple
#
cd ~/my-repo
mkdir some_dir_name
mv my_script.py some_dir_name/
git add .
git commit -m "Moved script inside a directory"
git push
#

I don't know what you're reading but no, you don't need to mess with the .git folder.

sand thistle
#

im assuming by ~/my-repo you mean the directory in which my project is stored

#

locally

tawny temple
#

Yes

sand thistle
#

alright thanks, i have to give it some thought

#

what the best structure would be for this

dull halo
sand thistle
#

is there a quick way to streamline pushing multiple projects to git

somber lion
#

Git is command line, so you can just write a batch file which pushes each.

sand thistle
#

I actually meant github tbh, but I'd need to push all to fit first I guess

#

That's a great idea

#

do you think it will cause an issue if some of them may already be pushed to github'

#

I have to reinstall my computer and I want to push everything to github

tawny temple
#

If there are no changes to push then it will just do nothing

sand thistle
#

i was thinking about pushing different scripts to different repos using a batch file

#

or something like that

#

im still trying to figure out how i would go about deciding how to group my scripts together

#

was looking at this

north latch
#

I have noticed some python code I am looking at, when calling class methods they do
App().run()
instead of

   a.run() ```
On the first option, How does that work?
tawny temple
#

It skips the "middleman" variable and directly uses the return value, which is an instance of a class, to call the run function

#

Oh this should have been asked in a help channel rather than here in tools

neat falcon
#

in readthedocs, how can I additionally install a package via pip? I'd prefer to not have to vendor/submodule the package

#

I'm just looking for a quick pip install [package]

#

I don't know where to put this in the config yaml file though

tawny temple
#

Try this ```yaml
python:
version: 3.7
install:
- method: pip
path: pkg_name

neat falcon
#

that didn't work, it tried installing the package as if it was local (Hint: It looks like a path. File './package' does not exist.)

tawny temple
#

I was worried it might

#

That's a shame

#

It supports a requirements file

#

Multiple of them

#

I know it may not be particularly convenient to have to create a file, but that should work.

neat falcon
#

:// yeah I'm using that for now but I'd rather not because I'm using poetry

#

it's still not working as expected, since it's not installing my package itself

tawny temple
#

You probably need to do what I showed above to install your own package

#

Except use . as the path (assuming it's in the current directory)

neat falcon
#

yeah I just tried that and it worked 🙂

#

thanks so much for the help!

tawny temple
#

You're welcome

#

I imagine poetry supports extra packages so maybe you can use that to install that other dependency and git rid of the requirements file

#

@neat falcon

neat falcon
#

yeah I currently have the other dependency in the dev dependencies section. I don't want to mess with RTD anymore for now, but I'll keep your suggestion in mind

sudden path
#

To those who have or clone a lot of repositories on github on to your computer, how do you guys organize those repos, do you keep them all in the same folder? or do you have many folders that organize those repos in some way?

fast garnet
#

I keep them all in the same folder, I have ~40 repos or so

#

Anyone here familiar with enjarify?

tawny temple
#

I have a folder with subdirectories for different languages

#

If there's a group of related repos I may consider making another subdirectory

heavy knot
#

so what I do docker logs even when there's an error sometimes it doesn't show up in the log until more text is printed to the log

tawny temple
#

What if you use -f option?

#

It may be due to buffered output

heavy knot
#

buffered output?

#

also can I specify -f inside of a docker-compose

#

oh and also I found the way to make it restart on crash restart: always

#

🦀 I never need to touch systemctl again 🦀

tawny temple
#

Buffered means it waits until a buffer of a certain size is filled up before flushing the buffer (i.e. outputs the contents of the buffer and empties the buffer)

#

I doubt -f can be set inside the compose file

#

That'd be weird

heavy knot
#

I don't want to pass in so many arguments every time I do docker-compose up tho

#

like rn I have to pass --build -d and now -f

tawny temple
#

-f is for docker logs, not for docker-compose

#

Completely separate command

heavy knot
#

oh

#

wait what does -f do then?

#

I thought python had like a PYTHONUNBUFFERED or smth

tawny temple
#

It's in the docs

#

The docker logs --follow command will continue streaming the new output from the container’s STDOUT and STDERR.

sand thistle
#

have you pushed things to git/github using a bash script?

#

I'm trying to read up more on it

tawny temple
#

Sometimes pip takes a few minutes to resolve connections to pypi. It just gets stuck on Starting new HTTPS connection (1): pypi.org:443

#

If I restart the OS, it is all fixed.

#

I still have internet, and it does manage to install things eventually

#

But waiting like 3 minutes for it to even start doing anything is not acceptable

#

Not sure if this is an issue with pip or with my arch vm

hollow swan
tawny temple
#

dig was fine so I suppose that means DNS may not be an issue

#

openssl hangs though

#

Assuming I used it right ```
openssl s_client --connect pypi.org:443

#

I came across something about disabling ipv6 so I did that and I'll see if the issue still crops up again in the future

sand thistle
#

well i don't know what's going

#

my projects virtual env is all off

#

and now for some reason there's no git

#

fatal: not a git repository (or any of the parent directories): .git

#

even though my script was already pushed to github

#

i don't even know how this happened, and what to do, where to start

#

never mind

#

venv is still off, but i just wasnt in the right directory

heavy knot
lavish cosmos
#

@heavy knot something seems wrong with your spaces? Are you using some weird keyboard or copy paste from some web page?

heavy knot
#

found the problem

#

there should be no \ in the end of string

spiral valve
#

!dark

rancid schoonerBOT
#

Mutable Default Arguments

Default arguments in python are evaluated once when the function is
defined, not each time the function is called. This means that if
you have a mutable default argument and mutate it, you will have
mutated that object for all future calls to the function as well.

For example, the following append_one function appends 1 to a list
and returns it. foo is set to an empty list by default.

>>> def append_one(foo=[]):
...     foo.append(1)
...     return foo
...

See what happens when we call it a few times:

>>> append_one()
[1]
>>> append_one()
[1, 1]
>>> append_one()
[1, 1, 1]

Each call appends an additional 1 to our list foo. It does not
receive a new empty list on each call, it is the same list everytime.

To avoid this problem, you have to create a new object every time the
function is called:

>>> def append_one(foo=None):
...     if foo is None:
...         foo = []
...     foo.append(1)
...     return foo
...
>>> append_one()
[1]
>>> append_one()
[1]

Note:

• This behavior can be used intentionally to maintain state between
calls of a function (eg. when writing a caching function).
• This behavior is not unique to mutable objects, all default
arguments are evaulated only once when the function is defined.

spiral valve
#

any dark mode for idle

vivid cargo
#

idle takes your terminal color scheme

modern oxide
#

Any Visual Studio Code users here?

vivid cargo
#

✌️

heavy knot
#

I'm trying to install jupyterthemes using conda and it's just been spinning for 30 mins and says "Solving environment"

heavy knot
#

Is there a way to install powerlevel10k for windows?

#

I have ubuntu (shell) and zsh installed

#

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

#

I did that in my shell

#

https://www.youtube.com/watch?v=su0h5StEZ6A

#

I'm watching this tutorial ^

#

And as the tutorial told me to type p10k configure, the shell tells zsh: command not found: p10k

#

I have this directory here

#

I don't know where the configuration is and how do I run my config setup in the shell

#

Can I get any help?

tawny temple
#

Haven't seen what the tutorial said but here are the instructions from the official docs

#
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
heavy knot
#

@heavy knot I also use vscode when I'm doing pentesting and I've been handed a project

#

yay!

#

Can you give me your plugins and settings please

#

I'm running low on them

#

My editor is almost with basic configurations

#

I use the default plugins or whatever, I only install language support for whatever project I'm working with

#

it's the main reason I use VSCode for it, installing language support is pretty easy and it can do pretty cross-referencing

#

oh!

#

Is vim very comfortable in linux?

#

I'm comfortable with vim

#

it has a very steep learning curve

#

hm!

#

I used it on-off for a few years before I finally decided to invest in properly learning its functionality

#

oh!

#

what's the terminal you use?

#

(Pretty sure you use zsh with p10k don't you)

#

zsh is the shell (which I do use), urxvt is the terminal

#

urxvt?

#

Is it limited to linux?

#

pretty sure it is, yes

#

very minimal terminal emulator with no bloat (no menus etc)

#

hm

#

Thanks for answering! 😄

#

I'll go watch some tutorials

#

Wait!

#

yeah?

#

before that, would you recommend me a python project for beginner?

#

I made a discord bot

#

depends on how much of a beginner you are

#

Can I dm you the invite link?

#

You can see what my skills are, if you look at the bot I made

#

you can leave after you see the bot

#

try looking around in #303934982764625920 to see what others have made and maybe draw some inspiration from that

#

ehhh I'm currently a bit too busy for that, sorry

#

oh okay

#

sorry

#

np!

topaz aspen
#

@heavy knot vim is good to learn - I differentiate between vim keys and vim though. So, I use vim keys with anything that I use, but I don't use vim. I use vim for bits and pieces, but mainly I use vscode.
If you want to learn vim keys then vimtutor is the best place to start, I'm not sure how to start that on windows you'd have to have a search for it

heavy knot
#

I'm good with VSCode, thanks for the advise @topaz aspen! 😄

topaz aspen
#

vscode has a vim mode, that i use

#

you will have to go through vimtutor a couple of times first tho, before using it much

sly crystal
#

Hi guys, I'm new to coding and right now starting with python. Is there any IDEs that I can use for free in my own computer? Or something to start practicing my skills on?

thorny shell
#

lots of IDEs. Pycharm, VS Code immediately come to mind

#

probably others

#

I can't recommend any because I don't use them, but they're popular

sly crystal
#

@thorny shell Thanks, I'll see to them.

thorny shell
#

💐

obtuse saddle
#

Is it possible to integrate cookiecutter and Pycharm's project templates?

#

I can create project with cc and open it in pycharm. But i would like to do it in one place.

sand thistle
#

is it best practice to add the gitignore file to a remote repo?

violet belfry
#

.gitignore should be version controlled, yes

topaz aspen
heavy knot
#

What's the best software or managing tasks, deadlines, etc? For software dev above all else, but ideally it'd be suitable for all tasks - development oriented or not.

true vapor
#

The best depends on a lot of factors. Jira is probably the most common thats used inside companies though

heavy knot
#

Is it free? What sort of factors should I take into consideration?

thorny shell
#

wow

#

there are one billion choices.

#

and I'm not in love with any of them

#

if you're at a really small scale, I'd start with whatever you're already using -- maybe google calendar or the apple or microsoft equivalents.

#

they're certainly not ideal, but they have the advantages of being free, and you already know how to use them

true vapor
#

If you're on a small scale, trello or github issues+projects is what I'd reccomend

thorny shell
#

I love trello, but I use it the way other people use pinterest -- to keep track of stuff I want to buy

#

(it's pretty clearly designed to be used for agile programming, so who knows, maybe it's good at that too 🙂

#

I'd be slightly wary of github, though, since if you start using it, you'll be locked in

#

I don't think they let you export a lot of your stuff

#

hope I'm wrong

true vapor
#

You can export issues as CSV. I don't know about the project boards though

thorny shell
#

trello lets you export as JSON; I assume that's essentially lossless

true vapor
#

well, issues as CSV lets you import them directly into gitlab (and probably bitucket). Gitlab issues is what I use to track stuff for the very small (3 people) team that I'm on - I really don't see any good solutions though

thorny shell
#

and don't get me started on bug trackers -- I've never seen a good one

#

actually the one in github could easily be the best there is

#

(I've barely used it)

vivid cargo
#

@heavy knot jira or trello, they have different uses but can be used for similar things

#

jira is more like issue tracker and is team oriented

#

and trello is more like TODO tool that can be customized and manipulated to serve as issue tracker or WIP tracker

sand thistle
#

anyone have advice for homebrew

#

I just did upgrade && update

#

and it messed up some dependencies on for my project

#

looks like it upgraded it pyenv, and now my project is looking for the old file path...

#

tired of this BS, keeps messing with my projects.

#

it messed up my shims

#

so i go into ```cd /Users/adkjaskjda/.pyenv/shims/

#

and there exists pyvenv and pyvenv-3.7

#

just in the shims directory

#

and a scrapy

#

I guess I have to check my bash profile because it may be pointing to something that doesn't exist anymore

kind chasm
#

@heavy knot

#

fits into one simple markdown file

modest salmon
#

hi all

heavy knot
#

If this is print of my "response.text", how can I get the value from "title" which is "Dried apples"?

I've tried for key,value in reponse.text.items():
print(key) but that doesn't work, reponse.text[0] prints "["

tawny temple
#

This is not the right channel. You should ask in one of the available help channels.

heavy knot
#

for i in range(len(response.text)):
for key,value in json.loads(response.text)[i].items():
if(key=="title"):
print(value)

#

answer if anyone needs

kind kindle
#

I was wondering if anyone knew hot to solve "SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81"

I've downloaded version 81, made it my default browser and uninstalled 80 to then see the message cannot find chrome. So i re installed version 80 and 81 is still my default and it wont go at all. Is there a way to force it to use verson 80?

kind kindle
#

I was wondering if anyone knew hot to solve "SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81"

I've downloaded version 81, made it my default browser and uninstalled 80 to then see the message cannot find chrome. So i re installed version 80 and 81 is still my default and it wont go at all. Is there a way to force it to use verson 80?

heavy knot
#

Guys I am using a app in my android but they mb blocked my so i need to connect to vpn to get the access of that app but i want to record a requests session of that app by charles. Is any possible way to record requests session from an android which uses vpn to get access of that app?

topaz aspen
#

vscode often overwrites a tab, i want to open a file in a new tab

#

is there something obvious im' missing there?

violet belfry
#

Try disabling those two

topaz aspen
#

ok cool - thanks

finite fulcrum
heavy knot
#

pycharm is an absolute pain for me

naive cypress
#

Hey can anyone help me with de-compilation?

north latch
#

I love pycharm. It tells me what to do to fix issues in my code 🙂

heavy knot
#

Does anyone know where I can host a script for free?

thorny shell
#

it won't act as a web service, though, if that's what you're hoping for

trim cloak
violet belfry
#

One Dark Pro or Atom One Dark probably, the emojis are just your system font

trim cloak
#

Thanks... Can i change it?.. Imean the font of my system... It doesn't show emoji's...

violet belfry
#

Yes, you can change your system fonts

trim cloak
#

Thanks

shut hornet
#

Hey guys I need help with python
I need to add an interpreter in my settings
I try to choose my interpreter but then this pops out

#

And also what is SDK?

#

Probably i asked a question in a wrong way so we can contact via google hangouts

shut hornet
#

Ok now it works
I had to download it again

peak mirage
#

I can't get my virtual envs to behave normally in pycharm. Running pip -V and python -m pip -V produce different version numbers with my venv activated. I can't upgrade pip from the GUI because it uses pip. I can't upgrade pip with python -m pip because it's pointing to a different version. I can't install what I need with python -m pip ... because the packages end up in my system python folder, despite the venv being activated. What in the actual fuck is happening here

lost rock
#

can you check type -a pip and type -a python as a start?

peak mirage
#

not sure what you mean, sorry. running those commands as written just results in an error

lost rock
#

what error?

#

oh, are you on windows btw? I just assumed Linux

peak mirage
#

windows

lost rock
#

ok, then I don't know anyway, sorry lemon_unamused

peak mirage
#

ok, thanks for trying

#

I think it's an issue with how pycharm sets up the venv because I just deleted it and made one from the command line which is not nearly as convenient but seems to have worked, and now works within pycharm as well

warm pollen
#

You can also do where <executable> to know if you’re executing the system interpreter of the venv

edgy basin
#

How do you configure VSCode?

heavy knot
#

I need that too, or a guide through how to tabulate the lines selected or auto tabulation

junior bronze
#

Jython works by compiling Python source into Java byte code and executing it in the JVM in the same manner as Java. ... I think Jython is better suited for integration with existing Java libraries.
so jython is faster
then why people don't use jython
?

stable cloak
#

@junior bronze Because it hasn't kept up with the CPython versions, and people want the new features they often bring

junior bronze
#

u mean they not compatible

#

if so why don't they just copy the python code and paste in cpython

tired aspen
#

yes, that's why people use cpython - to use the latest python features 🤣

summer tulip
#

Sorry no one have a pyton program for android to get te color of one pixel

#

On the screen?

junior bronze
#

process share same code ? what does it mean unable to understand

junior bronze
#

i need some help

#

object create process

warm pollen
#

You have to tell us more

kindred forge
#

what does that mean? venv?

#

@coarse rapids

coarse rapids
#

A virtual environment for a single project, it switches Python interpreters and modifies the path

#

So you can have different packages installed under different projects

#

The fact that you said a package you installed wasn't available in vscode means you're possibly in one

#

Can you compare the output of a few lines of Python in regular powershell and VScode powershell?

import sys
print(sys.executable)```
#

just run python.exe and paste that in

kindred forge
#

run python?

#

ok

coarse rapids
#

inside powershell yes

kindred forge
#

sure

#

in vs code:

#

C:\Users\Helio\AppData\Local\Programs\Python\Python37\python.exe

#

and the regular powershell is the same

#

C:\Users\Helio\AppData\Local\Programs\Python\Python37\python.exe

coarse rapids
#

hmm, ok, so maybe you're not in a venv

#

What was the package you installed that you couldn't use?

kindred forge
#

let me paste the environment path on both:

coarse rapids
#

k

kindred forge
#

vs code powershell:

#
Name  : Path
Value : C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\sqlite3;C:\xampp\php;C:\Program
        Files\PuTTY\;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\xampp\pgsql\12\bin;C:\xampp\pgsql\12\lib;C:\Users\Helio\AppData\Local\Programs\Python\Python37\S 
        cripts\;C:\Users\Helio\AppData\Local\Programs\Python\Python37\;C:\Users\Helio\AppData\Local\Microsoft\WindowsApps;C:\Users\Helio\AppData\Local\Programs\Microsoft VS Code\bin;C:\PHP7;C:\Program    
        Files\Git\cmd;C:\Users\Helio\AppData\Roaming\Composer\vendor\bin;C:\Users\Helio\AppData\Roaming\npm
#

regular powershell:

#
Name  : Path
Value : C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\
        System32\OpenSSH\;C:\sqlite3;C:\xampp\php;C:\Program Files\PuTTY\;C:\ProgramData\ComposerSetup\bin;C:\Program
        Files\nodejs\;C:\Program Files\Git\cmd;C:\xampp\pgsql\12\bin;C:\xampp\pgsql\12\lib;C:\ProgramData\chocolatey\bi
        n;C:\Users\Helio\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\Helio\AppData\Local\Programs\Python\P
        ython37\;C:\Users\Helio\AppData\Local\Microsoft\WindowsApps;C:\Users\Helio\AppData\Local\Programs\Microsoft VS
        Code\bin;C:\PHP7;C:\Program
        Files\Git\cmd;C:\Users\Helio\AppData\Roaming\Composer\vendor\bin;C:\Users\Helio\AppData\Roaming\npm;C:\Program
        Files (x86)\GitHub CLI\
#

so I installed chocolatey and github cli

#

but none of the are available in the visual code powershell

coarse rapids
#

That doesn't appear to be Python related. I think this might be solved by forcing all open programs to refresh their environment variables by logging out of Windows and back in

#

you shouldn't have to reboot

kindred forge
#

right

#

I thought I didn't that and it didn't work

#

let me see

#

when you say windows, you visual studio, right?

coarse rapids
#

No, I mean actually sign out of Windows

kindred forge
#

right

#

I see

#

sure...

coarse rapids
kindred forge
#

let me try then...

coarse rapids
#

rip

#

they died

kindred forge
#

@coarse rapids just came to tell you that logging out Windows did solve the environment variable issue from the vs code integrated terminal

#

just like you suspected! 🙂

#

thanks a lot once again for you help. Really appreciated 🙂

coarse rapids
#

Glad

#

No problem

idle lance
#

how to go live on discord?

#

i am on mac

#

i am clicking on go live

#

but it starts and ends itself

#

i have enabled streamer mode

#

and developer mode

warm pollen
#

It is disabled on this server

modest lantern
#

what are advantages of sublime text over notepad++

tawny temple
#

The plugin ecosystem seems much more mature for sublime

finite fulcrum
#

I use notepad++ for simple viewing and edits but can't say that the few plugins I got were very conventient to get

inland osprey
#

Has anybody used any SMS phone messaging modules or APIs? From what I understand you can buy phone lines from sites such as Twilio per month but is there any way to text and receive data through your own personal phone?

pure pulsar
#

i did use twilio, i also did use an android phone to automaticaly send and receive sms messages

#

for android it's just a matter of creating an app that does it using the android api, and to give yourself an api to do it, so you can send a request to your phone using http or whatever, and let it send the message

flint badge
#

I was told to discus this here.
Hey everybody,
I'm curious, I'm new to Branching and Pull requests and such on Git.

What is your standard for how many branches you use? Now that I understand this, I'd make a branch for my Header, Footer, BlogPage, and everal things that will be having several updates moving forward. But I'm curious about how you manage your branches etc. Thank yo.

inland osprey
#

@pure pulsar Ok thank you

pure pulsar
#

@flint badge i don't think you have parts of your page in different branch, basically you create a branch when you want to work on something, and you merge it into master when it's ready, branchs can be short lived, a few commits and then merged/destroyed

#

they are mainly useful for two things, collaboration with other purpose, collaboration, and release management, as you can work on something without disturbing the main version, it allows people to work each on something at the same time, and if something is not merged, you can still release the main version, as the in progress code is not into it

thick patrol
#

not sure if this is the correct channel but here goes

#

we've a uni assignment and it has to do with machine learning

#

in short we annotated faces and lips in video segments, got the csv from the tool, and now I just finished a script to turn the csv to xml

#

our data is in the form of x, y, width, height, and we want to either extract these regions from each frame or apply a mask (i.e. blackout) everything outside the regions in the frame

#

we're planning on using ffmpeg for frame extraction

#

any suggestions would be greatly appreciated

violet belfry
#

Suggestions for...what?

thick patrol
#

how to go about extracting the areas or applying the masks

#

our data is ~1100 clips 0:01-0:006 seconds long, with 24fps

#

you can imagine it can't be done manually

jovial bronze
#

or it might be still loading...

finite fulcrum
#

did you try changing it to the correct one?

modest hazel
#

if you drop down the run configuration (on the top right where it says 'mythixgame') and click 'Edit Configurations' you should be able to set the right interpreter for 'mythixgame'

dawn depot
#

import nglview
from nglview.contrib.movie import MovieMaker
movie_6M71 = MovieMaker(view_6M71, output='view_6M71.gif', in_memory=True)
movie_6M71.make()

#

Anyone can help me with that?

heavy knot
#

@dawn depot hi! As this isn't necessarily related to tools, I recommend grabbing a help channel from "Python help: Available". More people will see it there

tawny temple
#

Any ideas which plugin would be causing SVG previews in Sublime Text?

#

I want to edit the XML, not see the image

#

I suspect it may be one of the latex plugins I installed

#

I have no idea how to see the code for the SVG

#

Oh never mind

#

I opened the png, not the SVG

#

:\

coarse rapids
#

:V

brazen venture
#

I'm trying to find a tool to scan a hard drive and create a database consisting of: file name, file type, date create, date edited, date access, and other meta data.

is there something that exists to do this?

#

I mean I have found things but I'm looking for something python and opensource

kind chasm
#

@brazen venture The journal of the file system is essentially already such a database

#

would be kind of redundant

brazen venture
#

Well I have millions of files that are from a system that was compromised and I'm trying to build a visual timeline using file info. It is not as easy a task as I thought it would be on the outset.

kind chasm
#

That does what you want

#

Make sure to mount any evidence ro

brazen venture
#

Cool! THanks I will try them out

heavy knot
#

I want to run a python script as a cronjob using google app engine. I get how to do that, but how can I log data to a file ON google cloud? how do I see files ON google cloud?

#

where are they stored?

#

e.g. if I want to log the time the cronjob is run to a CSV file

thorny shell
#

no idea!

#

well, OK I do have an idea

#

your cron job's stdout probably goes to a file on the host where cron is running

#

and that's automatically in the cloud.

#

But, how you can see that file; that I don't know.

#

never having used google's cloud stuff

zinc cloud
heavy knot
#

@zinc cloud what are you trying to do?

zinc cloud
#

import pandas

heavy knot
#

ah

#

you need to run this to install modules in a jupyter cell @zinc cloud

#
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install pandas
zinc cloud
#

that works, to install, which is what it was showing was ok, but then it fails the import step

frozen coral
#

conda keep install an older version of python

#

I use the command conda create --name threeEightWX python=3.8

#

and it still install 3.7.6

#

how do I get it to actually work properly??

finite fulcrum
#

@tawny temple Sorry for the ping but I'm not very well-versed with git and don't want to mess it up further; did the rebase and diff gets me this which looks correct

(bot) D:\pycon\bot>git diff origin/help-dormant-feedback help-dormant-feedback
diff --git a/config-default.yml b/config-default.yml
index 70c31ebb..89600397 100644
--- a/config-default.yml
+++ b/config-default.yml
@@ -112,7 +112,7 @@ guild:

     categories:
         help_available:                     691405807388196926
-        help_in_use:                        356013061213126657
+        help_in_use:                        696958401460043776
         help_dormant:                       691405908919451718

but I can't push it becaues the remote is forward by that change, should that be forced?

tawny temple
#

Yes, you have to force

#

Rebase rewrites history

finite fulcrum
#

Thanks, forcing is scary so didn't want to do it before making sure

zealous sluice
#

anyone here using VSCode?

#

im trying to save a "from x import y" halfway down my python file, but VSCode keeps on moving the import to the top of the file. I need it to run AFTER a configuration that I have set up. What settings can I change on VScode for it to not automatically format my file?

thorny shell
#

dunno, but I'd consider succumbing, and writing your code so that your import order doesn't matter

#

import-time side effects are evil

leaden flame
#

I'm struggling to get VsCode to recognize my python virtual environment in my project

tawny temple
#

Where is it located? In your project folder?

leaden flame
#

no, it's in a subfolder. the structure looks like this:

ProjectFolder
  - native
    - .venv
    - program.py
  - ...
#

And then I have.... wait.... wtf

#

somehow changing it to ".\.venv\Scripts\python.exe" fixed it?

#

after restarting the editor

#

ugh

#

so ridiculous

#

it will lose it again soon like last time

tawny temple
#

I suppose it only looks in the root of the project

#

And it makes more sense for it to be there anyway IMO

leaden flame
#

Well, it would if python were the only language I was using

#

But I'm writing a firefox extension

tawny temple
#

In any case, you can always manually specify a path

#

You can set python.pythonPath in the workspace settings

leaden flame
#

It won't recognize it unless it's at the root unless you create a workspace and then make the python folder (native in my case) to be the first entry in the workspace

#

I knew that already, but I had that and it STILL wasn't recognizing it after recognizing it before

tawny temple
#

When it recognises it, it saves its path to python.pythonPath in the workspace settings

#

If it no longer recognises it I would presume either it's been moved or your workspace settings were deleted

leaden flame
#

No, they were still there, Code was just being inexplicably finicky

tawny temple
#

Sorry, I haven't experience that. I don't know what could be wrong then.

leaden flame
#

kinda annoyed by it since now I can't track down why it screwed up in the first place

dense verge
#

Is there a reason why CTRL+Q doesn't work when using Dataclasses in pycharm?

#

it suggests named arguments correctly

#

but when I do CTRL + Q in the brackets of MyClass() I don't get any suggestions what arguments are available

hard karma
#

@dense verge

#

How do you do pip install on visual studio code on a mac?

dense verge
#

why do you ping me?

tawdry needle
#

in the Makefile generated by Sphinx, what does the $(0) variable do? as in

%: Makefile
    @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
#

wait... that's O

#

what the hell sphinx

candid maple
#

what is a good ide for postgresql?

#

similar to mysql workbench or something (free preferrably)

tawdry needle
#

not as good as mysql workbench but i've used pgadmin before and it was fine

#

there are also a few cross-platform ides that work with many diffferent databases like DBeaver and Squirrel SQL

rough marlin
#

anyone else having issues logging into aws rn?

unique knoll
#

Hi all - I am trying to learn how to use venvs for python, but I'm having problems with vs-code recognising my venv

#

I'm using a windows environment.

#
(venv) F:\Programming\Python\April-2020> cmd /C "set "DEBUGPY_LAUNCHER_PORT=1228" && C:\Users\12345\AppData\Local\Programs\Python\Python38\python.exe c:\Users\12345\.vscode\extensions\ms-python.python-202Users\12345\AppData\Local\Programs\Python\Python38\python.exe c:\Users\12345\.vscode\extn\April-2020\MyApp.py "ensions\ms-python.python-2020.3.71659\pythonFiles\lib\python\debugpy\no_wheels\debugpy\launcher f:\Programming\Python\April-2020\MyApp.py "
Traceback (most recent call last):
  File "f:\Programming\Python\April-2020\MyApp.py", line 3, in <module>
    from flask import Flask, render_template
ModuleNotFoundError: No module named 'flask'

(venv) F:\Programming\Python\April-2020>```
#

I have attempted to change the interpreter that vs-code is using, but it doesn't find the interpreter in my venv

heavy knot
#

@candid maple pgadmin

quasi topaz
#

have you ever heard of AWS

#

amazon web services

#

or GCP, google cloud platform

#

they are good places to start

heavy knot
#

Yes

#

Ik Google cloud platform

#

But isnt it $300

quasi topaz
#

on AWS a VPS is called a EC2

#

you can get a simple one for $5 per month

heavy knot
#

Is it good?

quasi topaz
#

it's AWS

heavy knot
#

Oh ok

minor herald
#

AWS / OceanDigital are great

heavy knot
#

K