#tools-and-devops

1 messages · Page 54 of 1

harsh panther
#

Oook I wnt to have something like py bot

#

I wnt to configure CI/CD

warm pollen
#

The PyDis stuff is running on Linode though, we are sponsored

harsh panther
#

ooo

warm pollen
#

But uses Azure Pipelines for CI, and SaltStack for CD

harsh panther
#

And azure free tier can run my docker too at testing ?🙂

warm pollen
#

I don’ know any cool youtube video though, sorry

harsh panther
#

Np

fast cargo
#

udemy has a bunch of courses - granted, at the moment their promotion has ended

#

however... you MIGHT be able to find the same course.. elsewhere.. if you catch my drift

charred skiff
#

https://www.oreilly.com/ always has a free trial with no CC required and they have tons of video courses on just about anything

Gain technology and business knowledge and hone your skills with learning resources created and curated by O'Reilly's experts: live online training, video, books, our platform has content from 200+ of the world’s best publishers.

sweet agate
#

Has anyone managed to use p4python on windows? I ran the installer and it seemed to work but when I include it in my project it fails to find it

harsh panther
#

What's the use of saltstack in devops?

#

How can I use that for my bot?

warm pollen
#

It is a CD tool

#

Basically, it is here automate the deployment of your bot

#

so yes, you can

harsh panther
#

🙂

#

So where my docker will be used in Salt or azure?

warm pollen
#

Salt will trigger a deployment on your host, so azure would host docker and will recieve instructions from salt

wooden ibex
#

Yea, that’s not the way to roll on Azure

harsh panther
#

Actually I am new to all this stuff my bot is on heroku

#

And I wnt to use azure+salt on that

#

And docker also

#

Ty Akarys and Rabbit

wooden ibex
#

Azure + salt is not a combo

harsh panther
#

O

wooden ibex
#

Azure DevOps can push stuff directly out

harsh panther
#

I thought this is a combo cuz py bot uses lemon_sweat

#

Ok

wooden ibex
#

They use it but it’s not the way to roll with Azure

tawdry needle
#

azure has a container deployment thing?

#

i know about service fabric

#

actually is there a host where i can just give them my dockerfile and they run/host it for me? id happily pay money for something like that

wooden ibex
#

Website?

#

Like docker container running web site?

tawdry needle
#

not necessarily a website, but usually i just need a few TCP ports exposed

#

things like ZNC

wooden ibex
#

Sorry, I saw VNC, they don't have a cheap way of running non web container

tawdry needle
#

what do you mean "non web" container

#

oh, like something other than TCP port 80/443

#

i mean it doesnt have to be azure

#

im just curious if such a thing exists

supple venture
#

well can i get pycharm edu from my school mail id?

proud trout
#

yes

supple venture
#

and what is the differene between logo_pycharm edu and logo_pycharm prof

proud trout
#

instead, get github student pack

supple venture
#

oh where is it?

proud trout
#

edu is prof version

supple venture
#

never heard of it

proud trout
#

just google it

supple venture
#

ohk

#

my school doesn't support programming btw

tawdry needle
#

the professional version has extra features to integrate with various testing and web frameworks

supple venture
#

okh, but as iceman isn't edu same as prof?

proud trout
#

edu gives u free prof version

#

i have a jetbrains student account too

supple venture
#

so i need to make a account?

#

well lemme search google

#

will let u know if prob occurs

proud trout
#

first, get github student pack, it includes pycharm prof

supple venture
#

okh

proud trout
#

i got mine by sending them a picture of my identity card, as I was still in my high school and no school-specific email was provided

supple venture
#

that gives a lot of stuff

proud trout
#

yes

sand thistle
#

how would you guys allow ssh by state

#

like lets say i want to allow all IPs from a certain state to be able to access ssh

#

but nothing else

supple venture
#

question @proud trout what does "$100, $50 in azure (etc.) credits" mean?

proud trout
#

that much worth of stuff is free

broken eagle
#

Does anyone here work with pipenv inside of docker?

#

I'm having issues with the packages being available to the python interp inside of docker-compose

supple venture
#

okh

#

i applied

#

will see

leaden tartan
#

Does anyone here work with pipenv inside of docker?
@broken eagle What issues?

broken eagle
#

I have a Pipfile and Pipelock file that includes things like Pandas and Pyarrow. When I use docker-compose, it pulls in the Pipfile.lock and then deploys those dependencies within the container. However, when I attached Pycharm to that container as a remote interp, it says module not found when I "import pandas as pd"

#

My best guess is that the paths are off, but I'm not sure.

leaden tartan
#

I dont use Pipenv myself but I have heard that you need to provide --system switch to pipenv install command

#

so that you install you deps on the global path instead of a virtual env

broken eagle
#

Yeah, I saw that. I think I tried that at some point, but waiting for pipenv is such a slow process, I've worked on this for a day and half... and am not sure if I made some other strange change that prevented --system from working.

#

I'll keep poking at it

leaden tartan
#

@broken eagle I found Pipenv very slow too

#

Thats why i switched to Poetry

#

Its easier too

#

Pipenv plays with Pipfile.lock for too long. Its very annoying.

broken eagle
#

yes, very much so

#

have to use pipenv for this project, otherwise I would try something different

broken eagle
#

Also, building just a few times results in huge downloads

leaden tartan
#

Use alpine images

wooden ibex
#

No

#

As for pipenv In docker, it can add complexity where it’s not needed. Maybe see if you can use pip with requirements file.

leaden tartan
#

@wooden ibex Wow that was really insightful. I will look more into this.

wooden ibex
#

I didn’t write it

#

But I agree with their advice, I’ve had similar issues.

elfin cloak
#

Hey everyone, have a question on Celery, Django, and Ansible. I have a playbook that is going to take "some amount" of time to run, which I expect to be longer than the timeout on the HTML server for Django, and I've seen Celery mentioned as a solution, but to me, it looks like it's "just" a task scheduler, and I'm not sure how well that'll play with Ansible, since i'm submitting the playbook as what would be one task (I think)

leaden tartan
#

But I agree with their advice, I’ve had similar issues.
@wooden ibex time hasn't been a problem but yeah figuring out dependecies can be quite difficult

wooden ibex
#

Slim is pretty good without BS

supple venture
#

what is low memory error in pycharm ce?

wooden ibex
#

you are low on memory?

#

how much RAM do you have?

broken eagle
#

I'm using python 3.7 image. Not sure if that's built off alpine

wooden ibex
#

what does FROM say?

leaden tartan
#

I'm using python 3.7 image. Not sure if that's built off alpine
@broken eagle It's probably not

wooden ibex
#

FROM will be clear

#
FROM python:3.7-alpine```
#

that's alpine

supple venture
#

on my pycharm, it came a low memory error, it didn't come anywhere else in the stste

broken eagle
#

Im using

supple venture
#

system*

broken eagle
#
FROM python:3.7 AS base
wooden ibex
#

so stock python

#

which is pretty big I believe

#

my docker is firing up so I can't see

#

python 3.7 84d66a048f90 4 months ago 919MB

broken eagle
#

part-ay

#

im just tired at looking at Installing dependencies from Pipfile.lock (edf710)…

wooden ibex
#

again, I don't know pipenv but does it make requirements.txt file?

#

or can you tell it to?

broken eagle
#

im required to use pipenv and pipfile for this :\

wooden ibex
#

why?

broken eagle
#

assignment

tawny temple
#

Copy the pipfiles into the container and run pipenv install --deploy --system

#

You can attach a shell to the container and run the python repl to test that the dependencies installed successfully

warm pollen
#

What does --deploy does again?

wooden ibex
#

Is pipenv part of default python images?

broken eagle
#

@tawny temple that's what I'm doing

#

Rabbit, no. You have to apt install pip, then pip install pipenv

brave scaffold
#

WW

tawny temple
#

So isn't it just a PyCharm issue?

#

Can you set where it looks for the interpreter?

#

Though I don't know how it could find an interpreter separate from the system interpreter.

#

It doesn't make sense.

#

Are you sure it's actually using your container?

vague edge
#

hey um so for sublime text the command palette only comes up with the keyboard short cut only if i use the ctrl key on the right side of my keyboard- is this intended or something?

wooden ibex
#

pip is default in python images

#
FROM python:3.7-slim

#Run PIP install
COPY requirements.txt .
RUN python3 -m pip install -r requirements.txt```
leaden tartan
#

Yep, i used to use poetry inside my docker images too. Then I realized that is useless since docker is absolutely virtualized from my system and there is no need for an additional python virtual environment and slow down the process, and increase image size.

tawny temple
#

If you're not using poetry then you're not using the lock file, which means you're susceptible to deploying with different dependency versions.

#

Unless you converted the lock file to a requirements.txt

wooden ibex
#

requirement files is needed for sure

leaden tartan
#

Unless you converted the lock file to a requirements.txt
@tawny temple I am doing that.

#

poetry has an export option and i use that in a git hook, that way it is always updated

tawny temple
#

A local git hook?

leaden tartan
#

yeah

#

pre commit i believe

