#tools-and-devops

1 messages ยท Page 48 of 1

heavy knot
#

no I have tried

blissful sluice
#

oh really, might be your OS uses a lot alongside then

heavy knot
#

stuff like VM, K8s and Spark requires atleast 4GB of RAM each

#

and I have total 4

#

also DevOps would not make much sense if u only have 1 node, u should have at least 3 nodes?

blissful sluice
#

devops is a lot of things, not just running kubernetes

heavy knot
#

oh okay, but what is the final solution then , use AWS free tier without VM?

blissful sluice
#

I mean, you might as well sign up for all the free stuff you can, and if you don't have a credit card ,and AWS is the only one that'll let you have access to resources without a credit card, then it sounds like that's your only option

#

but I do recommend studying all the non-kubernetes stuff as well. you mentioned Ansible, but there's a whole bunch of other stuff too that you can do locally

#

don't forget stuff like Terraform and whatever, that should work well with AWS's free tier

heavy knot
#

Yep Terraform is also in the list

#

@blissful sluice thanks man

blissful sluice
#

also Ci/CD tools. Github Actions for example has a free tier, that works quite nicely for simple things

elfin ether
#

I think a good start is to learn about Docker compose, similar to Kuberntes but a bit lower level

blissful sluice
#

as I mentioned before, despite being a java app, Jenkins is also an option, but I have mixed feelings about Jenkins

#

I don't particularly like setting it up

heavy knot
#

I have Jenkins installed in ubuntu already, but I don't know how to find a project to use it

blissful sluice
#

and another important part of devops is log handling - so I suggest getting to grips with centralised logging. you already deal with Prometheus, but also check out logstash or stackdriver

#

that's the thing about devops, you can't really study it in isolation

#

you need something to actually deploy and instrument

heavy knot
#

...

blissful sluice
#

you can deploy open-source tools though

#

here'- a good one: deploy your own sentry server

#

since that's also ostensibly dev-ops related

heavy knot
#

oh nice, I'll try

blissful sluice
#

the open source edition of sentry is dockerized, and they have some nice guides to doing it. If you're going to mess around with Terraform, you could also consider doing the whole dns/mail thing - so register a domain, point the domain to AWS route 53, and have Terrafrom manage that. Set up Email authentication - DKIM, DMARC, etc., and then either use SES or Sendgrid and set up outgoing email alerts for your sentry box

#

hell, you could even play around with incoming mail if you wanted to

heavy knot
#

that's the idea, u r amazing

blissful sluice
#

here's an interesting thing you can do as well: do you know DDNS services?

#

you can run your own using Route 53 and some scripting

heavy knot
#

yep, I once saw a video where you can take a fee domain name and run the site with route 53

blissful sluice
#

oh, another dev-ops related thing, though this is more on the network admin side: VPNs. OpenVPN is actually quite easy to set up, you can run that in the cloud

#

I've set up three of those, and they're always handy, not just for accessing resources, but also if you need to bounce your internet connection around a little

#

if that stuff is relevant to you, then there's a couple more things: SSH and CA management, using something like Vault (hashicorp)

heavy knot
#

Vault stuff is related to terrraform right?

blissful sluice
#

generating SSH keys is annoying, you can have Vault handle your CA and key provisioning. You can set up proper host-checking on SSH keys with your own CA

#

same company - Hashicorp. different tools

#

I like Hashicorp, and I use Vault, Terraform, and Packer

#

I need to look into Consul, but might go with Istio instead

#

(service mesh)

#

Vault is for secrets management. These days instead of storing the database password anywhere, what happens instead is my deployed apps will fetch a JWT from the VM's infrastructure (something Google provides, allowing scripts to prove trust), and then use that to go to Vault and request the database password

#

Now my database password doesn't need to be stored anywhere in production. The only thing is needed is the fact that the script is able to prove to Vault that it is running from inside the infrastructure and should therefore be trusted to receive the database password

#

But Vault will also do key signing, as well as a couple other duties. it's a nice system to run

heavy knot
#

u sure know what u r talking about, u r good!

blissful sluice
#

the only other thing that I use that I haven't talked about is Apache Airflow, but that's mostly because I have some ETL workloads that I have to run

heavy knot
#

so do u know Kafka and ETL pipelines too?

blissful sluice
#

I don't recommend that as a thing to learn for studying devops unless you also have ETL tasks. But I like Airflow over alternatives like Spring Dataflow is its DAGs are in Python

#

and Python is clearly good because we're here on a Python server

heavy knot
#

Yes, I know good Python, Golang and C++

blissful sluice
#

are you familiar with serverless functions? AWS Lambda and GCP Functions etc.

heavy knot
#

I've heard about AWS lambda, never used it. I know the theory of many tools

#

Serverless computing

blissful sluice
#

ok, I think it's a pretty important technology this decade. I highly recommend being familiar with lambda. However, the reason I bring it up is because there's a very nice project called Kubeless which lets you run your own serverless functions on top of kubernetes

#

your mention of Go reminded me because Kubeless comes with a lot of runtimes, Go included. And honestly, I feel we're going to be seeing a lot more of serverless and service meshes this decade

heavy knot
#

nice

blissful sluice
#

I use Kubeless because I want to use serverless for some things, but I need some quite large libraries to be installed that I can't easily do in Lambda or GCP Functions, so I roll my own python runtimes with the libraries installed (it's easier than it sounds since the runtimes themselves are really just docker images)

#

anyway, that's what I know

heavy knot
#

well u know a lot ๐Ÿ˜„

sand thistle
#

soooooo pycharm doesn't support css unless you upgrade

#

that's a little ridiculous?

gilded quiver
#

hello, I am struggling with writing some python code using boto3 on an AWS EC2 instance. The issue is that I have an instance that has specific permissions to access a resource in AWS and have created a sts:AssumeRole policy. But when I try to use boto3 I do not understand how to assume the role in the client to whatever work I need. I can run the commands use the awscli just fine, but I cannot figure out how to do the equivalent in boto3. In other words, I do not have an explicit credentials key/secret, I am trying to use the instance assume role itself. Hopefully, I am making sense here, but can someone tell me how one goes about this?

clear girder
#

@gilded quiver If the instance has the appropriate rights, you just use the boto3 resource like you do with awscli

gilded quiver
#

hmm....

#

@clear girder i don't understand what I am doing wrong.... does the user have to be root or something for this to work?

#

it basically is claiming permission denied everytime I try

#

but the awscli works fine

clear girder
#

Are you managing instances in the same region?

gilded quiver
#

well, i am running the python code from the actual instance

#

so when i specify the command i do use the same region

clear girder
#

So what's the command you can do in awscli?

gilded quiver
#
  INSTANCE_UUID=$(aws ec2 describe-tags --region ${AZ::-1} --filters "Name=resource-id,Values=${INSTANCE_ID}" --query 'Tags[?Key==`instance_uuid`].Value' --output text)
#

for some reason the describe tags does not work in python

#

i kept getting permission denied

clear girder
#
import boto3

ec2 = boto3.client('ec2')
response = ec2.describe_instances()
print(response)
#

try running that real quick

#

And send a screenshot of the error

#

You might need to explicitly add the region

#

So it would be

#
import boto3

ec2 = boto3.client('ec2', 'us-east-1')
response = ec2.describe_instances()
print(response)
heavy knot
#

does anyone know how to remove a file from a specific branch

#

i accidentally published to the master branch, but meant to publish on my own branch

elfin ether
#

you can use git revert

elfin ether
#

git checkout branch, git revert <commit hash>, git push

heavy knot
#

i got it thank you

#

when you push a repo to a specific branch is it supposed to show up on the master branch as well or just the specific branch

elfin ether
#

only specific branch, unless someone merges it to master branch

heavy knot
#

omg yes i got it! thank you

wooden ibex
#

if you are using hosting service, you might consider setting it up to prohibit master branch pushes

lyric bobcat
#

in most Linux shells and I think also in cmd is this ESC + . functionality. What it does is, when you for example type:
mkdir ./path/to/file
and then:
cd ESC+. will translate to cd ./path/to/file.
Does this exist in Powershell too?

blissful sluice
#

try cd !!:2

#

oh in powershell? not sure

#

is it $$?

wooden ibex
#

@lyric bobcat no because Powershell returns result of mkdir so if you wanted to move to directory you created, you just pipe output of new-childitem to set-location

#

Or new-item for directories, Iโ€™m so bad with file manipulation in Pwsh that Iโ€™m always having to read documentation when I do it.

blissful sluice
#

$$ returns last token of last command, might be useful in some cases

lone linden
#

anyone got a handy program that lets you list and browse an s3 bucket?

blissful sluice
lone linden
#

