#tools-and-devops
1 messages · Page 62 of 1
Might have even been reported already 🤷
Where would poetry otherwise install deps if I tell it to not use a venv?
To the global site, I guess.
Unless requirements file won’t work, I’d just pip install requirements file and call it a day.
can conda install more than pip or is it possible to represent everything conda installs in pip requirements file
Yes it can install more than pip. It's a totally separate repository. Not everything on a conda channel will be in PyPI too. While pip can install from custom package indexes, I believe conda repos and packages are a completely incompatible format anyway.
Also conda has package support for other languages (like R) bedside Python
Hi,I dont know why but github made 2 identical commits. How can I delete one of them?
You can use git rebase -i to remove choosen commit however if it's already pushed you must use git push --force and it's dangerous
How exactly? IIRC it will squash all the 5 commits into one, however I want to remove the last commit visible in that screenshot
When you type git rebase -i HEAD~5 you will see last 5 commits for example, every line starts with pick. Rename it to remove in those lines with commits that you want to remove, save file and it's done.
Here you have more informations https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History
Ohh got it. Thanks
However you should create new branch or new tag because it can damage your git history
Like git branch before-rebase
hey guys! Does anyone use GitHub Actions for automation?
I used some GitHub Actions to run tests
I am working on a CLI tool that helps you to clone, update and share your GitHub Actions workflows across all of your projects, or just with the community. Do you have a project with your GH Actions, or probably you know a project with good GH Actions?
I already have a pack of workflows for Python libraries and apps, but there is a lot to improve
Oh unfortunately no, I have Actions for projects with different languages than Python 😦
I also have a pack for TypeScript/JavaScript Node.js apps
well, other languages would be awesome as well!
Check this repository https://github.com/ets-labs/python-dependency-injector - it seems to be highly maintained
@night quest thank you! I support poetry and pipenv, but not tox, so definitely going to add it
Excellent!
@night quest what languages do test with GHActions ?
It's Rust mainly
However I think that my actions are not very well 😂
@night quest never tried it TBH. how do you think, would it be easy to create a universal on_push action for Rust projects? I am not familiar if there are common ways to run unit/int tests and code coverage
Here you have actions for Rust https://actions-rs.github.io/
I created my own but it looks better than mine
I don't know how to deal with coverage however tests can be executed by cargo test command
this looks great! thank you a lot. I will research how people use it and try to organize it in a workflow
@night quest thank you again for Rust workflows. I added a link to this repo in order to clone workflows. As I see they use multiple jobs, just added support for it
Glad to help!
Can someone help in python begginer Journey i am lost
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
How about it?
I'm trying to install extra packages in snekbox https://github.com/python-discord/snekbox which I'm running as a dependency through docker. Where should I run
docker exec snekbox /bin/sh -c 'PYTHONUSERBASE=/snekbox/user_base pip install numpy' as it says in the README?
better alternatives to kafka?
in you hosting system? it execute a program in your container with bash
Thanks
I wrote a python program that works well enough, but I haven't figured out how to deploy updates automatically when I commit changes to the github repo. Most of the CI/CD tutorials I have found focus on websites on servers reachable over the Internet. My script runs in a VM in a private network and I'd like to know what the industry standard (or best practice) is for this type of environment before I start trying to reinvent the wheel.
the said VM, can it access github?
you could set a cron so that it pulls the repo every one minute
another question is do you need to restart the service to apply the changes? then I would add another line to restart the service after pulling the repo
Thanks @mossy dock, that's surprisingly simple and should work.
It does, but it requires human interaction so it's not a big deal
I need to change the configuration file inside a docker image. The docs say "a Docker volume or bind mounts can be used to override the configuration files at their default locations." How do we do that?
it means you can use a file from your host system to override the same file inside docker
How do I do that without rebuilding the image? I'm using docker-compose to pull the image from GitHub Container Registry.
Use volumes option in Docker Compose file: https://docs.docker.com/compose/compose-file/compose-file-v3/#volumes
Like
services:
service:
volumes:
- ./host/file:/inside/container/file
Thanks it worked ^_^
shot in the dark, has any one had any experience with terraformed azure functions not creating function keys
For shell scripts I use #!/usr/bin/python but is there any way to change that to use current python in path
Yes, #!/usr/bin/env python
Or python3 
This works for any binary, not just python
Yeah they had python so that's what I went with
But python3 is probably more cross compatible
Right, I have problems with raw python without 3 on RPi 🙂
I don't think most distros have symlinked python3 to python
Thanks!
My app will have a dynamically changed config that will affect the way its containerized services work. What would be the best way to keep the config up to date for all services?
I thought about keeping it in Redis or using some message broker, but I haven't really used them before
Does your container runtime support something like that?
im sure e.g. kubernetes has some way to update env vars across the cluster, i wouldn't know how though
I'm planning to use minikube, yes. But those configs are gonna be too big to fit in env vars
You can store config in YAML format
I know nothing about k8s
I am using my custom loader to load config file and properly change application's state
Let me be more clear, it will be a discord bot with heavy customization written with microservice approach for the sake of learning and comparing different frameworks. So I have a basic interface bot service already, now I need to handle the bot settings with another service. For long-term storage I'll use mongo, but I'll have to make the settings service somehow distribute those settings among other services which I'll add next
I think that I cannot help in this case 😦
Store it in a database
Whatever you want
obviously the database connection can't be stored in there but everything else can be
Hello everyone. Curious to hear how folks starting to move their scripts into a CI/CD pipeline and what tools they used
You can start with something like GitHub Actions 
I have quite a few automation scripts for monitoring, alerting, etc managed through repos but getting them deployed is becoming a hassle as they all run through cron
well deployed and updated
Oh, okay
I've had a few folks mention Jenkins but it seems like it may be a bit overkill
I have Jenkins instance in my workplace and it's very nice
Makes checks on every commit
Automatically build packages on stable releases
However I don't know anything about deployment methods
so you're using say pylint to validate syntax, best practice, etc. before deployment
Ofc, I cannot merge feature branch if Jenkins say that pylint returns wrong result
Pylint, pytest and so on
I think that's likely the route I may take, just curious as a lot of the Jenkins examples show more for appstack deployments
and not just self contained scripts
For personal usage I prefer GitHub Actions
It's simpler method builtin inside GitHub
I have Gitlab at home for local but looking for more for enterprise
Thank you for the suggestions though!!
Does anyone know how come I cannot delete my docker images as root?
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json?all=1: dial unix /var/run/docker.sock: connect: permission denied```
Happens when I try to reactive etc. as well
You also apparently need sudo for docker ps
you can add docker to your user group so you don't have to sudo every time
sudo isn't a magic prefix in your shell, it's just a command that runs another command. Your shell tries to expand the stuff inside $() first, before it executes the sudo
That said, a shell that natively supports something like sudo but for the entire command line would be super useful
I don't know of any shell that does, including the "weird" ones like fish
i worked in jupyterlab and wanted some extensions, so i wrote !pip install jupyter_contrib_nbextensions !jupyter contrib nbextension install --user !jupyter nbextension enable collapsible_headings/main But executing markdown cells with headings were still not collapsibel?
I think this channel make the most since.
I'm trying to use antlr4 to generate python code that I will use in my package.
How do I make a setup.cfg/setup.py for this?
setup.cfg
[metadata]
name = CarbonLang
version = 0.0.1
author = Johnathan Dunker, Reuben French
author_email = jadunker@protonmail.com
description = C++-like programming language compilier
long_description = file: README.md
long_description_content_type = text/markdown
[options]
packages_dir =
= src
packages = find:
cmdclass =
install = InstallCommand
[options.packages.find]
where = src
from setuptools.command import build_py, install
class InstallCommand(install.install):
def run(self):
print("antlr4 lexer call")
subprocess.check_call(["antlr4", "-visitor", "-Xexact-output-dir", "-package", "carbon", "-Dlanguage=Python3", "-o", "src/carbon/core", "antlr/carbonLexer.g4"])
print("antlr4 parser call")
subprocess.check_call(["antlr4", "-visitor", "-Xexact-output-dir", "-package", "carbon", "-Dlanguage=Python3", "-lib", "src/carbon/core", "-o", "src/carbon/core", "antlr/carbonParser.g4"])
super().run()
pyproject.toml
[build-system]
requires = [
"setuptools",
"antlr4-python3-runtime"
]
build-backend = "setuptools.build_meta"
I'm getting an InstallationError from pip
hello, was anybody trying to mount subpackage in docker ? it's for dev environemnt and I'm trying to solve it whole day. Running docker-compose for dev env and I need to include subpackage data to my project
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- ../some-package/mypackage:/srv/django_project/mypackage
- .:/srv/django_project
ports:
- "8000:8000```
I am not sure that making volumes inside volumes is allowed 
I did it in vagrant with symlink 🙂 but in docker it's really hard.. and if it's working, then pycharm is not following it
How about mounting - ../some-package:/srv/some-package - then you can make symlink mypackage -> ../some-package/mypackage
Does Jenkins support use of make files to run scripts? Or does it need any plugin?
Also, is there a way to know if a service has finished execution so that I can call compose down?
if the docker entrypoint or cmd exits, the container shuts down by itself
docker-compose should be smart enough to recognize it as having exited cleanly
@tawdry needle thanks. the service is a worker node so how can I shut down the manager automatically once all worker nodes have finished their process?
i want to try if a dockerfile is about to work properly, is it possible testing not locally with mybinder or sth else?
is there an API available which can give me access to audio files of all songs ?,trying to build a web music player
Doubtful; music isn't free.
Build image from Dockerfile and then run as a container, I don't understand what do you mean by
is it possible testing not locally with mybinder or sth else?
i wonder if it is possible to do it without having locally docker installed
so just upload a dockerfile and mybinder would build it
You need to have Docker somewhere
You can always install Docker on remote machine and call it via SSH
ok so eg i could launch mybinder jupyterlab and go to the terminal where i install docker, or which remote machine do you have in mind
I don't know how mybinder works 
Never used it
me too:D but thanks for the explanation, actually i have meanwhile installed now docker:D
does pycharm has discord rich presence?
Hi everyone. When you develop in your Django projects, how and when do you setup your database during development?
wdyt about https://github.com/pycontribs/mk ? Do you find it useful?
Maybe? I'm going to have to read project documentation anyway because there's more to contributing than just learning how to run tools, so I'm going to learn how to do this stuff in a project-specific way most of the time.
Sometimes it's not documented but with enough experience it's not hard to infer how to do it.
Might be handy if contributing to a large volume of different projects, but that's not me so I can't comment on that.
Hi, I'm trying to run a container with a volume with relative path but it keeps telling me to use absolute path. is there a way to use relative paths as volume?
dont't know if that helps but you can define WORKDIR, if not already done
Show your Compose file or command that you are trying to run
i also have a quest to docker: i did a dockerfile, build and run it, i gave 80 as port, but opening the browser it didn't show up, instead the tutorial of docker appears, any tip?
i did not have an error and it is claimed to run, but i have no access
a) existing docker tutorial container might be running, which is why it's occupying the port 80
b) your new docker container, when you run it did you map it to host port?
I would recommend you to use Dockerfile in addition to docker-compose
How do you run this container?
hi thx, a) i have deleted this so i really wonder b) i run docker run -dp 80:80 imagename
dockefile snippet please
How about docker run -p 80:80 imagename? Do you have any output?
prob the service exposes to another port
[FATAL tini (7)] exec . failed: Permission denied
i have deleted everything via docker desktop
Your Dockerfile seems to be very helpful
i have push it dockerhub https://hub.docker.com/repository/docker/takla/jupyterlab3/
it is public
but ist actually quite short ```FROM registry.git.rwth-aachen.de/jupyter/profiles/rwth-minimal-2021-ss:latest
run this before copying requirements for cache efficiency
RUN pip install --upgrade pip
COPY requirements.txt /tmp/requirements.txt
RUN python3 -m pip install -r /tmp/requirements.txt```
it runs and builds fine but is not accessable for me
this is the entire Dockerfile?
it doesn't listen to connection after the last command. so it promptly exits
yes, i have a requirements.txt next to it and thats all
if it's a jupyter notebook, you'll have to add CMD jupyter notebook something at the end of it
and jupyter notebook exposes to port 8888 by default, so you'll have to use 80:8888 port mapping
ok same 8888 port. but you'll have to add either CMD or ENTRYPOINT for the server to be running and listening for connections
ok so CMD jupyterlab
hmmm I recall there's a few extra steps
you'll have to use this jupyter lab --ip=0.0.0.0 --allow-root
the whole thing you're doing is under devops and deployment thing, a different skillset than python programming in general
so if you want to learn Docker, try to familiarize yourself with Unix and bash shell first
ok, so i have added CMD jupyter lab --ip=0.0.0.0 --allow-root in dockerfile and executued the run with port 80:8888 and without -d, but i get the same error [FATAL tini (7)] exec . failed: Permission denied.
yes its just we need to do a profile at the beginnig, actually i work on python stuff
so i need to replace pip install with sudo pip install
oh wait I think both work
ok so i dont replace anything
@night quest docker run --network test -v ./tmp:./junit.xml --env-file file image-name pytest
just wanna thank you all before it will get lost, i may ask that in dev tho, but i got further now, so thanks:)
Second path must be absolute as far as I remember 
I am talking about -v ./tmp:./junit.xml part
@night quest making the destination path absolute helped with the run but weirdly the file wasn't saved in the source
What do you want to do?
Save file from container inside host directory?
@night quest Yes
right now we're using docker cp. but i thought using volumes would be an elegant solution.
How can I get PyCharm Professional to both use the TODO ligature and highlight it? I'm using PragmataPro
Right now my TODO looks like this
and I want this instead, with the yellow highlighting and everything
Font will be provided at request, only the PragmataPro Mono Liga Regular because it's a paid font and uploading the whole set would be piracy
Then you must use directory where the file is created, not the file itself
$ docker run -v ./files:/path/to/directory image
Where your file appears in /path/to/directory
@night quest that worked thanks
Nice
Does anyone know how to get the commit from a released version of a pypi module? If I have a package thats on version x.y.z, can I get the last commit associated with that release from pypi?
If I understand correctly you cannot get commits directly from PyPi, but you need to check it on portal like GitLab, GitHub, BitBucket etc. 
Well, I would check if tags exist on the package, but the package is mine and I don’t have any tags on it, it’s why I was trying to find the associated commit so I could add tags 😂. I just did the same thing with my open source rust library, but I was able to get the commit hash from crates.io in that case.. too bad it’s not possible here
pypi doesn't know anything about whatever your vcs setup is
does rust require using git or something?
hello, I was directed here for my question about git
I created a new folder and did a git init, but not sure how to connect to my github account.. not able to do a git push
when I tried to git push my terminal said
$ git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url>
and then push using the remote name
git push <name>
so I did that, and the command executed successfully, but git push still does not work.. still getting the same error.. thoughts?
yep, I did that. I can confirm that too because when I run the same command again, it says: fatal: remote $REMOTE already exists.
actually.. I did git remote add $REMOTE $URL
where $REMOTE = name of my repo
and $URL = https://github.com/$MY_USERNAME
not sure why I've never ran into this issue before, not really sure what to think
Remote is not name of your repo
It'll be sth like git@username:repo name or sth
If you just github, there should be an instructions on how to add remote on a fresh repo
oh, well that makes sense..
thank you
yeah I tried finding that github page but was unsuccessful. Will try again. thank you.
@tepid nymph so here's with a git remote looks like:
$ git remote -vv
origin git@github.com:${USERNAME}/${REPO_NAME}.git (fetch)
origin git@github.com:${USERNAME}/${REPO_NAME}.git (push)
${} being a placeholder
interesting.. not what I was expecting.. need to go back and finally read the git basics I've been putting off.. thank you!
after you made a repo on git it tells you exactly what commands to run to get your project started or if you already skipped that part smh u can see here the command again
oh, that page comes up when you create a new repo on github, thanks. I was wondering where I saw it..
I usually either do it from github itself or vscode, wanted to try to do it via cli this time..
thanks @heavy knot
my mistake was forgetting to append the repo name after $URL
np i dont remember it either and i think u have to make a new repo on the website github bc else it says the repo doesnt exist in the cli
but just try it out i guess mby it works for you and i just did it wrong in the past
kk, gonna try now. let's see.
lol - this is so weird. Idk if it's just late and I should call it a night or what..
Me@Computer ~/OneDrive/Documents/code/DevelopedByEd (master)
$ git remote add origin https://github.com/amusabji/DevelopedByEd.git
Me@Computer ~/OneDrive/Documents/code/DevelopedByEd (master)
$ git status
On branch master
nothing to commit, working tree clean
Me@Computer ~/OneDrive/Documents/code/DevelopedByEd (master)
$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
Me@Computer ~/OneDrive/Documents/code/DevelopedByEd (master)
$ git push --set-upstream origin master
remote: Repository not found.
fatal: repository 'https://github.com/amusabji/DevelopedByEd.git/' not found
Me@Computer ~/OneDrive/Documents/code/DevelopedByEd (master)
$ git remote -v
origin https://github.com/amusabji/DevelopedByEd.git (fetch)
origin https://github.com/amusabji/DevelopedByEd.git (push)
maybe I am using the arguments here incorrectly?
$ git push --set-upstream origin master
maybe I need to replace origin or master by DevelopedByEd ? idk..
oh this is normal. you need to tell your local branch where to push it
bc for a single repo you can have multiple remotes
in this case, just type git push --set-upstream origin master
do it the first time only
if you type git branch -vv it should now tell where the remote is pointed to
currently git branch -vv wouldn't point to any remote as of yet
you don't notice this in GUI tools bc they do this in the background
Yeah just type
git push -U origin master
or what @mossy dock said
It does the same but -U is simpler and faster to write and is just the flag
the switch is lowercase
and I did that, I included it in my code snippet, but I am getting the error
thanks for the tip @heavy knot - did not know about this shortcut, pretty neat
Np and what error are you getting?
saying the repository is not found.
$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/amusabji/DevelopedByEd.git/' not found
I think what you mentioned early holds true
Yeah bc u didnt create it on the website likr github wants you too
as much as I hate to believe it
yeah 😦
I couldve sworn I did it in the past..
idk
I created a .sh file were i did tricked github. Let me open that quckly and i tell you how
hmm, interesting
I did an .sh file and made a function which i just call with the repo name and thats the code:
function create(){
cd
python create.py "$1"
cd Desktop
mv c:/Users/chorn/Desktop/"$1" c:/Users/chorn/Desktop/Github/
cd Github/"$1"
git init
touch README.md
git add .
git commit -m "'$1'"
hub create "$1"
git push origin master
code .
}
And heres the website where i found it
https://hub.github.com/hub-create.1.html
oh thats neat. thanks for the share
np if you want i can send you the code for the pyton script and then you can just use that one command and the parameter to create your git repo
cool and thx for the post of it
there's another script? yeah sure, please send it.
i made a main.py and a command.sh
# main.py
import sys
import os
dirName = "/Path_to_dest_folder/"
try:
# Create target Directory
os.mkdir(dirName+str(sys.argv[1]))
print("Directory " , dirName , " Created ")
except FileExistsError:
print("Directory " , dirName , " already exists")
# command.sh
function create(){
cd
python create.py "$1"
cd Desktop
mv c:/Users/chorn/Desktop/"$1" c:/Users/chorn/Desktop/Github/
cd Github/"$1"
git init
touch README.md
git add .
git commit -m "'$1'"
hub create "$1"
git push origin master
code .
}
what does hub create do?
set upstream?
I have an aws lambda and python question. Is this the right channel for it?
I'm working with openpyxl in aws lambda, and I'm trying to format a column so it would show long ints as integer instead of string.
offline it works and converts the column to integer, but when I run it through aws lambda, it doesnt turn the column into a int.
This is how I turn each cell into integer:
ws is an openpyxl Wokrbook
ws["B" + current_row].number_format = "#"
There are two ways to know the flow of the program. One is to log things into console using logging module and other using pdb. Which one do you guys prefer?
It depends on how much detail is needed
I'd prefer to have both available
Logging for a broader overview (even with trace logging it can be considered relatively broad)
I have a Dockerfile like this:
FROM python:3.9
WORKDIR /app
RUN apt-get update && apt-get upgrade -y
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-p...
do I need to use pylint if i am already using black ?
and how to use pylint and black together ?
Pylint is a linter, black is a formatter. They're not substitutes of each other.
black has a --check flag, that can check the code.
black also offers a github action, named lint.https://github.com/psf/black#github-actions
if i use both black and pylint, will there be conflict ? and how to resolve them ?
hey can anyone help me how to host my bot coded in discord.py on azure?
ive been scouring for a way to render rsts in a convenient/pretty way in Django, preferably with Sphinx for its table of contents/navigation/layout, has no one ever thought to do this or am i overcomplicating it? the most relevant package i seem to have found, django-sphinxdoc, has an outdated dependency and arduous setup of elasticsearch etc
Is there a general consensus on which Github API wrapper Python library is better of the two very active ones, PyGithub and github3.py?
I've been using PyGithub and it's a pain that the classes aren't hashable, which isn't a huge issue but I figured I'd check if anyone has any opinions on the two.
s3keyring does not work for me. It always show "s3keyring: command not found"
Have anyone used this PyPi module?
I'm currently running this command in Ubuntu 20.04 LTS and Python 3.8.5
@indigo igloo Is ~/.local/bin in your path?
Do file ~/.local/bin/s3keyring
hey is anyone here using education host?
i need some help
Does anyone have a suggestion on how to port output to VIM while the program is still running?
I build a file and want the user to have the option to edit anything live before continuing.
Not sure if there's a module or another type of wrapper
is there a way to sort that?
raise Exception(f'FileError. Unsupported type {file[-3] + file[-2] + file[-1]}')
@full ledge can u help
uhhh i know nothing about this lol
xD
def connect(file):
if not file.endswith('.txt'):
raise Exception(f'FileError. Unsupported type {file[-3] + file[-2] + file[-1]}')
elif file.endswith('.txt'):
with open(f'{file}') as f:
connect('hi.py')
like if i have this
it will say
Exception: FileError. Unsupported type .py
how do i sort the {file[-3] + file[-2] + file[-1]}
Sort?
If you want to write it in shorter form then use file[-3::]
okay thanks
However you should use file.rindex(".") to get valid extension name (for example .py has length 2 and .txt has length 3)
yeah
coughs in pathlib
can someone give me some help with this script ```
from plyer import notification
import time
import psutil
name = "Device User"
webAlert = "Beware of online browsing, unsecure websites may possess malicious content!"
emailAlert = "Beware of Phishing attacks. Do not open emails and do not click on links from unknown senders!"
def alertUser(title, message):
notification.notify(
title = title,
message = message,
app_icon = "C:\Users\Claud\Desktop\faculty.ico",
timeout = 10,
)
def recognisedProcessEmail():
for process in psutil.process_iter():
if process.name() == "Outlook.exe":
alertUser(name, emailAlert)
def recognisedProcessWeb():
for process in psutil.process_iter():
if process.name() == "chrome.exe":
alertUser(name, webAlert)
recognisedProcessEmail()
if name == 'main':
while True:
recognisedProcessWeb()
time.sleep(60)
i get an alert for having the web browser open but then loads of errors on console and nothing. im trying to get the script to run in a loop and detect when a browser or email application is open. detecting this through the process name.
I have weird question about CMD and ENTRYPOINTT directives in a Dockerfile.
at the moment I only have a CMD ["php-fpm", "-F"] directive. at this point I just want to add an entrypoint without changing the CMD directive to get the same functionality.
[docker-entrypoint.sh}
#!/bin/sh
exec "$@"
----
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["php-fpm", "-F"]
does this do what I want?
Ok, I think I just accidentally made my %USERNAME% folder a git repository
Any way I can remove this repo without deleting all my files?
rm -rf ./.git
It should probably be ENTRYPOINT ["/bin/sh", "/docker-entrypoint.sh"] but I don't understand what the point of that shell script is
Why do you want to do this?
at this point I just want to add an entrypoint without changing the CMD. once I've done that 'correctly' I want to extend the entrypoint script
gount to bed now :)
gn
How do i replace values from all the queries(table) at once in powerBI desktop?
tnx, that's what I needed. I need a proper base, now I'm off to extend my script :)
hello, can you please suggest a good tutorial about how to make a python bot for instagram?
Do you know how to work with git?
Not really but I've seen some files and stuff from other peoples repo's
I just don't know how to create them
I created something but I think I messed up bad and now I'm not even able to delete it
Git is a version control system. It's usually used from the command line, but there are GUIs, and it's often integrated with IDEs. GitHub is a website not affiliated with the creators of Git; it allows you to host your Git repos online.
hmm
basically like a source for your code
how do I create a git
or gist
whats it called
git init creates a new repo in whichever directory it's called in
wait what
There are many git tutorials online, just look around - it's not tied to GitHub. The most basic stuff is git add . to add files and git commit to create a "commit", which is a "snapshot" of what your repo looked like at that time.
okay
okay github is too complex i quit
Hm, my profile doesn't look like that. I don't think I've seen that format before but it's probably yet another feature GitHub added recently
Git is used by pretty much every modern developer, and GitHub is the #1 website to host your repos. It's a good idea to learn it.
But first learn Git, then worry about GitHub
.
Any good IDEs for Python you recommend?
So far I've tried VS code and Atom, but don't love them
PyCharm is only other one that most people use
Thanks!
spyder is fine too
Has anyone used poetry?
looking at swtiching my project from venvs to something
poetry looks nice
I use pyenv + pipenv
How can I build my docker image using files from other directories inside this tree? My Dockerfile is inside the docker_dev directory but I need to use files from the root and from config_db and from database_info.
I get this error while building the image error checking context: 'can't stat '/home/diogo/koerber_digital/koerber_pipeline_watchdog/docker_dev/tmp''.. tmp is a volume I mounted in docker-compose
The build context can be specified as an argument to the docker build command
You can cd to the root and then run docker build --file ./docker_dev/Dockerfile . too (notice . is the build context here)
Docker Compose has something similar for specifying the compose file docker-compose --file docker_dev/docker-compose.yml build if you run it in the root
I don't know what's wrong with the tmp directory. You'd have to show how you mounted it I suppose.
From what I've read, it had something to do with directory ownership of tmp, once I did sudo chown -R <username> docker_dev it worked
Now I've solved it by moving Dockerfile to the root, but I'm gonna try it out once again, with these commands and test it out
king = False
kingo = True
if king:
print("hi king")
if kingo:
print("hi kingo")
elif king and not(kingo):
print("u r noob")
elif kingo and not(king):
print("Pog")
now the proplem is how do i make it print pog with changing the True or False
it sounds basic but something is wierd
https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action
perhaps this could be of help
This guide shows you the minimal steps required to build a Docker container action.
initially i also thought that is it.
but no! thats the tutorial for building a new actions
i am trying to make an workflow
hmm
good thing, is that, docker is pre installed in gh ubuntu environment
actually... why not repeating all necessary steps into workflow
that make docker build
all we need...
name: Docker build and test
on:
workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t samplepy .
the docker command directly works
installing docker inside the workflow
and building our container
literally two lines to add in theory
Hello, i want to use the same mongo db for many projects, im running monogo in a container, is it a good practice to do so ??( i want to do that so i can avoid data redundancy)
I have DB container per project 
and they point all to the same volume !!??
Nope, I mean that I keep data in different containers and different volumes/databases
oh oki cause in my case i have different projects that use the same raw data and im not sure what to do ?
Hmm... Have you seen Docker Compose to store configuration for multiple services in single file?
yep thats what i tend to do the only thing that im not sure if that is a good practice tho
If you have several services connected to the same database using Compose file it looks okay for me 
See celery
with git add -p filename we can select what we stage
how to stage one specific line from hunk?
I found a simple guide how to deploy django into kubernet
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: django
labels:
app: django
spec:
replicas: 2
selector:
matchLabels:
pod: django-container
template:
metadata:
labels:
pod: django-container
spec:
containers:
- name: django-web
image: localhost:32000/apapacy/tut-django:1.0.0
ports:
- containerPort: 8000
to have two replicas behind.. service with next conf
kind: Service
apiVersion: v1
metadata:
name: django-service
spec:
selector:
pod: django-container
ports:
- protocol: TCP
port: 8000
# targetPort: 8001
type: ClusterIP
# type: NodePort```
my question, what is exactly it bringing to make it better
does it make randomization, to which pod to send users?
what's exactly point to make replicas?
or actually this scheme only allows quickly to launch same docker containers at few different ports
but to randomize which one to use, should be done by something else, which is not done yet
the advantage of replicas is that you can run the same application on multiple nodes at once, meaning you don't need a single machine capable of handling all the traffic your website gets
you generally have a load balancer or an ingress which directs the traffic smartly across the pods
ah, that's what for
so... kubernet can be used, to replicate my docker container to multiple machines
with minimum efforts?
yeah
that's EXACTLY what I need
(without distributed traffic though)
actually
I need those docker containers running with different environment variables
can be each node with different environment variables, right?
maybe, I don't know enough about kubernetes to answer that
omg, found really good tutorial how to put my django into kubernetes
with parts how to add into kubernetes, postgresql as pod
then redis and celery
then... no idea what it is
then monitoring and logging as addition
aww, it looks like more for one evening to handle
if only I could help myself
what's up
u know how to create nuke tool ya self bto
Yes, it worked. Thanks!
No problem!
if I'm looknig to deploy, is it useful to learn nginx or should I just hop straight into learning AWS?
I began experiencing issues with pycharm's Find in Files dialog since the last update I believe, any idea what it could be? For example I can find occurrences normally through the in file search but a project/directory wide search missed it
is there a way to add a repo as a subtree but only a shallow clone of it? e.g. --depth=1
cant find anything about this in the git subtree docs
Hello! I hope I'm asking this in the appropriate channel!
I have already checked online and I guess it may have been asked many times here but for a super basic program, what do you recomend(pros cons of each), pyinstaller or py2exe to convert the program into an exe?
I have gone for PyInstaller at the end!
hi
Hello, can someone help me with a small script?
Please DM me (if possible in german)
Thanks
I'm having trouble with figuring out a deploy system with my Discord bot.
My concept is that the finished product is a modular "framework" for making your own customisable bot
You download and run a program, and it generates a couple config files and stuff.
You set up the config with your required settings, and you move a few "extension" files into a directory to add functionality to the bot.
Then, once it's done, you can run it again and it'll start the Discord bot.
However, I feel like I may have bitten off more than I can chew here - this is my first "proper" open-source project, and I'm encountering lots of issues.
The biggest issue is I have no idea how to do build/execution/deployment - I'm clueless with everything starting from version tags and good usage of Git(Hub) and ending with Docker containers, compilation, and cross-platform support.
Does anyone have any advice? Thanks in advance.
(Code is on https://github.com/ThatOtherAndrew/ThatOtherBot - I don't mind criticism, all help appreciated!)
||(Please do @mention me if you have anything to say!)||
Probably write a script to load everything into docker container would be my recommendation
Like they run your app, get the config files then it loads everything into container
Ok, so Docker's the way to go, thank you.
!ban 615243826579243064 Came in to just spam crash videos
:incoming_envelope: :ok_hand: applied ban to @broken dust permanently.
It's not always the best way to go but it's generally easiest/simple way to go
and almost anyone can run it, Docker Desktop is now available for Windows 10 Home because WSL so just about everyone can run containers
Wait, if someone wants to run the container, they have to do it through Docker Desktop? That sounds like a real pain...
No, they can run it on Linux or Kubernetes if they want.
it's pretty hard to hand Python Code to others and be like run this. They may not have right version, they may not understand pip
Is there a way to cut down on repetition in an action like the below? One where you still want parallel/independent jobs to run.
name: main
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
pylint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-python@v2.2.2
with:
python-version: 3.9
- run: |
pip install -U pip setuptools wheel
pip install . pylint~=2.7
- run: pylint --rcfile ./.config/lint.ini ./src/wikiman/
flake8:
# ... REPETITION OF THE SETUP IN EVERY JOB ... #
pip install . flake8~=3.9 flake8-bugbear~=21.4 pep8-naming~=0.11
- run: flake8 --config .config/lint.ini
# ... OTHER LINTERS WITH A LOT OF REPETITION HERE ... #
pytest-cov:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-python@v2.2.2
with:
python-version: 3.9
- run: |
pip install -U pip setuptools wheel
pip install . pytest~=6.2 pytest-cov~=2.11
- run: pytest --cov
- uses: codecov/codecov-action@v1.4.1
You could use Conda to do that.
https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-python.html
Ok, thank you.
@soft axle I'm not practiced in Conda, myself, though. So you may need to look into more sources to confirm my advice.
But the idea is that you have Conda running on a certain version of Python, as its "engine", and yet Conda can supply/bundle different versions of Python as needed in an "environment", distinct from the "engine". This is all very hand-wavey, I understand.
It's not clear to me what exactly is being repeated. If it's the installation of packages, then you can put that into a shell script and just run the shell script instead. You'd still need a step in each job to do that.
Unfortunately, GH Actions doesn't have anything more powerful to reduce redundancy (like Azure Pipelines does with templates).
Maybe you can use a matrix, but it's quite limited.
Thanks for the advice @tawny temple. I figured there wasn't a magical solution, based on my Googling. I may just do shell scripts to reduce redundancy.
I have a minor concern that a shell script could be modified in a malicious pull request, which might be less obvious at a glance than a pull request that modifies a GitHub Workflow. But I guess that anytime you have GitHub Actions at all, you must be diligent with your environment secrets, and vigilant of malicious pull requests.
I see that Sebastiaan has implemented very sophisticated GitHub Actions on Sir Lancebot, I may try to learn from them. The caching and artifact generation for line highlights is particularly interesting!
https://github.com/python-discord/sir-lancebot/blob/main/.github/workflows/lint.yaml
There's pull_request_target but it also has some issues https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
Actually that isn't relevant, since by default pull_request restricts access
I thought pull_request_target had something to do with running the jobs in a different context but I think it only applies to the GH token
I went down the rabbit hole after the Codecov "breach" this week.
The company had a publicly hosted bash script being called by all of their CI/CD workflows. Someone got ahold of a credential and inserted an innocuous curl command into that script. It took a diligent dev (outside the company) checking the hash to find the vulnerability two months later!
Anyone who used the Codecov GitHub Action from January through March had their workflow environment exported to the malicious domain.
These "supply chain" attacks fascinate me. I doubt that anyone will target a random hobby repo of mine, but I'm trying to establish best practices in my GitHub Actions.
Maybe if I point my workflows at bash scripts, I will verify the SHA256 checksum of the script before running it.
https://www.reddit.com/r/programming/comments/mrgnub/codecovs_bash_uploader_for_coverage_reports
hello, im new in python, and i want to compile a py script in exe with py installer, in my program, i have a lot of lib, and recently the size of the .exe was increased by 30 mo. I think i add a big lib, but i don't know which one it is. There is a tools to check the size of imports of a python program ?
@forest frigate There may be a library that helps you do it, but you could just check your site-packages directory in your Python environment with a disk size analyzer like ncdu.
okay thank you
ok i checked, but i think the problem isn't the library itself, but the import of the library
hey guys does anyone knows how cipher = AES.new(key, AES.MODE_EAX)
cruipdome
cryptodome
How what? How to use it?
It's rather topic for #cybersecurity channel
hey guys, I installed docker desktop to learn and use but ever since, my python environments have been messed up. Do you know why?
I try to run simple Python script and it says it cannot fnd the file in directory
ok nvm gotit
having issues connecting to my managed db on digital ocean
all the params are correct
it was working fine last week, i didnt change anything i believe
cant run my program locally because i get an internal server error
I noticed that some tools I use log in this format, which I cannot identify but somehow Google Cloud parses it just fine:
I0422 15:24:39.761239 8 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"auctus", Name:"ingress-grafana", UID:"ec5a0fcb-e95b-42b5-9f10-01e88c625b48", APIVersion:"networking.k8s.io/v1beta1", ResourceVersion:"8193895", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
Does it seem familiar to anybody? I assume the first I is for info, the ] is a little odd, no idea what 0422 is for
another line: W0422 14:44:33.067272 8 controller.go:977] Service "auctus/apiserver" does not have any active Endpoint.
the part before ] gets recognized as "source" and here you can see W for warning... still no idea what the 0422 means
Is anyone else unable to run mypyc on MacOS? When I try I get a bunch of errors like this: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:386:41: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] int (* _Nullable)(void *, const char *, int), All of them complain about a missing nullability type specifier (not 100% sure what that is 😅) in either stdio.h or stdlib.h. I think it needs the -Wno-nullability-completeness C flag, but I couldn't see a way to pass this in.
How do you verify SHA checksums though?
Not expert in this field but I feel you need signed instead. Unless your shell script is assumed to be static or you can verify checksum in secure way.
If someone's credentials get hacked, it's pretty problematic though.
In the case of Codecov, their script was hosted at https://codecov.io/bash (putting it in code ticks so as not to link, it literally downloads a bash script). So the attacker was able to surreptitiously modify the script hosted on Codecov's website, through a compromised credential. Then the GitHub Action was blindly pulling that bash script into the workflow and running it. If the workflow did a checksum to the incoming text, it would be able to halt the action upon failing checksum verification.
This effectively makes it necessary for an attacker to compromise their bash script and their GitHub repo, changing the bash script at https://codecov.io/bash and the expected checksum in the repo. Of course, Codecov could just host the bash script inside the repo instead. But it fuels a number of their actions across a number of platforms, so I guess they want to keep it centralized.
Here's the Pull Requests in which they implemented checksum verification in their GitHub Action
https://github.com/codecov/codecov-action/pull/282
https://github.com/codecov/codecov-action/pull/287
Oh I see that makes sense
It's pretty hard to track down shasums for random things and know they are authentic
Yeah. And for my own personal projects, the chance that I will need to checksum my own stuff isn't likely. But if I'm explicitly pulling in something that I don't control, especially a bash script like the one at https://codecov.io/bash, I might remember this news in the back of my mind and try to do my "due diligence" to verify the checksum against a version I knew was safe. Of course a single (non-malicous) change to such a file would break it, as well...
I think signing is still more secure since you can't add a checksum to malicious file without more action
Do you mean to require signed commits in repos you control?
I mean something like certificate or gpg
I think for gpg you need a passphrase to sign something so they have another layer of security. Would need to be able to compromise further.
I see, something like what is described in this resource. So, if you have a particularly security sensitive thing, either figure out how to do it yourself properly, or go hire a security consultant lol
https://gnupg.org/gph/en/manual/x135.html
Definitely more effort than a simple checksum though
Hey everyone. I'm trying to start up postgres from my vscode terminal and I can't figure out how to do it. Do I need to download one of the VScode extensions or can I do it without it? I feel like I did it before without it but now I can't figure it out.
Specifically vscode isn't recognizing the psql command
I have added the \bin and \lib directories to path and it is recognized from the normal windows command prompt
I forgot to install postgreSQL in my condas environment
I'm using Ansible and I'm trying to figure out a proper way how to send out a notification at the end of a run if server/s are unreachable during the run. It can be done with registering a variable for a task and ansible will add a field: "unreachable" to the registered variable
but how to do it properly with multiple tasks? and some of my tasks already register a variable for other purposes
another alternative is to have a specific task at the beginning to check for reachability at the start, but some of our servers are on wonky networks and those servers can become unreachable during a run
?
Get a better network in the end what you could check at end of you have some resource available but if it fails on the go umm :/ unless like all the stuff can handle network unavailability and move on within some sane time frames
seting up github runner for python project with steps
build -> pylint -> pytest
all in one job....
name: Runner
on: [push]
jobs:
main-workflow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
find . -path ./venv -prune -o -type f -name "*.py" | xargs pylint --exit-zero
- name: Pytest
run: |
pytest test.py
is there a point to make those steps in different jobs?
(they just look there cooler in github interface)
if yes, how to do it?
I tried with
name: Pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
pylint:
needs: build
runs-on: ubuntu-latest
steps:
- name: Analysing the code with pylint
run: |
find . -path ./venv -prune -o -type f -name "*.py" | xargs pylint --exit-zero
pytest:
needs: build
runs-on: ubuntu-latest
steps:
- name: Pytest
run: |
pytest test.py
but pylint and pytest jobs don't receive data from build in order to run correctly
I guess, I am supposed to use cache for that
or oh well, steps should be enough too. Since the only proffit here... is getting just better visual output
but it would cost me performance for sure, if I would do so
Hmm, VPS is so cheap
hard to choose
EU, or USA? hmm
thinking to use it as 'show off' thing for my little web site project
plus to get for myself VPN with unlimited internet speed
30 Euro per year
for 10 GB SSD, 1 GB EEC, Intel Xeon 1 vCPU core.
I wonder if there is better offer
mm yeah, there are offers which are the same, but with payments per month, which is nicer i think
hmm, there is quite cheap one with payment per hour, which is even nicer
@rapid sparrow
is there a point to make those steps in different jobs?
Pretty much just to guarantee that both your tasks run, rather than one failing and blocking the other, I think.
For example I still want my tests and coverage tasks to run even if flake8 raises a minor issue with my code.
That's not necessarily a good reason because steps can be configured to run even if previous ones failed.
I don't really see a point in separate jobs besides organisational purposes. Separate jobs makes runs slower because it takes time for a new agent to spin up.
And depending on what you're doing in the jobs you may also need to checkout the code again etc.
Separate jobs are useful for having different environments like different operating systems or different python versions, though a build matrix abstracts that away for you.
It's also useful if the things you are building are completely independent of each other, but this is relatively rare to have (I would expect this to be avoided by keeping them in separate repositories).
Ah, I wasn't aware of the ability to flag steps as continue if failed. Good to know. I usually get into the documentation of things as I go, but the feedback loop for learning/building CI/CD stuff is so agonizing.
I wish there were a better way to test GitHub Actions and workflows without having to commit+push the YML to the remote and then trigger the workflow after every minor change. I end up with a bunch of garbage commits.
Can you "promote" the X/check of a step to be visible at the "top-level" in the GitHub UI? I guess you could have a thin wrapper job that just shows the status of a "buried" step inside another job.
I just added flag
if: always() to my steps
It makes my step always running too
With keeping errors in previous steps
I discovered cool feature about flake8
It can have a hook to git, which prevents commit, until you fixed the errors
Nice quality control feature
That's cool, I didn't know flake8 bundled an optional hook like that.
boi. I love the click. Just started to use and got rid of all my shell files
its nesting/grouping commands feature is awesome
it makes my documentation shorter too
hell, it is even self documented!
For building CLI tools with Python, I've been using fire, myself. I've heard that click is good, too, though.
tox is funny thing
same as github/gitlab runners
but works offline
cool, in order to make tests for dependencies on multiple python versions
technically, it could be used to speed up pipline run
instead of using 'matrix' mod, which creates new containers for each version
we can use tox, which does the same without it
I wonder if there is point in any tools besides docstrings and Sphinx for documentation of Django
How can I start the Docker Engine?
https://why.life-is-pa.in/pN3mNm it shows it is stopped here...
https://why.life-is-pa.in/9XYiex but it is running here
generally it'd start up on my computer start up but sometimes randomly it doesn't
I think you should consider
swapping to linux for development
makes things much easier
speeds up learning
and work
and experimenting
Sphinx is awesome
it can auto generate most of documentation based on docstrings ;b
enables search / navigation automatically
I should learn Google style docstrings to make it better though
Just find it's path and run?
if you are using windows press ctrl+r type 'msconfig' and look there
you can chose which app don't run after startup you want
fixed it with a restart, thanks
A Question for More Advanced Developers since I am a beginner could I still use Microsoft Learn to learn Python or do I have to study at Python.org ??
I am sorry if this channel is inappropriate for this question :C
May i ask for recommendations for python packages that helps extract or convert music into some sort of data?
I used pytube to install as mp4 and then convert them from a website but you can automate that too
I just didn't wanted to work for that
Can someone recommend a great solution to hosting a FastAPI on multiple servers so the load can be balanced and if one goes down the other can still handle the requests?
Kubernetes
can anyone help me with my HTML code?
not in this channel
hey, does anyone know how to define the find-links for a package when using setup.cfg ? for example when i install the package with pip i use pip install torch==1.8.1+cpu --find-links https://download.pytorch.org/whl/torch_stable.html
but i want to have this insluded as a dependency wehn installing my package
If I'm converting python2 code to python3 is there any way to figure out which objects and libraries will require changes?
I've run 2to3, but it didn't flag things for attention that it couldn't fix like it said it would.
Right now my list of things to change includes:
Regular expressions on binary, buffer, and reviewing all division operations to see if it needs to be reviewed,
but there must be a better way to get a full list of interfaces or important internals that have changed
Even just a page on the python docs for each import that documents what to look out for would be better than a shot in the dark
hello, i need help with pyinstaller. can anybody help me (if it possible in german pls). i didnt know where i bind in utils like psutil or other
hey - can i get a professionals thoughts on bamboo? It seems theyve dropped cloud support and one of the first results when you search atlassian bamboo is "is atlassian bamboo dead?". For context I'm trying to write a hypothetical recommendation to a large company. Im not sure if its dying or I'm just reading all the bad things from articles
Atlassian is the worst place of CI tools.
Their servers are laggy, their soft is unoptimized shit that loads forever.
My advice, run. Run from them.
Gitlab is quite awesome for example.
😦
welp, my place uses Atlassian
Confluence, bitbucket, and their Jira product
no native dark mode annoys me infinitely
lolll ill use no dark mode as a reason
im comparing to gitlab - especially the free version + the free ultimate edition for startups. I've said gitlab would be best for startups. Would you say gitlab is best for ftse 100 companies too then?
no clue. I've not noticed the slow loading yet, so my main gripe is dark mode, and we can't install plugins to get around that. My company is very big though, so not sure
Most Fortune 500 companies will likely use something more open like Jenkins or some other big name tool
GitHub and other cloud build systems can be too restrictive depending
has anyone deployed wiki to github pages?
I succeded but I don't have automatic redirect for index.html
looking how to fix it
Oh, nice, it is working
I was informed by AWS that I've used 25GB of my storage.
I ran du -h -a / | sort -n -r | head -n 10 to find out the biggest files and it’s looking like most of it is ~1MB and from Docker…?
~$ sudo du -h -a / | sort -n -r | head -n 20
du: cannot access '/proc/...': No such file or directory
du: cannot access '/proc/...': No such file or directory
du: cannot access '/proc/...': No such file or directory
du: cannot access '/proc/...': No such file or directory
1021K /snap/core18/1997/usr/lib/python3.6/pydoc_data
1021K /snap/core18/1988/usr/lib/python3.6/pydoc_data
1020K /var/lib/docker/overlay2/.../merged/venv/lib/python3.8/site-packages/gssapi/raw/ext_dce.cpython-38-x86_64-linux-gnu.so
1020K /var/lib/docker/overlay2/.../diff/usr/local/lib/python3.8/site-packages/httptools/parser
1020K /var/lib/docker/overlay2/.../diff/venv/lib/python3.8/site-packages/gssapi/raw/ext_dce.cpython-38-x86_64-linux-gnu.so
1020K /var/lib/docker/overlay2/.../merged/usr/local/lib/python3.8/site-packages/httptools/parser
1020K /var/lib/docker/overlay2/.../merged/usr/local/lib/python3.8/site-packages/httptools/parser
1020K /usr/share/perl/5.30.0/unicore/Name.pl
1020K /usr/share/locale/it
1020K /usr/sbin/tcpdump
1020K /usr/lib/modules/5.4.0-1038-aws/kernel/arch/x86/kvm/kvm.ko
1016K /var/lib/docker/overlay2/.../diff/var/lib
1016K /var/lib/docker/overlay2/.../diff/venv
1016K /var/lib/docker/overlay2/.../merged/usr/local/include
1016K /var/lib/docker/overlay2/.../merged/usr/local/include
1016K /var/lib/docker/overlay2/.../diff/usr/local/include
1016K /usr/share/locale/sv
1012K /var/lib/docker/overlay2/.../merged/venv/lib/python3.8/site-packages/werkzeug
1012K /var/lib/docker/overlay2/.../diff/usr/share/locale/de
1012K /var/lib/docker/overlay2/.../merged/usr/local/include/python3.8
Running sudo docker system df shows that docker with all the images, volumes, etc. only uses < 5GB,
~$ sudo docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 5 5 2.224GB 1.049GB (47%)
Containers 7 7 1.312MB 0B (0%)
Local Volumes 4 4 50.12MB 0B (0%)
Build Cache 0 0 0B 0B
Can someone give pointers on how I can figure out how my server is using 25 GB?
Are you referring to docker system prune -a ? I did that and it did clear .... 175 MB
@rapid sparrow when I ran docker system df it did say Build Cache is 0.
~$ sudo docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 5 5 2.224GB 1.049GB (47%)
Containers 7 7 1.312MB 0B (0%)
Local Volumes 4 4 50.12MB 0B (0%)
Build Cache 0 0 0B 0B
I also said this in another community:
Also had unused volumes cleared by running docker system prune --volumes and 0 B was cleared after running that.
What does df -h show?
used and available HDD space in human readable way in linux systems
docker rmi $(docker images -a -q) to clear all not active at the moment layers
docker rmi $(docker images 'PROJECT_NAME' -a -q) to clear layers for a specific image name
if you had for example used image ubuntu 20.04
this cleaning will lead to repeated downloading from public storages
and if you had your container not running
next build will be forced to rebuild all layers from zero
P.S. if you will run this thing every time, it will increase your build time
I know. I was asking the person above what the output is.
Also I think the method you propose is obsolete with more recent Docker versions that added docker image prune
In any case I would expect sudo docker system df to have already shown the space that docker image prune would clean up.
Thank you so much for that command! But now, I'm super confused why AWS informed me of using 25GB storage when it looks like I've only used 5.3G. Or am I reading the output wrong...
Filesystem Size Used Avail Use% Mounted on
/dev/root 30G 5.3G 24G 18% /
Full output:
~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 30G 5.3G 24G 18% /
devtmpfs 484M 0 484M 0% /dev
tmpfs 490M 0 490M 0% /dev/shm
tmpfs 98M 1.3M 97M 2% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 490M 0 490M 0% /sys/fs/cgroup
/dev/loop0 34M 34M 0 100% /snap/amazon-ssm-agent/3552
/dev/loop1 56M 56M 0 100% /snap/core18/1988
/dev/loop2 70M 70M 0 100% /snap/lxd/19188
/dev/loop4 33M 33M 0 100% /snap/snapd/11402
/dev/loop5 71M 71M 0 100% /snap/lxd/19647
overlay 30G 5.3G 24G 18% /var/lib/docker/overlay2/6b3166bf004f50a45110ff0d855f6d2f3c058a9ac68c8ab7a3c40ce3c118d049/merged
/dev/loop6 56M 56M 0 100% /snap/core18/1997
/dev/loop7 33M 33M 0 100% /snap/snapd/11588
overlay 30G 5.3G 24G 18% /var/lib/docker/overlay2/2f072eb2d9b6e555c8b9c8cdc4de18c90828f3a4267a2cd19ec046b73c0d0b0f/merged
overlay 30G 5.3G 24G 18% /var/lib/docker/overlay2/6998b7925356ff5f30a23eaa0a5b29bbcfd0fa42a70380212ecaf2621abf8759/merged
overlay 30G 5.3G 24G 18% /var/lib/docker/overlay2/de96dece2092b986e46b9a6574133554a8c6bde78af74b5a53b8ab5881e2f20d/merged
overlay 30G 5.3G 24G 18% /var/lib/docker/overlay2/dd3b77593cde8307f0a00a03380b7c49812e94a5bd0cd14d32f2b79efd5e9616/merged
overlay 30G 5.3G 24G 18% /var/lib/docker/overlay2/09be3e30556a91b602534ac65709700c569f44364f91fcb31a617e5725819e8d/merged
overlay 30G 5.3G 24G 18% /var/lib/docker/overlay2/8f80297ce43b53902a785dc53f354119971d43ea5b98f6e76fd52d305f37eb27/merged
tmpfs 98M 0 98M 0% /run/user/1000
You read it correctly. Only 5 GB used.
I'm not familiar with all of AWS's services. Do you have some external volume that you're also paying for?
Or maybe they were talking about bandwidth rather than storage?
Ultimately, you should be able to just contact them and ask. You are a customer, after all.
The 25 number is surprising since you have 30gb allocated.
Thanks @tawny temple !
Thanks, joined 👍
how can I connect to DockerClient inside the docker container (dockerpy)?
Hey i made a program in python to drag images and convert them to PDF. I tried to make it exe with pyinstaller but when i drag an image it says permission denied while it works fine in the terminal
Hello! I'm trying to test a CI pipeline on GitLab. Basically, I use a python image (3.7.9) and I install all the necessary things on the build stage (not sure if necessary) and then I try to run the script but I keep getting this error python3: command not found. Here's my .gitlab-cy.yml
image: python:3.7.9
stages:
- build
- test
building:
stage: build
script:
- apt-get update
- apt-get install -y python3
- apt install -y python3-pip
- python3 -V
- python3 -m pip install --upgrade pip
- echo "Moving on to requirements install"
- pip3 install -r requirements.txt
testing:
stage: test
script:
- python3 oauth2_sign_in.py
after_script:
- echo "Test successful"
I've tried to read numerous pages and forums, but still couldn't find a solution, and I think it must be something really stupid
Why are you multistage building?
Multistage build requires you to copy stuff over and you are not
and with Python, looking at your build, there isn't a big reason to multistage build
also Python Image comes with PIP so why do this: - apt-get update - apt-get install -y python3 - apt install -y python3-pip
Ok, Gitlab CI doesn't throw out last stage stuff but it's possible you are messing up with previous stage with your apt-get of install of python, use the baked in one and also just called "python" most python 3 docker containers map "python" -> "python3"
OK, in short, I should just skip the apt-get installations and only run python <script>?
@wooden ibex
Hehe, misread github for gitlab
You need to pip install obviously
So just pip install requirements.txt and run python
image: python:latest
before_script:
- python -V # Print out python version for debugging
- pip install -r requirements.txt
pylint:
script:
- python scripts.py test pylint
flake:
script:
- python scripts.py test flake
unit:
script:
- python scripts.py test unit
- python scripts.py test cover
in python images, we have already pre installed python3
weirdly enough it is invoked through python
It's not that weird. The only reason python3 even exists is cause of Python 2 occupying python on many systems. This is fading away and doesn't matter at all for the container since it only has Python 3
Just another question @wooden ibex @rapid sparrow , in this case, what I'm testing is a Flask app, but, of course as it does not get any input, it just waits for input endlessly. How can I perform test in a Flask app?
Sorry for bothering this much tho
Pytest the methods or just write external tests after you start the flask server
With git rebase -i, is there a way to fold a commit into the next commit, e.g. like fixup but down?
anyone have any experience coding bots to buy items online?
is that possible/doable in python
there is nothing like long description in poetry, rather you can set a readme file.
readme="README.md"
Perhaps you are speaking about making factory from your flask.
Instead of initialization on file import, it should be wrapped into createapp function.
And server started only on if __main__ == something, something
Then it will not run server when not needed, and you can easily program additional behavior
Running tests
Or click scripts
So I made a docker push workflow on one of repository, but it fails without any errors, here is the link https://github.com/Shivansh-007/griff-ify/actions/runs/795073268
I see the error. It's
Build & Push Docker image
buildx call failed with: error: invalid tag "ghcr.io/Shivansh-007/griff-ify:main": repository name must be lowercase
ah missed that, isn't griff-ify already lowercased?
I guess it counts your username as part of the repo name
But it's case insensitive so it's weird that it is complaining
Well, I suppose buildx doesn't know that GH is case insensitive. Fair enough
hmmm, is there a way to go around doing this?, i can't change the username.
Yes you can. It's used as a literal string right here https://github.com/Shivansh-007/griff-ify/blob/main/.github/workflows/main.yml#L123-L125
.github/workflows/main.yml lines 123 to 125
tags: |
ghcr.io/Shivansh-007/griff-ify:main
ghcr.io/Shivansh-007/griff-ify:${{ steps.sha_tag.outputs.tag }}```
Just make the S lowercase
Probably. I assume it'd have the same issue with it being uppercase
pushed, lets see the workflow output
just a short question, say there are two ppl with same repositories, say a, and their names are Mark and mark, how will buildx differentiate between the two?
It's case-insensitive on GH, so Mark and mark are the same person
ah ok
https://github.com/users/Shivansh-007/packages/container/package/griff-ify and btw it worked, thanks 
Np
@pliant plover Let's talk here
Your Procfile needs to be worker: python Main.py
I thought your file was named main.py
Have you made this modification?
itis there
You still have an error when you push your code?
yup
Build main 0c66b21f
There was an issue deploying your app. View the build log for details.
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/python
-----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
! Push failed
@river pasture
what to do
ok i will talk later
How did you created your app?
Considering that I can't voc rn, here's a video on how to setup a discord py bot on heroku : https://www.youtube.com/watch?v=BPvg9bndP1U
How to host your discord bot for free using heroku. This tutorial shows you how to host your python bot for free using heroku services. We simply need to setup a few things to heroku, upload our code and turn the bot on!
Text-Based Tutorial: http://techwithtim.net/tutorials/discord-py/hosting-a-discord-bot-for-free
Heroku: https://heroku.com
...
That's the one I followed when I started developping mine and had no problem deploying it
Groovy#7254: ``
@candid kayak What should I chose to make it free? The lowest options seems to be 7.7$/mo
I was able to reduce the pricing to 5.39/mo
4.79 by choosing a standard disk
i get it down to 4.88 monthly with the f1-micro
it's free because up till certain limit, compute engine is free
it's some sort of quota which i now forget, let me see if i can find it
Well thanks to free credits, I could host my bot for 55 mounts 
i just stay within the free trial limits for compute engine, so in effect it is totally free (doesn't deduct fromthe credits either)
Oh ok
Once I opened the ssh what should I do ? (or is there a tutorial/guide/...)
Tutorial for?
oh setting up a discord bot?
just...install the dependencies and run the thing :p i think digital ocean has a few tutorials on deploying discord bots on their platform, just skip through until you reach the part where they ssh in
Managed to get my bot on the vm
How do I install libs that are not recognized by pip?
🤔 are you sure the version you specified is right
Managed to install chess via pip on my computer but not on the vm
and are you sure you're using the correct version of pip
python and pip by default are python2 and the corresponding version of pip i think
i generally make a virtualenv and install into it
use python3 and python3 -m pip
cooooool
Ok, after a lot of trial and error, I managed to only have python3.9 and all my requirements 
The chess lib only supports python 3.7+ and the latest official version of python on ubuntu was 3.6
ah nice
yeah it seems to come with 3.6 default which is annoying 😔 i use 3.8 for almost everything
Can anyone help me with git ?
Q. The problem is I want to change the default location of repository's being saved by git , like whenever i clone a repository , git clones it in the default location in my c: drive that is User/hp in my case. Now i want to change the default locations to save the repository from c: drive to another drive on my pc. Can anyone help me like how do i change the default location ?
Pushing code is so much faster 
Now the last step is adding all my env vars
I found how to install ffmpeg, opus and gtk
help please?
super cool 👍
I'm trying to make a simple Python script that reads a text file and then runs a .exe file, giving the .exe parameters that are found in the .txt file 😛
Is there any... efficient way to do this? lol
Hmm, you can use subprocess.run or subprocess.Popen 
!d subprocess.run
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.)
!d subprocess.Popen
class subprocess.Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=True, shell=False, cwd=None, env=None, ...)```
Execute a child program in a new process. On POSIX, the class uses [`os.execvp()`](https://docs.python.org/3/library/os.html#os.execvp "os.execvp")-like behavior to execute the child program. On Windows, the class uses the Windows `CreateProcess()` function. The arguments to [`Popen`](https://docs.python.org/3/library/subprocess.html#subprocess.Popen "subprocess.Popen") are as follows.
*args* should be a sequence of program arguments or else a single string or [path-like object](https://docs.python.org/3/glossary.html#term-path-like-object). By default, the program to execute is the first item in *args* if *args* is a sequence. If *args* is a string, the interpretation is platform-dependent and described below. See the *shell* and *executable* arguments for additional differences from the default behavior. Unless otherwise stated, it is recommended to pass *args* as a sequence.
An example of passing some arguments to an external program as a sequence is:
Popen(["/usr/bin/git", "commit", "-m", "Fixes a bug."])
yea, ive been reading about that online.. didn't know if there was a... more common way to do it 😛
ah tysm
There is os.system too but I don't like it
!d os.system
os.system(command)```
Execute the command (a string) in a subshell. This is implemented by calling the Standard C function `system()`, and has the same limitations. Changes to [`sys.stdin`](https://docs.python.org/3/library/sys.html#sys.stdin "sys.stdin"), etc. are not reflected in the environment of the executed command. If *command* generates any output, it will be sent to the interpreter standard output stream.
On Unix, the return value is the exit status of the process encoded in the format specified for [`wait()`](https://docs.python.org/3/library/os.html#os.wait "os.wait"). Note that POSIX does not specify the meaning of the return value of the C `system()` function, so the return value of the Python function is system-dependent.
@night quest is there a way to surpress the print statements but also saving it?
I see a capture_output, but...
I'm doing:
FNULL = open(os.devnull, 'w')
result = subprocess.run(["myargshere"], stdout=FNULL, stderr=subprocess.STDOUT)
``` this surpresses the print statements... `result` is now an instance of CompletedProcess..
lel just needed capture_output=True:
result = subprocess.run(["myargshere"], capture_output=True)
``` and now I can use `result.stdout` !! 🙂
I want to download this library called Pydome https://github.com/badassdatascience/pyDome, but it is not updated for Python 3.0.
Someone made a pull request to update to python 3.0, and I want to download that version instead. How can I do this?
https://github.com/badassdatascience/pyDome/pull/1
this is the pull request
for now i just went to the files and viewed the raw text and simply copy pasted them, but is there a better way?
load from pull request owner
from forked rep here
https://github.com/compeoree/pyDome
there is no better way in the current situation, except for downloading the rep
ahhhhh yeah that's what I need thanks!
Can you give me advice
from which stage of project development, a person which takes fully devops position is highly needed
project is full of microservices, with multiple services
at the current stage with one big server, and only few services deployed to other servers, but the amount of servers will grow quickly in a matter of several months
I am a little bit unsure, if we already need him desperately right now
or may be a month/two months later
Am I correct that DevOps can be taken, which next roles
- to setup proper development cycle and deploying system
- to think of a better microservice architecture of the project, how to make the load balanced, to setup stuff like that
- he can have network skills too, to help with stuff where regular developers can be missing
and perhaps:
4) he can be also taking administrative/talking role with internet-server providers/thinking of a project development direction?
Technically at least coding part of development cycle I was able to set properly with having gitlab piplines / static code checkers / unit testing
I am severally only missing proper deployment system
doing it with just....mix of python/shell/docker scripts at the moment
Hey all! Can you help me in a issue here?
I have a file which creates a simple k8s namespace inside the GitLab cluster
apiVersion: v1
kind: Namespace
metadata:
name: kpw
I run the following command inside my deploy stage, in a job called deploy-code
kubectl create -f ./k8s/namespace-creation.yaml
It returns the following error Error from server (Forbidden): error when creating "./k8s/namespace-creation.yaml": namespaces is forbidden: User "system:serviceaccount:gitlab:default" cannot create resource "namespaces" in API group "" at the cluster scope
It has something to do with authorization or could it be a path issue?
If i create binaries on the image for a different microarchitecture will the docker image not run? i.e. if i compile with avx512 instructions
could anyone help me please?
Did you forget to enable venv
normal pip was broken
I don't want to use venv
I only want to use pip in all cases
You should really consider using venv always
I don't even always install pip to global env usually
Not really needed
even if it is, I care that pip was broken
Leaning venv takes no effort, it is just four commands tov remember
I need to solve this problem
Venv could repair pip with infernal pip possibly
Okay, but you make a big mistake
I only use venv when i need it
but I don't need now
I want to install anything via pip on my machine
but pip was broken
Just reinstal python I guess
In your windows case, it should work
(Don't ever do it if you are in desktop linux ;b)
thanks
but, does anyone have any other suggestion?
I have this problem after I updated pip via "pip install --upgrade pip"
isn't the latest pip version stable?
Try
C:\python38\Scripts\pip.exe --help
Mm yeah
I think only python reinstallation will work in your case
Unless you have secondary package manager that can reinstall only pip
(conda, or May be chokolatey can)
Although
You could try repairing pip
With files from another installation :b
But tbh it has no meaning to do that
Reinstallation is faster, easier and reliabler
I don't understand why that happens
I have this issue after I update it
I think the last version of pip is not stable and has problems
May be it is meant to work with latest python39
Some bug with broken compatibility about it with 38
Or just linux developer, which missed to check windows compatibility
@willow flame on windows you should never do pip install -U pip, only python -m pip install -U pip
usually the first one just doesn't work, but in this case it seems like something got corrupted
just reinstall python from python.org
Why?
I added the scripts folder to path
And Pypi recommends to use just pip
And, I and many of the developers use pip only
The latest version of pip recommend using python -m pip
When i upgraded from v19.03 to v21, anytime I installed something using just pip I'd get a depreciationwarning
.
Reinstall mate, that's so weird
because on windows things get weird when a program tries to modify the file that is currently being executed
this is not a problem on linux and mac because the operating systems work differently
you can use pip install for other things on windows, just not pip itself
New blog post on the upgraded SeleniumBase Dashboard: https://seleniumbase.com/the-new-dashboard-is-here/ (SeleniumBase can be installed via pip install seleniumbase)
hi everyone. just wondering what the best way to manage python installs on macos (or linux) is these days? I've heard a few people mention it is better to avoid using python installed via Homebrew (on mac anyway) as it will update it as needed which can screw some things up so its better to use another tool to manage python for development and just left Homebrew do its thing for Python that it needs to do its job?
pyenv is a great choice (https://realpython.com/intro-to-pyenv/)
thanks will check it out!
oh yeah looks great, exactly what I was hoping for. Something that just sets up different python installs without screwing up the Homebrew version 👍
anyone pls help me to host my bot on heroku
are there any DAG schedulers like luigi, airflow but more like luigi in its simplicity? I think airflow is pretty heavy weight for some simpler tasks
I have coded a module.
This module is for probability. It returns True or False output based on a probability.
>>> from probability import Probability as pr
>>>
>>> pr.Prob(1/2)
False
>>> pr.Prob(1/2)
True
>>> pr.Prob(1/2, num=5)
[False, False, True, False, False]
>>>
>>> # it is recommended to create an instance
>>> myobject = pr()
>>>
>>> # use iProb instead of Prob
>>> myobject.iProb(5/8, "50%", "2/11") # for more accurate results give them as str
[[True], [True], [False]]
>>> myobject.count_values()
{True: 3, False: 0}
>>> myobject.history
{0.625: [True], '50%': [True], '2/11': [False]}
>>>
>>> # you can also set a constant
>>> myobject.set_constant("7/15")
>>> myobject.iProb()
False
>>> myobject.iProb()
False
>>> myobject.iProb()
False
>>> myobject.iProb()
False
>>> myobject.iProb()
True```
Can you suggest a name for my module? (my module name is also used in Pypi)
Any1 know why my discord bot wont host on heroku? It says done and deployed I have it on on heroku but it wont come online idk y and Ive done this for other bots couple days ago n they all worked
Omerfi name your module Omerfibulous...
thanks, could anyone have any other suggestions?
Some variation of Boolean probability?
Is anyone else having problems with github desktop?
It stopped responding for an hour so I restarted my laptop and tried to start it and it wouldnt so i uninstalled and when i reinstall it it keeps on saying there was a problem installing
github desktop is meh
if you are in windows, use SourceTree
if in Linux, well, git bash + git cola
github desktop is not really good, you dunno when what is gonna happen when you press that button, you dunno what that button is doing, or learning from it.
Use git cli tool
if you really wanna stick with gui, then use gitkraken
It makes switching branches and repos very easy, It visually shows different branches compared to others, and it is easier to stash/un-stash files in the interface, Gitkraken makes it super nice to do the commits
SourceTree is better than Gitkraken for GUI ;b
plus it is free
never heard of it, can you share the link?
the only problem, it is windows/ mac os only
no linux(
Here how it looks
really comfortable multi repository one, looking through files to reset/revert in hunks and lines
oh wait a second, perhaps I was able to find alternative for linux
going to try SmartGit, perhaps it would do the trick
smh no linux :(, gitkraken looks better than that imo, why would you choose the two over it?
it is free, working smoothly, no bugs
great customization
gitkraken is laggy and buggy in my opnion
I had really big trouble with its accounts during setup
yeah, accounts setup a bit difficult on git kraken
not difficult, but confusing rather
Dammit. SmartGit is not free as well
hmm, perhaps just to try Wine installation
Technically.... GUI is for the weak ;b
CLI rulezz
but still, I miss them a bit
honestly, I haven't felt much of a need for a dedicated git GUI. I have used tortoiseGit before and it does have some nice things, but all I really want is editor integration for git stage in order to allow for granular commits in a way that is nicer than git stage -p
oh wait a second, SmartGit is allowed to be used for free for non comercial purposes
not bad
same I guess. git sage -p is more comfortable with GUI
as well as git checkout -p
haven't gotten much usage from git checkout -p tbh, I don't like using it all that much.
it is useful for fixing really messed up histories though.
well, smart git is sort of having all I need
slightly weirder interface, but I can get used to it
quite powerful GUI
Mk thanks!
Someone who's familiar with Cloud Functions - how can I pass in a variable when I call the HTTP function? For example if the trigger URL is https://test.cloudfunctions.net/test I'd like to do something like https://test.cloudfunctions.net/test?abc123 and then print that variable in my function:
def start(x):
print(x)
Your url is a string right? Split your string on '?' And print item [1] of the resulting list
If there are multiple ?s in your url then pop the [0] item and join everything else back together
@supple venture Thanks a lot GitKraken made it much easier and better to use git
and I could understand what was going on
np 
</div>
<div class="trn-defstat">
<div class="trn-defstat__name">Total XP</div>
<div class="trn-defstat__value" data-stat="PVPTotalXp">
15,935
</div>
How can i use urllib.request & BeautifulSoup to pull data number inside PVPTotalXp ??
i want it get data and print out 15,935 only
What have you tried?
I tried
import urllib.request
from bs4 import BeautifulSoup
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'
url = "https://r6.tracker.network/profile/pc/Moddy"
headers={'User-Agent':user_agent,}
request=urllib.request.Request(url,None,headers) #The assembled request
response = urllib.request.urlopen(request)
text = response.read()
soup = BeautifulSoup(text, "lxml")
data = soup.findAll('div',attrs={'class':'trn-defstat__value'})
print(data)
for div in data:
links = div.findAll('a')
for a in links:
print(a['href'])
but it print all the
I just want the only number/info inside
!e
htmlstr = """
<div class="trn-defstat__value" data-stat="PVPTotalXp">
15,935
</div>
"""
from bs4 import BeautifulSoup
soup = BeautifulSoup(htmlstr, 'html.parser')
for div in soup.find_all("div"):
print(div.string.strip())
@night quest :white_check_mark: Your eval job has completed with return code 0.
15,935
.string gives you content of the div element, .strip() is to remove whitespaces
Thanks
In ECS when using describe_taskDefs is resourceRequirement only returned if a GPU cluster is enabled? Or should it be returned regardless? I know the Response syntax shows this, but for some reason when I run this API call, i don't get that block:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_task_definition
'resourceRequirements': [
{
'value': 'string',
'type': 'GPU'|'InferenceAccelerator'
},
],```
Hey guys,
Docker newbie here!
I think I understood the basic concept of Docker, but there are some questions that remain unanswered. Google and co. can unfortunately only partially or very incomprehensible clarify my open questions.
Why do I want to learn Docker?
-
I want to keep my system (Mac user) clean and not cluttered with hundreds of different environments (e.g. diff. Node or Python versions, diff. DB's and so on).
-
I think it is good for my professional career.
What questions do I have?
I would like to use docker not only for production environments, but also go so far that all my local dev environments run within Docker containers.
Here I would like to hear from experienced users the advantages and disadvantages of Docker and local development.
- Is it possible, for example, to run a NodeJS container and use it "globally" for all my software projects or do I have to run a separate NodeJs container for each NodeJs project. I've heard of the concept of mountings, but haven't fully understood it yet.
E.g. If I run a MongoDB container, I can assign a port here and use it 'globally / system-wide'.
- Can / should one also run git inside containers or rather directly on the host?
For me it is very important not to do without hot reloading of my dev environment, whether Express Server, Flask Server, React / NextJS and so on, without having to create a new image and restart it after every change.
So all of my questions relate more or less to whether you can 'Dockerize' the whole subject of software development or whether you can not avoid installing some tools on the host anyway (e.g. NodeJS)
I look forward to your feedback.
Thanks! 😃
@junior linden use docker compose
Have "dev" and "prod" versions
In the dev version, mount your files as a "volume" so you dont have to rebuild the container to run your updated code
for the 2nd question, yes you should be able to
port mapping host:container
Yep, specify all that in docker compose
Better still, run nginx in docker compose too and put all your stuff behind it
Mhh... do you have any example resource?
Thanks @tawdry needle @supple venture
not as of now, see if you find a mongo compose file and play around with it
this might help perhaps https://www.osradar.com/deploy-mongodb-using-docker-compose/
@junior linden I use separate containers per project or service, I rather not use docker compose though it facilites management sometimes. It actually depends on your needs and skills. I do git stuff in my Mac, not inside containers. Restarts happen when file changes so if you setup your docker volumes correctly, you should be able to enjoy those features even with containers. Although, I usually have Node and Python installed in my host as well, basically to help my IDE :). brew, pyenv, poetry and nvm help a lot with that part
Cool thanks. How long do your restarts take? I mean, it's different when you look at hot reloads versus container restarts, right?
difference can't be noticed by my limited brain
😆 ... do you have any public repos where i can take a look?
I don't think so but let me check
@junior linden you might want to check this instead of my stuff - https://docs.docker.com/samples/
@short peak you're talking about app restarts right? you have your source code loaded as a volume?
my docker compose files at work look kind of like this
version: "3.8"
services:
mongo:
image: mongo:4.4.3-bionic
container_name: myapp-mongo
hostname: myapp-mongo
restart: always
server:
container_name: myapp-server
hostname: myapp-server
build:
context: .
dockerfile: Dockerfile
ports:
- 8888:8888
volumes:
- .:/myapp
@tawdry needle, yeah, I usually do
While you can do Mongo as container, which is fine for dev work, databases don't always make greatest container dwellers in prod
why's that? we use mongo in a container but it's all hosted on gke with kubernetes and istio blah blah and i dont ever have to worry about it 😛
because you are relying on whatever Volume replication software working and keeping up with rate of changes
or you are locked to Single Host which is problematic in itself
oh, yeah honestly idk how thats all set up
i know the mongo server uses replica sets
and i also know that theres 0 reason for us to be using mongo
and we should just be using sql..
Sure, but plenty of clouds provide SQL setups where they provide all that
indeed
i dont know why they went with mongo
wasn't my decision, i joined after it was already in place
Personally I never worked around with mongo, was going to but never got the time, and ideas to use it, Postgres is what I always used
Mostly django ORMs
Because you can cluster really easy
hey. I'm trying to write an essay about Docker and Kubernetes. I understand that Kubernetes manages nodes such as docker. I was wondering if that is needed in a small company where not much processing power is likely needed?
it depends.
company size and processing load are not super strongly related
and
well, yes, Kubernetes is used for container orchestration
Hi guys ! Can I use Python Kivy to create (or access) a directory in Android like I do on Windows PC??
like making a directory : os.mkdir()
Am I able to do that on Android device ??
hey how can we control bluetooth of our pc using python
is there any library available?
Something's wrong with Anaconda Navigator 😦
Tried almost every solution available on the internet. But since no errors are seen, not able to pinpoint the issue.
Could someone please help me out? 🙂https://stackoverflow.com/questions/67395489/anaconda-navigator-doesnt-get-past-the-initializing-screen-doesnt-give-any-er
I am not into kivy, but according to my knowledge, you can create a folder into the SD card
os.mkdir(App.user_data_dir)
which gets you the /sdcard/<app_name>
https://blog.kevindoran.co/bluetooth-programming-with-python-3/ you can give this a read
Bluetooth Programming with Python 3 written Apr 21st, 2013 This post presents basic techniques for communicating over Bluetooth with Python 3.3 and …
Anyone has experience with GitLab CI? I'm trying to create a deployment stage inside my pipeline, and I already have built my Docker image and it's already registered inside my Container Registry. But when I try to kubectl run from a file (I'll append it), it does not push my own image, instead it will try to push an image from Docker Hub. How can I tell GitLab to use my own image stored in the Container Registry?
Here's my k8s deployment description file (kpw is the name of the image inside Container Registry)
apiVersion: apps/v1
kind: Deployment
metadata:
name: kpw
spec:
selector:
matchLabels:
app: kpw
template:
metadata:
labels:
app: kpw
spec:
containers:
- name: kpw
image: kpw:latest
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 65203
P.S: its very simple, but its supposed to at least for now
I am familiar with GitLAB CI only to run different testings and to deploy automatically sphinx docs to gitlab pages
it would be cool to learn how to deploy too
Not sure if gitlab and GitHub CIs are related, but you can have a look at @rancid schooner ‘s source, we use k8s to deploy the containers
Or any other pydis projects
thanks man
Does anyone have any insight into what is going on with anaconda? It's going on 6 months since the last release, which is the longest span between releases in years.
Good question. Weird company.
What is devops?
developer operations. basically stuff related to deploying software and other things that help software developers do their jobs.
Oh ok cool
Devops can build the pipline 👆
Making it more or less fully automated
datetime module by default lists values in utc right?
No, datetime defaults to naive objects i.e. no time zone
How odd
Hey guys,
is someone here who has Python running in conjunction with a linter and code formatter in a Docker container and is ready to help me with my setup? (VSCODE Remote Container)
Thanks! 🙂
Is it possible to keep kivy app run in Android background ? For example, I want my kivy app to do smth each hour, so I must keep the service run in background to check the time.....
How do I do aware ones
You need to include the Python interpreter somehow. That could be by installing it normally, or by bundling it with the app into a single package, like what pyinstaller does. There are also some more out of the box ideas like Nuitka, which links your app against libpython.
You can look into containerisation, which makes it easier to deal with installing a Python environment for deployment.
I don't have much experience with turning Python to a binary executable, but I feel that it would just add more steps to the pipeline and more reasons for your app to somehow break, so I'd personally avoid it for production deployment given that it's possible to be in full control of the environment.
Hello there. I've been using Docker fairly often for my Python images and I couldn't help but notice Docker took a lot of disk space despite me pruning my containers and images not long after I've been using them. Is this normal? What's happening behind WSL 2?
Docker is awesome when I'm having compatibility issues, but I just wish the memory purging would be smoother.
What is taking up the space? You can check with docker system df
When running images you can use docker run --rm ... to automatically remove all data when container is no longer active
You have nice video from Microsoft about WSL2: https://aka.ms/wsl2
I went and purged the data through Docker Desktop and freed around 20GB of memory. It's probably after I've been running a Flask / MySQL / React compose
I suspect it might be a volume in your case 🤔
The other common reason is that you have intermediate layers saved from old builds. But if you're not building images a lot, then that should not be a concern.
And of course, the base images themselves use up some space, but not that much.
Probably because I was struggling with database creation through my ORMs. I tried the factory pattern with create_app() but I always need to refresh my Flask app twice so the creation works, then open flask shell and use db.create_all()
Next time you see high disk usage, run that command to see a breakdown of what's using up disk space.
You can run it with -v to see a more detailed breakdown
But yeah, building often can really kill your disk space quickly.
Especially if your Dockerfile isn't optimally using layers, meaning you end up rebuilding large layers and having a bunch of old versions of those layers still saved.
Unfortunately yes. I'll take that in mind next time I'm building my Python backend
File "main.py", line 21, in <module>
print(gethumantime(givendt))
File "main.py", line 6, in gethumantime
time = realdt.strptime(time,None)
TypeError: strptime() argument 2 must be str, not None```
def gethumantime(time: str):
time = realdt.strptime(time,None)
humantime = dt.strftime('%A, %b %d %I:%M:%S')
return humantime
This is the wrong channel. Please go to #❓|how-to-get-help
My goal is to convert a string into a datetime
Hey guys. Not sure if this is the right place for this but I just wrote a quick script that pulls some info from a database hosted on my local machine. It loops over a list of like 20k tables and pulls some info from each one. The first time I ran it it took maybe 10 minutes to complete. Then I ran it again and it took maybe 30 seconds. I noticed the 2nd time it didn't access my C: drive at all, and the first time it ran my C: drive was maxxed out at 100% the entire time. I'm wondering what happened here and if there's anyway to take advantage of that behavior in the future
nvm found it
Does python generally get installed as python rather than python3?
in python3-venv yes
in windows... I think yes too
but in linux global, it is more likely python3
What about OS X?
no idea. never used OS X
on linux, it gets installed as python3 if there is no python, if you have python3.6 as python3, and you wanna install python3.8, it would be installed python3.8
so it depends from case to case
that's what i have seen, not sure if that's what actually happens
this is a lot more complicated than I thought. I'm trying to update onboarding documentation for a library.
Hey guys, got a question about kms keys in AWS, does the default aws managed alias keys always exist in each account by default, and there's no way to get rid of them, only remove permissions for those keys?
E nvm I got my answer, can't get rid of them
Same and it's hell
Hi, I have been stuck at one problem for a while and I need your help guys.
I'm new to regex and I'm unable to parse addresses with it
I'm working on text extractor that extracts address for helping people who are affected by Covid
but I'm having a hard time figuring it out how to extract addresses with it
Real Example Addresses:
Apollo hospitals jublihills , Hyderabad
Location :Mata Roop Rani Maggo Hospital, Uttam Nagar, Delhi
Address: Yashoda Hospital Somajiguda.
Address: Rama Hospital, NH-9, Delhi-Meerut Expressway, Near Mother Dairy Pilkhuwa, Hapur (Ghaziabad)
Hospital: Pinnacle Hospital
Hospital name: medicover arilova
Hospital : Sparsh Malhotra Hospital Location: Agra
Suyash hospital raipur
Depends how the format is for the addresses.