tawny temple
#

That doesn't sound reliable.

leaden tartan
#

why?

tawny temple
#

Because you cannot ensure every contributor has the hook installed

leaden tartan
#

other team members always have a reliable copy of requirements on their system

#

it is their responsibility to use it correctly

tawny temple
#

Are you checking in the requirements.txt?

leaden tartan
#

ofc

tawny temple
#

Then it's possible for someone to check in an updated lock file without updating requirements.txt

leaden tartan
#

im checking in requirements.txt poetry.lock and pyproject.toml

#

Then it's possible for someone to check in an updated lock file without updating requirements.txt
@tawny temple their PR would fail, since I have CI setup

tawny temple
#

I would have just done it in CI to begin with

leaden tartan
#

Can you explain a bit?

#

this is thr best method I have come up with

#

I'd like to know how experienced people do it

tawny temple
#

I personally don't care about having a requirements.txt file checked in. So I'd have the poetry lock file exported in CI. If anyone needs to build containers locally for some reason, then they can manually export the file before building (or write a short shell script that combines the export and docker commands).

#

But you may like having a requirements.txt file checked in cause it means no one ever has to rely on poetry to install it as-is.

wooden ibex
#

github action sounds like a great way to export poetry into requirements.txt for building

leaden tartan
#

or they could install poetry on their docker image

#

github action sounds like a great way to export poetry into requirements.txt for building
@wooden ibex Yeah that's a CI

tawny temple
#

Installing poetry in docker would be slower, but yes, they could

#

At least as a multi-stage build

leaden tartan
#

it's quite slow lol

#

and in alpine you have to install a bunch of stuff

#

not worth wasting time over

tawny temple
#

How does CI fail though in your current setup?

#

You said it fails if the files are out of sync

leaden tartan
#

earlier my tests used to take 15 minutes with all the poetry bs, but now i removed it and takes about 10 minutes

#

You said it fails if the files are out of sync
@tawny temple my build is failing these days but it's not a dependency issue. It's a permissions issue inside docker that I can't figure out lol

tawny temple
#

Well, the main concern I have is that the files can go out of sync since you cannot enforce contributors to properly have hooks set up. I'm not sure how you could check they're in sync in CI either.

leaden tartan
#

You are right there. But since my project has no contributors, it doesn't matter

tawny temple
#

Actually, you could export in CI and then ensure there's no diff. But that's only if you want a requirements.txt checked in for other reasons I mentioned. Otherwise, that'd be redundant and you could just solely rely on the export in CI.

leaden tartan
#

Yeah that's what I should probably do once I invite some contributors

wooden ibex
#

I keep looking at Poetry but I'm confused what it does besides combine virtualenv/pip into single stages

tawny temple
#

It has a lock file which ensures consistent version for all sub-dependencies

#

Well, I guess that's like pip freeze

wooden ibex
#

yea

tawny temple
#

Yeah you are basically right

#

It just tries to package it into something more convenient and integrated

wooden ibex
#

but I don't switch python versions or heavy development

#

so maybe I haven't hit the need for it

leaden tartan
#

one major reason i like poetry is like consider this pip install jupyter installs a bunch of dependencies but pip uninstall jupyter removes only one package and i get an invalid requirements.txt

#

poetry takes care of version solving elegantly

#

I think pipenv does the same but it's freaking slow and annoying

wooden ibex
#

I see

obtuse rapids
#

I use poetry to build packages and publish them to PyPI. It's fantastic for that.

swift spindle
tawny temple
#

Logging uses different logging levels. The standard library's logging module supports a debug log level. You can use an environment variable or some command line option to determine whether the debug level should be used.

#

If the logging level is higher than debug, debug logs will not be shown.

void burrow
#

tip regarding logging, while it is true that logging.debug("debug %s msg", arb_obj) will only emit if level is debug or higher, be careful with f-strings and the like, where logging.debug(f"debug {arb_obj} msg") will compile the f-string regardless of log-level. which may or may not matter to you, depending on how tricksy arb_obj is to serialize.

swift spindle
#

Thanks for the tips!

tropic ibex
#

Is there any way to find official documentation for a specific command?

#

I can't find documentation on:
my_dict.values()[x]

#

I only get things related to dictionary.values(), but nothing directly addressing directionary.values()[x]

Specifically that ()[x]

tawdry needle
#

@tropic ibex () is just part of .values()

#

my_dict.values() returns a list-like thing, which supports accessing elements with []

#
vals = my_dict.values()
vals[x]

you can do this, right? so

my_dict.values()[x]

is the same

#

!d g dict.values

rancid schoonerBOT
#
values()```
Return a new view of the dictionary’s values. See the [documentation of view objects](#dict-views).

An equality comparison between one `dict.values()` view and another will always return `False`. This also applies when comparing `dict.values()` to itself:

```py
>>> d = {'a': 1}
>>> d.values() == d.values()
False
tawdry needle
#

actually im not sure that object does support []

#

in fact im pretty sure it doesnt

#

where did you see this? @tropic ibex

tropic ibex
#

Saw it used in a test code in some tutorial

#

Thaks for the explanation btw.

#

It worked, that's why I was fascinated.

tawdry needle
#

!e ```python
print( {'a': 1, 'b': 2}.values()[1] )

rancid schoonerBOT
#

@tawdry needle :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | TypeError: 'dict_values' object is not subscriptable
tawdry needle
#

was it a python 2 tutorial?

tropic ibex
#

I believe so

#

Not entirely sure

tawdry needle
#

iirc .values used to return a list in python 2

#

don't use python 2

#

!e ```python
print( list({'a': 1, 'b': 2}.values())[1] )

rancid schoonerBOT
#

@tawdry needle :white_check_mark: Your eval job has completed with return code 0.

2
inner pollen
#

I use poetry to build packages and publish them to PyPI. It's fantastic for that.
@obtuse rapids Any guide on how to publish your package using poetry.

leaden tartan
#

i think poetry's website has one

inner pollen
#

Yes it's very straight forward.

supple venture
#

how do i add my pycharm presence on discord , i am using pycharm community version an ubuntu 18.04

supple venture
#

hmmmm i put the discord intregeration but doesn't work

heavy knot
obtuse rapids
#

python executable not in $PATH

heavy knot
obtuse rapids
#

Strange. At least, Atom can't find it.

supple venture
#

you may not have put a build of it i think

supple venture
#

ok i got that rich presence plugin but it still doesn't work

supple venture
#

i get this

#

using ubuntu 18.04

wide forum
#

How do I understand programming?

#

Any references?

thorny spear
#

you get used to it when i started it was hard at first but when you get the hand of it you will be ok

fervent orchid
#

Hi everyone, bit of a noob question but I can't set up a python environment on windows with venv for some reason

#

I keep getting this error:

#
PS D:\Home\USER\Documents\Development\Python\learning_dj> python -m venv learning_dj
Error: [WinError 2] The system cannot find the file specified: 'D:\\Home\\USER\\Documents\\Development\\Python\\learning_dj\\learning_dj'
#

Anyone familiar with what's going on here?

#

Nevermind it was a Windows thing

#

Controlled Folder Access was blocking it

#

Wait nvm with CFA off it still doesn't turn on the virtual environment

#

ohhhhh I needed to use the .ps1 not the .bat

#

ok

tranquil birch
#

Question : What IDE you recommend for python (i.e PyCharm, Atom, etc.)

vague edge
#

i personally use intellij

#

but vs code is also good

#

for editor speed sublime is epic but it has no intellisense

tranquil birch
#

but vs code is also good
@vague edge I use vs code for HTML, I might search up info about intellij then !

vague edge
#

dude epic

cerulean flame
#

did you guys use tasks to run python scripts in VScode?

leaden tartan
#

yeah i do

cerulean flame
#

do you use conda?

leaden tartan
#

nope, i am more into web dev

cerulean flame
#

when I select my environment in the bottom left it doesn't translate to the task

#

ahh

leaden tartan
#

when I select my environment in the bottom left it doesn't translate to the task
@cerulean flame it should

#

vscode always activates virtual environment before running tasks

cerulean flame
#

are you thinking of launch instead of task?

leaden tartan
#

no I'm talking about the tasks that are defined in tasks.json

cerulean flame
#

im on windows so I don't know if that's the problem. I try to run python it is uses the python from base instead of the one I select.

leaden tartan
#

maybe you can chain commands?

cerulean flame
#

im thinkign about using conda run

#

not sure of the performance of that tho

leaden tartan
#

yeah that's fine too

#

performance should not be a problem

#

conda just reroutes your command to the correct virtual environment, nothing more

cerulean flame
#

on my pc, I was using the defaul launch.json way of building the project but I had isses w/ it

leaden tartan
#

building is a bit different

cerulean flame
#

it would activate run and deactivate the environment but i found it was slower than clicking the terminal w/ the active env and hitting up to run previous build command

#

im looking for something faster

leaden tartan
#

hmmm

#

maybe a script which does all this and then a task in tasks.json?

#

that runs this script ^?

cerulean flame
#

I haven't tested conda run yet

