#tools-and-devops

1 messages Β· Page 64 of 1

urban pecan
#

but i'm not sure about that yet

#

@tawdry needle does that answer your question?

tawdry needle
#

q?

#

from justuse import use seems reasonable

urban pecan
#

i don't see anything that couldn't be put into the class and keep the simplistic import use though

#

any particular (technical) reason to take the less beautiful route?

tawdry needle
#

Callable imported thing is confusing and weird to me

urban pecan
#

so is importing things via a function instead of import πŸ˜‰

tawdry needle
#

Meh

#

Modules are objects

#

It's ok to return them, cf importlib

#

It's not that weird but maybe something would break if import doesn't return a module... good q for #internals-and-peps

urban pecan
#

actually, i stumbled over a strange thing that reminds me of this, the only actual issue i had with use() is with dataclasses

#

it seems dataclasses also manipulate sys.path and does weird tricks on import, which kind of crosses streams with use()

#

but i never had a problem with use itself not being a module so far

#

i'll reconsider if someone shows me an example of a lib that operates on modules that couldn't work with use

tawdry needle
#

I imagine there could be other issues, i just don't see a reason for it

#

All to save the from?

urban pecan
#

if there was other stuff in the module the user might want, it would make sense to require the from, but as i see it, that's the most succinct form, so i prefer that

supple venture
#

Ah yes, thought so, thanks!

rugged flame
#

Does GitHub really not have a way to view markdown/rst files without rendering them, or am I missing something? πŸ€”

#

Context: I'd like to refer to a line of a rst file in an issue.

burnt ibex
rugged flame
burnt ibex
#

You can click "Blame" I think, but that has some extra stuff

rugged flame
#

Ah right. Thanks!

finite fulcrum
#

While not lines, if it has headings etc. you can go to those

urban pecan
#

i was just wondering if it might be useful to add p2p capability to pip? if i add an auto-install feature to use() it might be feasible to add a p2p layer?

#

or is there already p2p planned for pip itself maybe?

urban pecan
#

i'm just thinking that maybe with IoT this could be useful.. like if you had a swarm of drones, you could tell one to use a package, which pulls it from pypi, then the other drones could install that package without burdening pypi

wooden ibex
#

Nope

ebon escarp
#

lol

urban pecan
#

what nope?

runic verge
#

i am surpised with hearing how many companies store their repositories on github ... and was wondering why do they do that . Why put their trust into github

#

i saw theres Git .. which i saw explained as Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows And that makes a lot of sense to integrate that into your company .. rather than creating a system to do that for your company

eternal flicker
#

not that different from using cloud hosting instead of on-site

runic verge
#

i havent uploaded anything that is commercial to github, even in a private repository , becuase i see its one more company that can see all of my source code
so thats why its wild to me that larger companies with a lot more expensive software are doing it

runic verge
#

i have uploaded to github .. stuff that consider to be opensource

eternal flicker
#

so it's mostly a matter of companies employing the services of another company

runic verge
#

and Git sounds incredible ... you can upload all your source-code where all the engineers are able to reach it , AND it can be integrated with Git for seamless updating , i see trust is kind of out of the equation

eternal flicker
#

i see trust is kind of out of the equation
how so?

runic verge
finite fulcrum
#

I really doubt private repos are readily available to employees of github or that a company as large as them would risk doing something with them

runic verge
#

to having it integrated . And they are a huge company , and of course are legally responsible for protecting the data they store . but i see that is overlooked.

finite fulcrum
#

Hosting git or other vcs is not that uncommon, but I doubt there's much more risk having it on github compared to hosting it yourself and exposing it to the internet

supple venture
#

you could always host your own git cloud server

#

many do that

runic verge
#

i currently have an auction bot on github. It provides valuable information about which items are available at auctions around the US . It's routed with an API . Working on the API and protecting the code .. and just the frontend and integration is opensource

subtle horizon
#

hey can I get some help regarding brython?

#

im trying to develop a chrome extension using brython. I can get the python console to open in chrome, but I can't get it to run MY script

tawdry needle
#

@runic verge lots of companies pay github for private repositories or even on-prem deployments hosted on internal networks

#

Version control is really a life-changing tool in programming, distributed version control like git even moreso

#

Git itself is a very powerful tool with an elegant underlying model... and a confusing command line interface that can be difficult to learn

runic verge
#

I appreciate the suggestion to look into DevOps @civic hound , i have heard from others that its important aswell , and i see it is important in a team environment.

runic verge
runic verge
#

i dont like working on github files, on github (editting the saved code that is on github with the changes of the file on my computer or deleting and uploading the same file when updating) ... I see Git can connect to the repository and make those changes from CMD or from the Git GUI

runic verge
# subtle horizon hey can I get some help regarding brython?

i am not sure about brython or whether its considered tools /devops . There may be a better channel for the subject . .. I see #β“ο½œhow-to-get-help and creating a help channel could get some help (though im not sure of that either , because i see brython may be a specific thing that fewer people are aware of ) . Maybe talking about it in python-general , because there are more users there .

subtle horizon
runic verge
#

hey guys, if anyone knows anything about the http.server module, i would greatly appreciate any help in #help-chestnut
i just saw this phrased like this , in the python-general channel and i thought of the question i heard you had
i see this is a good way of doing it
as the http.server module is also a specialized thing
hope you find what youre looking for @subtle horizon

opaque gorge
#

How would I wait for another github workflow to finish, before continuing with my one?
I know I could do this: ```yml
on:
workflow_run:
workflows: ["Verification"]
branches: ["main"]
paths:
- pyproject.toml
- setup.cfg
- setup.py

which works well, except it could trigger multiple times if say, both `setup.py` and `setup.cfg` were edited, the workflow would run twice, which isn't what i want.

If I however use on push, I don't know how would I wait for the `Verification` workflow to finish, before continuing, and if it fails, this workflow should fail too
#

Please use reply, or ping me on response

supple venture
opaque gorge
#

2 different files

supple venture
#

name: PyPi Publish

# Only trigger, when the lint workflow succeeded
on:
  workflow_run:
    workflows: ["Lint"]
    types:
      - completed
#

Example

#

name of first file should be the exact match of the workflow_run: workflows: ["Lint"] in the second file.

opaque gorge
#

yeah, that's what I did in my example, but since I only want it to trigger on separate files, if they're specified, this triggers 3 times if all 3 files were changed in single commit

supple venture
#

Basically are u trying to run the workflow only on those file edits right?

runic verge
#

@opaque gorge

#

oh that was hours ago .

#

hearing about workflows i am wondering if that's how git projects can be seperated from eachother .. and each project can be worked on seperated . Right now when i do git add <filename> i see it adds it to the same project ... but i am working on something that doesn't belong in the project it is adding the file to . ( we want to have a seperate project .. is it a workflow?)

also looking for a way to link this to github , and separate github projects

rapid sparrow
# runic verge hearing about workflows i am wondering if that's how git projects can be sepera...

nah
https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow (eng)
https://www.atlassian.com/ru/git/tutorials/comparing-workflows/gitflow-workflow (rus, if necessary)

workflows are all about organizing work for one repository and their meanings

  1. main one about actually collaboration with other developers
  2. secondary one, to make job easier for devops guys to deploy releases of your project

if you want to have a separate project... it belongs to separate repository.
one repository should have only everything that belongs purely to that project and at maximum it can have... some additions that can be launched only together with the project. (for example my Django projects, have included into them docker-compose/docker scenarios to build Nginx / Redis / Celery containers together with main project,)

I usually answer for myself question, if it belongs to separate repository or not, but asking myself... does it need separate ci/cd, its own pipline runner? if yes -> then create new repository

#

btw, recommending to read atlassian guide about git from the beginning "Learn git" up to "Forking workflow" chapter

#

quite cool one in my opinion

#

p.s. wink, we are probably from the same country, or at least our origins are.

runic verge
#
git remote add origin2 https://github.com/swordysrepo/usegit2.git
git origin2 branch random
git push -u origin2 random```
#

jumping between repos checking that out.

runic verge
runic verge
#

https://github.com/swordysrepo/Windows-10-Toast-Notifications/pull/1
the first github PR request
it was merged! πŸ˜„
Such a simple fix also . (but i looked into it for hours .. to discover where the problem was originating from) @civic hound

GitHub

changed so that the notifications are always threaded . Seeing they are low processing power with it enabled ... and it prevents difficult-to-solve errors when running multiple files using desktop-...

runic verge
foggy token
#

for readthedocs how do i make it not automatically install requirements.txt?

#

nvm

ebon swift
#

Thanks, I see that it checks the version info from a clone in /tmp

ripe junco
#

Anyone know how to correctly install all azure SDKs for Python? I'm trying to install azure and I get this error

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

supple venture
ripe junco
supple venture
#

pip install -U setuptools does this hlp?

ripe junco
#

Nop, still get the same error

supple venture
#

umm, do pip --version

ripe junco
#

Even if I specify the version like this pip install azure==5.0.0 it doesn't work

ripe junco
supple venture
#

try updating it

ripe junco
#

Even with the upgraded pip

supple venture
#

could you send the full output of when you do pip install azure

rancid schoonerBOT
#

Hey @ripe junco!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

β€’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

β€’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

ripe junco
#

Ok, I think I've solved it

#

I've installed version 4.0.0

supple venture
#

Starting with v5.0.0, the 'azure' meta-package is deprecated and cannot be installed anymore.

ripe junco
#

Yeah, I did not pay full attention to the text πŸ˜…

#

Still, thanks a lot @supple venture

supple venture
wooden ibex
floral smelt
#

I'm not sure it's the good section but I don't find anything ANaconda-related

#

conda has a bug with dependencies. Soemtimes it takes eons before checking on the conflicts. I abort with Ctrl+C and relaunch the command

#

And it works Idg why. Anybody has this bug?

trim solstice
#

i have a django powered website that needs to be hosted for a fairly affordable price, ive been given the target of <$30/mo but im not sure if that will happen.

#

where might i get a decent VPS for this price?

burnt ibex
#

I believe this community hosts their site on Linode

trim solstice
#

im not sure what that is, is it a VPS provider?

burnt ibex
#

You could also use something such as AWS, Digitial Ocean, etc.

burnt ibex
trim solstice
#

aws seems good, too many options for me to wrap my head around tho lol

im really not a devops person, more frontend tbh. we're a small company so ive just been loaded with everything to do with the website.

#

what would aws's webhosting service be? or at least the best fit

burnt ibex
trim solstice
#

ah awesome! i'll have a read through. thank you

burnt ibex
#

Np

trim solstice
#

just to check, what im getting from that is i need an EC2 server instance, and then i use EB to manage moving the the project from my computer to the server as well as linking to a domain, did i get that right?

burnt ibex
#

Uh, not sure, I haven't read through that whole thing

#

But that sounds right

trim solstice
#

okay cool, i'll have a play around with this leading up to the end of the project and hopefully get everything sorted. thanks again!

twin valley
short peak
#

isn't this what jupyter does too?

tawdry needle
#