anything for linux perhaps via cli

blissful sluice
#

then the usual awscli tools

#

DragonDisk, second link, is linux

lone linden
#

Not much experience with aws tooling or the like in general, thanks

heavy knot
#

Any recommendations for a macOS app to view the contents of hdf5 files?

wooden ibex
#

meseta, TIL about that in Powershell and also ugh, pipeline stuff

trail geyser
#

is there a way to see if a certain process is running by name on linux
I tried PSutils however when I try to install it with pip I get "can't find python.h" errors

eager cedar
#

@trail geyser htop?

#

But yeah ps -ax | grep -i $name if you could get ps working.

trail geyser
#

I got it

#

thanks

safe hill
#

Straightup, git is literally not ignoring my files correctly.

#

I haven't added the files to the repo, this .gitignore template I'm using has worked before properly

#
    Directory: F:\Programming\Unity\Climb
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         7/7/2020   3:33 AM                Climb
-a----         7/7/2020   8:44 PM           2836 .gitignore
Directory: F:\Programming\Unity\Climb\Climb

Mode LastWriteTime Length Name


d----- 7/7/2020 3:33 AM Temp
d----- 7/7/2020 3:33 AM Assets
d----- 7/7/2020 3:33 AM Packages
d----- 7/7/2020 3:33 AM ProjectSettings
d----- 7/7/2020 3:33 AM Logs
d----- 7/7/2020 3:33 AM Library
d----- 7/7/2020 3:34 AM .idea
d----- 7/7/2020 3:38 AM obj
-a---- 7/7/2020 3:38 AM 917 Climb.sln
-a---- 7/7/2020 5:18 PM 46495 Assembly-CSharp.csproj

#
PS F:\Programming\Unity\Climb> git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Climb/
```I just can't get my head around why this could be.
wooden ibex
#

On what line is Climb supposed to be ignored?

safe hill
#

What do you mean by line?

wooden ibex
#

On what line number should "Climb/" be ignored?

safe hill
#

...None? I don't know what you're talking about. Very confused.

wooden ibex
#

Why do you think Climb/ would be ignored? Because it's filled with files that should be ignored?

safe hill
#

It shouldn't be? This is a Unity template .gitignore made to ignore unneeded automatically generated project files. Only the Assets, ProjectSettings and Packages folders should be kept, I believe.

wooden ibex
#

sigh Exactly WHAT should git be ignoring but isn't?

safe hill
#

Library, Temp, Packages etc. Check the .gitignore above it describes everything that should be ignored but simply... isn't

#

it's as if the .gitignore doesn't even exist

wooden ibex
#

you showed git status and single folder

#

Climb/

#

which isn't ignored

safe hill
#

...what? Do you not see my Gist above? I am extremely confused what you're talking about.

wooden ibex
#

Yes I do

#

you have /, you have /Climb, inside climb you have /Climb/Temp, /Climb/Assets and so on

#

you are complaining /Climb is showing up as wanting to be committed yet you can't explain why it shouldn't be

safe hill
#

Not waiting to be committed, waiting to be tracked/added to the repo.

wooden ibex
#

tracked/committed

#

this isn't semantics issue, why would /Climb be ignored?

safe hill
#

It shouldn't, it wouldn't.

#

Items within Climb would be.

#

For example, the ./Climb/Temp, ./Climb/Library, ./Climb/Logs folders should be ignored.

wooden ibex
#

so git is operating normally

safe hill
#

No. They should be ignored and not be available for tracking, but I can track them, as if the .gitignore doesn't exist at all.

wooden ibex
#

you haven't shown that

safe hill
#

When I cd in it shows ./ can be tracked (relative).

wooden ibex
#

try git add --dry-run

wooden ibex
#

Climb needs to be tracked, unless it's completely filled with files that won't be tracked

#
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#```
#

Root

#

you haven't shoved into root

#

since /Climb is root of your project

safe hill
#

Actually this is a modified version of that template. Trust me, this .gitignore works for another project perfectly fine.

#

Plus, if you look at the rules, they shouldn't actually have any problems.

#

[Ll]ibrary/ should ignore any Library or library folders across the board.

#

I looked it up and others had different problems with the placement of their .gitignore. Removing the preceding forward slash makes the placement of the .gitignore irrelevant. My template file is organized to be placed at the repository root (not the Unity project root) so that the repository can be organized better overall.

wooden ibex
#

Really, my git stays different

#

Climb\ is going to get tracked unless it's 100% empty of anything it should follow

#

is it

safe hill
#

The Asset folder has all the stuff in it that should be tracked (scripts, shaders, mats etc).

wooden ibex
#

so git status is going to report Climb\

#

git add --dry-run is better tracking anyways

safe hill
#

But as that dry run reports, it added literally everything

wooden ibex
#

github seems to have different git ignore from you

#

try that and see if you get results you want

safe hill
#

does a .gitignore have to be tracked to be active?

wooden ibex
#

it should be tracked

safe hill
#

But not git?

wooden ibex
#

Rider likely uses git binaries

safe hill
#

and once I commit with all of these files the commandline git magically fixes itself

#

fantastic

#

actually: not sure if it was the commit or the push that did it, since I pushed before I checked. sounds like commit, though.

vague lion
#

I have been trying to get the Python LSP (really any LSP) to work with Neovim, but all the resource I have tried seemed to fail. I tried to follow tutorials implementing ALE and coc.vim and coc-python to no avail. I currently use a solution that uses jedi, but I want to mimic my Vscode setup. Any thoughts?

heavy knot
#

I made an install.sh file, but the bash command to install gradle out of the other commands didn't work?

#

Does anybody know what could have gone wrong?

#

Is this a dependency issue?

sharp elm
#

How do you get around the difference between pip install and python setup.py install when it comes to data_files?
When running pip from pypi, the data_files get installed directly under /usr and when running locally with setup.py they end up under the package folder at /usr/lib/python3.8/site-packages/<package>/.

setup.py contains:

    data_files=[('examples', glob.glob('examples/*.py'))]
heavy knot
#

It is advised to always use pip install to install packages, also where packages are installed depends upon what rights you have as a user in your pc.

sharp elm
#

shit that's insanely inconsistent ๐Ÿ˜› I'd expect them to end up by default in a place where the installing user always have permission, meaning the package directory by defaullt. pip install --user to get it under the user and pip install to install it to /lib/.... Not completely different cwd..

#

I use setup.py for local testing as it's way faster. But this.. so how do you define it to the <package lib root> in data_files=? As it's unknown where that will be depending if the user does pip install or pip install --user?

heavy knot
sharp elm
#

Kinda new to Discord and the meta layers of this "server" or guild is a tad bit confusing. I'll try my luck on stackoverflow ๐Ÿ™‚ thanks to @heavy knot ๐Ÿ™‚

heavy knot
#

shit! , I was just trying to help

sharp elm
#

I know, it's just there's so many servers and the "how-to-get-help" channel seams to be a bot thing and I'll be moved around and I need to keep track of that heh.

sharp elm
#

@heavy knot For reference, using package_data seams to be the only way to do it, as data_files is to unpredictable. The shortcoming of package_data tho is that it is limited to the root folder of your project's source. meaning it can only include things in and from git_repo/src if src is where the library is. The only (dirty) workaround I can see, is to - in the setup.py hotswap in the files you want to include, use package_data to include them, and at the end of your setup.py remove the temporary copies. Essentially doing a build-script for your project that wraps around setup.py. Which would look something like this: https://stackoverflow.com/a/62792591/929999

tawdry needle
#

i just use MANIFEST.in and include_package_data=True

#

it never broke for me

#

until i switched to poetry and ditched setuptools entirely

chilly wharf
#

is there a way to to run and see the output while using vsc

gleaming forge
#

mhm

quick nova
#

is there a way to to run and see the output while using vsc
@chilly wharf yep

gleaming forge
#

download the python extension

quick nova
#

i used to ask that too lol

chilly wharf
#

ok

#

done

gleaming forge
#

then just hit the lil green arrow

#

and it runs

quick nova
#

yep

chilly wharf
#

but it doesnt show for some reason

gleaming forge
#

send a pic

chilly wharf
#

i want to see the output

#

turns out because it was debugging it

#

from before

gleaming forge
#

ah

quick nova
#

ah

chilly wharf
#

sorry for the trouble

#

i feel like idiot lmao

quick nova
#

hey @gleaming forge can i improve my output console so it looks nicer

#

i feel like idiot lmao
@chilly wharf don't be lol

gleaming forge
#

you can customise pretty much anything in vsc

quick nova
#

do you know any resources to improve the console?

gleaming forge
#

dunno i still have explored a lot of the extensions and stuff

#

i just changed all my colours

quick nova
#