#

hopefully its faster

#

im trying to find a faster way to build then just moving my mouse lol

#

conda is weird allowing you to use base version of python w/o activating the env

#

not sure i like that

spiral ore
#

Hey guys, was directed here for my issue at hand. Hope you can help. Not sure what exactly is the issue and it seems like a basic one tbh.

Basically not getting any commands to work, or well, most of them aren't, some are still working.

#

Like this issue right here simply trying to make a venv folder. Or listing pip I get that pip isn't a valid command either. Not sure exactly why this is.

#

I've installed python to VSCode, then Anaconda, then I also installed Git. That's it.

leaden tartan
#

do you have python installed?

#

looks like you do

spiral ore
#

Yes ofc

leaden tartan
#

what's the output which python

spiral ore
#

which: no python in (/mingw64/bin:/usr/bin:/c/Users/Rocinante/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/cmd:/c/Users/Rocinante/AppData/Local/Microsoft/WindowsApps:/c/Users/Rocinante/AppData/Local/Programs/Microsoft VS Code/bin)

dusty maple
#

Might have something to do with Msys

leaden tartan
#

can you change your default shell and try running python again?

spiral ore
#

Somethings off.... On my laptop, which is W10 based as well, I don't have this issue really. Although I also have more choices when it comes to choosing interpreter (like 32 and 64 bit)

leaden tartan
#

definitely weird

#

vscode is detection python but your cmd, git bash or powershell can't

ashen cradle
#

hey guys, I'm currently teaching introductionary programming and got a technical issue at the school I'm working at - no admin access chromebooks for all the students, trying to figure out a way to get some form of IDE that supports pygame and/or flask

#

anyone got any suggestions for a cloudbased solution or any other tips?

#

currently, we're running google colab 'cos of google integration for the rest of the schoolenvironment, works fine, except, no real support for pygame

frozen pier
#

Can anyone help me get vim rich presence? (please @ me if you would like to help)

sly sleet
#

@spiral ore what does clicking the thing in the bottom left corner show

#

the "conda" text

spiral ore
#

It was just the conda interpreter, nothing else. I just uninstalled everything and removed all folders and will try with a fresh install. Maybe the "install path" wasn't ticked or something, who knows....

#

But I'll try that tomorrow. Gotta sleep now. Thanks anyway guys, much appreciated!

tired fractal
#

Guys how could i get my computer audio?? (obs: its not the microphone)

#

like in real time

smoky compass
#

Why does flake8 complain about __path__ being "F821 undefined name"?

ember relic
#

Pycharm question: how can I update my interpreter? Switching it in the settings window doesn't let me update from 3.7 to 3.8

sly sleet
restive fable
#

anyone know whats wrong with line 5 im stuck

#

driverage = 0
licence = 0
driverage = int(input("please enter your age"))
licence = int(input("do you have a drivers licence? 1 for yes, 0 for no"))
if driverage >= 17 and licence = 1:
print("You can legally drive cars on the road!")
else:
print("You cannot drive on the roads!")

mint veldt
#

you need ==

#

after the 'and'

frozen anchor
#

@restive fable for the future, this is better suited to the general help channels, as your question doesnt havevanything related to #tools-and-devops

broken eagle
#

@ember relic what OS are you running?

#

There are a few ways if your system requires a specific version.

#

You can install anaconda or run things through docker

heavy knot
#

Yes, I know this is sloppy code but im just testing for now. How would I go about making it so if I type XXXXX it will replace those inputs with a random string or number, and it will do it for any variable i type in the input

topaz aspen
#

Is is possible to cache joblib output to a Csv of JSON and pickle?

elder solstice
#

@heavy knot A for loop that iterates through each character in the input, with an if branch that selects from a different character pool depending on the input character, should do the trick

heavy knot
#

How would I make it go through each character

#

actually lemme rephrase that, i know how to make it go through each character but how would i make it replace it and then put it all back into one line

#

somehow removing the inpstr line fixes it but when i keep it there, it says invalid syntax at print(s, end = "")

sly sleet
#

you're missing 2 close parens at the end of the prev line @heavy knot

#

also you don't need the ''.join since random.choice already returns a string

heavy knot
errant gyro
#
import string
from ctypes import windll


def get_drives():
    drives = []
    bitmask = windll.kernel32.GetLogicalDrives()
    for letter in string.uppercase:
        if bitmask & 1:
            drives.append(letter)
        bitmask >>= 1

    return get_drives()


if __name__ == '__main__':
    print(get_drives())```
#

I know this is wrong but I'm not sure how it is wrong. Also when I use if name is main does my file name need to be main or should I change that to the actual filename?

#

changed:
for letter in string.ascii_uppercase
and
return drives

wooden ibex
#

What are you doing?

heavy knot
#

Its kind of doing what i need it to do. Its replacing but i need a random character for each character, not the same random character for each one its replacing

#

so like XXXXX would turn into AK1CH or something like that, its all random

wooden ibex
#

This is for Tools/Devops work

tawny temple
#

This channel is not appropriate for your question.

heavy knot
#

for me or spencer

wooden ibex
#

that was for you

heavy knot
#

i just now understood that channel, i thought help-name was some sort of install for python not the name of the help

#

thanks

tawdry needle
#

is there some tox equivalent but specifically based on pyenv

errant gyro
#

I'm trying to backup a drive when plugged in

#

Currently I have my script checking for drives then when a new drive is detected it makes a new folder on my desktop and uses robocopy to copy the drive data over

#

I'm trying to use check_output to run robocopy but right now it is timing out.

#

Now I have most but not all of the drive copied

wooden ibex
#

Powershell would probably be better tool

#

robocopy is exiting out for some reason

errant gyro
#

I was able to get it to run I think the exit is just not clean

#

I want to use python because I'm trying to learn the system stuff in python
-edit added "in python"

#

I use powershell all the time :p

#
import os
import string
from ctypes import windll
import time
from subprocess import check_output


def get_drives():
    drives = []
    bitmask = windll.kernel32.GetLogicalDrives()
    for letter in string.ascii_uppercase:
        if bitmask & 1:
            drives.append(letter)
        bitmask >>= 1

    return drives


if __name__ == '__main__':
    print(get_drives())
    before = set(get_drives())
    waitfordrive = input("Please insert USB drive now, then press ENTER: ")
    print("please wait...")
    time.sleep(5)
    after = set(get_drives())
    drivestatus = after - before
    delta = len(drivestatus)

    if (delta):
        for drive in drivestatus:
            if os.system("cd " + drive + ":") == 0:
                newly_mounted = drive
                print("There were %d drives added: %s. Newly mounted drive letter is %s" % (
                delta, drivestatus, newly_mounted))
                check_output("robocopy \"%s:\" \"C:\\Users\\Spencer-IT\\Desktop\\%s\" /mir /r:5 /w:15 /mt:32 /v /np /log:backup-py%s.log" % (newly_mounted, newly_mounted, newly_mounted), shell=True)

    else:
        print("Sorry, no new drive was detected.")```
#

How can I make this better?

broken eagle
#

Comments and docstrings

tawdry needle
#

@errant gyro as a matter of style, i would write all that code under if __name__ == '__main__' into a main() function, then just do

if __name__ == '__main__':
    main()
#

if (delta) should probably be if delta != 0

#

drivestatus is a bad name, how about drive_diff?

#
if os.system("cd " + drive + ":")

dont use os.system, do this instead:

if os.path.isdir(drive + ":")

or better yet

if os.path.isdir(f"{drive}:")
#

also i'd avoid using % interpolation in general

#

f-strings tend to be easier to read in my opinion, especially if your text editor has good syntax highlighting

robust sandal
#

what should be the best approach to start build automation framework for Rest API?
I'd like to use nose2 framework for automation

leaden tartan
#

@robust sandal are you sure about nose2? Looks like pytest is a much better option.

robust sandal
#

yeah nose2 is my requirment

leaden tartan
#

If you do choose pytest, feel free to dm me, since I am also working on testing a django rest api with pytest

robust sandal
#

Hi @leaden tartan

#

I have dm you

shy yarrow
#

Hi! i just had a question about porting over code from python 2 to python 3. I have to update a codebase where some of it is python 2 and some of it is python 3 and i was wondering if there is an efficient way of differentiating between the py2 and py3 files

errant gyro
#

What is the reason behind this recommendation?

if os.system("cd " + drive + ":")

dont use os.system, do this instead:

if os.path.isdir(drive + ":")

or better yet

if os.path.isdir(f"{drive}:")

@tawdry needle

tawdry needle
#

os.system is almost never a good idea

#

just in general

errant gyro
#

Is it a security concern?

tawdry needle
#

partially yes

#

but more generally it just makes a big mess

#

not to mention portability concerns across different shells over time and different machines

#

which might not matter to you, but its a good habit to avoid using it unless absolutely necessary

#

plus, your intent is clearer when using os.path.isdir anyway

errant gyro
#

I thought it made it more portable, but I have not used it in a long time as well

tawdry needle
#

os.path.exists could work too

errant gyro
#