all these not-jupyter notebooks are too focused on "cloud" and "collaboration" and not enough on "being more usable" imo

#

it's the same feature set rehashed over and over

#

data science ux generally still sucks

twin valley
#

I guess their focus is a little bit more "publishing" slanted and trying to make the ui/ux a little cleaner looking but yeah; I'm a fan of https://observablehq.com/ and I think this is someone trying to do something similar for python? 🀷

frozen anchor
#

Any1 here using GitHub SuperLinter? I started using it a while ago and it works - showing me that I have linting errors on PR.
Question is: Is there a way to automatically fix the (easy) lint problems - something like x= 1 to x = 1? I didnt find an option to autoformat the code.
I think black allows that - however I use other languages as well in my project so a tool like "SuperLinter with Autoformatting" would be amazing.

urban pecan
#

@frozen anchor just use black πŸ˜‰

#

or brunette for a little less black

urban pecan
#

is there a way to use pip inside a script as an API from within a script without calling it as a subprocess?

#

i can call it as a subprocess, but python -m pip download requests==2.6.0 for instance puts the file in the cwd with a name that isn't 100% predictable

#

i could glob for that with the name-version as a pattern, but it would be nicer to have a function that would just give me the file name

#

after downloading it

#

i'll try that

tawdry needle
#

it's unofficial though

#

pip doesn't guarantee any stable python api (annoyingly)

#

you could parse the output i guess

#
import re
import subprocess

proc = subprocess.run(['pip', 'download', name], stdout=subprocess.PIPE)
m = re.search(r'(?m)^Saved (.*)$', proc.stdout)
save_location = m.group(1)
#

very annoying that you can't configure this

#

maybe use a temporary directory, and run pip in that directory? using the cwd= option

urban pecan
#

cwd option of subprocess?

#

or?

#

@tawdry needle

tawdry needle
#

yeah, subprocess.run has a cwd kwarg

#

!d subprocess.run

rancid schoonerBOT
#
subprocess.run(args, *, stdin=None, input=None, stdout=None, stderr=None, capture_output=False, shell=False, cwd=None, timeout=None, check=False, encoding=None, errors=None, ...)```
Run the command described by *args*. Wait for command to complete, then return a [`CompletedProcess`](https://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess "subprocess.CompletedProcess") instance.

The arguments shown above are merely the most common ones, described below in [Frequently Used Arguments](https://docs.python.org/3/library/subprocess.html#frequently-used-arguments) (hence the use of keyword-only notation in the abbreviated signature). The full function signature is largely the same as that of the [`Popen`](https://docs.python.org/3/library/subprocess.html#subprocess.Popen "subprocess.Popen") constructor - most of the arguments to this function are passed through to that interface. (*timeout*, *input*, *check*, and *capture\_output* are not.)
urban pecan
#

okay

tawdry needle
#

!d tempfile

rancid schoonerBOT
tawdry needle
#

use TemporaryDirectory

urban pecan
#

yeah, i planned to use that for the "not-in-a-virtual-env" case.. i figured out how to detect whether i'm in a virtual env or not, should i use TemporaryDirectory either way?

#

it might be a bit awkward (but probably safest) to use it in all cases

#

it will certainly be slowest to re-install it every time the program is run, though.. on the other hand, i'm planning on incorporating some p2p distribution of packages, which might alleviate this problem somewhat

#

let's try to make it work for all cases first and have it save and slow before making it fast πŸ™‚

#

safe*

tawdry needle
#

This is just for controlling where pip download dumps its files right?

#

Maybe you can integrate with the existing pip cache somehow

#

Pip already has a download cache

#

Would be silly imo not to be able to use it for this

#

Why do you even use pip download? I believe pip install has options to control where exactly the package is installed to

unique imp
#

s

urban pecan
#

@tawdry needle i need to first download the file in order to check its hash before installing anything malicious

#

having looked at pip's code, i think it might be most reasonable to simply utilize pypi's pretty slick json API

#

via requests

#

so far it's no big trouble to get the fitting wheel, the bigger next hurdle is how to install it in a way it can be directly loaded

#

i fear only packages with a setup.py (whose requirements are already fulfilled or that can be auto-installed themselves) can be auto-installed

#

which wouldn't be a big issue for me, but others might complain πŸ™‚

#

with auto-install requiring a proper hash with version-pinning, it might even be a more future-proof way overall

#

i feel no pressure to match or replace pip in all its features, though. i think it's a great alternative as a command line tool

#

but thinking of typoes and malicious packages on pypi, insisting on version pinning and hashes is the most straight forward way to get to a really secure supply chain

#

which, in my opinion, is done best directly in the code doing the import to be 100% clear on what exactly is used

urban pecan
#

it's also easy to check the available links for a matching hash, so that's even simpler for the user than what pip hashing mode suggests - it asks the user for a list of possible hashes

#

installing and importing a package might become as simple as use("yourpackage", version="1.2.0", hash_value="7a7a8b91086deccc54cac8d631e33f6a0e232ce5775c6be3dc44f86c2154019d", auto_install=True)

#

copy&paste-able anywhere πŸ™‚

lament compass
#

does someone mind helping me with a problem that ive facing while working on a python script for the back end?

#

ModuleNotFoundError: No module named 'sklearn.linear_model.logistic'
this is the error that m getting and Ive already installed sklearn

#

dm me if someone thinks they can help me out

rapid sparrow
#

try import sklearn before where you call it

lament compass
#

Yes I did

#

I am in dire need for some help I am a beginner and I have a very important submission tomorrow I've been working on this for 2 weeks and I can't solve this error

frozen anchor
#

@lament compass this is a tools/devops channel and your question is not related to tools/devops at all. I suggest you open a help channel with:
The code you want to execute
The error message

lament compass
#

M trying to develop a flask app and having trouble with a python module that's why I ended up posting the quesry here

shy locust
#

From sklearn import linear_model then call linear_model.logistic_regression()

wintry iris
#

what should one do to have a perfectly structured python project on github?

#

i've looked around at repos, but can't find a certain common way

tawdry needle
#

there's no "perfect" structure

#

and don't worry about github so much - whatever is good in general is good for github

short peak
#

same ☝️

sacred dragon
#

does any 1 here has uploaded python package in pypi

#

i'm getting this error even tho my token is correct

runic verge
#

i forget whether i found out how to do this without the file ..

#

It is a common issue

#

what are you using to upload to pypi? @sacred dragon

#

I heard twine is a package that is the one that is supposed to work . And heard other packages might throw errors like this . From what i've gathered about uploading to pypi .. it is a fragile process , but once you've got it working it should work consistently.

sacred dragon
#

i'm using twine

#

consistently

#

it's my third release

#

and it shows like this for the first time

heavy knot
#

Hi this is my post here, I am trying to load and work with DMN files. Can anyone suggest me a Library to use?

heavy knot
#

I've created dmn xml based file in signavio and then trying to import in python. by pyDMNrules i can't do it. i tried cDMN API it doesn't work

wintry iris
#

ill look around

#

never used a dmn file tho πŸ€·β€β™‚οΈ

opaque tiger
#
    ERROR: Command errored out with exit status 10:
     command: 'c:\users\co\appdata\local\programs\python\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Co\\AppData\\Local\\Temp\\pip-install-l_p5bva2\\pycurl_ca46745b7aa24090bf02fc06186d5660\\setup.py'"'"'; __file__='"'"'C:\\Users\\Co\\AppData\\Local\\Temp\\pip-install-l_p5bva2\\pycurl_ca46745b7aa24090bf02fc06186d5660\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Co\AppData\Local\Temp\pip-pip-egg-info-1q1wejsn'
         cwd: C:\Users\Co\AppData\Local\Temp\pip-install-l_p5bva2\pycurl_ca46745b7aa24090bf02fc06186d5660\
    Complete output (1 lines):
    Please specify --curl-dir=/path/to/built/libcurl
    ----------------------------------------
ERROR: Command errored out with exit status 10: python setup.py egg_info Check the logs for full command output.
``` When trying to install pycurl.
#

Anyone? Would be very apprciated.

heavy knot
wintry iris
regal ledge
#

Maybe this is the correct channel..

Hello.
I have been struggling with this issue for a long time now and I can't find answers online.

I'm trying to deploy a Flask app to an Apache server, with fcgi.
The file that runs the app, dispatch.fcgi, is below.

The issue is that when deployed, it can only find the routes that are @idle salmon.route in the same file.
It does not find any of my blueprints or blueprint routes. Nor can I create blueprint routes in this file after creating the app.

The application works on my local. Only difference is that instead of this file I run a run.py which just creates the app without extra config that Apache wants.

How can I get it to find my blueprint routes?
PS: It's a shared host, therefore I don't have root access so the fix I'm looking for should probably be on py side.

#!/usr/bin/env python3.7

import os, sys
sys.path.insert(0, "/www/apache/domains/www.somedomain.com/hinnang/hinnangapp")
from hinnangapp import create_app

os.environ['REQUEST_METHOD'] = "GET"
os.environ['SERVER_NAME'] = "somedomain.com"
os.environ['SERVER_PORT'] = "80"
os.environ['SERVER_PROTOCOL'] = "HTTP/1.1"
DOMAIN = "somedomain.com"
PREFIX = "/www/apache/domains/www.somedomain.com/"

sys.path.insert(0, os.path.join(PREFIX, ".virtualenvs/hinnangapp/lib/python3.7/site-packages/"))

from flup.server.fcgi import WSGIServer
from flask import Flask

app = create_app()
@app.route("/")
def hello(): #<- this works
    return "Hello World! <a href=\"test/\">to test</a>"


class ScriptNameStripper(object):
   def __init__(self, app):
       self.app = app

   def __call__(self, environ, start_response):
       environ['SCRIPT_NAME'] = ''
       return self.app(environ, start_response)

app = ScriptNameStripper(app)

#@main.route("/home") #<- tried to create a route for a blueprint here, didn't work
#def home():
#    return "home"


if __name__ == '__main__':
    WSGIServer(app).run()
runic verge
#

having a problem where git says everything up-to-date but its not

#

tried another way and i get GitHub - error: failed to push some refs to 'git@github.com:myrepo.git'

and found on google ... ```In my case git push was trying to push more that just the current branch, therefore, I got this error since the other branches were not in sync.

To fix that you could use: git config --global push.default simple That will make git to only push the current branch.

This will only work on more recent versions of git. i.e.: won't work on 1.7.9.5``` My branches are also not in sync , going to try the git config adjustment git config --global push.default simple and report back
heard it from this link https://stackoverflow.com/questions/10753268/github-error-failed-to-push-some-refs-to-gitgithub-commyrepo-git

#

it didn't change . hadn't noticed that i was getting this error before though error: src refspec database does not match any

runic verge
#

my branches are kind of a mess . Have been switching between them on git not knowing what it actually does . (it says certain files need to be removed before switching . )
and when i run git add (some files) after removing cached with git rm --cached . -r , and then commit the adds with git commit -m "database initial commit" , it says nothing changed . (even though there should be no record of the file , after it has been removed from cache)