ooo

#

o yea

chilly wharf
#

so i can remove this " C:/Users/Qwertzy/AppData/Local/Programs/Python/Python38-32/python.exe"

quick nova
#

i wanted to ask this too

#

what is the difference between the code and python?

gleaming forge
#

?

quick nova
#

in the output terminal option

#

there is 4

gleaming forge
#

oh

quick nova
#

sorry if it wasn't clear before lol

gleaming forge
#

python is the output

#

cmd would be the console

quick nova
#

no i mean the code

#

Code

#

there is an option named Code

#

there

gleaming forge
#

oh code

#

no idea

#

might be shell or something

quick nova
#

when i pressed run

#

it shows uup

#

but when i select run the code in this terminal

#

python shows up

#

idk what's the difference

#

what's yours?

gleaming forge
#

mine just goes to python

#

with the output

#

and then python pops up when i run

#

and outputs there

quick nova
#

hemm i see

#

do you use the small arrow there

gleaming forge
#

yeah

#

for python anyway

quick nova
#

it shows directly to python?

gleaming forge
#

mhm

#

even if i just use the console

#

it'll still show up in python

quick nova
#

owww

gleaming forge
#

for a split second

#

then go back to the console

quick nova
#

damn why is mine shows Code

#

instead of python

gleaming forge
#

no idea

quick nova
#

does it matter though

gleaming forge
#

doubt it

#

should be fine if everything is working alright

chilly wharf
#

oh btw is there a way to add indentations quicker

quick nova
#

yea

chilly wharf
#

in vsc

quick nova
#

spam tab

#

XD

gleaming forge
#

i just tab

#

but that applies everywhere

chilly wharf
#

ok

#

i didnt know

#

thanks

#

i just press space until the line shows up

gleaming forge
#

oh lol

#

yeah tab is better

quick nova
#

hey @gleaming forge do you ever use pycharm?

gleaming forge
#

nope

quick nova
#

hemmm

#

i wonder should i use pycharm or vscode for bigger projects

#

vscode is so light i like it

#

fast boy

gleaming forge
#

i've never had a reason to step out of vsc

quick nova
#

i see

#

i wanna know how to customize my output console

#

what do you call it?

#

the console?

gleaming forge
#

what do you mean by customize?

#

in what way

#

all the colours and stuff you can change in the settings.json

quick nova
#

i want to change the highlighted ones

#

to make it look nicer

gleaming forge
#

like the

#

oh that

#

yeah

#

settings.json

#

you can change everything

quick nova
#

ooo

#

what is .json format?

gleaming forge
#

.json is just a dictionary basically

#

very useful for storing data

quick nova
#

oooww

#

if it is a dictionary why don't use python?

#

python also has dictionary?

#

why must use the .py format

gleaming forge
#

huh

#

yeah but

#

its not a file

#

its a python file

#

.json is a file format

quick nova
#

owww

#

is it like txt?

gleaming forge
#

yes

#

but

#

better

quick nova
#

ooww

#

i see

#

thanks!

gleaming forge
#

for storing stuff

quick nova
#

o ya btw

#

what's the output called

#

when we run

#

and the code shows on the terminal

#

what is it called?

#

this part

gleaming forge
#

uh one sec

#

lemme see

#

ah

#

its just terminal

#

and then just scroll until you find something that says edit in settings.json

#

it'll auto put some stuff in so just undo

#

and then you can edit whatever you like

quick nova
#

ooo i see

#

what is launch.json?

gleaming forge
#

uh

#

launch would be executed upon launching

#

i assume

quick nova
#

i forgot how the file got there lmao

#

is it generated automatically?

gleaming forge
#

which one?

quick nova
#

launch.json and settings.json

gleaming forge
#

yeah

quick nova
#

ooo i se

#

i see

gleaming forge
#

and then you just add stuff to them

quick nova
#

hey is there any way i can transfer vscode settings and plugins to another vscode in another pc?

#

and then you just add stuff to them
@gleaming forge oooo

gleaming forge
#

yeah

#

just

quick nova
#

omg

gleaming forge
#

copy the settings.json

quick nova
#

that is so neat

gleaming forge
#

and paste it into the other

quick nova
#

ooo

#

how about the plugins?

gleaming forge
#

plugins you would probably have to redownload

quick nova
#

damn

gleaming forge
#

though

#

actually

quick nova
#

how about the libraries i installed through pip?

gleaming forge
#

that i've never used

#

so maybe you can actually save a profile

#

or something

#

libraries you will need to reinstall

#

vsc can't save those

#

they are saved to your computer

quick nova
#

ooo

#

cool

#

libraries you will need to reinstall
@gleaming forge i see

#

thank you very much!1

gleaming forge
#

all good

quick nova
#

yepp

#

so clear

sly flare
#

Hey! Are there any differences between, git checkout head filename and just simply git checkout filename?

tawdry needle
#

@sly flare the former explicitly specifies which commit to check out from

#

the latter implies HEAD

#

note that git checkout head filename is better spelled git checkout head -- filename

#

in fact the ability to write git checkout filename is IMO a horrible design decision and one of the biggest mistakes in the git CLI

sly flare
#

And, I can use the SHA to, specify the commit right?

tawdry needle
#

yes

#

git checkout <tree-ish> -- <pathspec>

#

where "tree-ish" is a commit or even a specific tree object

quick nova
#

hey, until now i still don't understand the use of git

#

what is the use of git?

tawdry needle
#

"version control"

blissful sluice
#

imagine you were working on a project, and your teammate was also working on the project, and you both change the same file

#

what would you do to combine the changes?

#

usually the answer is: grab both copies of the project, look at the changes side by side, find all the changes that were made, and then copy/paste the changed parts together to make a single project that contains all the changes

#

now repeat for every single file that was changed

#

sounds fun right?

#

now imagine you had a tool that could look at all the changes you and your teammate made, and automatically combine those changes and warn you when there were conflicts where it can't automatically combine the changes for you to resolve manually

#

that tool is git

#

or at least the most basic task that git does. git is a lot more than this - it solves many similar problems

quick nova
#

wow

#

git is godly

blissful sluice
#

basically yes

quick nova
#

how to use git tho

tawdry needle
#

the underlying data model is nice and elegant too

#

the CLI is a fucking mess

quick nova
#

oww

blissful sluice
#

lol

#

yeah

quick nova
#

do you use git by entering it in command?

#

or by using plugins?

blissful sluice
#

both

#

both are possible

quick nova
#

oooo

#

time to learn more

#

hei meseta what ide or text editor that you use?

blissful sluice
#

the cli is worth learning, but day to day, using a gui tool or the one integrated into text editors for basic workflow is fine also

quick nova
#

the cli is worth learning, but day to day, using a gui tool or the one integrated into text editors for basic workflow is fine also
@blissful sluice i see

blissful sluice
#

I use Atom. but I freely admit VSCode is probably better, I'm just too lazy to set it up

quick nova
#

owww

#

ok!

#

how about vs studio tho

tawdry needle
#

i use the git CLI

#

i think its still the best way to learn

#

if you learn the data model first

#

the CLI isn't that bad

#

the real problem with git is when you try to "learn by tutorial"

#

then you make real problems for yourself

blissful sluice
#

I've not used VS Studio for python, I use it very occasionally if I have to touch C++, so I don't know how good it is for python projects

quick nova
#

i use the git CLI
@tawdry needle okk noted

#

I've not used VS Studio for python, I use it very occasionally if I have to touch C++, so I don't know how good it is for python projects
@blissful sluice vscode or vs studio?

blissful sluice
#

I don't use VSCode at all, but I do know it's fairly similar to Atom, but faster and better integration with linters and stuff. VS Studio is a full IDE, I only use it for C++ projects, but don't know what it's like with python

quick nova
#

oooo

#

btw i want to ask if the pip i installed in my computer can be used in vs studio?

#

like the libraries?

blissful sluice
#

in most cases yes

quick nova
#

which cases don't?

blissful sluice
#

as long as you've got your PATHs set up properly

#

if VS can't find your python installation

quick nova
#

ooo that sucks

final furnace
#

Is there a way to SSH into a computer that doesn't have OpenSSH Server installed?

blissful sluice
#

as for git, I use git CLI or Atom's git integration depending on whether I already have the project open in Atom or not. It's just already there in the sidebar, so might as well use it

tawdry needle
#

i dont think its possible @final furnace

blissful sluice
#

Atom starts up real slow, so I don't like opening it, and use git bash/WSL to quickly do git stuff

tawdry needle
#

am i an animal if i just use conemu + cmd

blissful sluice
#

conemu is good, I used to use it

tawdry needle
#

powershell is too verbose, git bash / msys is too "not windows"

