#tools-and-devops
1 messages · Page 61 of 1
Will the Rasberry pi automatically create a wifi?
I don't know anything about network device in RPi, maybe it's possible to create WiFi network
Your welcome
is there any good resource on openStack
how to approve own pull request?
There is no way in github to approve your own PR
is there a way to bypass the request needed thing? can i disable it somewhere?
You need admin rights to disable it, which will still allow you to force merge it even without the required reviews
Not sure if this is the right channel for this but i have a github project where i have certain tags based on priority and i want those issues tagged with it to be moved to a certain project column, is that possible?
not with the built-in automation, you can diy it with github actions though, see https://github.com/marketplace/actions/move-labeled-or-milestoned-issue-to-a-specific-project-column
Hi, whats the best liscense to put on my github repo if i want to give all permissions to the users like every permission except i dont want to be responsible with what they do
and no warranty
Look into MIT, ISC, BSD-0, BSD-1, BSD-2, and BSD-3.
MIT is the most common choice.
The BSD license give you some more choice since there are 4 of them.
ok thanks
Also how can I delete an already pushed commit?
I know re writing history is bad but I leaked my creds
look into git reset. The hard option preferably
then force push'
it keeps saying fatal: Could not parse object 'c8533afbdf9e6de01c66e54f99ad5ba390ab6a05'.
I ran git reset --hard c8533afbdf9e6de01c66e54f99ad5ba390ab6a05
Hi, I currently have 2 branches main and dev. Whenever I commit into main, I also want the commit to be present in dev. Basically auto-merge when a commit into main is made
It's likely achievable with git hooks, but I've not tried something like this myself.
Why do you want this?
Depending on frequency of commits, you may just end up with an insane amount of merge commits.
Because the dev branch should be the latest & greatest. If I am commiting or pushing to main, it should also be present in dev
oh
well nevermind then
I think you got it backwards. You should be working on branches and then merging those branches to master.
Well, I guess it's "main" now, not master
Alright, thanks
You can avoid merge commits by rebasing instead, but this will be disruptive to anyone using the dev branch because it will re-write history. So it's practically not an option.
Alright
Not if the merge startegy is rebase
oh nvm
you did mention it later
is it at all possible to use google home, but instead of google home's voice its your voice speaking back at you?
Any idea how to connect gitlab to aws pipeline. working on building CI/CD. But Gitlab is not available on aws pipeline as a source.
is it possible to override pip install command? why it does not runs setup.py install?
What is it doing instead
I am trying to customize package installation
it seems to ignore setup.py
I tried using cmdclass arg of setuptools.setup()
import setuptools
from setuptools.command.install import install
class InstallDecorator(install):
def run(self):
pass
it still installs the package
setuptools.setup(
name='...',
packages=['...'],
install_requires=requirements,
version='1.0.0',
author='...',
author_email='...',
description="...",
long_description=long_description,
long_description_content_type='text/markdown',
url='',
cmdclass={'install': InstallDecorator},
classifiers=[
'Programming Language :: Python :: 3 :: 3.8',
'Programming Language :: Python :: 3 :: 3.9',
'Operating System :: OS Independent',
],
python_requires='>=3.8,<4.0',
)
it seems pip install != setup.py install
ah it runs setup.py install for source distributions but only after installing all dependencies
but I need to override dependencies resolving
for some stupid reason .gitignore isnt working, my ide automatically creates a folder but when i try to add that to .gitignore it dosen't work. Heres my .gitignore
__pycache__
.git
.vscode
.history
/.idea
/gwatch.exe
credentials.log
tempCodeRunnerFile.py
$ git status
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .gitignore
modified: .idea/.name
no changes added to commit (use "git add" and/or "git commit -a")
@visual ridge
for running an app on gcp VM, does anyone know which host i should put when i run superset run -host {????} -p 8088 ? i've tried the VM's internal & external IP but the UI is still not loading when i run http://{??????}:8088 on my browser (outside of the VM)
I'm not familiar with gcp, what OS is the VM running?
debian 4.x i beliebe
and what os are you running to try to connect to the port?
i am on a mac; for context, i have run this setup locally and usually do localhost:8088 which worked, not sure how it differs on a VM
ok, I'm not super familiar with mac, altho I use one at work, I just wanted to know what tools you have to work with
do you know if Debian has a firewall running? if you type 'which ufw' or 'systemctl status firewalld' in the VM do you get any output?
or rather, what output do you get?
no output for either
hmm ok. how about 'uname -a' in the VM?
Linux druid-query-1 4.9.0-14-amd64 #1 SMP Debian 4.9.246-2 (2020-12-17) x86_64 GNU/Linux
oh sorry I missed the notification you replied. one moment plz
seems like Debian would be running ufw if anything, for a firewall. So let's try as root or with sudo in the vm terminal 'ufw allow 8088/tcp'.
if you get no output, then run 'echo $?' if it returns '0' the command worked. Please restart your application and try connecting from your laptop again
I'm not sure if your mac would block a port from being open or not, so I will need to let someone else answer. Good luck!
i've set firewall rule inside the VM's networking policy, but ill keep looking! thanks
if i have a dockerfile uploaded to my repository
my teammates would need to 1) download, 2) build the container, 3) run the container
is that how docker works?