(myactivity) [documentation +8 ~0 -0 !] C:\github\api-side-twitch
> git ls-files
.gitignore
README.md
(myactivity) [documentation +8 ~0 -0 !] C:\github\api-side-twitch
> git rm --cached .
fatal: not removing '.' recursively without -r
(myactivity) [documentation +8 ~0 -0 !] C:\github\api-side-twitch
rm '.gitignore'
rm 'README.md'
rm 'database.ini.example'
(myactivity) [documentation +0 ~0 -3 | +11 ~0 -0 !] C:\github\api-side-twitch
> git ls-files
(myactivity) [documentation +0 ~0 -3 | +11 ~0 -0 !] C:\github\api-side-twitch
> git add .gitignore
(myactivity) [documentation +0 ~0 -2 | +10 ~0 -0 !] C:\github\api-side-twitch
> git add README.md
(myactivity) [documentation +0 ~0 -1 | +9 ~0 -0 !] C:\github\api-side-twitch
> git add database.ini.example
(myactivity) [documentation +8 ~0 -0 !] C:\github\api-side-twitch
> git commit -m "initial database commit"
On branch documentation
Untracked files:
        code
        config.py
        connectdb.py
        create_api.py
        handle_requests_api.py
        models.py
        recieve_as_api.py
        templates/

nothing added to commit but untracked files present
(myactivity) [documentation +8 ~0 -0 !] C:\github\api-side-twitch
> git ls-files
.gitignore
README.md
database.ini.example
(myactivity) [documentation +8 ~0 -0 !] C:\github\api-side-twitch
> git push origin database
error: src refspec database does not match any
error: failed to push some refs to 'git@github.com:swordysrepo/api-side-twitch.git'

#

this is also a private repo

#

and i just set up SSH

#

i think i broke git πŸ˜„

runic verge
#

#help-dumpling
edit:
resolved #help-dumpling message

it wasn't SSH , i see it's becuase git was in the documentation branch and trying to push to the database branch (throwing the src refspec error) . creating a local database branch would have worked as git push origin database . but i decided to revert back to just 2 branches , main and staging

shy mountain
#

Any library I can use to detect languages used in a repository? like cloc but native within python?

burnt ibex
shy mountain
#

I was more thinking of a local directory that might not even be git

burnt ibex
#

Oh, my bad

shy mountain
#

no problem, its a good thought!

#

I think I can just manually parse the output of cloc --json by using a JSON parser

opaque tiger
#

If you know how to code in Pycurl/pyurl shoot me a dm right now!

reef lake
#

Hi, has anyone done text extraction using pytesseract or worked with image pre-processing?

deft trout
#

Hey, can you help me? I just want to make a simple youtube downloader and I get this error every time πŸ™‚

burnt ibex
oblique finch
#

hello folks, does someone know is there a way to strip JAVA_OPTIONS from output of java -jar...

#

IK it's python discord but it's messing up my python tool

rancid schoonerBOT
#

Hey @wise tiger!

It looks like you tried to attach file type(s) that we do not allow (.bat). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.

Feel free to ask in #community-meta if you think this is a mistake.

wise tiger
#

where is a channel to learn phyton

ancient socket
#

Trying to visualize the way I do this project.
I have a piZero with a camera. Was going to do facial recognition.
its Headless to I have to SSH into it.
What is the testing like for this? I just need to make the pi create pictures,
send to a folder and have my desktop running a program to do facial recognition?
or is the piZero supposed to do it all? which its hard to test what it sees over SSH.

wet stag
#

If you have enough storage on the device, then you can keep your trained model there and try to recognize faces per-image based on that model.

#

That being said, modern systems such as Amazon Alexa have such massive always-changing-models, that data is definitely going to the cloud for processing

#

You can probably go either way

#

Either way, my recommendation will be getting the simplest solution working first

#

Then any related problems will be clear, and you'll have something that works that you can maybe redesign or expand on

#

This is a strong route to go, unless your intention is to understand the recognition and training algo's yourself, potentially to get closer to generic machine learning

ancient socket
#

Thanks, ya i was just trying to understand how it works to build it myself.

mystic void
shy locust
#

What's the implication of terraform hitting 1.0 on version

#

Also I'm being sent for RHEL training, anyone know a good discord for that

whole talon
#

py charm vs vs code which is better

lyric crown
#

hey guys
I accidentally overwrote friend's package-lock.json file with my file upload (I added by file-upload a file with the same name)
I didn't know that it will do that, I thought that it will merge somehow (newbie mistake)
is it okay if I just copy the content of my friend's package-lock.json into mine?

supple venture
rapid sparrow
#

restoring file from previous commit

#

git checkout <path to file>

timber hawk
#

Hi, I m coding a program and I want it launch with windows, how can i do ?

agile relic
#

does anyone know of a good CLI python script i can run which generates prompts for filling in DESCRIPTION, README, puts init into a directory, etc? basically a quick package generator

pseudo moon
agile relic
clear burrow
#

NOTE: You must install tkinter on Linux to use MouseInfo. Run the following: sudo apt-get install python3-tk python3-dev

#

that's a weird note

tawdry needle
#

that will depend on your os of course... not all linux distros are the same

#

debian takes the approach of breaking out parts of the python stdlib into separate installable packages

clear burrow
#

I use Ubuntu until not

rapid sparrow
#

wow, there is venv for docker. It is named docker-machine.

tawdry needle
#

what would such a thing do?

rapid sparrow
#

apperently it is a shortcut to create virtual machine with running docker inside

#

so, a layer of isolation. Instead of running containers directly in your server, to run them in a quickly raised virtual machine

#

it would be useful for situations when your application is made of many microservices

#

in order to make isolated sandbox environment to test them without port and other conflicts

#
$ docker-machine create -d virtualbox testenv
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env testenv
#
$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM
testenv            virtualbox   Running   tcp://192.168.99.101:2376
#
To see how to connect Docker to this machine, run: docker-machine env testenv
shy locust
#

Time to learn ansible

cloud elbow
#

[git]

I made a commit, but I have new changes again, what's the best way to update with the same commit message?

tawdry needle
#

you could write a shell script to get the previous one and then make a new commit with that message, but i don't know why would you want to

cloud elbow
#

oh god, it it just a small update to the last one

#

I had a typo

#

I want it to be just one commit

#

I did not push it yet

short peak
heavy knot
#

not sure where to ask this or if i can ask this in this discord, but can someone help me with docker? im getting really weird errors and i have no clue what could cause the errors

#

none of my imports are working when i go in the docker with docker-compose exec (containername) sh and try to run a py file

#

except the requirements.txt installed imports

umbral briar
#

container is isolated environment, only the modules you installed in Dockerfile are available

heavy knot
#

ill show you 1 sec

rapid sparrow
#

if in public branch... better reverting previous commit. (it will create second commit that handles reverthing previous one) Not exactly fulfilling the goal to keep shorter commit history though. But that's the only best way to cancel commit in public branch

#

if in your own branch (which you have before it will be merged to some public branch)

#

just do git reset --soft HEAD~1

#

it will cancel the last commit while keeping all your changes from it

#

and commit everything again

heavy knot
#

these files are in the root of the container, for some reason the Flask directory is still there even tho i removed it from my project

Dockerfile  __pycache__  app.py  boot       dev                 etc   kubemanifests.yaml  lib64  mnt  proc              root  sbin     srv  tmp  var
Flask       app          bin     config.py  docker-compose.yml  home  lib                 media  opt  requirements.txt  run   scrapes  sys  usr

then ill need to go to the directory app

Dockerfile  __init__.py  __pycache__  config.py  database.sqlite  forms.py  manager.py  models.py  reddit  routes.py  static  templates

and then i type: python manager.py db --help and its saying the imports arent working, while the imports i use are:

from app import app, db
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager

and it cant find the module app

rapid sparrow
#

show us at least docker file

heavy knot
# rapid sparrow more of a code?
version: '3.7'

services:

  flask_app:
    container_name: 'flask_app'
    build: '.'
    environment:
      - FLASK_APP=app.py
      - SQLALCHEMY_DATABASE_URI=sqlite:///database.sqlite
    ports:
      - "8001:5000"
    volumes:
      - .:/Flask
    depends_on:
      - redis

  simple_worker:
    image: 'python:3.8-alpine'
    container_name: 'worker_flask'
    build: '.'
    volumes:
      - flaskapp:/var/lib/flask/data
    environment:
      - SQLALCHEMY_DATABASE_URI=sqlite:///database.sqlite
    depends_on:
      - redis
      - flask_app
    command: rqworker --url redis://redis:6379/0

  redis:
    container_name: 'redis_flask'
    image: 'redis:4-alpine'
    ports:
      - '6379:6379'

  db:
    image: mysql:5.7.22
    restart: always
    environment:
      MYSQL_DATABASE: main
      MYSQL_USER: root
      MYSQL_PASSWORD: root
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - .dbdata:/var/lib/mysql
    ports:
      - 33067:3306

volumes:
  flaskapp:
#
FROM python:3.8-slim

# layer caching for faster builds
COPY requirements.txt /
RUN pip install -r /requirements.txt

#COPY app.py /app.py
COPY . /
WORKDIR /

ENV FLASK_ENV=development

CMD flask run --host=0.0.0.0

#CMD gunicorn --workers $WORKERS \
#  --threads $THREADS \
#  --bind 0.0.0.0:$PORT_APP \
#  --log-level DEBUG \
#  app:app
#
from app import app, db
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager

migrate = Migrate(app, db)

manager = Manager(app)
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()
rapid sparrow
#

a moment

heavy knot
#

okay

#

this is a better view of the structure

rapid sparrow
#

this should be fixed for sure... for...

#
FROM python:3.8-slim

ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1

COPY ./requirements.txt ./
RUN pip install -r requirements.txt

# Create directories app_home and static directories
ENV HOME=/app
ENV APP_HOME=/app/web
RUN mkdir $HOME
RUN mkdir $APP_HOME
WORKDIR $APP_HOME

COPY . .

RUN chmod 777 $APP_HOME
ENV FLASK_ENV=development

CMD flask run --host=0.0.0.0
#

That would work better.

#

the thing is / address is filled with system things

#

it is already full

#

not the best place to run application

heavy knot
#

oohh okay thanks! im gonna change it to that

#

btw when i try to remove the Flask directory its saying there are still things running in there, do you think what could cause that? afaik there cant be anything running in there and it shouldnt even exist since i removed the directory

rapid sparrow
#

make .dockerignore file btw

#

and include into it ignoring everything your .gitignore has

#

venv especially

heavy knot
#

okay thanks ill do that

rapid sparrow
#

will cause rebuild and run

#

or actually

#

docker-compose build

#

πŸ˜‰

heavy knot
#

im gonna try it!

rapid sparrow
#

when you call docker ps

#

from another terminal, you can see your conainers running right?

heavy knot
#

yeah

rapid sparrow
#

docker exec -it <containerID> <linux command> will run command inside the container

#

so

#

docker exec -it <containerID> ls /
or docker exec -it <containerID> ls /app/web