blissful sluice
#

Windows terminal is nice now

final furnace
#

use new win term

tawdry needle
#

im on win 7 at work still

blissful sluice
#

ah ok

tawdry needle
#

stuck here due to covid

final furnace
#

use tears

blissful sluice
#

conemu is great

quick nova
#

im on win 7 at work still
@tawdry needle wat win 7

tawdry needle
#

conemu settings menu is a mess tho lol

quick nova
#

that's so sad

final furnace
#

if not new win term, then you can use extraterm

quick nova
#

hey you can upgrade it?

tawdry needle
#

no

#

its a work pc

quick nova
#

i just upgraded my windows 8 to 10 and it's free from youtube!

tawdry needle
#

also i dont really notice a diff

#

i have win 10 at home

quick nova
#

owww

tawdry needle
#

which i use exclusively for gaming lol

#

linux mint is the daily driver at home right now

quick nova
#

wat

#

you use linux mint?

tawdry needle
#

yes

blissful sluice
#

I'm on Win 10 right now, and I've moved most of my python dev to WSL/WSL2 and it's been great except for the editor integration

quick nova
#

why not ubuntu

tawdry needle
#

because mint isnt made by canonical

quick nova
#

i like ubuntu

tawdry needle
#

and also cinnamon is great

quick nova
#

well preferences..

#

and also cinnamon is great
@tawdry needle yeaaa

#

i only used it in virtual machines tho

#

cough virtual box cough

#

i don't want to dual boot

tawdry needle
#

i had no trouble dual booting

#

i got refind + win 10 home + mint

#

no problems here

#

but i havent tried to full version upgrade mint yet

#

we will see what breaks

quick nova
#

no i mean i have no trouble as well but virtual machine is really neat

tawdry needle
#

yeah for sure

#

it just feels... not fun

quick nova
#

but it takes way bigger storage and memory!

#

sad

tawdry needle
#

every time i try to test drive a distro in a VM i give up after 10 minutes

quick nova
#

every time i try to test drive a distro in a VM i give up after 10 minutes
@tawdry needle lol

tawdry needle
#

i need to really spend time with it to feel like i've learned it

quick nova
#

yea

tawdry needle
#

more time than im willing to commit to distro hopping

#

i have a tendency to want to support the "outliers" and "underdogs" but thats tempered by my limited patience for bullshit

#

e.g. i want to try suse but how much do i really care at the end of the day

#

i tried guix once but the setup experience was bad

#

spent like 30 minutes downloading and compiling software updates, i didnt sign up for that

quick nova
#

lol

tawdry needle
#

i might revisit for a server deployment one day

quick nova
#

hey i spent 2 hours installing kali linux

#

and i don't even use it because i haven't learned any penetration testing

#

damn

#

so i deleted it

#

and i installed lmde, only to find that cinammon is way better

#

sucks

tawdry needle
#

installing kali linux is basically a meme lol

quick nova
#

lol

blissful sluice
#

try WSL by the way!

quick nova
#

nice try

tawdry needle
#
  1. read some forums
  2. decide you're going to be a l33t pen tester
  3. try to install kali linux
  4. everything breaks
  5. give up and install ubuntu
#

lmao yes

quick nova
#
  1. read some forums
  2. decide you're going to be a l33t pen tester
  3. try to install kali linux
  4. everything breaks
  5. give up and install ubuntu
    @tawdry needle lol
#

sudo apt is godly tho

#

lololol

tawdry needle
#

@blissful sluice i actually have WSL opensuse installed but i didnt bother to learn how to use it lol

blissful sluice
#

lol, there's a saying:
every linux user has two distros that they use:

  1. one that's objectively better than the others
  2. ubuntu when they want to get stuff done
tawdry needle
#

hah

quick nova
#

i used sudo apt get install atom to use an atom inside a linux distro inside a virtual machine

#

geezuz the memory

tawdry needle
#

wsl just booted to a terminal and i realized i could do anything i wanted on that machine from windows cmd or powershell

#

and if i wanted actual linux i was just a restart away

blissful sluice
#

yeah, WSL is nice, it makes Windows a viable dev machine for backend tasks. It's not perfect, but it's come a long way and now I don't bother switching to my ubuntu box. but I agree, nothing beats actual linux, buuut I'm lazy and don't like switching so often

quick nova
#

yea linux is good

#

switching isn't

tawdry needle
#

true if i had to do C/C++ dev on windows i'd be more interested. for python there's basically no difference

quick nova
#

i really hate switching or transferring between distros

blissful sluice
#

and WSL linux on Windows is better than trying to run wine

tawdry needle
#