Ok cool

#

Thanks for the upgrades this does seem more clear

errant gyro
#

How would I know the best time to use subprocess.check_output() vs subprocess.run()?

tawdry needle
#

@errant gyro use check_output only if you need to check the return status. use subprocess.run if you want to do other things

meager saffron
errant gyro
#

Is that the google foo bar?

#

Or is that the one inside pycharm... Anyhow feel like I have done that before but can't remember what I did

tawny temple
#

@meager saffron As the channel name and topic state, this channel is for tools and devops, of which your question is neither. You should claim a help channel to ask that. #❓|how-to-get-help

tawdry needle
#

@meager saffron also this looks like homework. please note that we cannot hand out homework answers, but we can help indirectly by clarifying material from your classes and directing you to other learning resources

frozen pier
#

Can anyone help me get vim rich presence? (please @ me if you would like to help)
@frozen pier anyone?

leaden tartan
#

I'm using tox for test automation, and would like to ask- how do I install different python interpretors without changing my default python interpretor (3.8.5)?

#

i use Arch btw

tranquil creek
#

pyenv

#

Or containers

leaden tartan
#

in my experience tox on docker is annoyingly slow.

#

I'll look into pyenv

dusty maple
#

I have multiple Python versions on my Manjaro system through pyenv to facilitate tests through tox

#

On Travis CI on the other hand I just have to configure the build matrix to ensure concurrent builds across versions

leaden tartan
#

@dusty maple can you please link some tutorials to do this? I can't find one, and don't want to mess up my default python

dusty maple
#

Right after that, I typically do: (replace x with the latest patch number)

$ pyenv install 3.8.x
$ pyenv install 3.7.x
$ pyenv global 3.8.x 3.7.x system
#

This makes python3.8 and python3.7 available globally

noble sand
#

Can anyone help out with figuring out the text editor atom?

ancient abyss
#

Which is better, PostgreSQL or MySQL

leaden tartan
#

@dusty maple thanks i'll look at it

leaden tartan
#

@dusty maple I get Interpretor not Installed even though I did pyenv install 3.7.8 and then pyenv global 3.8.5 3.7.8

dusty maple
#

@leaden tartan Are you able to invoke both interpreters just fine?

leaden tartan
#

@dusty maple The answer is no, but I got it working. Thanks!

tired fractal
sand thistle
#

i suck with pdb

#

how do i get good

errant gyro
#

If I had a RAID 0 and the controller died, but I have another controller can I connect the drives to a new, but different brand and model of RAID controller, can that work? If so will it take long to rebuild or for the RAID controller figure out the layout of the disks?

wooden ibex
#

Maybe

plush cobalt
#

Apologies, new to this channel. Ran into a very unique python3.7 error, found on a docker cloud container when site randomly threw a 504 error:
Sorry

importlib/_boostrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject?```
leaden tartan
#

is it possible to setup Travis CI so that it automatically publishes a package to pypi once all tests pass?

tawny temple
#

Generally, yes. You can create a step that uses twine to perform the upload. I'm not familiar with Travis specifically.

leaden tartan
#

I don't personally use twine, i use poetry but the process would remain same as what I'd do locally, right?

tawny temple
#

Yeah, if poetry lets you upload then you can use that

leaden tartan
#

it does

tawny temple
#

Just execute the same command you would locally I guess

#

Make sure whatever secrets you need are available in CI

leaden tartan
#

Yeah. Also is it possible that the package is published only from the master branch?

#

i develop on a different branch and push to master every now and then

tawny temple
#

Generally yes, but how you accomplish that depends on CI. I'm not familiar with Travis as I said

leaden tartan
#

I want only this commit to be pushed to pypi under a new version

tawny temple
#

You need to look for how to create conditional steps/jobs

leaden tartan
#

ok i'll have to research a bit, ig

#

which CI do you use?

tawny temple
#

And typically you have some predefined env vars set by the CI like the branch name. You can use that in the condition.

#

I'm familiar with both Azure and GH Actions.

leaden tartan
#

hmmm, gh actions feels a bit weird to me

#

it has this weird syntax that I find difficult to familiarize myself with

#

but anyway thanks for the pointers

tawny temple
#

Azure gets more complicated when it comes to syntax 😄

#

Has template stuff that can get quite ugly

#

Basically abusing YAML at that point

leaden tartan
#

do people follow the pep8 standard of 79 chars? I find that very restricting and increased mine to 90 chars but I feel like I am cheating somehow.

tawny temple
#

No. That's probably the most ignored thing in there by people who otherwise follow it

tawdry needle
#

i usually do 100 or so

leaden tartan
#

yeah I used to see a lot of projects which would have theirs increased to 100 amd would laugh at them. but now that I am working on a serious project, I see where problems creep in.

tawdry needle
#

in a lot of "business code" i see, sometimes variable names can get long

leaden tartan
#

yeah. absolutely_dont_change_this_var = SECRET_KEY

tawdry needle
#

yep

#

not to mention really long imports

leaden tartan
#

i find that long imports can be minimized using brackets and __init__.py files are really helpful to minimize import code

tawdry needle
#

sure. however i find that too much happening in __init__.py can make it hard to follow code in big applications

#

i'd rather just have long chains of imports

#

obviously with good IDE support its less important

leaden tartan
#

atm, my init files just have the imports and an __all__ variable to stop my linter from complaining.

#

but I've seen a lot of projects using init files as more than that

#

especially django has a few Exceptions declared in init files

velvet granite
#

How to run aria2c on python?

#

Iam using termux as the CLI

#

For example.
Python = checks link if valid and online
Python, passes the link to aria2c and start the download

buoyant snow
#

Hi there, I'm wondering if anyone has a solution to fold multiline strings in VS Code?

grizzled pike
#

Does Python3.8's typing module have some kind of functionality for a function type?
I imagine something like this: (I know this is a stupid example, it just shows what I'd need)

def f(func: Function[int, dict]) -> dict:
  return func(1)
#

(I presume this counts as tools, cause its direct type documentation, which editors mainly need)

dusty maple
#

@grizzled pike You're probably looking for the Callable type

grizzled pike
#

yeah

#

tho... yay... no keyword arguments (which i'd need), but i can deal with that

#

thanks! ❤️

heavy knot
#

@leaden tartan yeah i installed hroku

#

heroku

west wolf
#

um, do someone know how to fix this bug i have in pynput? I am doing Controller.type("string") and it doesn't work, here's the error I'm getting: TypeError: type() missing 1 required positional argument: 'string'

leaden tartan
#

@heavy knot you're on windows?

sly sleet
#

@heavy knot is it on your path?

heavy knot
#

sorry for late response

#

im on windows

#

and my path is fine

#

okay

#

now its working

#

and i havent done anything at all

#

weird

leaden tartan
#

If you reboot your machine, that could be reason

#

or if you restart cmd, that could be another

hearty swift
#

hello, i have problem

#
FROM python:3.8
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
CMD ['python','server.py']
#

that's my docker and it says me: /bin/sh: 1: [python,server.py]: not found

#

wtf?

leaden tartan
#

what does your directory structure look llike?

sly sleet
#

python3?

leaden tartan
#

shouldn't really matter, tbh

patent goblet
hearty swift
#

uh, nevermind

#

acctualy i was fighting with docker+flask(hello word) straight 2h

cyan scarab
#

can someone help me with Git

#

i add some files to the .gitignore but they still ask to be commited

#

why is this happening

finite fulcrum
#

They'll stay tracked if they were tracked before the gitignore was added

obsidian torrent
#

Hi, Could someone please help me setting VS Code up?

#

It's incredible hard to do anything in that thing

leaden tartan
#

@cyan scarab they can be removed though git rm --cached filename

#

@obsidian torrent what's the issue?

supple venture
#

can i push my code to a new branch from the pycharm app?

#

if yes how

vestal pier
#

Pycharm has git integration, I only use terminal though

#

so I am not totally sure

supple venture
#

hmmm, ok i will push from terminal 😄

buoyant snow
#

@obsidian torrent what'd you like to do in VS Code?

warm pollen
#

can i push my code to a new branch from the pycharm app?
@supple venture you have to change branch first

bronze kite
#

hey i want to lean python

#

plz help me

#

😫

leaden tartan
#

!resources @bronze kite

rancid schoonerBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

bronze kite
#

recomend me a good tool

lethal flax
#

How do folks here set up a local repository for installing inhouse packages with pip?

#

I'm using twistd but I'm seeing very weird behaviour on its part with regards to tar.gz files.

leaden tartan
#

@bronze kite for editing py files? Vscode

lethal flax
#

PyCharm! 🙂

leaden tartan
#

yeah both work fine

buoyant snow
#

@leaden tartan if you are using vscode, don't you have the multiline string wrapping issue that i've mentioned yesterday in this channel?

leaden tartan
#

i don't, but that's because I don't really use multi line strings except for documentation for my methods.

#

and there's a way to have multi line strings with code folding but it's a bit weird

buoyant snow
#

eventho it says vscode will do the default + the ones defined by the extension

bronze kite
#

@leaden tartan no bro i am going to start learning python thats why i asked you guys that suggest me start up development tools, that i would start my practice and further I’ll go to next tools

cyan scarab
#

@leaden tartan thx

leaden tartan
#

!resources @bronze kite

rancid schoonerBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

latent spindle
#

hi

#

So I installed Anaconda Python and VScode a few months ago. I'm on MacOS.
Until a few hours ago, VSCode worked fine, and I could run everything in the interactive window. But then, I downloaded a new .py file, opened that in VS code, and I believe I clicked on something that might have changed my version of python or the editor that I'm using or something. Now, I can't run the python interactive window at all.

#

nevermind i fixed it

#

holy sh

#

its been lik 2 hours lol

leaden tartan
#

I have been reading up on semantic versioning and came upon this line

Software using Semantic Versioning MUST declare a public API. This API could be declared in the code itself or exist strictly in documentation. However it is done, it SHOULD be precise and comprehensive.

Can anyone explain what this means? What API are they talking about? I am making a package that will follow this versioning system, but it doesn't have an API, it's not a web-app.

For reference: https://semver.org/#spec-item-1

dusty maple
#

@leaden tartan The API that it's talking about is the interface that your application exposes e.g. the signature of the functions/classes/methods you're exporting or things like constants

#

e.g. suppose to say that on x.1.x you have a function with the signature of

def foo(xs: int) -> int:
```turning it into a
```python
def foo(ys: float, xs: int) -> int:
```e.g. making it backwards incompatible when upgrading to `x.2.x` doesn't make sense
leaden tartan
#