#

and you will see stuff copied to cintainer

#

or even...

#

docker exec -it <containerID> apt install mc

#

docker exec -it <containerID> mc

#

and navigate inside the container with Midnight Commander)

heavy knot
#

nicee im gonna try it out

#

pip install takes a while to do since it includes all anaconda installs also

heavy knot
# rapid sparrow docker exec -it <containerID> apt install mc

this one isnt working its giving this error:

docker exec -it f7bf3a0f7f7b apt install mc
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mc is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'mc' has no installation candidate
rapid sparrow
#

before trying that

heavy knot
rapid sparrow
#

apt-get update

#

or apt update

heavy knot
#

nice its working!

rapid sparrow
#

as alternative

#

you could actually connect with ssh to your container)

heavy knot
#

btw

#

do you know why Flask is still there and i cant remove it?

rapid sparrow
#

docker ps

#

docker ps -a

heavy knot
#

thanks it worked!

#

im still getting that weird error btw that the imports arent working:

root@968472cb319f:~/web/app# python manager.py db --help
Traceback (most recent call last):
  File "manager.py", line 1, in <module>
    from app import app, db
ModuleNotFoundError: No module named 'app'
#

its weird since the manager.py is in the app directory

tawdry needle
#

@rapid sparrow why PYTHONUNBUFFERED?

rapid sparrow
tawdry needle
#

i haven't had any issues with this, i've been using python and docker compose at work extensively for months

#

maybe it's an old bug or something

rapid sparrow
#

perhaps at least some docker-compose versions do that

tawdry needle
#

interesting, it could have to do as much with the OS inside the container as with docker-compose

#

it looks more like they just managed to write a buggy application and it happens to be in docker-compose

#

why this question was not closed as unclear i have no idea

#

no minimal example, screenshot of some random output, not even a snippet of a dockerfile

rapid sparrow
#

By default, Python buffers output to sys.stdout.
PYTHONUNBUFFERED: 1 This will cause all output to stdout to be flushed immediately.

#

perhaps there is a differnece between sys.stdout and stdout

#

and docker-compose shows only stdout

heavy knot
tawdry needle
tawdry needle
#

python packages are looked up relative to the current working directory, not relative to the script being executed

heavy knot
#

but it says that it cant find the module app

red grove
#

Spent the whole day working on ansible and I think I'm finally close to a once command deploy of our ubuntu/django/postgres/nginx stack install

#

Just need to sort out redis

tawdry needle
#

if you are in my-stuff/app and you run python ./manager.py then you need to cd up one level. you should be in my-stuff and you should run python -m app.manager

heavy knot
tawdry needle
#
my-app/          <--- WORKDIR should be here
  README.txt
  app/           <--- WORKDIR should not be here
    __init__.py
    app.py
    db.py
    manager.py
#

and you should run python -m app.manager db --help

heavy knot
#

thanks! im gonna try it

tawdry needle
heavy knot
#

i already found the error, its working

#

thanks!

tawdry needle
#

πŸ‘

muted cobalt
#

Is it possible for us to cache our dependencies in docker build?

tawdry needle
muted cobalt
#
FROM python:3.8-slim

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1

# Let service stop gracefully
STOPSIGNAL SIGQUIT

# Copy project files into working directory
WORKDIR /app

RUN apt-get update && apt-get install gcc -y

COPY Pipfile Pipfile
COPY Pipfile.lock Pipfile.lock

RUN pip install pipenv
RUN pipenv install --deploy --system

ADD . /app

# Run the API.
CMD python launch.py runserver --initdb
#

If you only copy in the pipfiles before installing dependencies it will cache

#

Since no files in your working dir have been changed

tawdry needle
#

that's not quite the same as caching, but if it works for you then it works

short peak
#

what about having a docker image with the "cached" stuff?

#

then use that "cached" image as base

muted cobalt
rancid schoonerBOT
#

Hey @muted cobalt!

It looks like you tried to attach file type(s) that we do not allow (.yml). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.

Feel free to ask in #community-meta if you think this is a mistake.

muted cobalt
tawdry needle
#

Using build layers is totally reasonable and normal

#

You could probably even use a multi-stage build where the artifact is the venv that will run the app

muted cobalt
#

Could, but this is already 60 times faster than our last Dockerfile πŸ˜‚

#

(not a joke)

tawdry needle
#

Yikes

muted cobalt
tardy ginkgo
#

Hey yall, I got a PyInstaller question:
Is there a way to create an executable/.app that runs my python script with command line arguments?
i.e. produce a .app that emulates running my script with added command line arguments. (the user wont input arguments, they will simply run the .app and my script will be run with some predefined arguments)

muted cobalt
#

just code the CLI arguments into the script before you compile it?

tardy ginkgo
#

that's kind of what im trying to do without making redundant files.
its to compile for different build targets. code checks the "target" variable and some features become enabled/disabled. id love to have a way to set that "target" variable in my .spec file that i pass to PyInstaller

#

or maybe i can ask my question this way:
is there a way for PyInstaller to supply commandline arguments (even an environment variable would do) to the script thats being compiled?
if so, I can have one .spec file per build target and that would make me very happy rn

rapid sparrow
#

Just launch your pyinstaller with command from it

#

os.system("your pyinstaller command")

tardy ginkgo
#

python oriented makefile, yes!
i have not heard of this module, i'll look into it. thank you!

rapid sparrow
#

For example for your interface

#

Build target could be having default value

tardy ginkgo
#

python scripts.py build -t linux
i dont think i quite get this. does this solution not use PyInstaller?

rapid sparrow
#

What would be used inside is completely your choice

rapid sparrow
tardy ginkgo
#

but would pyinstaller create an executable that running it would be the equivalent of running a script on the command line with arguments?
to reiterate, im trying to produce an executable that itself will not take an argument, rather the executable will be the executable of script.py arg1 if you will

#

so that i can make
target1: pyinstaller executable with arg1 target2: pyinstaller exec with arg2 ...

rapid sparrow
#

Actually you just wrote simple makefile :)

tardy ginkgo
#

i see. lemme bang my head on it for a bit

#

i have the makefile, i use make

#

but i need to compile the same code with just one variable be different at compile time

#

that i couldnt achieve via pyinstaller

rapid sparrow
#

Click library is the same as, makefile, it just allows you to write makefile in python

#

With more comfortable features

tardy ginkgo
#

gotchu. thanks!

muted cobalt
rapid sparrow
#

if such thing exists, it was probably in your root folder

muted cobalt
#

it wouldnt have been there

#

only config val we change is max line length

rapid sparrow
#

actually

muted cobalt
#

and it’s in the tox.ini file

rapid sparrow
#

may be you have broken \n\r new line in your workflow

#

instead of running
run: "python -m flake8
--format='::error file=%(path)s,line=%(row)d,col=%(col)d::
[flake8] %(code)s: %(text)s'"

#

it runs:
run: python -m flake8

#

check what it is launching)

muted cobalt
#

it’s legit copied from their workflow though?

#

except python -m

rapid sparrow
#

shrugs I just consider all potential choices

muted cobalt
#

yeah

#

I’ll try later

rapid sparrow
#

it runs normal locally

#

but not running well in workflow

#

perhaps it has problems with some dependencies?

#

in how they are installed in workflow

#

actually...

#

just make git clone of your repository to another folder

#

and try launching flake8 from zero

#

perhaps some .gitignore issue

urban pecan
#

just letting you know, i released a 0.2 version of justuse πŸ™‚ now it's also possible to decorate functions/methods/classes etc. matching a name-pattern on import

#

on the auto-install front i'm a bit stuck with the actual "install" part, downloading and checking works though

#

oh, and you can pass in optional defaults now, that should be returned if something fails during import

#

so instead of

try:
  import foo
except ImportError:
foo = None
#

you can do

foo = use("foo", default=None)
#

and aspectizing (remote-decorating) works like
foo = use("foo", aspectize={(use.functions, ""): log})

#

which would decorate all functions in the module with your "log" decorator of choice

#

use.isfunction*

#

(an alias of inspect.isfunction)

inner pollen
#

Do you guys know any library which helps me to find a line of code or a log from all the imported modules in a particular module of python. Do you know how to use grep command to do so.

supple venture
heavy knot
#

your main branch is protected - that means you can not directly push to it

supple venture
heavy knot
#

@supple venture To me it seems that you maybe need to allow admins to bypass this rule: "remote: error: Required status check "Lint" is expected. At least 1 approving review is required by reviewers with write access."

supple venture
#

But I haven’t enabled this, so admins have basically no restrictions PE_PandaThink

supple venture
#

I added myself to allow bypass let’s see if it works PE_PandaFingersCrossed

cloud elbow
#

I have two postgres versions

  • 9.6 (my data is in this version)
  • 13 (empty | new)

how do upgrade the databases from 9.6 to 13 and move it to version 13?

tawdry needle
#

@cloud elbow
https://www.postgresql.org/docs/current/upgrading.html

For major releases of PostgreSQL, the internal data storage format is subject to change, thus complicating upgrades. The traditional method for moving data to a new major version is to dump and reload the database, though this can be slow. A faster method is pg_upgrade.
I recommend reading this entire page carefully

cloud elbow
tawdry needle
#

they might be installed somewhere else

#

it's probably os-dependent

#

maybe /usr/bin

#

it should already be on your path

muted cobalt
#

Looking at this it seems like it's definitely an issue with the caching

tawny temple
#

You need to ensure the .cache folder is excluded in your flake8 config

#

@muted cobalt

muted cobalt
#

Ohhhh

#

That makes sense

carmine maple
#

hello folks, I have a (private) python repo on github and I'd like to know whether is it possible to set up something like

  1. pyinstaller creates the .exe
  2. the exe is zipped alongside a .txt file
  3. the result .zip is marked as a release
    (please ping me when replying)
tawny temple
carmine maple
#

looking up what that is, thank you

rapid sparrow
#

hmm, why is it having a dog with man as picture? πŸ€”

carmine maple
#

oh this also looks great, thanks!

rapid sparrow
#

with some googling it is possible to find for python

#

this one auto publishes to PyPi

#

nice

carmine maple
#

I did some googling but didn't find what I was searching for

rapid sparrow
#

I am googling like... "github actions <insert my combination of words>"
usually adding "release" word
the last combination I tried "github python auto release actions" and previous one as "Github actions auto making release"

sharp plank
#

so this code is in my_file.py

hkdf = cy.hazmat.primitives.kdf.hkdf.HKDF(
    algorithm=cy.hazmat.primitives.hashes.SHA256(),
    length=32,
    salt=None,
    info=None,
    backend=cy.hazmat.backends.default_backend()
  )```
but get an error: 
```AttributeError: module 'cryptography' has no attribute 'hazmat'```
 but the same code in terminal interpreter works just fine
primal basin
#

im stuck in a terraform init loop; im just learning TF, and trying to set up a remote backend. I deleted a S3 bucket on the console and now my terraform CLI keeps me in this loop about the deleted S3 bucket...

ive tried terraform init -reconfigure and still blabbing about the deleted S3 bucket.. any way I can do a fresh restart?

#
β”‚ 
β”‚ Reason: Unsetting the previously set backend "s3"``` is the error msg im getting
#