Yes, that is one way.
If in the context of development, then usually one does need to build the container locally so that the container has their local changes.
However, images can be published to a registry like Docker Hub and users can pull images from there without having to build them.
Thanks! I have been working on my repo for like 1 month and never noticed that .gitignore didnt work
I'm using Docker BuildKit, and have the following RUN command
RUN --mount=type=cache,target=/root/.cache/pip pip install --no-cache-dir -r requirements.txt
problem is that the dependencies don't get cached because I have --no-cache-dir. Is there anyway to cache the dependencies outside the container, while not having them cached inside to reduce image size?
That seems odd. Is it really true that it will also store the cache in the image?
The cache mount should be an external mount
You cant use no cache dir because that tells pip not to write anything to the cache
can anyone help how to solve this error
what's your pylint version
In order to run my python program, I need java installed in the system (I'm using jpype). Now, I'm trying to dockerize this program. How can I install and use java in the image in an effective way? I know I can just use from ubuntu and install jdk in it. But I want to obey best practices.
I have tried FROM openjdk:11 as base and copy from it but couldn't make it.
you will need to install OpenJDK into Python Container or Python into OpenJDK container or build your own from scratch that does both
Okay, I have installed jdk in a python based image. For multi-stage building, how can I copy the jdk into another stage? No boilerplates, just jdk? I have tried copying from /usr/lib/jvm/java-11-openjdk-amd64/bin/java but seems like it's not enough. jpype needs libjvm.so too and I don't know how many other dependencies it has and unfortunately it's very time consuming to find out manually
You copy your own code
you do not copy stuff like that
apt get install or whatever works your image
your final container will need JDK and Python interpreter
But, for example, for the sake of lower image sizes, you first install python dependencies in one stage and copy these packages into final image. I just want to apply this for java too. If you say it's unnecessary I can understand. I just want to do the best practice
Container Size isn't a problem per say
And no, why would you copy out the python dependences? Most Python Containers are just "Copy in requirements.txt" "Install packages" "Run main.py"
Like here is this server bot dockerfile: https://github.com/python-discord/bot/blob/main/Dockerfile
it's single stage build
that's if you have stuff to compile
https://pythonspeed.com/ <-- this is what you reference when you can get your application running in docker
you haven't made it there
And your docker container is going to be a mess, you are throwing in Java nightmare
Only article you need to read is: https://pythonspeed.com/articles/alpine-docker-python/
When you’re choosing a base image for your Docker image, Alpine Linux is often recommended. Using Alpine, you’re told, will make your images smaller and speed up your builds. And if you’re using Go that’s reasonable advice. But if you’re using Python, Alpine Linux will quite often: Make your builds much slower. Make your images bigger. Waste you...
Okay thank you, there are lots of articles
and really, storage space isn't that expensive these days
I mean, I run install default-jdk and it installs fontconfig amd64 2.13.1-2 [405 kB] etc which is unnecessary. I don't know if openjdk has these, but you get the point
Seriously the build time is not a huge issue, I just use a ubuntu docker. We don't have a space issue so i'd rather just have a good base image with lots of my common stuff shipped in our image repo, then do a quick build and apt-get what we need. Plus we utilize a squid proxy so i get 600 packages within a couple seconmds. ez pz
Do you know java enough to say it's wrong? You are trying to optimize something before you have it working, wrong order, working, then optimize if required
Generally it's not but Alpine is nightmare for several reasons, not all of them to do with space/build time reasons
I just love having a good docker instance that i can get into and have a good set of tools if there is a problem thatis hard to debug (intermittent problems etc).
The selling point of alpine is that it is a minimal image. So if you're not concerned with space then you shouldn't be using alpine anyway due to its other downsides mentioned in the article.
How to avoid merge commits when merging main to feature branch?
i pushed to main instead of feature
Rebase rather than merging
ah so how would i rebase to merge commits from main to feature?
git fetch origin
git switch feature
git rebase origin/main```
ive successfully 1) built and 2) ran my docker container with my app
docker desktop shows its all good
i think, however, ive messed up the ports. it has a flask component which is supposed to use port 5000
and ive also exposed that port in the dockerfile
but when i try to open it locally, its not connecting

Thanks!
Also how to amend particular commits that I have already pushed, I made a couple of spelling mistakes. For example a commit 6 commits ago, how would I do that?
an interative rebase is probably what you want here. You can also fixup the old commits with the small changes and then autosquash, although I haven't used that myself
You'll have to run the flask server on your network. In Django this is done by python manage.py runserver 0.0.0.0:8000, I don't know the flask equivalent though.
Hi,
I am a QA Engineer and I am trying to learn docker. I understand that docker allows you to specify a specific step-by-step way to set up your project such that anyone can have all the requirements needed to setup and run such project on any machine at any given time without worrying about anything else.
As a QA Engineer, my challenge is that I get stuck trying to get a chrome driver and a selenium library to be included in the script such that it can run. Who can help get past this obstacle? More importantly, who can break it down for me like I am a novice because I think I have got myself confused.
a common solution we use is shipping the actual selenium in a different container so it can be started/managed independently from the tests container
so the test bundle itself comes without selenium and the test running gets it included via config (either ci as a extra service or locally as a extra docker container) plus it enables updating the browser images independently
depending on your internal/deployment situation in the company you could also have a selenium cluster setup be deployed with chromium and just have your app test container images use that
I am actually learning on my own so everything is local on my mac, no company set up for now. can we chat privately?
no private chat for now
Ok, so what I have tried to do was bash into the base image say python:3.7-stretch, then see if I can run everything from there but I get stuck at the point of getting a chromedriver and selenium
You need to write a Dockerfile.
If you just install stuff in a shell in the container, it only applies to that specific instance. That's what a container is - an instance of an image.
Writing a Dockerfile enables you to build an image from which you can spawn containers consistently
I understand that I need to do that. I just want first run the same commands from the shell then run history to copy all the commands. and create the Dockerfile with it
Installing selenium shouldn't be any different in Docker than it would be on your local machine.
Granted there are some optimisation that can be done to make the images smaller but don't worry about that for now
So I can just run a pip install -U selenium or include it in the requirements.txt file?
Yeah. You can use pip if you're using the python base image.
yes I am doing that
Thanks @tawny temple the next issue is the chromedriver or geckodriver, how do I install it globally?
I'm not familiar with installing it, but why would following the standard installation instructions not work? Also, have you checked if someone else already published an image with it in Docker hub or another public registry?
@orchid tartan as i said earlier, i wouldn't include any selenium driver into the test images, and instead use one of the official selenium driver images
@vale wedge Thanks
Hey guys - if it helps, we created a Django starter project generator. And this includes Dockerfile and docker-compose...so you might be able to simply reuse this. https://github.com/imagineai/create-django-app
Hi, my docker file is in Project/docker. I want to add everything in Project, how would I do that?
and this is done after you build and run the container right? i will try with the 5000 port. thanks
Generally it’s easier to leave dockerfile in root
If anyone here is familiar with linux machines, I can't get pip to work. It returns an error /usr/bin/python3: No module named pip
Can you try python3 -m ensurepip
If not, try the package manager, ik on Ubuntu it can be done with apt install python3-pip
I'm on kali but I'm pretty sure it's the same
anyways, it returned this: E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
What happens when you run the suggested command?
Hold on lemme send a pic
Text should be fine
Alright anyways, what do I do when it says this:
Tbh, it might not be a good idea updating the system. Due to what kali is used for
It's usually a set toolkit
So updating might cause issues
But pip won't work without updating it?
Well is this a vm?
Mhm
Give it a try, worst that can happen is a remake of the vm
Alright
Also, if you require more help it might be worth grabbing a #❓|how-to-get-help to clear up this channel. Please ping me if you do
Ok it printed a couple lines in terminal and updated successfully I think
There's still one problem
It still says there's no module named pip
Alright I did sudo apt-get install python3-pip and I think it may've worked
Alright it worked
Kali comes with few packages. It’s designed for those who know security and Linux
Just as FYI
oy
oy oy oy
how can i re-route a nginx request to a docker container
like
i got nginx running on my sever but the web server is a docker container
You need Load Balancer
Been away from the language for a long while, only did some parsing mainly so nothing too deep. I see there's a lot of virtual environment stuff now, any recommendations or tips to keep the bloat down for multiple projects?
Hi, whats the best workflow for github? Others make pull requests into the dev so if I want it in main then whats the best practice? To wait like 5 more pull requests and make a pull request from dev to main? Or rebase it, how do you do it?
Sounds like what you're describing is the "git flow" workflow.
It seems unnecessarily complicated. You can just target main directly with your PRs.
Need help with Django channels ERROR:-ValueError: No application configured for scope type 'websocket'
Hi, how can I link specific places in readme.md? I have seen others do it, it looks like this: https://github.com/user/repo/README.MD#place-1
in github
@visual ridge github (and most markdown parsers) automatically convert all headings to links. So basically you have to start the line you want to link with # (number of hashes depend on whether you want the link to be an <h1> all the way through <h6>).
git clone git@github.com:myusername/foobar.wiki.git
https://stackoverflow.com/q/15080848/
thanks a lot
How do i restore to a previous commit in git using command line
to restore old files during commit?
nvm i did it
Hi, how to open a pull request and merge it again? i accidently deleted the merge pull request thing
is there a way to get around this in the postgres docker image?
I want the entry point scripts to always run when the container starts
The PostgreSQL object-relational database system provides reliability and data integrity.
Change image's entrypoint
the entry point only runs when the data-folder is empty
how will changing the image entry point make it work even tho the db has data
It seems that you need to change those lines in docker-entrypoint.sh: https://github.com/docker-library/postgres/blob/master/13/docker-entrypoint.sh#L292-L315
I mean - remove conditional execution of this code
I don't know how to do it simpler 
maybe I need to change my implementation
What is the real problem? What are you doing?
I have folder which has .sql files responsible for creating tables in the database.
I have this as entry-point
volumes:
- ./bot/postgres/tables:/docker-entrypoint-initdb.d/```
I want tables to be created whenever a new `.sql` file is added to the folder without erasing data (`docker-compose down --volumes`)
I have a discord bot connecting with the db with the help of asyncpg
maybe, I should create the tables using asyncpg instead of the entry point
You can execute new .sql files already after creation from Python container but store them in docker-entrypoint-initdb.d directory too to recreate database after container restart or something
right
Hi everyone, this is my first post in Python Discord so I'll try not to make it stupid. Does anyone have experience using locust for load testing? I'm looking for a framework for perf testing, and locust keeps popping up (and please let me know if this is not the right channel for this question). Thanks!
Hi, i'm trying to put these two scripts into separate instances but VSCode is giving me a hard time letting me do that. any suggestions?
windows filesystem or linux filesystem?
this is the best place im guessing to put this question
yknow how programs can associate themselves with a file ending
how can i do that with a script
Depends on the operating system.
Also I wouldn't say this channel quite fits your question. Don't get too caught up in the idea that all questions have to fit a topical category. Not all will, and that's why we have general help channels for you to claim.
Eh I suppose close enough, I'm not gonna argue over it. Anyway, on Windows, it would be set by modifying the registry. You wouldn't even need to use Python to change it. You could use the registry editor or create a .reg file and execute it once.
Alright thank you
Probably
Hmmm
I recently had to reinstall python
and the problem is with pip
at the moment, pip3 works but pip is broken
' Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources'
this occurs every time I try to use pip
and all attempts to reinstall pip yield: pip in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (21.0.1)
has anyone included html - that is generated by coverage.py - in sphinx docs?
i've tried a few possibilities but im struggling a bit
actually, just included the entire coverage dir into _build/html/_static/ and included it via a raw html directive, so it's not that difficult 🤷
Anyone know web or library or editor plugin that can show how a Python code flowing in the background (show sequences in arrows & tables)?
I've seen it but forget where is it.
Yeah there's a website http://www.pythontutor.com/
I have a webapp consisting of a Django backend and Angular frontend.
right now everything is in the backend repo (Angular served as static files)
and I manually build the frontend and copy it over
how could I set it up as frontend and backend in two separate repos, and each time I push either, I run a frontend build if necessary, updating the combination of the two, and deploy it?
I’m not even sure where to start tbh
Thank you 👍
At work, we store Angular with it's Backend in seperate folder so it would be like /root then /root/django and /root/angular
and it's two docker containers, one with Nginx/Angular which is built via multi stage docker and other being django
so you host/deploy them separately too?
how do i pass a string from one github actions step to another
i know i can hard code them as an env variable if i know what it is apriori but something that comes out of a build step
Yes, obviously at small size it doesn't matter but at scale, your backend will require more scaling then frontend will, also, you might want to decouple them
yeah that’s what I was thinking I wanted to do
sounds better from a devops perspective
yea, just make sure your angular app endpoints are configurable
so like target domain.com/api or something
yup, already are
where do you host?
and is it very complex? I haven’t done this kinda thing much tbh
at work? We are moving to Kubernetes
I mean, which provider
We use GCP at work
I'd consider something like Digital Ocean though
I was originally planning on Heroku
Any ideas what I am doing wrong?
apiVersion: apps/v1
kind: Deployment
metadata:
name: user-deployment
labels:
app: user-service
spec:
selector:
matchLabels:
app: user-service
replicas: 2
template:
metadata:
labels:
app: user-service
spec:
containers:
- name: user-service
image: sneakykiwi/hyplex-user:v0.0.1
ports:
- containerPort: 100
---
apiVersion: v1
kind: Service
metadata:
name: user-service
spec:
selector:
app: user-service
ports:
- port: 100
targetPort: user-service
error: error parsing deployment.yml: error converting YAML to JSON: yaml: line 9: did not find expected '-' indicator
I hope it's kinda tooling.
I have a docker related question. How would one do the following?
I have a file with 100 ids. My script reads the file and randomly selects 20. Those it then uses to send messages to message queue. I dockerized it with the file and it works fine. I see messages from those 20 ids in the queue.
I would then like to spawn another container (from the same image), and have it to use different 20 random ids.
How would I communicate between them which Id's from the file are still available?
Have the file in shared volume, instead of container, and maybe write another file with already used ids? I'm not sure that would be "safe", when the containers will spawn both at once. My goal is to be able to spawn up to 5 containers to use all the 100 ids.
that solution looks pretty good to me, what's the problem? @analog kiln
I'm not sure, how fast the read/writes will be, if the 5 containers will be started at once. It may also result in some weird output in the "used_ids" file, righ?
does anyone here have any sort of experience with sneaker bots or auto fill tools??
i recommend https://www.youtube.com/watch?v=NNZscmNE9QI
Ever wondered how to make a sneaker bot? You should watch this video!
Check us out at:
https://pythondiscord.com
https://discord.gg/python
Is there a tool available that will allow you to see which files your team have changed in another branch? Something to speed up communication to prevent conflicts
Preferably in the IDE itself (Jetbrains)
How about git diff --name-only one-branch another-branch?
Some of GIT GUI tools might or do a pull request and see what GIT complains about? Biggest problem is your workflow setup though
version: "3"
services:
app:
container_name: apptest
env_file:
- test.env
build:
context: .
dockerfile: ./test.Dockerfile
depends_on:
- mongodbtest
mongodb:
image: mongo:latest
container_name: mongodbtest
env_file:
- test.env
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD}
MONGO_INITDB_DATABASE: ${MONGO_DATABASE_NAME}
ports:
- ${HOST_PORT}:${CONTAINER_PORT}
seems the environment vars from test.env isnt exactly loading because i'm getting this error
docker-compose -f docker-compose.ci.yml up --abort-on-container-exit --exit-code-from app
WARNING: The MONGO_ROOT_USERNAME variable is not set. Defaulting to a blank string.
WARNING: The MONGO_ROOT_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MONGO_DATABASE_NAME variable is not set. Defaulting to a blank string.
WARNING: The HOST_PORT variable is not set. Defaulting to a blank string.
WARNING: The CONTAINER_PORT variable is not set. Defaulting to a blank string.
ERROR: The Compose file './docker-compose.ci.yml' is invalid because:
services.mongodb.ports contains an invalid type, it should be a number, or an object
not sure whats causing it
try removing the - from the last line
Does anyone know a simple way of starting the depended container before building the application?
version: "3.9"
services:
reiz:
build: .
ports:
- "8000:8000"
volumes:
- .:/app
depends_on:
- "db"
db:
image: edgedb/edgedb:20210320022940b2b91d
ports:
- "5656:5656"
volumes:
- ./data/db:/var/lib/edgedb/data
environment:
- EDGEDB_PASSWORD=edgedb
The dockerfile for the application itself consists from many steps, and from like step 7+ it requires database access. Though when I run docker-compose up it tries to build the application image without actually starting the depended database. Any ideas?
I've only seen the naive solution of polling the db connection in the app. It works well though
Docker itself has no knowledge of when an arbitrary program it's executing is in a "ready" state.
You're doing this in a build but I don't see why polling wouldn't work in that context too
It doesn't start the DB until it builds the dockerfile, so it is a bit tricky. I ended up with putting all db related stages in the same script and do my own cache layers (checking certain things to see whether I should execute a command or not). It kinda solved, but definitely not the best approach.
Hey I'm on Arch Linux and I'm trying to install Spyder but I get a dependency cycle. I know it's from vim and python but I really don't want to uninstall my vim RC files
Any ideas?
guys how to create a new folder in desktop by using linux terminal
any idea or is it impossible?
??????????????///
@wicked bane can't you just $ "cd desktop" and then $ "mkdir nameGoesHere"
with the CD or the mkdir?
I don't use linux xD
How can I download tools from github and use it?
@wicked bane cd ~/Desktop then mkdir folder_name
Hey I just had a quick question, I'm getting back into python after a while. I'm wondering where the best place is to install python modules?
what OS are you using?
Most people just use PIP
someone who use visual studio code and github help me pls
Hi, when I doing git add . It gives me a warning
The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in myfile.
It replacing LF with CRLF breaks my html, js and css pages. How to stop this from happening? I am on Windows
Create a .gitattributes file in the root and add the following to it ```
*.html text eol=lf
*.css text eol=lf
*.js text eol=lf
If you want all text files to always be LF you can do `* text=auto eol=lf`, but this imposes line endings on Py files too, which some contributors may find problematic.
alright thanks
A gitattributes file is better to use when working with other people, but you could also configure it on your local machine by chaning the core.eol setting and core.autocrlf. I believe the former would be lf and the latter false to force everything to be converted to lf on check out.
Or maybe autocrlf needs to be input... not sure.
got it
what (free) programs do you all use for those fancy architecture diagrams?
Hi, does anybody have experience using invoke with python-based build automation tools like doit or luigi?
Im trying to play music through speech, this is the code:
import pyttsx3
import speech_recognition as sr
from playsound import playsound
import multiprocessing
r = sr.Recognizer()
def take_commands():
try:
with sr.Microphone() as source:
print("Listening...")
voice = r.listen(source)
info = r.recognize_google(voice, language='en-in').lower()
return info
except Exception as e:
print(e)
print("Say that again sir")
def Speak(audio):
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
engine.say(audio)
engine.runAndWait()
if __name__ == '__main__':
while True:
command = take_commands()
if "exit" in command:
Speak("Exit now")
print("Exit now")
break
if "play" in command:
p = multiprocessing.Process(target=playsound, args=("play.mp3",))
p.start()
cmd = take_commands()
if "stop" in cmd:
p.terminate()
Even though the music plays I haven't figured how to stop it or better pause it by just saying "stop". What's the easiest way to do that?
https://app.diagrams.net/ gets the job done quite nicely.
thanks! ended up using this one
Hello guys, I'm new here and in this language. I learned the basics of python a few weeks ago and I want to improve my knowledge in that language, knowing that I already know the basics will there be any free course that I am recommended to take?
check out freeecode camp @heavy knot
Tutorialspoint and w3schools
@turbid tusk Try pygame mixer to play music. It has functions like mixer.pause() and mixer.play() to help you out!
thank you even tho i think the problem is when the music plays it doesnt take any commands if i speak until it ends
i get you. when using pygame mixer,when you speak in the midst of music playing, you can call mixer.pause() to stop playing and listen to commands being spoken.
Just code it to record for input when you press a hotkey or some button so that it doesnt always listen for anything being spoken.
Thanksss
Heard from some of my peers that pyinstaller will allow you to run a script(s) on a machine that doesn't have python installed. In a nutshell how does this work?
I gather that pyinstaller 'brings' all the information that's needed to the new machine, but doesn't need to install python?
From a 25k feet view, how is something like this possible?
Does it make a docker container or something?
PyInstaller packages the whole program with the python interpreter
Hey, thanks for the response. Interesting, forgive me, but what do you mean by the python interpreter?
Python Interpreter is what allows you to run python programs
ok, and Python Interpreter is on every windows machine?
PyInstaller “packages” that with the program you’ve written
Right
Python interpreter is not on every windows machine
It is what you download from the python website
When it’s already in a .exe form, the program will not have to download anything
Because the interpreter is basically inside it
I'm hearing conflicting things here.
Okay so here’s how it goes
First you download python from the website
Then you write your program
Using the python you downloaded you can install a package called pyinstaller
Now to run pyinstaller you need python
When you use pyinstaller on the program that you’ve written it will make a .exe file
In windows at least
Now with this .exe file, you won’t need the python you downloaded again
You can just run it pretty much
And it also will not download anything unless if your program is a program that downloads something
This is possible because the python you downloaded in the first place is “copied” inside the .exe file or whatever file pyinstaller produces
Ah, ok, so the .exe 'brings' python over to the new "python-nieve" machine
Yeah
And then, when the .exe is clicked, it installs python in, idk, a "temporary dir" -or- just places it in memory?
Yeah it doesn’t install it if i remember correctly and just directly executes it so it’s just in memory i believe
That's wild!
Slow, I'm sure, in comparison to having it installed 'traditionally'
but so cool!
Yeah i don’t know most of the intricacies but that’s the basic gist of it
Thank you!
Hey guys, - I've just finished creating my first proper project but researching how to deploy is leaving me totally overwhelmed. I'd like for me and a colleague in a different country to be able to run the script from anywhere. I'd like to do it as cheaply as reasonably possible and I would prefer it if the source code wasn't externally accessible. Originally I was planning just to upload the scripts to some shared hosting I have and use PHP to create a little web-based UI for it, but it turns out my plan doesn't allow me to install python on the server. I'm happy to do lots of reading and learning but with all the information out there about AWS, Kubernetes, Docker Containers, VMs and stuff I don't know where to begin. Can anyone point me to a starting point?

hmm, dockerize your app, if the hosting provider has some sort of k8s platform then it's all easy afterwards.
Forgive the ignorance, but k8s = ?
kubernetes
probably the best place to learn k8s that I have found https://learnk8s.io/blog/what-is-kubernetes
Thanks - I've been plugging away at the google tutorials, but I think I'm getting to the limit of my understanding so any resources are 100% appreciated
Hi All, I have small python program that I would like to transfer to multiple computers, but I don't want to spend the time to install Python and the various modules necessary to be able to run it
Is it possible to package the installation of those into one executable source?
You could also look into a virtual private server for hosting.
It is, although I do not know exactly how to offhand.
Yes. Look into pyinstaller
idk where this question fits in but why does it show this error when i try to play sounds
/usr/bin/python3 /home/chrispy_/os.py
Traceback (most recent call last):
File "/home/chrispy_/os.py", line 2, in <module>
playsound('startup.mp3')
File "/home/chrispy_/.local/lib/python3.7/site-packages/playsound.py", line 92, in _playsoundNix
gi.require_version('Gst', '1.0')
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available
chrispy_@penguin:~$ /usr/bin/python3 /home/chrispy_/os.py
Traceback (most recent call last):
File "/home/chrispy_/os.py", line 2, in <module>
playsound('startup.mp3')
File "/home/chrispy_/.local/lib/python3.7/site-packages/playsound.py", line 92, in _playsoundNix
gi.require_version('Gst', '1.0')
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available
Has anyone had the problem that you have a hand full "applications" that you develop and all of them use some libraries hat have been developed internally. The libraries are deployed to a private repository. So when you need to extend a lib for new case in one/more application/s, you have to, import it differently (ex. with pip install -e), do the change, build and deploy the lib, then all other applications have to be retest to be sure that no unwanted sideeffect happed... This is kinda tedious. Anyone having this problem? And maybe an idea for a better approach?
Do you do automated regression testing?
versioning ?
Library should have automated testing
yea thanks
how do we get out of pygame infinite loop
whenever i click the pygame x button it says not responding
Hey guys, I've build a django application that runs daily resource-intensive data analysis tasks via celery workers. These tasks can take hours to complete since they use beefy machine learning models.
I'm wanting to deploy this onto AWS such that when I run these analyses, the resources scale proportionally (the tasks need lots of memory and a GPU). I looked into deploying the api onto an ec2 instance and using redis with fargate tasks to offload the periodic heavy processing. However, the tasks need to access Django's ORM so I'm not sure if that solution is possible.
Does anyone have any suggestions on the best way to architect this? Any help is appreciated.
is it possible to increase pixel size in pygame??????????????////////
how are you creating the docker image and running it? Do you mind sharing your Dockerfile?
and the Dockerfile?
WORKDIR /home/node/app --?
USER node --?
FROM node:8
USER node
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH=$PATH:/home/node/.npm-global/bin
WORKDIR /home/node
COPY package.json .
RUN npm install --only=prod
COPY . .
the above Dockerfile seemed to have solved it for guys.
try on your local machine, perhaps?
hmm, donno much about docker-compose though.
import re
def check_links(content):
pattern = re.compile(r'(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?')
matches = pattern.finditer(content)
if matches:
for match in matches:
if str(match.group()[0:20]) == 'https://discord.gg':
print(match)
else:
print(match)
random_links = "https://stackoverflow.com https://www.youtube.com https://www.youtube.com https://discord.gg/"
check_links(random_links)
hi i want this to print the link name if it comes across a discord link but i am not getting an error but still it isn't printing the link name someone pls help
can someone pls help
"https://discord.gg" is not 20 chars long
just do match.group().startswith("https://discord.gg")
hello world https://github.com/Delta-Azura/Azura-in-python/blob/main/src/Azura.py please can someone check if the code will work
especially the var local and name, i don't know if they where work on os.system commands
If I make a branch, make a commit on that branch, then delete that branch, is that commit gone?
apparently not
(which is what I want, actually)
Hi everyone
Is it possible to automate input into a website
for example, if had to input certain information everyday to get a file from a website, but I wanted to automate that process, is that possible?
will Selenium be able to do that?
I'm not knowledgeable enough to give a complete answer, but a branch is just a reference to a commit, so deleting the branch does never delete a commit directly, but the commit may become unreachable (if no other branch points to it or a later commit)
however it seems that even unreachable commits aren't deleted immediately, and you can recover them
there's a garbage collection mechanism explained here: https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery
If deleting the branch would make commits unreachable, git should warn you though and require the force flag
@iron basalt thanks, it sounds like your understanding lines up with the explanation I found
the use case is that I have my resume as a latex document in a git repository, and I want to know the version that I sent to each listing. The goal was to have them indefinitely without having to have so many branches, but I guess I can just delete those branches once I no longer care about how that application turned out.
I think you want tags
That would allow you to keep a reference to a commit with a description
I thought tags were specifically part of GitHub
No, github's releases integrate with tags, but tags are a git concept
so is a tag a reference to a commit that doesn't move when a new commit is made?
Its a reference to a commit with some optional description attached to it, and you can checkout a tag like you'd checkout a branch
And list all tags in the repo
So if you wanted to mark a commit with something like "Applied to Deloitte with this revision" then I think tags are exactly what you want
@iron basalt that sounds interesting. Thanks!
yea no worry
What I'm googling for the moment is what happens if you make a branch, make a commit, tag that commit, and then delete the branch
Yeah I believe it can.
How can I download the contents in a requirements.txt file using pipenv. Thanks
Pipenv can construct a Pipfile from requirements, as documented here: https://pipenv-fork.readthedocs.io/en/latest/basics.html#importing-from-requirements-txt
Thanks I'll look at that
why does pipenv hate me
I have pipenv and pyenv installed, and i somehow have been having so much trouble with them
i installed pipenv from apt
oh now its this error
does anyone the code quality widget in conjunction with gitlab CI?
for the life of me, it does not work, and as far as i can tell, it doesn't work for anyone
How can I make a python package that includes a .net core executable? That is, if someone were to install my package, it would build the executable from source so that my python code can use it.
Any good terminal-based debugger for Py? I found pudb but would like some more recommendation
any terraform geeks here?
Ptpdb, ipdb, pupdb and pdb++
If your bot grows, it quickly won't be enough
I run postgresql and my bot on that lowest end VM and it's a steady 3-4% of CPU usage only
ooof
My bot is for a few private servers only though
mhm my bot is public and is alr in 25 servers
You can get more performant VMs for not too much
seems like the way to go
as i have a ups so power cuts wudnt be an issue
The rpi will be limited by your internet connection speed
100mbs?
Can't say how it'll behave
👍
Hi guys - I'm looking for a way to run 'virtual IoT devices' - I want to make some applications that interact with IoT devices, but I have no IoT devices to test on. Anyone know of any software/solution that lets me setup virtual cameras, sensors, etc?
preferebly something free I can run on my own PC.
shouldn't it be enough to fire up some containers that fake it?
Hello, I'm working on a prometheus exporter for atlassian APIs, I require some assistance with some basic decorator concepts. If you are available to help or keen to learn about this topic please reach out. I have detailed the problem on this reddit post:
https://www.reddit.com/r/devops/comments/meowye/making_a_python_prom_exporter_for_atlassian_apis/
I'll try them out, thanks for the suggestion
Hi, github is saying I have conflicts but I do not understand..
i tried setting up a mysql server that runs on docker locally and it asked for a password even if i dind't even set up one yet
https://phoenixnap.com/kb/mysql-docker-container i followed this tutorial
lol i checked the logs and it had this
how would i rerun it so that i have the option of specifying my password
you don't, you destroy the container, make a new one and run it with the right env
yeah i know how to destroy it and make a new one, i don't know how to make it allow me to specify a password though
docker run --name=[container_name] -d mysql/mysql-server:latest this is the command that i ran and it just makes the container and randomly generates a password haha
i googled the image - and https://hub.docker.com/_/mysql pretty much says to just set the env vars on the cli, and gives examples
MySQL is a widely used, open-source relational database management system (RDBMS).
right thanks i'll check that out
hmm, based on what i see, its not nicely documented
btw, is there a specific reason to use mysql (my personal experience puts postgresql miles ahead)
@civic grove ah, the official images suggest to grep the logs for the password, yikes
oh i'm just learning how to use docker haha
so if you use the official images, the official solution is outlined at https://dev.mysql.com/doc/refman/8.0/en/docker-mysql-getting-started.html, which includes grepping and setting a password
although i might actually just use postgres
yikes
anyone had an issue with vscode and poetry? I can't seem to get it to use the poetry env as the python interpreter
every time i read something mysql its all pain and wtf again
hahaha
at least it's working now
i'll learn postgres now since those things you've mentioned sound bad
i do have a question though
if i put data in this running mysql container or anything db really, will it retain the data as long as I don't delete the container?
yes, in general there is a strong suggestion to create separate volumnes for databases
neat
i like how https://hub.docker.com/_/postgres is set up much more ^^
The PostgreSQL object-relational database system provides reliability and data integrity.
do ya'll use docker as you main environment? by that i mean you don't install anything directly into your device(language, framework-wise) at all and just use docker
I install languages, but use databases with docker
But maybe that's because I'm a docker rookie
As a development environment? No, I only use it for services that are dependencies like databases. I found it more convenient to keep the files I work on local.
Though it is possible to do what you say. I remember trying out a visual studio code feature that launched the entire program in a container and supported remote debugging, etc
Container could even be remote
(I tried it by running it on a VM on my local network and exposed the Docker socket)
That sounds nice
the reason i am asking is because my laptop has quite a small ssd and programs are kinda hard to configure on windows
if i configure docker to just live in D drive (for the images and containers at least) then i won't have that problem
Why couldn't you just put your files on D directly
i have to check out that remote feature though, i might have a use for my chromebook if that's viable haha
also are there any other useful Dev/Ops tools i should check out apart from docker/containers?
Git or any other version control software
Grep or similar (cause windows search sucks)
Scoop/chocolatey on Windows. Makes it significantly easier to manage and update installed programs
nice i do know fundamental git already, i'll check out grep
i don't even use chocolatey anymore i just do everything in wsl2 haha
hello i have a question
how can create tools for hacking for Example in kali linux
with Python
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious or inappropriate. Do not help with ongoing exams. Do not provide or request solutions for graded assignments, although general guidance is okay.
i am sorry bro until now don´t use discord and i wanna advice me someone😪😪
Start with trying to create something simpler than hacking tools
does anyone have a shout out wall code if not its fine
just so i dont need to code it
hey all, i have a win2016 server.. i've played with ci/cd in gitlab to a gitlab runner but is there any windows applications that can check my gitlab and download scripts and run them? i've been doing this manually and thinking of automating this, but is there something that already exists and does this? looking for something simple where i can push from gitlab (or pull from the windows server) and it'll just run the script
and i can rdp to the server and see it running just as if i opened a cmd prompt and ran the script
Does anyone have a recommendation for a linter to use for pull requests in git? I recently discovered this feature, and I want to play with it, but there are a ton of options and I am not super excited about researching all of them.
I am using pylint
Hi all, I want to learn python for pen testing/CTFs, can anyone give me some ideas or point me in the direction of different project ideas?
bro why
why why why
anyhow, I'm trying to set up git with github.
I just initilzed a git repo and created a github and im having a lot of a trouble
please ping me if you have any help
fwiw, I'm using visual studio code and trying to use that with git, so its doing everything for me, but im still having issues!
git branch --set-upstream-to=origin/main main
git pull
do you use master or main
I tried some of this but nope!
your local git probably initialised with master
very mucky
and for what its worth
I can delete both the github and the local git repo shit
because i have had 5 successful commands so far
probably best to recreate, yeah
total
not the github repo
just the local copy
do
rm -rf .git/
and then git init -b main
and then uhh
oof
2018
okay see you soon
!remind 3y git should be in date now
Sorry, you can't do that here!
rm -rf .git/ again
then copy the commands exact from this box, can use the clipboard icon
nah it never created one
hm
how is it initing a repo without a branch
I'd say update git in this case and try again, not knowledgable enough in git-fu to try work around the stuff in this version
I still use github desktop
yep, lemme figure out how to update it on raspberry pi os 
sudo apt update && sudo apt upgrade
^
I last updated all of my machines when the openssl patch came out
latest is git 2.31.1
wtf
I have git 2.20.5 on my debian buster install
the ubuntu install has the latest of 2.25
which is also the one that's firewalled so I need to configure a reverse proxy on it smh
no wait
debian buster is all 2.20.1 sheesh
guess I gotta build git on 3 machines at least
lmao, it had me install dev packages, but dumb me built python from source so I uh had all of those already.
or, most of them
frick i had the console open to the wrong machine
still building
I'll let you know when its done joe
kek
@deep estuary updated git
Hello
I am trying to figure out why my "pip list" in my conda environment
returns the same result as pip list on a global scope on my computer
did I mess something up?
😦
I'm trying to keep all of the dependencies for each project isolated in each conda venv
no it doesn't have anything
interesting
so I guess pip list isn't bounded by conda env
should I be using conda install within each conda env to keep them separate?
Seems to be the case
yes, please use env
virtual environment is a blessing upon pythob
hello guys, (not sure if this is the right channel to ask this, in case no, lmk and I'd remove my q)
does anybody use meld to save (stage) changes?
I'm not sure what part of the setup I'm doing wrong but meld as difftool is working good
but at the moment I decide to save (stage) changes, those are saved in tmp file and not in the actual ones
I'm talking about staging unstaged changes on tracked files (no untracked files)
I'm using meld from flatpak so I call it like this:
$ flatpak run --file-forwarding org.gnome.meld \"@@\" $LOCAL \"@@\" \"@@\" $REMOTE \"@@\"
any help? or maybe meld is not for that purpose
okay this is a stupid question but conda seems to take a lot of space on my m2 ssd
it should be possible to just put everything on my d drive
and run everything from there right?
I guess I should just uninstall it
I don't really have any projects on this computer anyways atm
🤔
hey all, are there any windows applications that can check my gitlab and download scripts and run them? i've been doing this manually and thinking of automating this, but is there something that already exists and does this? looking for something simple where i can push from gitlab (or pull from the windows server) and it'll just run the script in a cmd prompt that i can check on when i rdp to the windows machine? i've looked into ci/cd but i don't need separate images or environments, just looking to easily run small scripts..
I think it'll be easier to set it up in CI
You want your server to pull and execute the code whenever something is pushed to the repository?
ideally, or even have it check my local gitlab instance every 30 mins and if there's a new version, download that and run it
Yeah, if you do it on the server you'd have to write an application that either polls GitLab for changes or, if available through an API, receives events from GitLab.
i've played with a gitlab runner but feels like a waste to spawn a new docker or something just to run a tiny script.. in my case, multiple tiny scripts
If you instead do it in CI, all you need to do is scp the files and ssh into the server to execute a run command.
is that different that using a gitlab runner?
my workflow now is when i commit a change, i rdp to the machine, download the new ,py script and run it in a cmd window
Well, no cause isn't the runner the environment in which CI jobs are executed?
yeah.. i have gitlab runner/workflow working fine, but if i have lets say 8 scripts that do something basic (but separate) i don't need separate docker containers for each
You should look into this. You don't necessarily need to use Docker as the runner https://docs.gitlab.com/runner/executors/ssh.html
Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner.
i'll look into that, thanks.. but i was kind of hoping for something that would maybe run it on the windows environment so i can rdp in and easily see all the scripts running and their output at the same time
Hey anyone know if i use heroku free plan, will i need to add billing info even id they won’t charge me anything? Because i don’t have a credit card
That's essentially what using SSH will do
It will connect to the Windows server and you'll be able to run build commands within the Windows server.
You can look at all the options you have here https://docs.gitlab.com/runner/executors/README.html
Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner.
ty mark, i'll look into it
hmm, getting closer.. i have windows gitlab runner setup as shell executor. job is deployed to the runner, as far as i can tell windows commands are working but it's not finding my python installation.. any ideas?
Checking out fc77364b as master...
git-lfs/2.13.3 (GitHub; windows amd64; go 1.16.2; git a5e65851)
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:01
$ echo "This job tests something"
This job tests something
$ python test.py
python : The term 'python' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
last question if anyone is around.. ci/cd to a windows runner is now working but from gitlab i can't see any output from my scripts (print statements in the python scripts). is there any way to show this? i've verified the scripts themselves are running
python -u fixed this for me
I have a possibly dumb question. So i started learning (by doing things with it) docker yesterday and i encountered a problem. I installed an image and ran it so now i have a container. When i added a package in that container using its own package manager(think using pip to install packages) it did it successfully but when i exited from the container and used docker exec again to execute the container, the package i installed previously disappeared. I googled this and found out i have to commit the container and push the image.
The question is what’s happening in the background that I have to do this(commit and push)?
When you run an image then Docker creates read-write layer under the hood. You can manipulate files inside container however when you exit and run image again (as different container) new layer will be created. If you want to install some programs which will be available inside container without any extra steps then you need to create your own image using Dockerfile
Hi, how do I delete one commit without losing the commits ahead of it?
Depends on what you mean with delete, you can revert the commit which will introduce a new commit reverting its changes; or rebase and drop which will delete it from the history (and will have to redo all the subsequent commits so they'll get a new SHA)
does anyone know how to run a gitlab pipeline/job forever? i'm realizing this is maybe not the intended usage of gitlab pipelines.. but i have a job that is running a script and i want that script to run 24/7 is it possible? it seems the max timeout is 1 month before gitlab will fail the job
What does the script do?
@deep estuary so I figured out most of the git issues from last night, but I'm having another issue with it. I'm trying to be able to push to a firewalled server over ssh but its not working how it should, full issue below
basically, I have my server here at home, and a firewalled server elsewhere that can't get from github, so....
My local server needs to clone its repo to the remote server, but I cannot use git clone on the remote server since it does not have remote access to me. The only way of access goes from local to remote server, it can not connect back to me.
I'm not sure if my format for adding the remote directory is correct or not, and I do have ssh access set up for local to remote.
EDIT I'm using vsc -git integration
hello! I am currently building a CLI tool to share, update and sync GitHub Actions workflows across multiple projects. Python projects support is one of the main goals.
The idea is to create a pack of workflows that work right out the box for any Python project, yet can be easily modified.
So, my question is: does anyone have a good idea how to figure out what linting/testing/type checking tools to run on git push?
For now the best solution I have is: pip list | grep flake8 && flake8 etc. Do you have any other ideas?
Python Discord projects use Actions for CI/CD, maybe you could look at the workflows for inspiration?
For example, the bot's is here: https://github.com/python-discord/bot/tree/main/.github/workflows
thank you! yes, something extremely close to lint-test.yml, but the idea is to figure out what checks to run based on installed dev dependencies
Usually the main branch is protected by a workflow that will install dependencies, run lint & test
And new commits on master trigger a release that builds an image and pushes it somewhere
yes, i see, it also builds artifacts...
Sounds like an interesting project, but I'm probably not experienced enough to help you beyond this point
omg, this is actually a great idea to cache PYTHONUSERBASE instead of ~/.pip/cache. caching pip cache does not speed up installation at all
thank you for directions!
this is what I have for now: https://github.com/vemel/github_actions_js/blob/main/workflows_py/README.md
Any chance for some help regarding virtual envs?
i can help
hey ronny, thanks i got it.
should I install jupyternotebook globally or only in my conda env?
I feel like for this global should be fine
since I can use it for every project 🤔
thoughts?
filepath errors but in gcp

i guess i cant use gs://[bucket name]

it worked when i read it in with pandas

pycharm is being a pain here, i moved the two files in a sub folder and its giving me this error (though the program runs fine, i dislike the red text that has no option to be ignored)
does anyone know what can i do here?
PS sorry if this is the wrong channel for this kind of thing
it may be confused about how your project is structured
if your program entry-point was tessellations/main.py then you would have to do from quad_trees.Quad import Quad
but I don't think you're doing that because I don't think quad-trees (with the dash) would even be a valid module name
so if your main is e.g. quad-trees/main.py the import path is correct, but pycharm may not understand that
does anyone recommend buying kite pro? I've been using the free version for a while now but it's kind of hard to tell if im actually benefiting from it or not considering I hit my daily limit pretty quickly
Hey, I am trying to bite a problem in the butt before it happens. So I am hosting a bot and I want the bot to be scaleable. The bot by itself does not need to interact with any databases it only requests from an api. I've heard about things such as Kubernetes would this be something I should look into for this?
I wouldn't buy it just use tabnine, or intellisense unless your not worried about money then sure
someone here use google cloud?
The way k8s does scaling is by basically running multiple instances of the same app and distributing the load.
Is a distribution of load something that is possible for your bot?
Let me rephrase: does your bot require all network traffic to be received in order to function or can it work with only some of it?
If is is a discord bot, look into sharding.
Split up incoming and outgoing.
Hey, sorry I just saw this yes I think it can work with only some of it. Its legit just grabbing stuff from and api and putting it into and embed, so its not a very complex bot
Ok I have heard about that as well that's splitting up the logical processes right?
Kind of, my understanding is that it spins up new instances of the bot as needed. (sharding only comes into play when a bot is in like more than 100 guilds though)
Yeah I just looked into it I wont really need to do any sharding until the bot gets really big but I am assuming the bot would be in a couple thousand servers.
Sharding won’t help if bot gets stuck in Asyncio nightmare
Ok, so I guess my question is should I still use docker containers? Or is there any auto deployment things that could help.
You don’t have DevOps problem software design issue. Containers won’t matter
It's not a problem that I am currently having I just wanna have my deployment planned out so when It is time I am not gonna be screwed over by a whole lot of things. I mainly just wanna know whats a good way to incorporate scalability to a bot?
I have the weirdest problem.
My entire project folder is read only
when I unset it, it gets set back
I think git might be doing it
I'm on Win 10
Ok, problem solved: I closed a bunch of stuff, including explorer windows
now it works
I think Windows isn't very good about informing the user why something is failing
in classic Windows ™️ fashion
Yeah I wouldn't be on it if I had a choice.
git checkout -q source-module
error: you need to resolve your current index first
@deep estuary
you have a merge conflict
…why does that link give me an opt out for every single site that uses its site
¯_(ツ)_/¯
TIL this is a thing
Is pyenv widely used?
I would like to set up a local python environment so I don't have to worry about Gentoo policy when trying to get stuff to work with Python.
can someone help me on #help-grapes?
virtualenv is the most popular
does anyone know a discord server which is specifically for tools/devops/editors?
How do i repeat similar steps acorss multiple sheet in powerBI?/
PowerBI has Powershell module, that might have what you need. https://docs.microsoft.com/en-us/powershell/power-bi/overview?view=powerbi-ps
I think so yeah, it's a great tool
keep in mind that pyenv manages python installs, it's not a replacement for virtualenv
there is also pyenv-virtualenv, which extends pyenv to manage python installs and virtual environments
Thanks everyone.
I already have python 3.9 and python 2.7 installed on my Mac. Now how would I use pyenv. Do I need to delete my existing python versions?
https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Setuptools-Entry-Point can someone help with this?
No, if your system came with Python installed you shouldn't delete or change it; your system probably depends on it
Take a look at the installation instructions, it's very easy: https://github.com/pyenv/pyenv
You system installs can live alongside the pyenv-managed ones
i tried to upgrade my pip and the upgrade broke it , it won't work anymore i run windows 32 bit
How about python3 -m pip?
Hi, how to do continuous deployment for a dedicated vps? I am using SSDnodes
with github
config = ConfigParser()
config.read('config.ini')
print('Logging out')
LoggedIn = False
config.set('main', str('LoggedIn'), LoggedIn)```
error:
`Traceback (most recent call last):
File "main.py", line 97, in <module>
config.set(str('main'), str('LoggedIn'), LoggedIn)
File "/usr/lib/python3.8/configparser.py", line 1200, in set
self._validate_value_types(option=option, value=value)
File "/usr/lib/python3.8/configparser.py", line 1185, in _validate_value_types
raise TypeError("option values must be strings")
TypeError: option values must be strings`
You are not allowed to use that command here. Please use the #bot-commands channel instead.
How do I make it a string?
str() dosent work
Please ping me when you reply
If you reply
Try to reinstall Python then
Hello everyone! I decided to try combo of pyenv and poetry. But I have some troubles with adding dependencies(
I've already created the question on stackoverflow: https://stackoverflow.com/questions/66776560/cant-add-any-package-with-poetry-while-using-pyenv?noredirect=1#comment118247643_66776560
Maybe someone can help me with my situation?
Talk Python has a livestream with Rob Richardson diving into some of the git internals, it's pretty fascinating stuff!
https://www.youtube.com/watch?v=gdY_RpY2oyU
We dive deep into the .git folder and git internals with Rob Richardson on this live stream of the Talk Python To Me podcast recording. Join us to be part of the show!
Got a question about github. I've got a local repository using github. I wish to add files from another folder to this local repository. Can this be done? Is it necessary to have all files in a repository within the same folder?
@umbral jay
That seems to be the only option now fine
didn't work
Hello there #tools-and-devops friends!
I've come down here for a possible big ask.
Could anyone here help with Git in general? In both the broad and specific senses that is. I understand the concept and how it's supposed to function, but I'd like to have a more in-depth explanation behind how each command (pull, push, commit, etc.) works, how remote servers come into play, and any tips/tricks to help in sending timely and (mostly) error-free code (for a pull request on Github for example)
P.S.
(be sure to ping me, i'm usually all over the place)
Have you seen GitHub tutorial for git usage?
Here you have a link https://lab.github.com/
I have, it's just not exactly the ideal way for me to learn. I do better with someone who can actively correct me.
Trust me, I've tried, it's just not it.
How about trying out these commands
This lab has a lot courses like introduction to GitHub or GitHub actions and more
Bot looks very helpful
I am afraid that interactive learning can be costly for someone to give detailed explanations to you
Understandable, I appreciate what you've given @night quest and @elfin ether
Back to the grind then >:O
I'm looking to set up my development environment after years of inactivity. I use vim. I used to use pathogen with vim and some other plugins I don't remember. I was just wondering what's good with vim plugins nowadays.
I am probably going to have to relearn a bunch of stuff but I hope I am up for the task.
can anyone point me to solid tutorials for hashicorp vault in written form? https://learn.hashicorp.com/vault - these are all videos
favorite neovim plugin site:reddit.com
I'd start there :)
sorry: favorite vim plugin site:reddit.com
choose your preference, but the plugins are cross-compatible in a lot of cases
What?
didn't you want to know which plugins people are using these days?
sorry, if I wasn't clear. write the above into your search engine and you will get some hits on reddit
look for the ones dated from 2 years ago (to now) and you should find plenty of plugins and reasons why people use them
that's how I search for new plugins anyway
Thank you for the suggestion.
this is my init.vim file for neovim: https://pastebin.com/KyEtNJh0
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it's nothing special, but it might give you a few ideas
Thank you I appreciate it.
🤘
What's the community consensus on using pipenv? I like that it combines pip and virtualenv, but afaik it doesn't use requirements.txt, and I see everyone use requirements.txt. Is it just not that popular vs virtualenv / venv?
Can't tell you about community consensus, but I'm pretty satisfied using pyenv and venv for personal projects
I use venv with development docker containers.
I would recommend you stick with simplified solution until it can't handle it and you are stuck with increasing complexity.
I want to make a ddos tool using python. Is there a resource I can learn how to do this?
is it alright to answer questions such as these?
you don't really need a resource
you need to learn what a ddos attack is
then it's fairly obvious
just know that if you decide to attack networks other than your own, you could face repercussions
i Uploaded a pip package to test someting out
and it uses webbrowser
this is what happens when Itry to install that packege
because webbrowser is in the stdlib
meaning you dont need to depend on it
@vital spear
tip: before uploading to pypi, try installing it locally first via pip install .
Hi everyone! I'm trying to get a CI/CD flow going for my personal Python projects. I'm getting familiar with the language, but not so much yet with the tools around it.
I develop on my Mac using PyCharm. I have two linux systems in my network and two in the cloud. I want to use them as "test" and "prod" and deploy to them python apps in docker containers. I would deploy on the local linux machine or the cloud ones depending on use case. I'd also like to use GIT and a pipeline to get familiar with the process.
Could you recommend me what tools I need to learn and tie together to make something like this work?
Thank you!
Learn git obviously, and if you have the professional version of pycharm look into its built-in ssh and docker functionalities.
Thank you for the suggestions! I did get ssh and docker working locally, but can't figure out how to tie them all together in a ci/cd type flow. Did you come across any good tutorials for this?
Not offhand.
ok, thank you!
@modern steeple do you want the CICD to build the container, deploy, both or something else?
where can i learn python for free ?
w3schools, codeacademy, tutorialspoint, I think there are free udemy courses also.
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Check out Corey Schafer on YouTube
Hi codemation - all that you mentioned, CICD should lint the code, run the tests, build the containers and deploy on the linux hosts, depending on project
I think i've identified the tools i need - pycharm for coding, flake8 and mypi for linting, pytest for testing, bitbucket and bitbucket pipelines for building the pipeline. I'm having trouble understanding how to best wire them together and who should do what. For example how much should i drive from Pycharm and how much from the pipeline.
i would like to update to jupyter lab 3, i need to write a command in a dockerfile, does anybody has experience with docker?
Within the Dockerfile, I assume you've already got Python installed and updated with either:
FROM ubuntu:20.04
RUN apt-get update apt-get install -y python3-pip
or:
FROM python:3.9
After that you can run a pip install command like so:
RUN pip install jupyterlab
thank you:)
how would i go about making a pip package with optional params, example pip install mypackage[async] to install the async version.
what's the term i should search for to get started with this cause google failed me >.<
They're called "extras"
Or "Extra dependencies"
thank you :D
does anyone know how to force nano to convert spaces to tabs? (something like reverse -E) search shows only - E
don't use nano :P
eh if i could use anything else then i would do so
anyone with VS Code able to paste the key for Computer\HKEY_CLASSES_ROOT\*\shell\VSCode\command
gone and edited the wrong key like a muppet haven't I
Hi, accidentally commited and pushed some code containing some rather private information I would rather not disclose
I used the BFG thing (or whatever it was called), but it didn't get rid of anything, it just duplicated the commits. It worked fine on my test repo, but on my actual one it didn't work as intended and I'm not sure what's going wrong. I followed the instructions on the docs.
Anyone have any idea what's wrong?
Where did you push it to? GitHub?
Yep
What you can do yourself is remove the commit from any branches. What you can't do is completely delete it from GitHub's servers. Even if a commit is "dangling", GitHub keeps it around.
To truly delete it, you'd have to contact GitHub and ask them to do it.
To just remove it from branches, use an interactive rebase to drop the commit.
Then force push
Does that work even if there were multiple commits with that sensitive info?
Not updating the file directly, but you can browse the files at the history of those commits I think
You can drop as many commits as you want.
Thanks!
Just another question: if I drop all the commits then my local repo would still be the same as I had left off before and I would be able to commit all of those files again, so basically nothing would change except I just have less commits?
@tawny temple
Yes.
Though you don't necessarily have to re-do anything (but maybe it's easier for you than trying to salvage what you had before).
K ty
Instead of dropping commits, you could stop and edit commits.
That would let you remove sensitive info from the diffs and keep the rest.
And how would I be able to do that?
With an interactive rebase too. Just edit instead of drop
Ah ok, thanks
idk which channel fits my question, so I am asking it here
isn't with open(file, "w") as f: supposed to create a file if it wasn't found?
if so, then why am I getting an error saying that the file wasn't found?
When you don't know where a question should be asked, ask which channel is correct in #community-meta instead of picking an arbitrary channel. In this case, the correct place is your own help channel #❓|how-to-get-help
Does anyone know why I can't seem to list the GPG keys I've generated?
I've created a key pair on GitHub using Kleopatra with RSA-4096
Uploaded the public key etc
But it doesn't seem to list anything
I want to write an app on microservices with minikube, so I have these questions:
- How should I organize the git repos? Currently I'm leaning towards putting each service into its own branch of the same repo
- I managed to utilize docker hub's autobuild, but how can I automatically update the service images in minikube? I found Flux, but that thing seems too complicated for me to quickly get into
Feel free to ping me if you have something to tell, I will probably forget that I asked here
Hi, is it possible to mount a single file in host to container and vice versa?
instead of explicitly copying the files back and forth
As in, do you want to have a file in a Docker container that syncs between the host and the container?
If so, it sounds like you want a bind mount:
Example: docker run --mount type=bind,source="$(pwd)"/target,target=/app python:3.9
So lets say I have this Dockerfile to set up a Django app. I need to add postgres to it.
https://github.com/shanerowden/django-markdown-editor/blob/master/Dockerfile
https://hub.docker.com/_/postgres
Thats two images. How do I combine them into one for a production deployment.
Sorry Ive never done much devops stuff.
source="" refers to the location of the directory on your machine, target="" refers to the location in your container.
You can also do it in a docker-compose.yaml like so:
services:
app:
build: app
volumes:
- ./host/path:/container/path
You'll need a docker-compose.yaml file for that. It allows you to 'orchestrate' the deployment of two containers, based on two images, at the same time.
Thanks you.
I only want one file to be a ro mount for 2 services.
And other file is a log that I need in the host so that I can rm the container
Should I listen to this guy's advice, particularly about python and alpine linux builds?
Also, is this guide a good starting point to Docker -- good Dockerfiles and docker-compose.yml files?
https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/
too many links on that page, but yes, alpine builds will be slow, unless alpine wheels now exist
there is a PEP for that
I see. I started with uhh python:3.9-slim
They are just local links for navigation for the most part, its a pretty well organized manifesto, I just dont know who to believe about alpine
Today is my first day trying to do docker
For individual files, this might be helpful: https://stackoverflow.com/questions/42248198/how-to-mount-a-single-file-in-a-volume
essentially, python sppeds up installation of things by having prebuilt "wheels", which are platform specific in most cases. But there is no wheel platform for alpine linux yet, so you have to build from setup.py/pyproject.tml/setup.cfg
eh, no thanks. Im a pip-tools requirements man.
If you're starting with Docker today, I'd avoid alpine. python:3.9-slim will have most of what you need, so it's simpler to get started.
that sounds like what i read
that is related to how your dependencies install, not how you setup your project
Plus it's small enough as it is, imo
Ive literally never used setup.py files before to do anything in python is all.
I dont really understand the approach because I just use requirements and venvs to install
setup.py is what things like flask use so that they get installed correctly using pip
I just started doing this today since it seems important for this to be more thorough.
Mainly what Im hoping for is to find a better approach to server config and app deployment that isnt a headache. I dont have a lot of experience with prod servers. Im learning with a vps though lately
Ive spun test servers of vm before but not front facing ones
You're definitely on the right track with learning about Docker then. I'd recommend their Quick Start guide. Really helpful.
docker compose is super helpful
And then just play around with it!
cool, its just a lot to digest, but if i can systematically eliminate server config hell, I would like that
What Im trying to do is Django, gunicorn, nginx, postgres
I have the django + nginx + gunicorn in an early state.
it works on dev server
If you're not already familiar with environment variables, check those out too.
And when you set up a docker-compose, or simply run a docker container on its own, you can specify the environment variables (aka env variables)
That way the container will know if its in a developer or prodution env, and you can change how it behaves accordingly
right.
A guide is saying to init a boilerplate django project withsudo docker-compose run web django-admin startproject composeexample . but I dont need to do that, I have a django app to work with.
Whaat is the significance of initting the project this way
I used docker build to make a container without postgres or docker-compose. Do I need to abandon that container?
To me that just sounds like an example to try out, to see what Docker is like
ah ok
Yupp that works. Thanks much.
volume:
- /opt/data:/var/lib/mysql
This means... the path on the vps will become the path in the container?
It means the dir on your VPS will be synced with the dir in your container.
So any files you have in that dir on your VPS will appear in your container when you run it. If files are edited in /var/lib/mysql in your container, those changes will be reflected in /opt/data immediately on your VPS. Even once the container has finished, those updated files will stay in /opt/data.
Is anyone using poetry with docker?
I read good things about poetry but the recommendation is to install using curl|sh.... Or their get-poetry script. Why not easy_install??
I believe they have their own installer to avoid conflicting dependencies with an existing Python environment
Since you're in Docker, you should have a fresh environment and shouldn't need to worry about any of that
So you can just install poetry directly with pip
I want to use the lockfile to make sure I install the correct versions of transient dependcies. And poetry export doesn't work correctly.
In what way does it not work?
I get missing packages with i use pip -r requirements.txt when I install the resulting requirements.txt and also it doesn't register the extras like mongo[tls]
Somehow it neglected to install certifi
Is certifi in the lock file?
It is
And if it's not including extras that may be a bug so you should look into reporting that to them.