So basically, it wants me to write documentation?

dusty maple
#

It wants you to declare an interface that isn't volatile

leaden tartan
#

So basically, I have to declare one function syntax and stick to it for the entire lifetime of the project?

dusty maple
#

You can always make a backwards compatible change that also changes the function signature

leaden tartan
#

Ok, but it also says that a major updates like 1.x.x to 2.x.x can introduce backward incompatible changes.

dusty maple
#

Yes

winter forum
#

i need help

#

pls dm

heavy knot
#

Hi everybody! I don't know if this is the best place to ask, but I'm looking for a framework that can help me build a robust api based on the aws services (or any other recommended cloud). Which one do you recommend? I can adapt to any language, but my current backend is mostly in python, so the migration would be easier if the framework is also in Python, but I prioritize how complete and robust the framework is more.

wooden ibex
#

@heavy knot FastAPI or could convert to Lambdas

gentle heart
#

+1 for FastAPI

heavy knot
#

currently my endpoints are defined with flask, with FlaskAPI the development and deployment to Lambdas is easier?

wooden ibex
#

Lambdas are complete rewrite

#

you can keep rocking FlaskAPI

#

FastAPI is better, FlaskAPI isn't terrible

onyx zodiac
#

hello everybody

#

i have a problem that i want to solve

#

it has to do with the black formatter

#

and the vscode python extension

#

long story short i need to find which file within the extension tells vscode how to execute black

#

coz i need to change the args that it gives it

leaden tartan
onyx zodiac
#

no, no, i know about that

#

but i want to remove the default ones

#

when formatting code vscode calls black like this: python -m black --diff --quiet <file>

#

i want to remove those two args

alpine ridge
#

hey can anyone explaing what kubernetes is and does?

leaden tartan
#

It's a vast concept. If you don't know docker, I suggest you get started with that

alpine ridge
#

ohh, okay

distant sun
#

I think this is kind of the wrong place to ask that too

leaden tartan
#

kubernetes is a tools used in devops so it's not entirely wrong...

#

but yeah, it was useless to ask here, they would have been rerouted to Google anyway

kind glacier
#

Is it possible to get data from, for example, steam / epic (% of download) or spotify running in the background (volume or name of song)? So that it runs in the background, what tools to use?

left mulch
#

In Visual Studio Code with Microsoft Language Server and IntelliCode, IDE doesn't autocomplete or show information about nested methods and objects from non-standard packages (like pygame). How can I fix that?

hushed plume
#

anyone know how to decrypt a batch file?

sly sleet
hushed plume
#

i forgot which channel it was

#

i asked an off topic question here

#

iirc

astral crest
#

This is sort of a packaging question, so I hope it fits here. I've built a CLI with click that I intend on putting on PyPI. I need to include two image icons for part of it, but they just don't seem accessible by the package (running after pip isntall -e .). The images are in MANIFEST.in, I can see them being included in the builds from tox and setuptools so am I just brain lapsing on something fundamental? What's the right way to include some arbitrary files in a package?

leaden tartan
#