so then i run terraform init -reconfigure

#

tehn i get Terraform has been successfully initialized!

but upon terraform apply it shows an error about the deleted S3 bucket

carmine maple
#

I'm having troubles trying to get git to work with vs code
I have a private repo. I generated the ssh key and linked it to my github account. When I clone using git bash, it downloads just fine, but cloning through vs code just hangs forever

tawny temple
#

I'm having trouble with poetry on Windows through the git shell. It's telling me that I need elevated permissions:

poetry run pre-commit install

  OSError

  [WinError 740] The requested operation requires elevation

  at c:\users\mark\scoop\apps\python\3.9.5\lib\subprocess.py:1420 in _execute_child
      1416β”‚             sys.audit("subprocess.Popen", executable, args, cwd, env)
      1417β”‚
      1418β”‚             # Start the process
      1419β”‚             try:
    β†’ 1420β”‚                 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
      1421β”‚                                          # no special security
      1422β”‚                                          None, None,
      1423β”‚                                          int(not close_fds),
      1424β”‚                                          creationflags,

Works fine through PowerShell. I tried looking up this issue for poetry but didn't find anything. Has anyone on Windows encountered this before?

Perhaps related, when I try to run my pre-commit hooks, one of them fails saying that node.js needs elevated permissions. Again, it works fine through PowerShell.

shy locust
#

Then try git fetching or something through vs code

#

If it works, there you go

carmine maple
shy locust
#

Noice

supple venture
#

this is not the right channel to post projects, you can post them on the reddit, thanks!

supple venture
inner pollen
#

Sure

carmine maple
#

I was so close. When I commit through VS code, it appears that all changes commit, but opening the repository on the website shows nothing went through and changed

shy locust
#

Look up creating a bash profile with credentials and how to point your bash terminal at the credential file

#

My best guess is that the hanging is related to an issue with your http proxy or https proxy setting, and the other half is that you don't have your github username and password saved in your vsc bash environment

#

If you got a 503 during that first vsc hang you need to set a proxy

carmine maple
#

it now downloads the repo correctly but nothing happens when I commit

shy locust
#

Anyone can clone your repo (since its probably public) without logging in, so you need to pass your username and password to your git request via the profile when attempting to commit

carmine maple
#

it is private, the cloning didn't work earlier but now it does

#

committing doesn't work though

tawdry needle
shy locust
#

Waitaminit

carmine maple
supple venture
#

Need some help with github permissions, the token has literally every permission it can have.

urban elbow
supple venture
#

actions/runner#514

urban elbow
#

ah, yeah that's probably right, didn't realise that was a warning not an error. I'm not too sure then

supple venture
#

No worries PE_PandaThumbsUp, I am using a token which I use to push myself (same permissions, different token) and I never got that error, so even I was suprised when I first got it. I tried to mess around with repo perms and token perms, didn't help.

brisk lake
#

any one know if its possible to set env variables in pyproject.toml

#

eg, i have a flask app and i want to have pyproject.toml recognize the entrypoint without me setting it with export

tawdry needle
# brisk lake any one know if its possible to _set_ env variables in pyproject.toml

no, pyproject.toml by default does not have any way to set environment variables in general. you could theoretically write a program that reads env vars from it, but in the case of flask it wouldn't be easy; you'd have to invoke a different script which would then invoke flask, and at that point you might as well just use a Makefile or a shell script

brisk lake
#

neat, will take a look

hollow summit
#

is anyone familiar with microsoft azure

supple venture
#

go ahead and ask!

hollow summit
#

actually i wanted to create alerts for the vm

#

Create an alert for the server down notification and check whether it is
implemented successfully?

opal ibex
#

is there a way that i can use selenium to select a drop down list and then click one of the items from that list?
https://www.technomarket.bg/search?query=remington this is the site and i want to click the drop down list as shown in the picture, I am typing using the xpath to do this:

elemental= driver.find_element_by_xpath("/html/body/tm-root/main/tm-search/div/tm-product-filter/div/mat-drawer-container/mat-drawer-content/div[2]/div[1]/div[2]/tm-product-filter-facet[2]/div/mat-form-field/div/div[1]/div/mat-select/div/div[2]")
elemental.click()```

(i am copying the full xpath from the page of the site) but i get an error that the element is not found
any idea why?
hollow summit
#

1)Create two users (user01 and user02) in Azure Active Directory.
2)Make sure that both the users can login to their accounts through Azure Portal.

#

how do i do the second step

frank stone
#

I want to switch my repo from GitHub to GitLab. I already changed git config --global user.name and email and added an origin with the new repo link. How do I give it my gitlab password now?

> git push origin-gitlab main
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
blazing badger
#

has anyone used selenium python to automate angular apps?

tawny temple
short peak
frank stone
tawny temple
#

Have you given gitlab your ssh key?

#

You have to do it on their website

frank stone
#

I was able to use gitlab option to import the repo from github, and then cloned from gitlab to a new folder. Now I'm trying to save the password/key so I don't have to type it everytime

#

I created a pair of keys and added the pub key to gitlab. ssh-add ~/.ssh/id_rsa

tawny temple
#

Does ssh -T git@gitlab.example.com work?

frank stone
#

I tried that with my ssh link and it says Could not resolve hostname .. Name or service not known

#

now I tried ssh -T git@gitlab.com and it says Welcome

tawny temple
#

Yeah that is what I meant to use

frank stone
#

it still asks for username and password when I type git push

tawny temple
#

Did you use the ssh link for the remote?

#

type git remote -v

#

It will list your remotes

frank stone
#

yeah I need to change to ssh

#

yes now it's working, not asking for anything

#

thank you

tawny temple
#

You're welcome

blazing badger
steady canopy
#

Does it make sense to dockerize a python script that needs to be portable for multiple users? Right now my setup instructions are just to clone a repo and then set up the virtualenv and install packages etc., but one person so far has had issues with python versions on their machine being all messed up. Granted that's probably a user error on their part, but I'm trying to minimize work for people to have to do in order to be able to run the script. I don't have a lot of creating Docker images experience, so my look at it makes me wonder why it would be worth it since then to run the script (from what I know) they'd have to exec into the container, no? Or is there a better way and the right thing to do is to make an image for the script?

tawny temple
#

I don't know what your target audience is, but if someone can't manage Python versions on their machine properly then trying to use Docker is probably going to be over their heads too.

#

If you create your image with an entrypoint defined, they would just have to start the container and then stop it when they are done. They don't need to exec into it.

#

You're trying to minimise work for users, but keep in mind that if you use Docker, then that's just another thing they'd have to install (unless they wanna go the manual route like your original instructions).

#

I suppose you could offer Docker as an alternative.

steady canopy
#

everyone that's using it should already have docker installed

#

it was my manager that's python versions were messed up, he doesn't really do dev work anymore and didn't feel like fixing it when i thappened I guess

#

so it just kind of begged the question if it's portable enough I guess

short peak
tawny temple
#

Well okay, you can make a Docker image for it. They'd just need to run one command to start the container.

steady canopy
#

but if the script takes arguments would those arguments be passed as run arguments then?

tawny temple
#

Yes, you can pass them to docker run

#

Though I think if you pass arguments you have to specify the command to run

steady canopy
#

gotcha.. will keep as a consideration

#

seems kinda like unnecessary work to me, would prefer to have a jump host we have tooling on rather than relying on personal machines

frank stone
#

When git push is run, which remote does it use by default?

heavy knot
#

Permission denied <repo> to username

I made a new github account and tried to git push origin master it gave me this problem, how to solve?

Please ping me if you know the help.

tawny temple
#

That can also be changed with git branch -u ...

nimble mango
#

I'm working on a tool that checks your email or (emails) if they are pwned, basically it works by seeing the error code of a website and if it's error code 200 it says a certain thing and if it's error code 404 it says it's not pwned, basically, I'm getting an error 403, and I tried Proxies, a useragent, etc., and it's just giving me a syntax error with the headers for some reason, and an error 403 without the headers, but with the proxies, somene help! 🀞

tawdry needle
#

@nimble mango doesn't troy hunt's site have an api? i suspect that haveibeenpwned forbids scraping and takes measures to prevent it, hence the 403

#

and circumventing that would be against our server rules to discuss

nimble mango
#

I believe their API costs money to use

#

And I don't really wanna pay for an api when I can just use the website

#

but it was gonna be cool to have a loop just checking my emails

urban pecan
#

btw, i haven't really mentioned it (since it works pretty much flawlessly and i didn't need any help with that), but justuse can safely import code from an URL, which i imagine could be nice for deployment

#

i'd be curious if i could tag a claim of "unhackable infrastructure" on it, even, maybe someone is interested in testing it πŸ™‚

#

i'd guess that a system under attack would rather collapse than get corrupted

woven saffron
#

Anyone here got experience with creating docs/docstrings for python+Doxygen?

#

I'm using Doxygen+doxypypy (because I have to) but I am having a hard time using e.g., the "Attributes" tag to define public class attributes

paper yacht
#

Any recommendations for a tool that handles processes?

wintry iris
#

So I decided to use a linter (with VSCode) again and settled with flake8. I've cleaned up my file as much as I could, but can't get rid of error no newline at end of file flake8(W292). The end of my file looks like this.

# TESTING
if __name__ == "__main__":
    app = qtw.QApplication(sys.argv)
    mw = ConversationsList()
    sys.exit(app.exec())
# end of file

Searched it up and found this article, https://www.flake8rules.com/rules/W292.html , that did not really help though. What am I doing wrong?

tawdry needle
#

@wintry iris press "enter" at the end of your file and try again?

#

it's possible that vscode is configured to remove trailing newlines

paper yacht
#

yea i mean interacting with the operating system (killing processes, etc.)?

tawdry needle
finite fulcrum
#

Can I get pycharm to ignore in-file annnotations and use stubs for type hints? It recognizes the stubs but the normal annotation overrides them which makes them useless

bleak pine
#

There is to many tchat for help I will put my problem here. Well i got a python question that even Stack O didnt answer ... I create a private chat secured by AES with Tkinter. It went perfectly even on Android with Pydroid on Google play. Here is my problème : I want to close a Android keyboard with python.

rich anchor
#

I want to click on the products in the basket one by one and get their information, but I can enter the first one, but not the others in Selenium.

wintry iris
#

how does one move one folder in github to another folder, preferably though the website UI?

primal basin
#

might be a dumb q but: I am learning terraform and aws, i am fiddling around making a new vpc, subnets, gateways, security groups for my redshift vpc. I eventually want to access redshift via my terminal, what should i be editing ? the security group ingress/egress?

#

like do i need to add an extra ingress rule to account for me eventually accessing redshift via my terminal?

#

if so, what would the rule be

shy locust
#

If you want to do configuration changes "properly", also set up an assume role that your desktop client can assume via Sts and give that role the necessary permissions to redshift (and ec2 and s3 and so on)

#

You should still be careful about exposing your vpcs to the Internet, so look up how to do that securely

primal basin
#

thank you

shy locust
shy locust
rapid sparrow
primal basin
#

So I’m not really using Python/boto3 unless I’m missing a use case

#

he accesses redshift through the console, i wanna access my redshift instance via my terminal

light crow
#

when you say "access redshift" you just want to run queries and get some data back?

#

this can be done via aws-cli or through boto3.

primal basin
#

ohhhh that looks promising ^

#

so if I have aws-cli properly configured I can just make use this boto3 API and not have to do any security/port configuring?

shy locust
#

Ah, yes, the security port configuring is if you are making requests from outside the aws environment

#

Since you're making requests using the aws sdk, no need to mess around with that

indigo wave
#

Hey guys, can anyone tell me how to generate an executable that can be run on Linux and Mac OS from Windows using PyInstaller or Nuitka?

primal basin
heavy knot
#
  scheduler:
    image: 'python:3.8-alpine'
    container_name: 'scheduler'
    build: '.'
    depends_on:
      - db
    command: cd app/reddit && python -m app.urs.mainscrape
ERROR: for scheduler  Cannot start service scheduler: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "cd": exe
cutable file not found in $PATH: unknown

hey, does someone know i can make this command work?

rapid sparrow
#

well, anyway.

#

just add path in your docker file

#

WORKDIR /app/follder/project

#

then you will be able removing "cd" command

#

or actually...

#

just debug the container with docker exec command

heavy knot
# rapid sparrow WORKDIR /app/follder/project
  scheduler:
    image: 'python:3.8-alpine'
    container_name: 'scheduler'
    WORKDIR: '/app/reddit'
    build: '.'
    depends_on:
      - db
    command: python -m urs.mainscrape
docker-compose up -d --build
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
Unsupported config option for services.scheduler: 'WORKDIR'

im getting this error, i think it isnt working because im using docker-compose

heavy knot
supple venture
#

WORKDIR /app/follder/project is to be put in your Dockerfile

heavy knot
supple venture
#

You can name your dockerfile anything and pass it in on build parameter

build:
 dockerfile: xx
heavy knot
#

oohh okay thanks! im gonna try it

heavy knot
# supple venture You can name your dockerfile anything and pass it in on `build` parameter ```yml...