(unless you're developing a linux-based application in python using sockets and gunicorn or something)

quick nova
#

yea

blissful sluice
#

yeah, I am

quick nova
#

o yea what advantages does linux have over windows tho?

#

some people loved linux and hated windows

tawdry needle
#

ngl i tend to go full cowboy when i set up a new server and just sudo su - then keep a /root/setup.md file listing whatever i did lol

blissful sluice
#

well for me mostly because I'm developing for linux servers, so getting closer to the intended host just reduces weirdness

quick nova
#

ngl i tend to go full cowboy when i set up a new server and just sudo su - then keep a /root/setup.md file listing whatever i did lol
@tawdry needle OMGGG

#

SUDO SU

#

LET'S GO

tawdry needle
#

"do as i say, not as i do"

quick nova
#

well for me mostly because I'm developing for linux servers, so getting closer to the intended host just reduces weirdness
@blissful sluice i see

#

"do as i say, not as i do"
@tawdry needle lol

#

and it crashes

#

sudo su let's go

blissful sluice
#

lol, I do that, but I took the time to start maintaining ansible scripts for setups

tawdry needle
#

there was some other ansible alternative i found

blissful sluice
#

but I'll admit.... the reason I started doing that was... oh boy, this is some story

tawdry needle
#

let me try to find it

#

oh no did you kill a server

quick nova
#

but I'll admit.... the reason I started doing that was... oh boy, this is some story
@blissful sluice lol

#

oh no did you kill a server
@tawdry needle gawd

#

hell yea

blissful sluice
#

at some point I managed to create a folder called ~ I don't remember how, but I had a folder called that in some directory

tawdry needle
#

ive been tempted to use GNU Stow for this kind of thing

blissful sluice
#

it was only writable by root

quick nova
#

it was only writable by root
@blissful sluice oooo

blissful sluice
#

so I did sudo rm -f ~ without thinking

hasty matrix
#

hey all!

quick nova
#

wait i forgot that command

deep estuary
#

@quick nova no need to use the r-word, please.

quick nova
#

i'm sorry but what is the r word

tawdry needle
#

oh no @blissful sluice lmao

#

i actually would pay money for a linux kernel module or compile-time option that forbade creation of stupid filenames like that

blissful sluice
#

and I've definitely nuked my install under similar circumstances before, maybe a dd gone wrong or other what you would definitely call "noob mistakes"

tawdry needle
#

: ' ~ et alia

blissful sluice
#

and so since then, I've maintained some ansible playbooks to set up my dev machines, and it's been nice since then

quick nova
#

@quick nova no need to use the r-word, please.
@deep estuary oo i see sorry!

#

imma delete it

blissful sluice
#

call it an insurance against my stupidity/laziness

#

and that makes this story channel-relevant, because ansible is an excellent tool for automation and devops

quick nova
#

lol

#

o yea i want to ask something

#

what is/are snippets?

blissful sluice
#

in what program/context?

quick nova
#

in vscode

blissful sluice
#

it's probably bits of code that you can quickly insert

#

an example might be:

class className():
  def __init__(self, abc):
    self.abc = abc
quick nova
#

owwww

blissful sluice
#

if you find it annoying to type stuff like this out all the time, you should be able to make a snippets for it, and automatically drop it in from a snippets menu of some sort. vscode might also be smart enough to let you automatically select className or abc for editing? not sure, haven't used it a lot

quick nova
#

oooo

#

ok ok

deep estuary
heavy knot
#

can someone explain the difference between an api vs database

#

i know databases are used for querying data but idk what the api is and its relation to database

dull fiber
#

Iโ€™d like to run a python script on a 3 hours schedule, inside a Docker container.
Whatโ€™s the best practice for that? Using a shell script inside the Docker container?
If so, whatโ€™s the shell used for python:latest on Docker? Traditional bash syntax doesnโ€™t work for some reason.

tawny temple
#

It uses Alpine Linux, whose default shell is ash

#

If you prefer, you can instead use the Debian container, which comes with bash

proper cairn
#

Anyone with any experience with Kite, the code completion plugin? There doesn't appear to be a setting that stops the initial dialogue box from popping up every time I start it - any ideas on how to stop it from cluttering my screen when I start it up?

I've tried Google and looked through the documentation ๐Ÿค”

https://kite.com/

Kite is a free AI-powered autocomplete for Python developers. Code faster with the Kite plugin for your code editor, featuring Intelligent Snippets, Line-of-Code Completions, Python docs, and cloudless processing.

ornate lodge
#

Hello. I am currently using pyenv(https://github.com/pyenv/pyenv) and pyenv-virtualenv(https://github.com/pyenv/pyenv-virtualenv) for managing Python installations and Python virtualenvs. I am developing on a Mac and using 'zsh' as my shell (with the Prezto framework). I have a good number of python projects I have worked on, from Flask RESTful APIs to low level scripts. Having the different python versions and virtual environments for each project is incredibly helpful.

I am now starting to do some Data Science work, and I need to install Anaconda/Miniconda. I do not want to break my existing Python Installs and Python Virtual Environments.

What is the best way of installing Anaconda/Miniconda alongside pyenv and pyenv-virtualenv? If it can integrate with pyenv, great! I am also open to having a separate, more isolated install and environment for Anaconda/Miniconda.

Thanks a lot!!!

tawny temple
#

I don't think conda integrates with pyenv, but it can essentially do the same thing in an arguably less convenient manner.

#

Conda has its own environments. So you could create a 3.8 environment and a 3.7 one. Python is merely another package in conda, just like numpy and so on.

#

So you could activate a 3.8 environment and then install virtualenv on it and proceed to create venvs as normal.

ornate lodge
#

I have been thinking keeping it separate might avoid some nasty complications. I do want to avoid breaking my existing pyenv setup, as it is being used for a handful of still active projects

tawny temple
#

Conda usually wants you to add some stuff to your zshrc so that a conda env is activated by default, or something along those lines.

#

You can simply not do that and also not add any of conda's environments to your PATH.

#

So you would need to always explicitly use a conda command to activate a conda environment

#

I'm not sure if you'd always need to do this or only when you want to set up virtual environments based on conda. The venvs may continue to work without activating the conda env, but this isn't something I remember anymore.

ornate lodge
#

I think the challenging part may be dealing with PATH and the shell config

tawny temple
#

I don't think you have to do anything

#

I imagine it will work if you just install conda CLI and leave everything else alone

ornate lodge
#

I will give that a try

tawny temple
#

conda activate just temporarily prepends your PATH with the environment directories, which is basically the same way a venv works

ornate lodge
#

Probably install the Miniconda distribution instead of Anaconda too

tawny temple
#

You may find that using virtualenv with conda is redundant, since conda can already manage environments

#

Yeah, I prefer miniconda

tawdry needle
#

^

vague lion
#

I have to say, after all my years of programming, I have finally come around to Vim and figuring it out. I really like Neovim.

blissful sluice
#

did you figure out finally how to exit vim? we need to know

vague lion
#

Haha.

#

I open it in a tmux window and I just close that tmux session.

blissful sluice
#

lol

#

tmux is great though, have you tried the mouse mode?

vague lion
#

No. I am curious though.

blissful sluice
#

might be worth it, you can drag your panes around and select stuff. importantly it makes scrolling into the history a lot easier. changed my life, it did

#

unless you're a hardcore keyboard-only tmux user, which is also fair

stiff nacelle
#

Anyone as good ressources to learn kubernetes (and kubeflow) ?
I'm looking for an e-book or something like that

leaden compass
#

hi i just installed spyder via anaconda on my linux pc, how can i make it a desktop entry?

heavy knot
#

Hey when i try to use wireshark on my linux mint does anyone know how i can fix the permissions error?

valid thicket
#

Guys , do you know any alternatives to tmux? I use NeoVim and I didn't like tmux and neovim's terminal

blissful sluice
#

screen

#

byobu

#

qtile

#

those last two are written in python, which is highly appropriate for this server

heavy knot
#

Hey when i try to use wireshark on my linux mint does anyone know how i can fix the permissions error?
@heavy knot maybe try to run this with sudo from the cli?

signal crest
#

Anyone know how to best use pipenv with pypy? Just specifying python_version = "pypy3" does make pipenv run python start with pypy, but it has some issues.

  • It doesn't seem to be able to install pypy in pyenv (if just using python_version = "3.8" then pipenv install will intstall a python 3.8 via pyenv).
  • Everytime I run something it gives a warning saying my python version is set to pypy3 but actual version is 3.6.9, and that pipenv check will surely fail.
violet belfry
#

@heavy knot this server is not for advertisement

#

Please stop spamming

blissful sluice
#

I find this kind of practice a little dodgy. any VPN service is able to snoop on your data

tawdry needle
#

yeah a free vpn is extremely sus

heavy knot
#

as a personal opinion i like proton vpn

#

you can get it free and it is reliable and trustworthy

#

you can pay to upgrade if you want tho

proud trout
#

Whats a good way to screen shot PyCharm Code? Or even record session?

#

Guys , do you know any alternatives to tmux? I use NeoVim and I didn't like tmux and neovim's terminal
@valid thicket screen is ok

#

those last two are written in python, which is highly appropriate for this server
@blissful sluice thx, i didnt know about these

fierce trout
#

I'm having some trouble with VSC. I'm importing an enum from python-docx:

from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
# ...
heading_para.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER # This is where the warning comes

and pylint says Class 'WD_PARAGRAPH_ALIGNMENT' has no 'CENTER' member pylint(no-member).
So I checked if this is the case but doing the following in the command shell suggests it certainly exists:

>>> from docx.enum.text import WD_PARAGRAPH_ALIGNMENT as alignment
>>> alignment.CENTER
1

My two questions are why this happens, and what I can do to fix it

round nest
#

Hey when i try to use wireshark on my linux mint does anyone know how i can fix the permissions error?
@heavy knot try to re-install wireshark
and if it says it is set to manual install then remove the files of the wireshark force fully using the terminal and then re-install it
I think it'll work cause I had same sort of problem and it worked for me
hope it works for you too

#

@heavy knot maybe try to run this with sudo from the cli?
@heavy knot yeh in the root directory maybe and try to find this directory dumpcap in your system
it maybe corrupted or damaged

deep estuary
#

@heavy knot please write in English and don't offer paid goods, also we don't allow recruitment, especially in this channel

fleet wraith
#

Anyone knows?

viral marlin
#

@fleet wraith why do you have the options line under set-up commented out? Also, you have a space in front of the list of packages you're including. Is there a reason for that?

Also, for the options, have your tried doing the following:
'includes': ["package_1", "package_2"]
I think requests and possibly discord is a module, not a package. So you want to use the keyword includes, and not packages.

fleet wraith
#

That's my fault

#

It doesn't work neither xd

#

@viral marlin these spaces are a bug or smth on stackoverflow, didn't allow me to post without spaces

#

I tried 'includes': ["requests", "discord"] and didn't work

viral marlin
#

Did it give you a specific error or just a "can't find the following" type of thing?

fleet wraith
#

Yeap

#

Bcs on the main script I wrote import requests

#

And there is a import error couldn't find

#

Can't find module requests

viral marlin
#

what version of setuptools are you running?

fleet wraith
#

Mmm that has versions?

#

Just from setuptools import setup

viral marlin
#

Can you do the equivalent of pip list in terminal and see what version you have installed?

fleet wraith
#

41.2.0 @viral marlin

viral marlin
#

Did you use an venv to create/run the program? And where are you trying to build the app from?

fleet wraith
#

I'm using vebv yeah

#

Venv*

#

What do u mean about where?

viral marlin
#

When you run python setup.py py2app do you also run that from your venv?

fleet wraith
#

Oh, nope

viral marlin
#

Try that and see what happens

fleet wraith
#

How do I do that?

#

Oh yes

#

I run it on venv

#

ModuleNotFound error

#

No module named requests

viral marlin
#

So it does build it, it's just not finding the module even though it works when it's in the python script?

fleet wraith
#

When I run the python script from terminal is everything okay

#

But I can't just run it on the app

viral marlin
#

Hmmm, well that's all I got. I would potentially check out PyInstaller if you keep hitting a roadblock here.

fleet wraith
#

@viral marlin it does nothing

#

My script is on tkinter

fleet wraith
#

Oh boooy

#

I solved it

#

@viral marlin ๐Ÿฅณ๐Ÿฅณ

#

I had to did it on terminal

#

Python3.7 setup.py py2app --packages=requests

heavy knot
#

I'm a bit confused about Docker. Should I just copy the code into the container, use bind mounts or do both?

hallow aurora
#

I'd say use the docker volumes

#

it's essentially a bind mount, if I understood it correctly, but you can just use the docker CLI

sly flare
#

Hi!
If I use, git reset commit_sha
will it change my working directory to this specific commit?

heavy knot
#

Gonna try to use volumes then

heavy knot
#

Apparently there are no easy ways to automatically migrate database changes with Django, Postgres and docker-compose?

heavy knot
#

I avoid docker, it often is just extra complexity with little gained

#

Orchestration tools are available without putting everything into a container.

#

You really only need them if you're using PaaS or you run lots of different os versions for some reason.

#

If you don't need containers, do not use them.

wooden ibex
#

@heavy knot copy your DJango site into Docker Container and run it there

#

as for Postgres, not a fan of databases inside Docker but if you want to do, you should use volumes or mounts or whenever you run a new version of Postgres, you will lose everything

#

Katrin, Docker enables two things, A) your code should be able to run anywhere docker can B) you don't need to configure machine for your app