Can someone tell me how some packages add executables to path? For example pip install pytest adds pytest to path automatically. I looked at pytests source code and did find an interesting line here (https://github.com/pytest-dev/pytest/blob/master/setup.cfg#L63), but I have no idea how the actual thing is done.

dusty maple
#

@leaden tartan I'd assume console_scripts is set somewhere in the setup.py file

leaden tartan
#

@dusty maple nope that file is empty, atleast for pytest.

dusty maple
#

Interesting

#

Yeah, seems like they use setup.cfg extensively

leaden tartan
#

yeah and pytest:console_main which should generally point to def console_main in a file called pytest.py doesn't exist.

#

Yeah, seems like they use setup.cfg extensively
@dusty maple they do, but it doesn't make any sense to me

dusty maple
leaden tartan
#

hmm yeah. Can you tell me some keywords that I can look up so that I can learn how to do this?

#

I don't know what to look for

dusty maple
#

I typically just go for python packaging

leaden tartan
#

that's too broad, it just brings up packaging basics

dusty maple
#

I meant as a prefix for most of my searches

leaden tartan
#

Well thanks. I'll look into it.

leaden tartan
heavy knot
#

hi, any user of poetry? I've some issues trying to run this package https://github.com/PrVrSs/idl2js/, I installed the package, and I'm able to run make and show tests working fine, but I can't exec main.py I got ModuleNotFoundError: No module named 'idl2js'

leaden tartan
#

@heavy knot i use poetry but this doesn't look like a poetry issue

heavy knot
#

I understand, but it's more to be sure I did everything right, if I run poetry run python idl2js/main.py I got no output

leaden tartan
#

here's the workflow I'd follow

#
git clone project
cd project
poetry install
poetry shell
python idl2js/main.py

@heavy knot

#

also from what I see, main.py isn't the main entry point

heavy knot
#

right, I did the same, do you have 5min to check the library? I'm noob at python and maybe I'm missing howto execute it

leaden tartan
heavy knot
#

how then? it seems it gets -w to get the idl file right?

leaden tartan
#

right, I did the same, do you have 5min to check the library? I'm noob at python and maybe I'm missing howto execute it
@heavy knot maybe ask the author to include setup instructions in README?

heavy knot
#

I did it a week ago, no reply

leaden tartan
#

how then? it seems it gets -w to get the idl file right?
@heavy knot i have no idea, the README should take care of stuff like this

#

but bottom line, this isn't a poetry problem but just inadequate documentation

heavy knot
#

thanks, I wanted to confirm it

#

not sure what to do I'm not understanding how the tool works

#

the readme is "this input, this output" but no examples, and make shows tests but not how that works

leaden tartan
#

yeah you should open an issue in their github

#

last commit was about a month ago, so the author would probably reply

heavy knot
#

I wrote to email, if he doesn't reply I doubt he will using issue in github

#

most of my questions on github unless is a big project are ignored

#

I understand no one wants to give free support to others, and they are more like, there is the code, your problem now if you want it

#

a bit frustrating when you are not a python developer and they use poetry or another package dependency manager I've ever used

leaden tartan
#

as i said, this isn't a poetry problem

heavy knot
#

I agree

leaden tartan
#

just open an issue, if it doesn't work then oh well just move on

heavy knot
#

thanks again IgnisDa

leaden tartan
#

do people actually use autodoc extension that Sphinx provides? the only python package using it is flask from what I see

ornate forum
tawdry needle
#

yep i use autodoc

#

saves a lot of typing

#

i use sphinx-napoleon with google style docstrings

#

so its the best of both worlds, i dont have to pollute my docstrings with tons of rST markup, but at the same time i still get to write all my docs inline and only in one place

leaden tartan
#

@tawdry needle i can't get it to work though. Perhaps you know a good tutorial or maybe have a repo using Sphinx and autodoc that i could use to learn?

tawdry needle
#

i had a lot of them at my previous job, i havent made one for personal use yet

#

for the most part it was just a matter of sticking the .. automodule:: foo directive in the foo.rst file

#

and some other syntax to get a basic table of contents on the front page

#

then invoking sphinx-build

leaden tartan
#

@tawdry needle so is there a way to get all the docstrings for a particular project without having to create corresponding rst files for them?

tawdry needle
#

what do you mean "get all the docstrings"?

#

you can do multiple automodule directives in one rst file

leaden tartan
#

now that I think about it, get all modules would be pretty stupid. I think I have to read the docs for Sphinx a bit more.

dense forum
#

does anyone know why my linters arent working

#

in my settings.json file, i have pylint and flake8 enabled

#

normally it would give off 3 errors in that code (nonexistent module, whitespace in 2nd line, lack of empty line after end of file)

#

but for some reason it doesnt show anything

leaden tartan
#

it may be because you have 2 linters enabled?

#

I'm not sure though

dense forum
#

i had 2 linters enabled before and it worked perfectly fine

#

im not sure why it suddenly doesnt work

leaden tartan
#

an update break?

dense forum
#

hmm

#

wait how do u check updates

#

wait nevermind i found the updates

#

im not sure if update caused it

#

but my linting did break like 2 days ago

#

i dont remember when the update was

leaden tartan
#

if you're on windows, updates can be downloaded from vscode website

#

otherwise use your package manager

proper plover
#

anyone know of a way in pycharm to have a macro/hotkey run a script on the current text selection in the ide and insert the output back into the current file
think parsing a class and automatically writing the docstring

#

i already have a script that does what i want given .txt file with the text selection and prints the output, but id like to be able to run it on the fly given a text selection from the ide

sly sleet
#

@dense forum check the extension log under the output tab

dense forum
#

ok

#

i dont see anything wrong with it

#

@sly sleet what would be in the extension log that i should look for

#

i found this under "Python"

sly sleet
#

huh that's weird

heavy knot
#

when should git issue be closed?

#

once developer fixes or when team approves?

leaden tartan
#

Technically once an issue is fixed, shouldn't all the developers automatically approve?

heavy knot
#

one said to not close it until they review the code and test themselve

leaden tartan
#

Well since the developers don't approve, you probably shouldn't close it

#

Team work is a thing last I checked

heavy knot
#

ok i want to annoy them by closing, so i was looking for someone to back me up but ok i guess to leave open now

#

Team work is a thing last I checked
@leaden tartan oh

leaden tartan
heavy knot
#

hmmm probably get thrown out to the street man

#

is there good guide on how it explain everythin for git and how to use good practices etc, in noob language

#

or does this just come with experience?

leaden tartan
#

Experience always works but to use that experience, you need to have the knowledge in the first place

heavy knot
#

alright thanks, i will take a look. reading is sometimes difficult because of language barrier, but i shall try

#

also do most people use git command line, or gui?

#

personally i find gui easier because it shows easy to understand changes/differences

leaden tartan
#

also do most people use git command line, or gui?
@heavy knot Doesn't matter, if you know the basics, the method used hardly matters

#

I prefer the cli

heavy knot
#

hmmm, maybe the os influences some people also i think so what they use?

#

i am windows so i use gui

leaden tartan
#

Well OS hardly limits the tool available these days but yeah as a general rule windows users prefer GUI

heavy knot
#

ok thanks a lot for the resources

#

good day

analog dirge
#

looking for help with Odoo 12 tag me please

drowsy lava
#

Everything that doesn't have a text or spaces in it is black for some reason

thorn berry
#

guys i need to convert a .exe file to a .msi using python

#

anyone knows some possible solutions or packages that i can use for this?

#

not sure what this does tho

#

could someone please help me understand if this library is fine for converting .exe to a .msi file

drowsy lava
#

from what I can read I think so

thorn berry
#

@drowsy lava i cannot see any docs for converting .exe to .msi

drowsy lava
#

maybe look again

#

why can't you use a .exe?

thorn berry
#

silent installation

#

i need to download and silent install exe files

#

but thats not possible unless its converted to a .msi

drowsy lava
#

sounds malicious

#

why would you want a silent installation

thorn berry
#

because i am trying to automate something

drowsy lava
#

what would that be?

thorn berry
#

chill lol i need to make a script to run for setting up atom and vscode on many machines

#

dont wanna manually do it

#

and trying to improve my python

#

would you know any library to convert it to a .msi?

drowsy lava
#

For the link you sent

#

I did a really fast skim

#

so probably it's inaccurate

thorn berry
#

hmm....

drowsy lava
#

It can help to create a .msi

#

but

#

you need to do it manually

#

with all those methods

thorn berry
#

i essentailly need a msi wrapper

#

ll what does you need to do it manually mean, write the code or...

drowsy lava
#

you mean msi wrapper?

thorn berry
#

its sayignn something about cabinet files

#

yes msi wrapper

drowsy lava
#

I have no idea what it means lol

thorn berry
#

exactly

#

lol

drowsy lava
#

the function FSI create

#

means

#

tells you

#

to create a new file called cabname with no extension

#

and then list all the files that you want in the msi

thorn berry
#

exactly

drowsy lava
#

in a tuple

thorn berry
#

ok...

drowsy lava
#

and everything in the tuple must be in the cabname file as well

#

and you'll make an msi installer I think

#

idk I'm in a rush but good luck

thorn berry
#

lmao no issues thanks for helping

languid helm
#

@thorn berry what kind of systems are these?

thorn berry
#

Windows systems

#

but i need to automate the installation @languid helm

languid helm
#

Are you the sysadmin here?

scenic anvil
#

Is it possible to have javascript autocompletions in pycharm community?

sly sleet
#

@thorn berry find a tool that creates msis instead of adding an exe

thorn berry
#

@sly sleet what does tha tmean lol

#

@languid helm yes i will run the script as admin

languid helm
#

I'm sure windows gives sysadmins the tools to install things to all pcs they manage.

thorn berry
#

@sly sleet what is a msis?

sly sleet
#

*msi's

thorn berry
#

aah yeah

#

@sly sleet @languid helm any way to silent install all .exe files

languid helm
#

Only if you are a sysadmin

leaden tartan
thorn berry
#

@languid helm yes we are sysadmin

#

is there a solution?

clever widget
#

Hello, can anyone help me how to get PyCharm (Windows 10) connected to WSL (this is easy) and VENV (don't know how). It is possible in VSCode, but I would be happy to make it work in PyCharm, 'cause it's awesome. dekan

thorn berry
#

@sly sleet any solution for silent install any .exe file if you're sysadmin?

sly sleet
#

bruh stop pinging me repeatedly

languid helm
dreamy onyx
#

hi guys. What does STOP_PENDING mean when running sc query x on wiondows promt?

wooden ibex
#

GPO installing rarely works

clever widget
#

Hello, can anyone help me how to get PyCharm (Windows 10) connected to WSL (this is easy) and VENV (don't know how). It is possible in VSCode, but I would be happy to make it work in PyCharm, 'cause it's awesome. dekan
@clever widget If anyone is interested: just create virtualenv using virtualenv -p python3.8 .env (not using env) and then set up Python interpreter as {project}/.venv/bin/python3.8. 👍

neat herald
#

Is there a pay by which I can auto run a python script at start up in windows

void cipher
#

yea

#

there's the task scheduler

paper moss
#

Code suggestions starting to take a while in Visual Studio Code with ~400 line python code (basically no imports). Any way to improve the speed the suggestions come in?

#

It doesnt look like it's using significant ammount of CPU performance so assuming it's not slow due to computer not being able to handle it

wooden ibex
#

it's probably firing up the pylance and scanning the code

vast wharf
#

I'm trying to make a dockerized Vue -> Flask & Flask-socketio server, but I'm running into an issue when I deploy it on Heroku.

End of my Dockerfile:

gunicorn -b 0.0.0.0:5000 app:app --daemon && \
sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/conf.d/default.conf && \
nginx -g 'daemon off;'```


I think the issue is I'm trying to start the eventlet server AND the flask/vue server in the same container.
Is there a way to properly do this?
wooden ibex
#

Two different containers

thorn berry
#

Code suggestions starting to take a while in Visual Studio Code with ~400 line python code (basically no imports). Any way to improve the speed the suggestions come in?
@paper moss you get autocomplete in visual studio code???

leaden tartan
#

yeah, kite for autocompletions @thorn berry and pylance for python language server. These are vscode extensions that you can install.

thorn berry
#

aah kite @leaden tartan but they barely give you any completions without buying pro oof

leaden tartan
#

yeah the pro one basically writes your entire project but the free works okay too

#

i plan to avail their student pro offer once I get my college id

ebon escarp
#

I ended up uninstalling because it was getting more in the way, than doing any good

#

its suggestions were no better than what my IDE already does

leaden tartan
#

ehhh, to each their own ig.
for me vscode is way better than pycharm or vim since I know all the hot keys, and i dont want to switch to something new and have to reconfigure stuff just to get it working.

ebon escarp
#

please don't compare sane IDE's to vim 🤣

dusty maple
#

Vim is a sane IDE

#

I jest of course, it's basically just a really light VSC for me

dense forum
#

im using VSCode and my Python lint (pylint + flake8) arent outputting anything in the "Problems" tab

#

i found this and i typed in python -m flake8 main.py

#

it shows what its supposed to show but the Problems tab is stil lempty

#

empty*

#

does anyone know how to solve this

leaden tartan
#

I jest of course, it's basically just a really light VSC for me
@dusty maple yeah i use vim only when I need to quickly change part of my code, which can be done under 2 minutes. I love its search functionality. is very fast.

heavy knot
#

Can any one help me in this problem

leaden tartan
#

Copy paste the traceback here- that picture is utterly invisible

#

!paste

rancid schoonerBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

void cipher
#

i plan to avail their student pro offer once I get my college id
@leaden tartan they have student offer?? hell yes I'm in

#

link pls

leaden tartan
#

yeah you need only an university link

#

email*

void cipher
#

I can't find student plan page

leaden tartan
void cipher
#

Yeah I saw this

#

but how I put my email

leaden tartan
#

you don't have to enter it

#

look at the instructions

#

you have to install it first i believe

void cipher
#

hmm I can just signup with my uni email?

#

instead of gmail

leaden tartan
#

idk just read the page

void cipher
#

okk ty anw

marsh oyster
#

Hello , does anyone have experience with hosting services using nsjail?

#

Ive been trying to deploy a service using nsjail , but each time I do so , and connect to the service with nc , I get , css [E][2020-09-30T11:18:25+0000][6] pid_t subproc::runChild(nsjconf_t*, int, int, int, int)():464 clone(flags=CLONE_NEWNS|CLONE_NEWCGROUP|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWUSER|CLONE_NEWPID|CLONE_NEWNET|SIGCHLD) failed. You probably need root privileges if your system doesn't support CLONE_NEWUSER. Alternatively, you might want to recompile your kernel with support for namespaces or check the current value of the kernel.unprivileged_userns_clone sysctl: Operation not permitted

#

so for this , as suggested by google , I tried running sh RUN (echo 1 | tee /proc/sys/kernel/unprivileged_userns_clone) || (echo 'kernel.unprivileged_userns_clone=1' | tee /etc/sysctl.d/00-local-userns.conf) 2>&1 RUN service procps restart

#

but that doesnt work either

#

this is How Im invoking nsjail ,

#!/bin/bash

./nsjail \
    -Ml --port 9000 \
    --user nobody \
    --group nogroup \
    --max_conns_per_ip 5 \
    --cwd /home/ctf \
    -R /app -R /bin -R /lib -R /lib32 -R /lib64 \
    --time_limit 30 \
    --cgroup_cpu_ms_per_sec 100 \
    --cgroup_pids_max 64 \
    --cgroup_mem_max 67108864 \
    -- $@```
warm pollen
#

You need to run NsJail as root

tawny temple
#

unprivileged_userns_clone is a debian-specific thing

#

If you happen to be running debian (on your host, NOT in the container), then you have to enable it on the host.

#

Otherwise, you have to run as root as Akarys said. To do that with docker, launch the container as --privileged

primal holly
#

How do I package a python script as a dmg from a windows or Linux machine?

#

I thought I could use pyinstaller but that ended up not working

snow sparrow
#

i hope this is the right channel, i'm trying to introduce python linting practice for my team, we mostly use intellij and want to have our github kick off the lint checks on every check in

#

can anybody recommend some tools to look at? in which linter.. which auto formatter for the team and ... where to go about enabling this linting integration?

#

so far i saw pylint, pyflake8 for linter and autopep8 black for formatter

#

quiet a choice here but does it really matter which tools? i just hope to use easiest and the most well supported one

leaden tartan
#

@snow sparrow here's what I use: flake8 for linting and autopep8 for formatting. Flake8 since it combines the best practices from the other linters you mentioned. i don't use black because it is too opinionated (even though that might be considered a strength) and doesn't provide many configuration options.

If you use flake8 amd autopep8, you will find that vscode has excellent support for both of these (and others)

sly sleet
#

@primal holly you can't

#

without a vm or something

primal holly
#

Alright

tidal solstice
#

how to check in setup.py that a package is not installed and if it is installed uninstall it?

obtuse rapids
#

can anybody recommend some tools to look at? in which linter.. which auto formatter for the team and ... where to go about enabling this linting integration?
@snow sparrow I'd recommend black ... It is opinionated, but that's not a bad thing.

#

Just configure your IDEs to format on save, and never worry about it again.

#

It's getting very popular.

thorn berry
#

guys i need to interact with a shell script
i have to interact with it multiple times so Popen doesnt work well for me

#

pexpect is not working as expected lol

snow sparrow
#

@leaden tartan @obtuse rapids sounds like choices to make here. 🤔

leaden tartan
#

patryk is waaay more experienced than I am so there's that

snow sparrow
#

could anyone here recommend tools setting up linting upon every github push?

#

@leaden tartan i've used both and always just liked what pycharm offered (flake8 i think)... hence asked 😉

leaden tartan
#

could anyone here recommend tools setting up linting upon every github push?
@snow sparrow you should actually be pushing linted code to github. Lint the code locally and then add checks using github actions (or some other CI) if the code is linted.

obtuse rapids
#

If you want more control, you can go with autopep8 I think

#

I honestly don't care.... I just want it to be consistent.

leaden tartan
#

yep autopep8 does it very easily especially if you configure your ide to do it

obtuse rapids
#

black gives me consistency, and I did have to get used to some things...

#

But it is a non-issue for me.

leaden tartan
#

consistentcy across developers is key

obtuse rapids
#

None of the changes are so horrible, and I don't want to have to think about it haha.

snow sparrow
#

i plan on making separate configuration file to exclude some rules and unify tools across developers

obtuse rapids
#

I use the airbnb eslint preset for JS with some minor tweaks, and black for python.

leaden tartan
#

just yesterday i contributed to a project which uses tabs for indentation (!!!) and ended up ruining the entire repo on my remote. I had to make a new PR lol

snow sparrow
#

anyone have CI lint integrated?

leaden tartan
#

i have CI lint checking enabled

obtuse rapids
#

I don't...

#

But I run pytest in CI, so it should really not be all that different

leaden tartan
#

that's what I do too. Isn't that CI linting?

obtuse rapids
#

Maybe add black and flake8 to my pre-commit hooks.

#

linting != tests

leaden tartan
#

pytest --flake8

obtuse rapids
#

Oh... I never used that flag lol

leaden tartan
#

it's a plugin called pytest-flake8. it's is a pypi package

muted cobalt
#

Is there a equivilent to this in pipenv?

# requirements.txt

psycopg2; platform_system == "Windows"
psycopg2-binary; sys_platform == "linux"
warm pollen
#

Yes, for example psycopg2 = {version = "*", sys_platform = "== 'win32'"}

snow sparrow
#

pytest --flake8
@leaden tartan this is only for test, right?

#

@leaden tartan what tools do u use for CI? there seems to be many options but i'm looking for optimal one to setup on Github

#

like is it right to set this up as part of your backend build server and trigger it from github?

vapid torrent
#

tree: command not found
Is tree not included in Github Actions?

tawny temple
#

It is not included.

#

Anything else you will need to install yourself

leaden tartan
#

@leaden tartan this is only for test, right?
@snow sparrow this will run pytest and flake8 at once

snow sparrow
#

ok, so basically linting on test runs

#

i’m leaning towards just configuring pre commit hook rather than integration server linting after push

leaden tartan
#

like is it right to set this up as part of your backend build server and trigger it from github?
@snow sparrow i dont understand what you mean but here's the thing. Even if you want to run linting on your project, do it before pushing it to your remote. As a general rule, you do not want CI to change your source code, just testing it on Ci Is enough

#

i’m leaning towards just configuring pre commit hook rather than integration server linting after push
@snow sparrow that's a great idea. Especially if you don't have a very large test suite. But problem with commit hooks is that they will only be present on your machine, not on others

snow sparrow
#

linting isn’t formatting though, it’s just catching the syntax right? so CI won’t change it unless u put autopep8 or black in it

#

well we share repo so everyone will have their precommit hook setup?

leaden tartan
#

exactly, and you don't want to do that

snow sparrow
#

would have to push precommit hook i guess

leaden tartan
#

hooks cannot be pushed I think

#

but I don't bother. If someone pushes unlinted code, their PR build automatically fails and they have to fix their code and correct their PR

#

their code, their problem

heavy knot
#

Are there any video classification tools? Like automatically getting data reports on appeared objects within videos/images?

ivory flame
#

hey everyone! im not sure if this is a good channel to ask in, but does anyone have some pointers for where to start with dockerizing my discord.py bot?

grave portal
#

@snow sparrow Just commit the pre-commit.yml config file to git? I like using black and isort since they do automatic fixing on pre-commit. If your entire team has the same configuration, then that's a good thing. I don't see why it's bad for everyone to have the same hook if the purpose is making the entire repository legible.

snow sparrow
#

@grave portal yes makes sense, looks like there is something called pre-commit package that helps with this - but i'm curious what how people like automatic formatting feature as versus just letting them know of linting errors so they can address it themselves.

grave portal
#

Check out pydanny/cookiecutter-django and go to the dir that has those curly braces {} Edit: Oh I see. Misinterpreted.

I can see both sides of the aisle, but personally, at the end of the day, most devs are not going to remember to sort all imports correctly, make the lines 88 max chars and, if it's over, make sure the new line looks pretty formatted. I'd much rather just have the linters do that for me.

snow sparrow
#

I agree.

blazing ravine
#

Can anybody tell me, which REPL is here in use?

dusty maple
#

Recently upgraded to poetry 1.1.0 and I was just curious about it, poetry-core, and tox

#

Currently I have tox configured to install testing deps for each environment separately, which allows for really fast parallel builds in Travis CI

#

Would there be any advantage to using poetry-core in terms of tox if I don't use poetry there in the first place aside from automatically managing the versions as well?

patent ginkgo
#

What is the best web-based IDE? It used to be Cloud9, but not since it was acquired by Amazon.

wooden ibex
#

or Github Codespaces but that will cost money soon

heavy knot
#

If someone is an ML engineer and uses MLOps, how do they monitor data drifts
drifts or monitor the quality of their models at work? What tools?

tropic hound
true vapor
#

How can I configure a Pycharm run configuration to use the GCP functions-framework serverless functions thing. To run one from the command line, the command is just functions-framework --target=<whatever> - but I can't figure out how to turn that into a run configuration

Nevermind, can just set it up as a python module run configuration

vague edge
#

hey so i'm trying to configure a background for atom

#

my settings are as follows

#

however, as can be seen, the background hasn't changed

#

any help?

obsidian grove
#

I've seen people in Youtube a while back using a vscode theme/font where self was italic. It looked really nice, but I can't remember the name. Does someone know the name?

#

It seems popular

vague edge
#

monokai?

#

idk

obsidian grove
#

I think I found it. It's just the font

#

They use it in this theme

#

Operator Mono

#

Nvm I don't want to buy a font

leaden tartan
void cipher
#

microsoft >;((

topaz aspen
#

has anyone found black to be less stable recently? I seem to be finding it formatting code and re-formatting for some reason

spark falcon
#

anyone can asnwer my question?

hollow ferry
#

I know this is a pretty subjective question but I'm quite new to programming and i was wondering if i should VS or VS code, now I made my research and I am leaning towards VS, because it seems way more versatile but i was wondering what the user experience was, and how the visuals of it were, because VS code seems very modern and clean, and from their website VS looks quite a bit dated, so I guess i just wanted some opinions

#

feel free to ping me

#

thanks

leaden tartan
#

@hollow ferry i stole this from another server

Visual Studio Code. You’ve probably heard of it, or even seen people in it, by why shouldn’t you use it?

In short: Visual Studio Code is a text editor. This is fine for languages like JS, TS, or Python, but if you want to do C# or C++, it’s heavily implored you look into Visual Studio. Visual Studio is a much larger install, so beware if you have limited disk space, or slow internet.

Furthermore: As Visual Studio Code (VSC) is just an enhanced text editor, you miss out on important features such as intellisense and memory profiling, which Visual Studio, an IDE offers out of the box. There exists extensions for VSC to make programming C# and C++ less painful, but at the end of the day, it’s not an IDE, and could hinder your workflow in the long run. VisualStudio is streamlined for C#, C++, and other .NET languages, and offers better tooling for such.

By no means do you need, VS, or an IDE in general, but an environment made for development makes life easier.

#

basically vscode for python js etc, but visual studio for c++

hollow ferry
#

@leaden tartan well thank you very much for the information but if you don't mind i have a few more questions , from what i have seen VSC has intelisense too (for python at least), my next question is about user experience i guess, how comfortable is VS in comparison with VSC, because VS seems pretty outdated in terms of visuals, is there any way to change it, maybe it's already in the settings or it's a plugin of some sort, pretty much what I'm asking is how customizable it is, can i make it dark mode, can i change the font,can i change the color of the text highlighting and stuff, in essence can i have the features of VS but make it look more modern like VSC.

Imagine it like Chrome vs Some newer browser, now Chrome has all the features i could ever need but maybe doesn't look as good as the newer browser or it's not as user friendly, but in the case of Chrome it's heavily customizable and i can tailor it to my liking pretty much making the choice simple, because i get all the features and since it's very customizable i also get all the good features of the new browser, making Chrome the obvious choice.

Is VS like Chrome, or is it more restrictive in terms of customization?

sly sleet
hollow ferry
#

okay thank you i have found a lot of resources and I can see that VS has a lot of customizing potential, also i wanted to ask how good the python integration is and if there is any downside to using VS over VSC for python specifically, lastly is using multiple coding interfaces (sorry if that's not the name) something people do, or something that is recommended, for example using VSC for Python JS and similar and using VS for C languages ?

sly sleet
#

yeah you can do that

#

i use vscode for everything but java and intellij for java

#

vscode c/c++ extension is decent

#

especially if you also add the llvm one

#

@hollow ferry

hollow ferry
#

why did you personally chose VSC over Vs

#

or any other interface for that matter

leaden tartan
#

I haven't really used visual studio myself. My dad uses it sometimes and honestly the interface looks pretty old, but he doesn't care about visuals.

ebon escarp
#

ah, who cares if the interface isn't super sleek

#

Like sure, VSC has that modern feel, but that's because it's all HTML and CSS which severely degrades performance

#

I wouldn't go as far as not call VSC an IDE, but it certainly has sort of an opt-in approach to features

#

Perhaps a bit ironic, you (practically) can't set a background image in VSC

leaden tartan
#

Like sure, VSC has that modern feel, but that's because it's all HTML and CSS which severely degrades performance
@ebon escarp html css degrades performance?!?

#

I have about 30 extensions on vsc, and it still runs faster than pycharm while performing better and looking waay better

ebon escarp
#

Can't look better

#

because you can't set custom background

#

aaaaaaaaaaaaaaaaaa

candid kayak
#

I'd set up pylint as a github action on a new repo, and it immedietely failed. The only thing on the repo was a bare django project. What should I be doing? (new to this stuff, trying github actions for the first time)

leaden tartan
#

this is an issue of bare django, it's not pep8 compliant

#

a lot of lines are over 79 characters

candid kayak
#

oh oof do i go through rewriting them to make them shorter?

leaden tartan
#

some of them can't be rewritten

#

for example the password hasher classes are too long

#

so i add # noqa in front of them to disable linting for that particular line

candid kayak
#

oh right

#

this is from the build fail message on github

ebon escarp
#

a lot of lines are over 79 characters
I've got the line linting thingy off

#

My screen can fit like 300 characters and it's not like anyone else reads my code

leaden tartan
#

idk man, that'd probably come back to bite you in the ass later

ebon escarp
#

Wouldn't count on it

#

Wasn't a problem in any of my finished projects

leaden tartan
#

pep8 exists for a reason

ebon escarp
#

Quoting from stack overflow

Much of the value of PEP-8 is to stop people arguing about inconsequential formatting rules, and get on with writing good, consistently formatted code. Sure, no one really thinks that 79 is optimal, but there's no obvious gain in changing it to 99 or 119 or whatever your preferred line length is. I think the choices are these: follow the rule and find a worthwhile cause to battle for, or provide some data that demonstrates how readability and productivity vary with line length. The latter would be extremely interesting, and would have a good chance of changing people's minds I think.

#

Since I code alone, this argument falls short

#

I agree with most of PEP-8

#

and definitely use it

#

but I also think that it shouldn't be followed blindly, but more as a guide line (unless your boss says differently ofc 🤣)

candid kayak
#

any idea what i can do about my issue?

leaden tartan
#

@ebon escarp yeah since you code alone, it not an issue but when you start coding with a team you'll get a lot of weird looks

ebon escarp
#

Fair enough

#

Well, I wouldn't mind completely following pep if I got paid ahahahahaa

leaden tartan
#

i don't get paid, but still follow it. A few of my public repos got Hacktoberfest contributions. I doubt anyone would have contributed if they saw the line length of 300 characters

#

A decent percentage of programmers code on laptops which wouldn't fit 300 characters in one line

sly sleet
#

@ebon escarp theres a extension for background img in vsc

ebon escarp
#

Have you tried it?

#

no?

#

thought so

sly sleet
#

so?

ebon escarp
#

I did

sly sleet
#

you have to at least somewhat research this

ebon escarp
#

yeah?

#

yeaaaaah???

#

I use VSC, I tried all the extensions

#

the thing is, whenever you update

#

it all resets

sly sleet
#

well

ebon escarp
#

considering how often VSC updates, it such a huge pain

#

I gave up

sly sleet
#

also how do you even code with 300 char lines

#

text across the entire screen

leaden tartan
#

wide screen probably

sly sleet
#

yeah, still

#

even if you have a wide screen

#

300 is way too much

leaden tartan
#

ik, it sounds idiotic

ebon escarp
#

small font maybe?

#

and hey, don't call it idiotic

#

Often there's not a good way to break up long lines, and it ends up looking super awkward

#

in particular when you need to indent the second one and then it visually looks like flow control

sly sleet
#

then dont write lines that are 150+ chars?

leaden tartan
#

that's why 91 chars is a good idea

sly sleet
#

split it up into variables or something

ebon escarp
#

Often there's not a good way to break up long lines

leaden tartan
#

you're probably writing statements incorrectly then

sly sleet
#

what type of code are you writing where you cant break up lines

leaden tartan
#

can you give an example?