i tried it like this:

services:

  flask_app:
    container_name: 'flask_app'
    build: '.'
      dockerfile: Dockerfile_flask
    environment:
      - FLASK_APP=app.py
      - SQLALCHEMY_DATABASE_URI=sqlite:///database.sqlite
    ports:
      - "8001:5000"
    depends_on:
      - redis
      - db

  scheduler:
    container_name: 'scheduler'
    build: '.'
      dockerfile: Dockerfile_scheduler
    depends_on:
      - db
    command: python -m urs.mainscrape

but im getting this error:

ERROR: yaml.parser.ParserError: while parsing a block mapping
  in ".\docker-compose.yml", line 6, column 5
expected <block end>, but found '<block mapping start>'
  in ".\docker-compose.yml", line 8, column 7

i think it has something to do with the '.' on build, but if i remove it it says it doesnt have an image or build context

jade summit
#

would this be the best channel for discussing IDEs?

supple venture
#

I am not sure about that.

tawdry needle
#

@heavy knot this might be a yaml parsing error, try quoting your commands and such

#

oh yeah this is wrong

build: '.'
  dockerfile: Dockerfile_flask
#

that's not valid yaml

#
  build:
    context: '.'
    dockerfile: Dockerfile_flask
``` @heavy knot it should be this
short peak
tawdry needle
#

they aren't, yaml lets you omit them

#

but yaml also interprets things like true as a boolean, so it's good practice to defensively quote yaml imo

short peak
#

I see

heavy knot
#

i have an error

heavy knot
#

t = subprocess.run(["dir"])
#

it it give

#
  File "C:\Users\kushal\Documents\com.py", line 3, in <module>
    t= subprocess.run(["dir"])
  File "C:\Users\kushal\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\kushal\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\kushal\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
[Finished in 2.1s]
fair hinge
#

@heavy knot

#

subprocess.run('dir')

heavy knot
#
  File "C:\Users\kushal\Documents\com.py", line 4, in <module>
    t = subprocess.run("dir")
  File "C:\Users\kushal\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\kushal\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\kushal\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
[Finished in 1.8s]```
#

no it also give error

#

I need invite tracker

#

I have 30%

#

Need join message cfg

#

And joinmessage cfg

#

And leave too

tawdry needle
#

@heavy knot dir might not be a binary, it might be a shell built-in. try subprocess.run('dir', shell=True)

heavy knot
#

it running

#

thank @tawdry needle

tulip meteor
#

Hi I have a Project repository which has 2 projects frond-end and back-end

#

Projcet

#

How can I deploy on Heroku?

#

backend is a flask api, front end is a reactjs app

astral tangle
#

anyone here deploying to Azure? I'm confused as to how my requirements.txt libs are supposed to be deployed

#

either by the azure devops build pipeline zipping them up, or the azure web deploy deploying them?!

short peak
inner hare
#

Got a somewhat non-Python question for you guys:

I am working on a semi-private project that I would like to remain visible to the open Internet.
However, I would also like to make sure that forks, pulls and clones can only be done by a group of authenticated users. This is to ensure that users may access the repository but can only make meaningful use of it if they agree to a set of Terms and Conditions.
Has anyone ever tried something like this? Any thoughts on how to do this in GitHub or GitLab?

urban pecan
#

any law-abiding person needs to adhere to the given license, so you could simply state your conditions in there

#

you can't prevent people from violating it though, which lawyers are for

#

(even if one clicks on "i agree to the license conditions" it could be a lie)

tawdry needle
urban pecan
#

@tawdry needle but that doesn't hinder someone with access to copy it locally and then fork etc. whatever they like..

fast kayak
#

Aye, has anyone managed to make sense of Tox's platform conditionals? I'd like to have a single testenv execute one of two commands based on the OS, but I'm quite lost.

stuck citrus
#

hello, do you know any good library to modify pdf and docx documents

floral smelt
#

Hello, I wanted to know if anybody tried a nvidia container with a different version of CUDA

shy locust
#

I need to practise navigating around Linux because I'm taking over my company's machine image release pipeline shortly, what would you guys recommend for practise on my own time

I'm on windows
Docker with Linux or Linux partition

rapid sparrow
#

Quite comfortable for devops stuff

snow sage
#

Hey, could someone give me an explanation on what git rebase does?

#

I've tried reading docs but I'm still a little confused

finite fulcrum
# snow sage I've tried reading docs but I'm still a little confused

It lets you change the base commit, for example if your main branch has commits a b c and you have a feature branch that's based on a, then rebasing would let you change the base commit to c (you get all the changes from main without a merge) and then it copies the existing commits on top of it.
Or with an interactive rebase you can manipulate the history manually, you can change commit messages, re-order, squash them etc.

snow sage
#

Oh I see, thank you!

mortal cosmos
heavy knot
#

hey

burnt ibex
#

Everwhere on the Nginx site, it takes about free trials

#

Is there not a free tier of some sort?

short peak
#

what?

tawdry needle
burnt ibex
#

Got it

#

Where are the docs for the free part?

supple venture
burnt ibex
#

Ty

warm pollen
#

@heavy knot what is the full traceback? It seems like something is trying to resolve a cache file at ~/.cache.json

#

alright, the error is that the home folder doesn't exist

#

Yeah

#

You can either create it first and use another location

#

!d pathlib.Path.mkdir

rancid schoonerBOT
#