#

if machine is running Python 3.6 and you want Python 3.8, just pull Python 3.8 docker image down and away you go

heavy knot
#

I do it mostly for learning purposes, but I'll search about mounting the db

wooden ibex
#

Postgres tutorials should have guidance about it

heavy knot
#

Since it's my bot which is used 24/7

wooden ibex
#

question about where the files go depends on answer to this question "Does this docker container contain data that is unique?"

#

if no, everything inside docker container

#

if yes, unique data in mount/volume

heavy knot
#

So I'd copy the whole django api part, copy the discord bot and mount its token, and mount the database

fleet wraith
#

@viral marlin bro finally solved, all working :))

#

but how can i send the app to another user? and let he run it on his pc

cyan scarab
#

does anybody know how i can stop vscode from stacking folders like this bc its really bugging me

#

nvm ignore me

visual vortex
#

VSC is telling me there is a invalid syntax at a spot which I just want to print something to indicate it has loaded.

heavy knot
#

bureaucracy anybody eh eh?

hollow plover
#

@heavy knot We don't do recruitement here.

#

on this server, to be specific

heavy knot
#

oh

halcyon wave
#

@fleet wraith did u import requests

#

*requests

fleet wraith
#

@halcyon wave I solved it

#

And the problem wasn't there's request was imported

halcyon wave
#

I see

cyan scarab
#

is there any reason to use a python virtual environment when programming django

finite fulcrum
#

Same as any other case I'd guess. Separated environment for your own dependencies and other projects don't interfere with anything

buoyant canopy
#

@visual vortex it's complaining because you put code before your import statements

visual vortex
#

nope

#

it works fine otherwise

#

but my apologies, i found out VSC was confused because i forgot a ( far down in the commands

tawdry needle
#

yes @cyan scarab

#

use one virtual environment per project imo

#

at least one

cyan scarab
#

why though

tawdry needle
#

Separated environment for your own dependencies and other projects don't interfere with anything

#

imagine you have 2 projects on your computer

#

that use 2 different versions of django

#

if you're not using venvs, have fun with that mess

#

given the sheer number of users on this server asking for help with their screwed up python environments

#

i would say that it's much better to pre-emptively just use a venv all the time

cyan scarab
#

what if im not using two different versions of django

true vapor
#

current you might not be, but future you might end up wanting to. It's also not just Django, it's every single one of Django's and your project's dependencies - things very probably will go awry if you keep on doing it

finite fulcrum
#

django may use dependencies, which have other dependinces, which have other ... etc. and all that can conflict with other packages. By only making an environment for one project you minimize the potential conflicts

#

I also had problems with tools in the past on some larger environments, which would be unavoidable without venvs

cyan scarab
#

ok thanks make sense now

lone linden
#

at least one

#

what

#

why would you use more then one venv per project

heavy knot
#

can anyone help me with a weird pycharm issue?

heavy knot
#

rip

eager cedar
#

Anyone in here aware of a tool that can easily keep single shared files "up to date"/synced in all repos they are used in? Example styleguide.md pylint.rc etc.?

tawny temple
#

Submodules if you're using git, but they're not particularly convenient to use.

eager cedar
#

Yeah I would use submodules if it was a dir

#

But it's just a single file pepoShrug @tawny temple

tawny temple
#

Here's a dumb idea: you could create a symlink to the submodule dir

#

I heard git's symlink support can be kinda broken sometimes though

#

You could write a bot that keeps them in sync, like opens a PR for every repo when it detects a change upstream.

eager cedar
#

I think the bot way is the most reasonable here

#

Thanks ๐Ÿ‘

tawny temple
#

I think ultimately it's best to keep it within the git repo somehow

#

Otherwise people have to use a separate tool and then you can't guarantee they have the files they need really

steady solar
#

Hi can someone help write a script that does the following?

Open the text file that contains some data.
somedate.txt
    name1 - id1
    name1 - id2
    name1 - id3
    name2 - id1
    name2 - id2
    name2 - id3
    name3 - id1
    name3 - id2
    name3 - id3

After executing the script, we get a zip file that includes a text file with mixed data from the file that we opened.
mixdate.zip
    mixdate.txt
        name1 - id1
        name2 - id1
        name3 - id1
        name1 - id2
        name2 - id2
        name3 - id2
        name1 - id3
        name2 - id3
        name2 - id3
blissful sluice
#

sure, open the data, read each line and split by the " - " into a list of lists, sort the list using the id# part (sort with lambda), write out the list as a string again, add that to a textio object, add that textio object to a zip file using the zipfile library

steady solar
#

@blissful sluice I provided the data a bit incorrectly id looks like some key:
name1 - adrt7-rft52-ty76x
name1 - 3ew95-ott34-ch51z
and ect.

blissful sluice
#

same deal

#

you're still going to sort by the key right?

steady solar
#

Yep, I want to get the output:
name1 - key1
name2 - key1
name3 - key1

#

all keys are different

blissful sluice
#

right, but in your example above, each of "key1" are the same value yes?

#

so you want to group lines by their key

steady solar
#

@blissful sluice Sorry, this is was a bad example.

Input data:
name1 - xfr56-tres9-y21yu
name1 - ixr47-op3s9-j54yp
name1 - ix4f5-hs44q-op321
name2 - xww96-2wes5-yuizu
name2 - 67ef7-93hjs-hsebd
name2 - poehg-adswd-gdtgs
name3 - mgets-tydgf-vsooe
name3 - bgyds-777ds-ghdye
name3 - zxc12-bfd55-yfes8

Output:
name1 - xfr56-tres9-y21yu
name2 - xww96-2wes5-yuizu
name3 - mgets-tydgf-vsooe
name1 - ix4f5-hs44q-op321
name3 - bgyds-777ds-ghdye
name2 - 67ef7-93hjs-hsebd
name1 - ixr47-op3s9-j54yp
name2 - poehg-adswd-gdtgs
name3 - zxc12-bfd55-yfes8

I want to mix the input data evenly

blissful sluice
#

oh, you want to mix up the names... re-shaping as it were

steady solar
#

yep

blissful sluice
#

is it always groups of 3?

steady solar
#

@blissful sluice nope it can be 6, 10, 15 and ect

blissful sluice
#

ok I suppose you'd better slice it

steady solar
#

@blissful sluice could you show me how to do this?

blissful sluice
#

so, lets say you read your input data as a list of lines (readlines() will do this)

#

if you did lines[0:10] will give you the lines from 0 to 10

#

but...

#

if you did lines[0:10:2] it'll give you every other line from 0 to 10
if you did lines[0:10:3] it'll skip by 3

#

now if you did lines[0::3] by leaving out the "stop" part of the slice notation, you're saying "all the way to the end of the list"

#

so in your example above, then lines[0::3] would give you:

name1 - xfr56-tres9-y21yu <- this line
name1 - ixr47-op3s9-j54yp
name1 - ix4f5-hs44q-op321
name2 - xww96-2wes5-yuizu <- this line
name2 - 67ef7-93hjs-hsebd
name2 - poehg-adswd-gdtgs
name3 - mgets-tydgf-vsooe <- this line
name3 - bgyds-777ds-ghdye
name3 - zxc12-bfd55-yfes8
#

lines[1::3] would give you the same but starting at index 1:

name1 - xfr56-tres9-y21yu
name1 - ixr47-op3s9-j54yp <- this line
name1 - ix4f5-hs44q-op321
name2 - xww96-2wes5-yuizu
name2 - 67ef7-93hjs-hsebd <- this line
name2 - poehg-adswd-gdtgs
name3 - mgets-tydgf-vsooe
name3 - bgyds-777ds-ghdye <- this line
name3 - zxc12-bfd55-yfes8
#

and lines[2::3] you can imagine

#

so if you did:

lines[0::3] + lines[1::3] + lines[2::3]
``` you will get the list ordered as you needed to in the output
#

(if you add a list to a list, it'll catenate the two lists together)

#

now, we can use a loop instead of having to write it explicitly:

skip = 3
data = []
for i in range(skip):
  data += lines[i::skip]
steady solar
#

@blissful sluice thank you

#

You are awesome

cyan raft
#

everytime i run with f5 in visual studio this thing comes up

#

and i want to skip having to click python file each time

tawny temple
#

You have to define a launch configuration

#

In your original, uncropped screenshot, the left sidebar even told you this

#

For example, this is the default config I have in my settings.json

#
    "launch": {
        "configurations": [
            {
                "console": "internalConsole",
                "name": "Python: Current File",
                "program": "${file}",
                "request": "launch",
                "type": "python"
            }
        ],
        "version": "0.2.0"
    }
cyan raft
#

alright thanks, i just started learning python in vscode after being a java eclipse boyo so this is very helpful

ornate lodge
#

Anyone know how to tell PyCharm the path to the conda executable?

simple trellis
#

Is it in your PATH? If not just give it the full path to the executable

hexed cloud
#

Is there a keyboard shortcut in VS Code that imitates the same type of selection as a double click?

hexed cloud
#

I found ctrl+shift+left/right arrow, but those need to be at the end of a word for it to be able to select the whole word.

frank compass
#

I think by default ctrl+w does that ? Or maybe that's jetbrains I don't remember

#

But search for a "expand selection" shortcut

true vapor
#

That's jbr. In vscode that closes the tab

pallid wing
#

Anyone familiar with how to automate github releases? I have files on my linux machine that I want to generate a github releases on a daily basis and wondering if anyone can give some suggestions on easiest way to do that.

tawny temple
#

Possibly GH actions or some other CI. I'm unsure specifically about being able to do it on a daily basis

#

In any case, it could be done with GitHub's API

#

Create a Python script using their API and then create a cron job

analog kettle
#

A chemist is asking me for python help. I think they just want to use Python for data visualization. Should I suggest Spyder to them?

buoyant canopy
#

never heard of spyder, but I used jupyter notebooks + plotly and found it easy and pretty

true vapor
#

Spyder or Jupyter notebooks are fine for that. Seaborn is a nice simple lib for the visualisation itself if they're looking for help with that

austere pier
#

@analog kettle VSCode is pretty good for data viz now also.

buoyant canopy
#

that sounds cool, what do I have to do to set up VS code with data viz?

heavy knot
#

Hey Question, How would I go about importing a class from another file so that I can call it's functions with ease?

bright night
#

You just import the filename

#

So if you have a python script with functions you created that you want to import you just import that script by using its name

iron basalt
#

for a project that I'm working on, I'd like some convenient way of marking specific points in development (basically versions), and I'm playing with git tags

#

currently it looks like lightweight tags would be all I need, and so my workflow at the moment is to e.g.:

git commit -m "Some important commit"
git tag 1.2.3
git push --follow-tags
#

on the host machine, to show the current revision, I then run a subprocess git describe --tags and capture the output

#

is this an acceptable workflow, or am I misusing the tagging system?

#

I'm wondering because I don't really see git tags being used that much, people will often keep track of the version in a version-controlled text file of sorts that can be read at runtime

#

with lightweight tags, we can tag a specific commit with a version, so it looks very convenient

#

but the fact that the tags don't get pushed to the remote unless --tags or --follow-tags is included sort of hints at tags being aimed at local development and not necessarily to be shared with other machines

blissful sluice
#

yes this works

#

we use tags often for CI/CD builds

#

GitHub hooks are set up to send tags to CI/CD which pulls and builds the tags, and the tags name becomes the release name

elfin ether
#

it's a viable solution, we used tags in one project, in some SCM tools you can even use UI to create or delete tags

blissful sluice
#

so if you tag it 1.3, then CI/CD builds version 1.3

#

of you tag it 1.3a-testing it builds version 1.3a-testing

#

often this is also the docker image tag as well

iron basalt
#

thanks, this is useful knowledge

blissful sluice
#

guthub's releases are also based on tags

iron basalt
#

once I get more used to it I may propose that we start tagging at work too

#

out of interest, do you use annotated or lightweight tags?

blissful sluice
#

I think it's a good idea. it doesn't fully replace version.py as often you need the version number in code. but it does introduce some maintenance issues. one option is to generate version.py from the tag automatically, or generate the tag from the version automatically

#

lightweight tags

iron basalt
#

mm, my approach was to read the tag at startup with the subprocess & allow it to be imported

#

but actually you're right it could also be written to a version.py in CD

blissful sluice
#

the one slight wrinkle with tags is you'd want to avoid deleting tags if possible

#

because git doesn't pull or track changes in tags. so if someone checked out your repo, and someone deletes a bunch of tags, the next time that person pushes tags, their client is going to try to push all the tags again, recreating them

#

best-case this is an annoyance, worst-case this triggers a CI build for every tag re-added

iron basalt
#

yeah, there are some nuances with the tagging system that I'm still trying to understand before I try to introduce it to a more serious project

blissful sluice
#

if you're using GitHub, it's worth noting that GitHub releases are attached to tags, but you can't make a GitHub release from git as releases aren't a git feature

#

when you make a release on GitHub, it'll create a tag and attach a release to the tag. or you can make a release that points to an existing tag

iron basalt
#

we use Azure DevOps, although I assume it'll be very similar if not the same

blissful sluice
#

ah ok, perhaps then

tawdry needle
#

@iron basalt i use git tags for versions yes

#

many projects do use them for this purpose

#

in fact when i see a big git-based project not using tags im surprised

#

personally i think of lightweight tags as "local" and verbose/-a tags as "public"

#

maybe lightweight tags for patch releases? but even then

#

the best method i've found for working either by myself or in small experienced teams is effectively trunk based development

#

reasonably-stable commits are pushed to master, versioned releases are tagged

#

short-lived feature branches for everything else

#

i think the release tagging process should be at least somewhat cumbersome, because it forces you to think about what you're relasing

#

i also still haven't found a tool i like that synchronizes version strings everywhere

#

release checklist is something like:

  • install into a clean env & run the full test suite (eg. with tox)
  • bump versions: 1) __version__ in __init__.py, 2) setup.py or pyproject.toml, 3) documentation source
  • rebuild the docs
  • update changelog
  • git commit
  • git tag
  • git push & push tags
#

and for versioning ive either used semver or calver depending on the development cadence & who is using the project

iron basalt
#

thanks for the answer

#

it's really useful and interesting learning about others workflows

tawdry needle
#

id love to know what other workflows people have

#

i also still haven't found a tool i like that synchronizes version strings everywhere
this is still a big annoyance, ive stopped short of writing my own scripts for it though

#

e.g. a python script that reads the contents of ./VERSION and modifies pyproject.toml src/python/myapp/__version__.py, and src/docs/conf.py accordingly, as well as spits out a new templated section in the changelog

#

i dont like tools that read from the git tag because i want to do a bunch of things before committing

blissful sluice
#

I use the git short hash for any build IDs that aren't a release

#

so our dev/feature builds don't use the tagged version, and look like this in Jenkins:

tawdry needle
#

^ that makes a lot of sense

heavy knot
#

having trouble getting git hooks to work

#

installed pre-commit in my pycharm project

#
#!/usr/bin/env python.exe
# File generated by pre-commit: https://pre-commit.com
# ID: 138fd403232d2ddd5efb44317e38bf03
import os
import sys

# we try our best, but the shebang of this script is difficult to determine:
# - macos doesn't ship with python3
# - windows executables are almost always `python.exe`
# therefore we continue to support python2 for this small script
if sys.version_info < (3, 3):
    from distutils.spawn import find_executable as which
else:
    from shutil import which

# work around https://github.com/Homebrew/homebrew-core/issues/30445
os.environ.pop('__PYVENV_LAUNCHER__', None)

# start templated
INSTALL_PYTHON = 'd:\\repos\\kaede\\venv\\scripts\\python.exe'
ARGS = ['hook-impl', '--config=.pre-commit-config.yaml', '--hook-type=pre-commit']
# end templated
ARGS.extend(('--hook-dir', os.path.realpath(os.path.dirname(__file__))))
ARGS.append('--')
ARGS.extend(sys.argv[1:])

DNE = '`pre-commit` not found.  Did you forget to activate your virtualenv?'
if os.access(INSTALL_PYTHON, os.X_OK):
    CMD = [INSTALL_PYTHON, '-mpre_commit']
elif which('pre-commit'):
    CMD = ['pre-commit']
else:
    raise SystemExit(DNE)

CMD.extend(ARGS)
if sys.platform == 'win32':  # https://bugs.python.org/issue19124
    import subprocess

    if sys.version_info < (3, 7):  # https://bugs.python.org/issue25942
        raise SystemExit(subprocess.Popen(CMD).wait())
    else:
        raise SystemExit(subprocess.call(CMD))
else:
    os.execvp(CMD[0], CMD)
#

thats the hook it generated if it helps

heavy knot
#

i also can run pre-commit run --all-files in pycharm's terminal too

heavy knot
#

(@ me if you respond)

tawdry needle
#

/usr/bin/envdoesn't work on windows

#

Idk how to do this correctly though

#

@heavy knot ^

heavy knot
#

heck alr

tawny temple
#

Try putting the absolute path to the python exe in the shebang

tawdry needle
#

does windows have anything equivalent to a shebang

#

wouldnt you have to write a batch script

tawny temple
#

Don't think it does, so probably

#

I think git executes the hooks with git bash by default

#

Or, more generally, it does respect the shebang even if Windows doesn't support it normally

#

You could also leave it as a shell script and just write python my_actual_hook.py

tawdry needle
#

I think git executes the hooks with git bash by default
interesting

tawny temple
#

Yeah, I didn't mean that. I was trying to say that is respects the shebang

#

I don't know if it uses anything by default

undone prism
#

i'm using pipenv and trying to disable this msg Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

#

with Set-Variable -Name PIPENV_VERBOSITY -Value -1 in Windows-Powershell

#

doesn't seem to work that way

#

any idea why?

undone prism
#

@dusty maple sorry for the ping, but since you mentioned you used pipenv: have you tried disabling this?

dusty maple
#

I have once but through CMD

#

I think you coulso use a .env file since Pipenv autoloads that but I'm not quite sure

late zodiac
#

can someone explain to me how to install sublim text

blissful sluice
#

yes, .env is autoloaded by pipenv

#

your message suggests that you're already inside a venv. perhaps you're in Conda, which sets up venvs?

untold escarp
#

Hello, can anyone from here help me with setting up flask app on heroku?

silent sedge
#

@untold escarp you're gonna have to be specific about what you've tried and what your problem is

terse nest
#

hey peeps

#

so ive been trying for some time now

#

but no matter how much i do and search

#

it wont replace the string

cunning pendant
#

Hey guys! When deploying a python app in a docker container, where should the app log stuff?

#

Docker seem to log stuff from the container stdout. Should all logging just be print statements?

buoyant canopy
#

that'll work

#

then you can do docker logs <container id> and it'll show you the logs

cunning pendant
#

Exactly! The docker daemon handles that stuff pretty well. I guess logger or something could help by formatting the log output a bit, but the way I understand it, there is no need to log to an external file.

tawny temple
#

IIRC the way the default logger works for Docker, it actually does log to a file.

#

By the way, the -f option is handy for that command to make your terminal follow the logs live as they come in.

mint fox
#

wht in ur opinion is the best ide to use cept pycharm

#

how can i download a theme for pycharm

#

i was keen on material ui

#

and atom icons

#

but none of em seem to work

#

could anyone help pls

#

nvm i figured it out

heavy knot
#
{
    "python.jediEnabled": false,
    "editor.fontSize": 16,
    "[python]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        }
    },
    "git.enableSmartCommit": true,
    "workbench.startupEditor": "newUntitledFile",
    

    "python.linting.pylintArgs": [
        "--extension-pkg-whitelist=extensionname",
        "--extension-pkg-whitelist=pygame" // comma separated
    ],
    "python.languageServer": "Microsoft",
    "python.linting.enabled": true,
    "python.lintong.pylintPath": "C:/Users/Turtle/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0",
    "python.linting.pylintEnabled": true,
    "workbench.colorTheme": "Noctis Obscuro",
    "git.autofetch": true,
    "files.autoSave": "afterDelay",
    "window.zoomLevel": 0,
    "[json]": {



        "editor.quickSuggestions": {
            "strings": true
        },
        "editor.suggest.insertMode": "replace"
    }
}

``` Relevant JSON
#

is poetry better than pipenv?

tawdry needle
#

IMO yes

heavy knot
#

I think avast blocked my use of pipenv

#

when i go into a certain directory

#

and run pipenv

#

it says that pipenv is not recognized

#

when i run pip install pipenv it says that the requirements are already satisfied

heavy knot
#

I disabled avast before

#

but it still interfered

simple trellis
#

Probably means pipenv isn't in your PATH for some reason

#

What are the contents of your PATH variable

heavy knot
#

How do i know my path variable @simple trellis

simple trellis
#

Type $Env:Path

dusty maple
#

is poetry better than pipenv?
@heavy knot Still waiting for poetry to support building external extensions but overall it's a really nice tool

grim flame
undone prism
#

your message suggests that you're already inside a venv. perhaps you're in Conda, which sets up venvs?
@blissful sluice I'm inside a regular venv

#

Created using python -m venv

blissful sluice
#

pipenv helps manage venvs, so you don't need to create a regular venv

undone prism
#

Alright then

faint comet
#

anyone know a package for atom that lets u run input() in atom itself

steady summit
#

Hi guys, I have a postgres docker container, i've made a backup of the db in that container, i don't know how to get that backup on my local drive now... Im not great with the volumes, still struggling to get a grip with it.

nginx:
    build: ./nginx
    ports:
      - 80:80
    depends_on:
      - django

redis:
    image: redis:alpine

celery:
    image: web_django
    command: wait-for-it postgres:5432 -t 0 -- celery -A project worker -l info
    environment:
      - POSTGRES_HOST=postgres
      - POSTGRES_USER=user
    volumes:
      - ./src/:/opt/workspace/
    depends_on:
      - postgres
      - redis

postgres:
    image: postgres:11.5-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    environment:
      PGDATA: '/var/lib/postgresql/data/pgdata'
      POSTGRES_USER: user
      POSTGRES_PASSWORD: user
    ports:
      - 5432:5432
    
volumes:
  postgres_data:

The backup of the DB is in the containers ./tmp folder so /tmp latest.dump

please ping me on reply

cunning pendant
#

Hey guys! How does one copy the source code from an application into docker image in a docker file?

#

The dockerfile I am working on sits in a directory next to the directory that contains all my code. So I tried:
COPY directory /directory/in/image

#

However, only a single, empty directory from the host is copied to the directory/in/image

drowsy lava
#

Does anyone know how to change themes in vim?

#

I have a custom one but am not sure how to install it

tawdry needle
#

@drowsy lava you have to unzip it in a specific location. Look up :packadd for details

#

Then you chance color scheme with :colorscheme

drowsy lava
#

which specific location

#

I have the files on my laptop

tawdry needle
#

@cunning pendant I think that's what I use, maybe check the docs for any weird cases

drowsy lava
#

I just gotta place it some where right?

tawdry needle
#

@drowsy lava it's specified in the docs

drowsy lava
#

would you mind telling me tho

tawdry needle
#

It varies across machines

drowsy lava
#

i'm on windows

tawdry needle
#

And it's different between vim and neovim

#

So it's better to read the docs than to ask strangers on the internet

cunning pendant
#

@tawdry needle the problem seemed to be with mounting. I'm trying to bind-mount a volume for generated data. The problem is that I'm trying to copy stuff into the volume dir, which of course is then "over-mounted" when using bind. Have to find a work-around

drowsy lava
#

hmm

#

alright

#

what does this mean?

#

can I just put it anywhere?

dusty maple
#

I assume that's vim-plug?

drowsy lava
#

yeah

dusty maple
#

Typically you'd put that at the start

drowsy lava
#

I'm very confused

#

and have no idea what to do

#

I can't edit stuff in the vimrc

dusty maple
#

Which one are you editing?

drowsy lava
#

wdym

dusty maple
#

iirc _vimrc on Windows should reside on your user folder

drowsy lava
#

I thought there was only one vim rc

#

yeah

#

I'm using that

#

but I can't edit it through bim

#

vim

#

I had to use notepad

dusty maple
#

Right

drowsy lava
#

yeah

dusty maple
#

Assuming you already have it installed, you have to put this at the start of your _vimrc

call plug#begin()

call plug#end()
drowsy lava
#

have what installed

#

vim plug?

dusty maple
#

Yes

drowsy lava
#

I did this

#

so I guess it is installed?

dusty maple
#

Right, but that's for Neovim, not Vim

drowsy lava
#

huh

#

neovim is at the bottom tho

dusty maple
#

The top one is what you'd want

drowsy lava
#

yeah I did the top one

#

so what do I do?

#

I specify to directory?

dusty maple
#

Also seems like you're editing the incorrect _vimrc

drowsy lava
#

how many vimrcs are there

dusty maple
#

The one you sent is the internal one used by Vim

#

It's different from your vimrc

drowsy lava
#

huh