Path.mkdir(mode=0o777, parents=False, exist_ok=False)```
Create a new directory at this given path. If *mode* is given, it is combined with the process’ `umask` value to determine the file mode and access flags. If the path already exists, [`FileExistsError`](https://docs.python.org/3/library/exceptions.html#FileExistsError "FileExistsError") is raised.

If *parents* is true, any missing parents of this path are created as needed; they are created with the default permissions without taking *mode* into account (mimicking the POSIX `mkdir -p` command).

If *parents* is false (the default), a missing parent raises [`FileNotFoundError`](https://docs.python.org/3/library/exceptions.html#FileNotFoundError "FileNotFoundError").

If *exist\_ok* is false (the default), [`FileExistsError`](https://docs.python.org/3/library/exceptions.html#FileExistsError "FileExistsError") is raised if the target directory already exists.
warm pollen
#

Yup

#

Don't forget to set parent=True

#

Interesting

#

How is FOURIER_CACHE defined?

warm pollen
#

lol I'm here now

#

You need to do FOURIER_DIR.mkdir(parents=True, exist_ok=True) @heavy knot

wooden ibex
#

Why are you putting everything /?

#

that's not best practice

calm tapir
#

Anyone know what this means? I am able to ssh just fine through terminal. But in VSCode I keep running into this.

eager cedar
#

bash command not found, do you have /bin/bash on your machine? πŸ™‚

calm tapir
#

On my local machine or the remote machine?

#

@eager cedar on my local machine I'm using zsh but the remote machine I'm connecting to uses bash

eager cedar
#

I don't use vscode, so I have 0 clue about the implementation and use of that feature

#

but seems to me like one should check if which bash on both machines I guess.

calm tapir
#

@eager cedar What editor do you use to connect to a remote machine?

eager cedar
#

why would I use an editor for that?

calm tapir
#

@eager cedar It's tough to code in vi or a command line editor

eager cedar
#

Do you absolutely need to code on the remote machine?

calm tapir
#

@eager cedar Yeah unfortunately, I can't really replicate the environment right now because the remote machine is a raspberry pi.

eager cedar
#

I use vim so I don't have that problem, but one should only have to code on a remote machine in very rare occasions

#

alright, I would just use a container technology if you have environment differences.

#

What kind of project are you working on? Maybe I could be more specific in my suggestions then.

#

@calm tapir

calm tapir
#

@eager cedar Yeah might just create a docker image tbh. It's basically a robot that runs on a raspberry pi. And I need to run a Python script on it. I could just write the code locally and keep copying and pasting it into the raspberry pi for debugging but that is a painful process each time.

eager cedar
#

you could also just rsync automatically on save.

calm tapir
#

@eager cedar Yeah that is definitely an option. I was also thinking of using git but I don't want silly commits on my account.

heavy knot
#

I need help with selenium

regal venture
supple venture
#

Sup, need some help I am working on a project with starlette, a fairly simple one, have it private sourced on github right now as it is for school, I am using a similar setup like pixels, but I get this error: https://paste.pythondiscord.com/yadatiliso.rb

#

Dockerfile

#

docker-compose.yml

rapid sparrow
#

migrate db, or something like that

#

or create db and tables πŸ˜‰

supple venture
hexed flare
#

docker compose create volumes as root
cannot make changes to the mounted files made from shell in docker container as a normal user

undone moss
#

Hey! I have my code and wanna add that to my git hub. I created new repository (default) and following instructions got this

#

I need copy this file to git folder πŸ€”

undone moss
#

Solved!

tawdry needle
eager cedar
tawdry needle
#

@eager cedar docker doesn't "translate" UIDs at all?

eager cedar
#

Define translate in this context

#

but think about it this way, the container doesn't know anything about your hosts users, so how would it even begin to "translate" UID's to something that doesn't conflict with UID's on the host?

Not sure if that's what you are reffering to :-)

tawdry needle
eager cedar
#

1234

#

I am pretty certain, but let me check LUL

#

seems like it's just owned by root sadge

#

I tried to make a docker compose example.

FROM ubuntu:latest

RUN addgroup --gid 1000 test_group
RUN adduser --uid 1000 \
            --gid 1000 \
            --home /home/test_user \
            --quiet \
            --disabled-password \
            test_user
USER test_user

CMD ["tail", "-f", "/dev/null"]

docker build -t meme .

docker-compose.yml

version: "3.8"

services:
  ubuntu:
    image: meme
    container_name: ubuntu
    command: tail -f /dev/null
    volumes:
      - ./kek:/tmp/kek

@tawdry needle

Produces:
drwxr-xr-x 2 root root 40 Jun 21 20:55 kek

#

because I ran the the docker command as root I presume.

tawdry needle
#

ok that's what i was wondering

hoary wharf
#

Does anyone here have experience with migrating a private pypi to Artifactory?

gleaming knot
#

can anyone recommend a dependency compatibility checker resolving transitive dependencies?

heavy knot
#

Can someone help me with a tool in py

#

please

urban pecan
#

i have a small issue with use() i'd like to discuss.

#

use(use.Path(..)) can load from arbitrary relative or absolute paths, which works well because it changes the CWD for each import (and back)

#

it also works well in jupyter, because you can cd around, but

#

F:\Dropbox (Privat)\code\justuse> python .\src\use\test4.py with a relative use(use.Path()) inside will invariably fail because the envocation doesn't change the CWD

#

so now my predicament - do i need to look at the sys.argv to determine whether or not i need to chdir or is there some cleverer way to make the right call?

#

using the CWD internally is very elegant and ensures that also relative imports just work, so abandoning this approach would make things a lot more complicated overall

#

nvm, i think i found a solution.. __import__("__main__").__file__ should do the trick

tawdry needle
#

maybe instead you can temporarily add stuff to sys.path, or maybe there's a way around sys.path entirely using the "loader" mechanism

urban pecan
#

@tawdry needle sys.path is a hack, i noticed somewhere in my deep dive into the import machinery a comment that basically said "we really should use cwd everywhere"

tawdry needle
#

Even for site packages?

urban pecan
#

and yeah, if CWD is changed correctly, it all works out perfectly

#

not sure about site packages, i haven't really gotten into auto-install that far yet

#

but yeah, if the cwd is updated recursively and reset correctly, even relative imports work in concert with use(use.Path())

#

at first i didn't even expect to have it both hand in hand

#

but now i kind of take it for granted πŸ™‚

burnt ibex
#

I have a git branch with 7 commits, and I'd like to merge it all into the same commit (sort of like squashing a PR, but on the same branch). How would you do such a thing?

tawny temple
#

git rebase -i HEAD~7

supple venture
#

Then you can squash them by adding s instead of the pick in all the commits you wanna squash down

#

Then it will open the commit file in your configured editor

burnt ibex
#

Thank you both so much!

supple venture
#

Np, and yeah remember to force force after commiting, git push origin my_branch --force

#

otherwise git would mess up your commit history

shy locust
#

Wow good to know

rapid sparrow
#

while remaining on the secondary branch where I squash the stuff

tawny temple
#

If your branch is set to track the remote then you can omit the remote and branch name from the push command

#

And force with lease is a variation of force that aborts if the remote has commits you don't have locally

tawdry needle
#

i.e. --force is serious danger zone material and --force-with-lease is not

supple venture
#

I didn't know about --force-with-lease, thanks!

tawny temple
#

It can still be dangerous if you're keeping your local repo up to date with git fetch (but not actually pulling those changes).

shy locust
#

What's the best way to keep your local branch up to date with the master (say, after merging a pr)

#

I've been doing fetch master then rebasing my dev branch

tawny temple
#

That is how I do it.

#

You could achieve the same thing with git pull too I suppose

shy locust
#

Git pull origin master?

tawny temple
#

git pull --rebase origin master unless you have git configured to rebase on pull by default.

shy locust
#

I had the oddest thing where one of my interns who swears she has been doing it was still 1.5k commits and several months behind the remote master somehow

#

Ahhhh okay. Probably doing that without having auto rebase configured

tawny temple
#

A feature branch living long enough for 1.5k commits on main is quite concerning.

shy locust
#

Right

#

Inspected everyone's local env and practices after that

tawny temple
#

I mean in the sense that she should be aiming to merge her changes more frequently into the main branch. But I've not worked on gigantic projects so what do I know. Maybe some stuff legitimately has to sit that long in a separate branch.

shy locust
#

Yup

tawdry needle
#

the only downside with rebasing off master (as opposed to merging master) is that conflict resolution can be extremely gnarly if your branch refactors existing code

#

resolving merge conflicts is one thing, resolving rebase conflicts is a whole different animal

supple venture
shy locust
shy locust
#

bar bar bar ME AM MAKE CODE GUD

#

I should put this on a bumper sticker

#

I, Caveman

supple venture
#

Lol, pycharm makes it simpler tho, not easy just simpler

urban pecan
#

the next big thing i'm going to tackle in justuse will be auto-installation, i guess.. then it also should be possible to install and use different versions of the same package in the same codebase πŸ™‚

#

any input on how that could be achieved?

#

downloading should work, but i'm not sure yet how packages are actually installed

urban pecan
#

i am thinking of a json file that keeps record of all the packages that are installed somewhere on the system with their versions and hashes, does something like that already exist?

#

{name: [version: "path": str(Path), hash: str(sha256)]} something like that

#

basically the pypi metadata, just locally with a pointer to the path

#

that would make it possible to share packages where possible and have diverging dependencies at the same time

#

hmm.. then i could lightly monkey-patch the import machinery to check the dependency registry on attempted import and chdir to that path

#

making messing with sys.path obsolete

#

and people could hack the registry if they moved packages etc. while at the same time integrity would be ensured via hash

urban pecan
#

any suggestions where that registry file could be put as a default?

tawdry needle
#

or $XDG_CACHE_HOME if it's not "bad" to delete the data

urban pecan
#

@wooden ibex how so?

wooden ibex
#

Mixing imports like that, when you are monkey patching core parts of compiler, you might want to reconsider your approach

urban pecan
#

sys.path is a hack that simply got out of hand, having a proper registry of installed packages is much less crazy, imo

#

and i said "light monkeypatch", it would only need to wrap the imports to chdir to where it needs to be

#

since the import machinery works much better if the current working directory is properly set

#

it wouldn't require changing the whole machinery

#

just a nudge to look in the right place

#

@tawdry needle okay, i'll start with that πŸ™‚

wooden ibex
#

Ok?

#

Someone going bonkers isn’t a license for others to go bonkers

urban pecan
#

heh

#

meta hooks is probably the thing i'll need to look into, since it's called at the beginning of the import process

wooden ibex
#

runs away screaming

urban pecan
#

lures Rabbit in with fresh carrots

wooden ibex
urban pecan
#

fresh meat?

wooden ibex
#

Nope

urban pecan
#

😦

wooden ibex
#

I don’t want anything near this, this isn’t DevOps, this is crazy dev

urban pecan
#

no more need for virtualenvs?

#

please? πŸ™‚

wooden ibex
#

No

gleaming knot
#

can anyone recommend a licence compatibility checker resolving transitive dependencies?

heady gull
#

hey guys,
I don't know if this is the right channel, but I want help with matplotlib. If anyone knows how to change the colors of the numbers please help me thx πŸ˜„

gleaming knot
heady gull
#

thx imma check out

#

thanks so much! it worked! @gleaming knot

forest goblet
#

personally, I don't see anything crazy about taking control of the import process long enough to ensure you get a specific module (version) loaded while not disrupting resolution for the rest of the session

heady gull
#

?

floral smelt
#

For Docker and docker-compose users, when you lauch a command with docker-compose, do you have errors saying x file could not be found despite having the directory configured?

#

Ex. when you launch docker exec on a Django app, with ls

#

You have the manage.py file in it

#

But when you use command: python manage.py runserver 0.0.0.0:8000 it says manage.py not found. Why is that?

urban pecan
#

@wooden ibex btw, i'm not even sure i need to fiddle with meta_path at all, no monkey patching required

#

less crazy dev, more devops πŸ˜‰

#

pip insists that only ever one version of a package is installed, so i can just put the other versions in an extra dir and let pip do its stuff without interfering

#

if someone wants to have different versions of the same package side by side in the same code, they'd go through use(), which will just handle those version-pinned, well defined versions with no guessing

#

so, if someone doesn't care about the exact version and wants to go the classic way, they can do that still with no change of behaviour

tawdry needle
floral smelt
# tawdry needle can you show the dockerfile and docker compose file?
FROM python:3.9.5-slim

ENV PYTHONUNBUFFERED=1

ENV PYTHONDONTWRITEBYTECODE=1

WORKDIR /app

RUN apt-get update &&\
    apt-get install -y binutils libproj-dev gdal-bin

COPY requirements.txt .

RUN pip install -r requirements.txt --no-cache-dir

COPY . .

and docker-compose:

version: '3.8'

services:
  db:
    image: postgis/postgis
    container_name: db-postgis
    env_file:
      - ./db/.env
    networks:
      - backend-network
    ports:
      - 5432:5432
    volumes:
      - db-data:/var/lib/postgresql/data

  backend:
    restart: on-failure
    env_file: ./backend/.env
    build: ./backend
    expose:
      - 8000
    ports:
      - 8000:8000
    volumes:
      - ./backend:/backend
    command:
      - ./startapp.sh
    container_name: django-backend
    depends_on:
      - db
    networks:
      - backend-network
      - frontend-network

  frontend:
    build:
      context: ./frontend
      dockerfile: ./Dockerfile
      args:
        environment: development
        status: stable
    expose:
      - 3000
    ports:
      - 3000:3000
    container_name: react-frontend
    env_file: ./frontend/.env.development
    volumes:
      - ./frontend:/frontend
    networks:
      - frontend-network

networks:
  frontend-network: {}
  backend-network: {}

volumes:
  db-data: {}

#

The Dockerfile is for the Django app

tawdry needle
#

just to be safe, i always use absolute paths on the RHS of COPY

#
COPY . /app
#

and what is in startapp.sh?

#

and one more question: what's the structure of files in .?

floral smelt
# tawdry needle and what is in `startapp.sh`?
#!/bin/bash

# Wait for db
echo "Waiting for db.."
if [ "$DATABASE" = "postgis" ]
then
    echo "Waiting for postgis..."

    while ! nc -z $SQL_HOST $SQL_PORT; do
      sleep 0.1
    done

    echo "Postgis started"
fi

# Runs the server
echo "Running Django server"
python manage.py runserver 0.0.0.0:8000
tawdry needle
#

and you're saying that you can do docker-compose run backend ls /app and you see manage.py there, right?

floral smelt
#
./backend
β”œβ”€β”€β”€api
β”‚   └───migrations
β”œβ”€β”€β”€control
β”‚   └───.mypy_cache
β”‚       └───3.9
β”‚           β”œβ”€β”€β”€collections
β”‚           β”œβ”€β”€β”€control
β”‚           β”œβ”€β”€β”€importlib
β”‚           β”œβ”€β”€β”€os
β”‚           └───_typeshed
└───users
    └───migrations
floral smelt
#

Including manage.py

#

I have a migrate.sh script but I can't trigger it using ./migrate.sh

tawdry needle
#

and backend is the CWD?

#

or . is the CWD and backend is a package?

floral smelt
#
.
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ Dockerfile.prod
β”œβ”€β”€ api
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ admin.py
β”‚   β”œβ”€β”€ apps.py
β”‚   β”œβ”€β”€ fields.py
β”‚   β”œβ”€β”€ filters.py
β”‚   β”œβ”€β”€ migrations
β”‚   β”‚   └── __init__.py
β”‚   β”œβ”€β”€ models.py
β”‚   β”œβ”€β”€ serial_fields.py
β”‚   β”œβ”€β”€ serializers.py
β”‚   β”œβ”€β”€ tests.py
β”‚   β”œβ”€β”€ urls.py
β”‚   └── views.py
β”œβ”€β”€ control
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ asgi.py
β”‚   β”œβ”€β”€ settings.py
β”‚   β”œβ”€β”€ urls.py
β”‚   └── wsgi.py
β”œβ”€β”€ manage.py
β”œβ”€β”€ migrate.sh
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ startapp.prod.sh
β”œβ”€β”€ startapp.sh
└── users
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ admin.py
    β”œβ”€β”€ apps.py
    β”œβ”€β”€ forms.py
    β”œβ”€β”€ managers.py
    β”œβ”€β”€ migrations
    β”‚   └── __init__.py
    β”œβ”€β”€ models.py
    β”œβ”€β”€ tests.py
    β”œβ”€β”€ urls.py
    └── views.py
tawdry needle
#

ok, i see

#

...i have no idea

#

lol, sorry

#

weird

#

you'd expect that to work, try deleting all the containers and images then starting over from scratch πŸ€·β€β™‚οΈ and try using absolute paths with COPY just in case

floral smelt
#

I have no idea if it's because the control folder has a different name from backend

#

Normally it shouldn't be the case

#

I tested them and it works

rapid sparrow
#

ask question, do not ask to ask

urban pecan
#

okay, RFC: let's say, there is ~/justuse-python with a config.ini, registry.json and usage.log and a /packages subfolder, which is used as a default, but can be arbitrarily set in the config. all installed (whether by pip or auto-installed or otherwise) packages are registered in the registry to look up during runtime. if you use() a package with a specified version, it is looked up, and if not available, downloads the zip from pypi, imports it and writes the compiled code to disk, discarding the unzipped, uncompiled sourcecode next opportunity. this should allow classical imports and pip to work in parallel with use() without interferance

#

could there be any problems with this setup?

topaz aspen
#

how would you control the requirement jupyter labextension install jupyterlab-plotly@4.14.3 ?

I can't add this to my requirements.txt file, so I'm not sure where that should be placed.

(ping me if you respond please)

urban pecan
#

which file permissions should i give the registry etc? i guess 777 is out of question, but what should be preferred?

tawdry needle
topaz aspen
tawdry needle
#

conda is one option, but even then jupyterlab itself might be in a different environment from the kernel (although in this case it probably shouldn't be)

#

another is just a build/setup script

urban pecan
#

hey @tawdry needle any ideas on my suggested auto-install system?

#

let's say you use("numpy", version="3.0.1", auto_install=True, hash_value="98f98df.."), it would download the package, install it into ~/justuse-python/packages/numpy-3.0.1.. - out of the way of pip and classical imports with the location with other metadata put into ~/justuse-python/registry.json for quick lookup during runtime

grand gale
#

Soooooo tl;dr of what i wanna do:
I wanna automate some parts of gitflow so when I push to master/a pr is merged i want those things to happen:
get the version from the last commit(s)
ie when the last commit is Merge from "release/v2.3.0" the version is v2.3.0
or when the last one isnt a merge it gets the last merge and then increments based on the feat and fix commits
use that version to create a tag
use that version and the last commits to create a gh release with the changelog generated from the commits
make a sentry release

#

the sentry release is easy i just need some way to provide it that info

#

the rest isnt so much

urban pecan
#

that way, use() will enable fully self-contained code, with no venv or external tools needed for dependency management

#

but it will actually make it easier for external tools to analyse and make updates, for instance an IDE could provide those

#

while not getting in the way of pip or import, if someone prefers those

deep estuary
#

I'd use a python script to determine if the commit matches

#

if it does, output a string, and then you can check that using run conditionals

#

and then you can also use that to output v2.3.0 or whatever

grand gale
#

yeah thought so as well, but i havent found a way yet to set variables during a run

deep estuary
#

uhhhhh

#

so

#

from python, you need to print a string like

#
::set-output name=is_release::true
::set-output name=release_tag::v2.3.0
#

then github will pick those up, and you can use job outputs

#

then inside that job you can use release_tag for sentry / gh release / etc

grand gale
#

yeah the i know the if syntax, the confusing shit is the setting vars

#

anyways tysm

deep estuary
#

i uhhh

#

hm I might have a thing internally somewhere where I use set output from a py script

#

but you can also just set the manifests from python

grand gale
#

@deep estuary so smt like this should work?```yaml
name: Lint Kubernetes manifests

on:
push:
branches:
- master
- ltr/v*

jobs:
getvars:
name: Gets the neccecary vars for the following actions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get the release version and changelog
run: |
version=$(python $(curl the script))
echo "version=$version" >> $GITHUB_ENV
echo "changelog=$(python $(curl the script))" >> $GITHUB_ENV
git tag -a $version
git push --tags

sentry_release:
needs: getvars
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: getsentry/action-release@v1.0.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: sentry_org
SENTRY_PROJECT: project_name
with:
environment: production
version: project_name@${{ env.version }}

gh_release:
needs: getvars
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: ${{ secrets.GITHUB_TOKEN }}
draft: true
tag_name: ${{ env.version }}```

deep estuary
grand gale
grand gale
#
name: Release Versions on Several Platforms

on:
  push:
    branches:
      - master
      - ltr/v*

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v2
      - name: Get the Release Version and Changelog
        run: |
          echo "release_version=test" >> $GITHUB_ENV
          echo "changelog=test" >> $GITHUB_ENV
      - name: Push the Release to Sentry
        uses: getsentry/action-release@v1.0.0
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: sentry_org
          SENTRY_PROJECT: project_name
        with:
          environment: production
          version: project_name@${{ env.release_version }}
      - name: Create a Tag with the Version
        uses: actions/github-script@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}          
          script: |
            await github.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: "refs/tags/${{ env.release_version }}",
              sha: context.sha
            })
      - name: Create a Release Draft
        uses: softprops/action-gh-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          body: ${{ secrets.GITHUB_TOKEN }}
          draft: true
          tag_name: ${{ env.release_version }}```
#

so this should work

#

the env shit is tested and works, the other shit not yet

grand gale
#

fucking yeah that shit works (with some edits lemon_sweat )

tacit flare
#

Hey all - playing around with GitLab, what's the most appropriate way to roll out source code changes to my server? GL CI/CD action that SSH's to my server and pulls the most recent changes from the master/main branch?

warm pollen
#

That's a perfectly valid solution if you don't have any (too) fancy setup with Kubernetes or similar

tacit flare
#

Perfect, thanks @warm pollen

warm pollen
#

No problem!

#

Also don't forget to generate a new individual ssh key that only has access to the required resources, you wouldn't want someone to gain a root access on your server in case of a leak

velvet spire
velvet spire
#

i assume your server is publicily accessible?

tacit flare
#

Good point @velvet spire , it’s not publicly available.

topaz aspen
tawdry needle
alpine pike
#

@deep estuary

topaz aspen
# tawdry needle no reason, depends on your intended usage i guess

Yeah, I don't think I have much intuition for one over the other.

When searching stuff like conda Vs docker a lot of stuff comes up (on threads or whatever) simplifying conda to a requirements alternative, but conda goes further than pip doesn't it?

I guess idk where the limit of conda is, and whether docker "takes over" at that point. I'm also not sure if one should prefer conda over docker if it's possible to use it, or whether it's more subjective

west seal
#

Hi guys how are you doin??I don't know if it's the right channel but am having some problem installing mysqlclient==1.3.10 via pip3 on ubuntu 20.04 (with python3.4.3),any ideas ?Thanks

gritty inlet
#

I would like to know how could I automate the video uploading process of a local video on my pc, to Youtube channel specific playlist (based on the name of the video file being uploaded).
Example: videoSam.mp4 goes to Youtube playlist "Sam", while videoFrodo.mp4 goes to Youtube Playlist "Frodo".
Is that possible?

grand gale
#

@deep estuary if you by any chance are interested in automatic release action heres the one i use atm:```yaml
name: Release Versions on Several Platforms

on:
push:
branches:
- master

jobs:
getversion:
name: Get Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

  - name: Git Version
    id: version
    uses: codacy/git-version@2.2.0
    with:
      prefix: v
      dev-branch: develop

sentry:
name: Create Sentry Release
needs: getversion
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Push the Release to Sentry
uses: getsentry/action-release@v1.0.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: org-name
SENTRY_PROJECT: project-name
with:
environment: production
version: project-name@${{ needs.getversion.outputs.version }}

settag:
name: Create Git Tag from Version
needs: getversion
runs-on: ubuntu-latest
steps:
- name: Create the Tag
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ needs.getversion.outputs.version }}",
sha: context.sha
})

releasedraft:
name: Create a Github Release Draft with the Changelog
needs:
- getversion
- settag
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Build Changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Draft
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: ${{ steps.changelog.outputs.changelog }}
draft: true
tag_name: ${{ needs.getversion.outputs.version }}```

deep estuary
#

the one CI/CD flow where I could use this uses Jenkins egg_cry

grand gale
#

rip

pastel meadow
#

can someone - define for me - tools and devops

#

sorry in drunk

#

mmmmmmm - how about a custom interface to talk to chips on a breadboard via python

grand gale
#

@deep estuary help, im getting way too much into ci/cd

deep estuary
#

lol

tawdry needle
noble path
#

should i use IoT platforms or just access a website's api itself?

urban pecan
#

if a user wants to auto-install something via justuse and they try use("stuff", auto_install=True), it should raise an exception and give proper advice, but also info on the package they are attempting to install in order to avoid malicious packages. what is important info a user should get at this point to decide on whether or not they are trying to install a malicious package?

#

i'm thinking number of downloads, what else?