#tools-and-devops
1 messages Β· Page 58 of 1
Thatβs ok thanks!
Are there any pycharm users here?
@olive warren it won't be on pip because that's only for python packages
either do what mark said
or use conda: https://anaconda.org/conda-forge/ffmpeg
@wise scarab uh why do you need to unzip the wheel anyways
@keen gull whats your question
around half the server uses pycharm
anyone can answer your question
if you actually bothered to ask it
I use a terminal that allows to run python scripts and they provide a sdk file that mimics the calls available in the terminal. How can I import that sdk file into my project in pycharm?
Hello wonderful people, I'm trying to upload a package to the Test PyPi repos with poetry, but it is failing with a HTTP Error 405: Method Not Allowed and I'm not sure why. I am using those two commands:
poetry config repositories.testpypi https://test.pypi.org/simple/
poetry publish --build -r testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }}```
Any help would be really appreciated!
Full workflow: <https://github.com/Akarys42/bestpy/blob/f3614a85f45f9cb6e30759304eccbff93a1bdc01/.github/workflows/publish.yml>
CI output: <https://github.com/Akarys42/bestpy/runs/1576826297>
Solved it, if you are wondering I had to use the legacy endpoint
I created feature branch, made changes, commited a few changes.
merged into main. I pushed it to remote server
is it possible to go back and squash those changes in feature branch?
Running into an annoying issue with Sublime Text 3. Whenever I open a new window, it spans across all 3 of my monitors. Just a big ass window. Any way to fix that?
If anyone else has encountered this or found a fix, ping me please. Will be away from my computer for a while
but I have arch linux for unzip .whl. I tried test demo with python.
I have 7-zip on python but 7zip not found in command line.
If you create a python env using conda and a custom file path, is there any way to give it a tag for conda activate instead of putting whole path?
how to get a json file
wdym with get?
from bs4 import BeautifulSoup
import time
url = ('https://google.com')
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
g_data = soup.find("div", {"class": "play-video"})
print('Link:',g_data.replace('src',''))```
im getting a "TypeError: 'NoneType' object is not callable" error when running, i think its because of the text replace part but im still not sure how to fix it, can anyone help?
@ruby nebula can you print the whole traceback?
yeah hold on
Traceback (most recent call last):
File "C:\Users\puddl\Downloads\pyhtondads\notepad4.py", line 13, in <module>
print('Link:',g_data.replace('src',''))
TypeError: 'NoneType' object is not callable
[Finished in 0.9s with exit code 1]
btw line 13 is the last line
@mortal cosmos
add a print(g_data) before the last print
from bs4 import BeautifulSoup
import time
url = ('https://google.com')
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
g_data = soup.find("div", {"class": "play-video"})
print(g_data)
print('Link:',g_data.replace('src',''))```
so like this?
yes, the idea is just to prove that g_data is None, because soup.find() probably did not return anything
Ok, but .replace() is a string method, so g_data may not be a string.. yet. try
print('Link:',str(g_data).replace('src',''))
ok i will, thanks
IT WORKS! now\ that im thinking about it i totally didnt think of that, thanks so much man
what do you guys think of this concept?
https://stackstr.io/
StackStr
AI o11y
For monitoring real-time metrics from models over time
AI o11y
Thanks all, I fixed my problem
I do dev both on laptop and desktop. I enjoy the "setting sync" Pycharm feature, but it seems it doesn't sync my plugins, so I have to curate my plugin list separately on both installation.
Is there any solution to that?
Okay, apparently the problem is that setting sync supports plugin, but setting repository doesn't. Weird.
for i in range(10000):
exec(f"a{i} = {i}")
print(a42)
``` for some reason its telling me the variable is not defined
in vs code
@heavy knot because pylance does static analysis
and it can't tell that the exec will create 10000 variables just by looking at the code
oh ok thanks
generally these types of things shouldn't come up at all in actual prod code
what does "prod" mean?
I have a question, please @ me if you have answer. Is it possible to deploy a python console application?
I have a couple of modules it needs to run, but other than that the only requirement is python 3.8 or better
i got two files, neither with .extentions.
On the left, pycharm does this cool highlighting of the file.
On the right, pycharm reads it like a normal text file.
poorly worded question: how do i get pycharm to change how it looks a file?
Question - Just starting to learn and using VS Code. When I do my opening ( or ' or ", it also autopopulates the ending character. Do you just have to press End to get to the end of the line or is there a key I can use to act as Enter/Return to go to next line without putting my closing ) or quotes on the new line too?
thats just python
you may have to read the manual or docs for pycharm
i will find a link for you
Pycharm Tutorial for python development!
In this video I will explaining how to use the pycharm IDE. Pycharm is an extremely powerful and useful IDE for python and can save you tons of time if you know how to use it. This pycharm tutorial goes over how to setup a project, python interpreter and to run your code. It also shows you how some cool ...
thats why u need to understand and know your tool first
goodluck learning β€οΈ
Hi, Iβm also a noob coder with little python knowledge. Iβm wondering what are some very good tools/videos/websites, that are free, I could use to learn more. Iβm open to anything, as long as it isnβt sketchy.
!resources check these out
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Thanks for this, anymore options?
i'd recommend https://realpython.com/ , they have a lot of content on many topics, really well made.
also, this channel isn't really for this, so maybe continue this conversation in #python-discussion or an off-topic channel
Ooh, whoopsies. But thank you very much, trying to get all I can get my hands on.
which gui framework should i use? Like kivy, django, Tkinter or what else? to code a bot or monitor for cookgrous (reselling)
anybody here knows python, gitops, kubernetes, ansible and json files?
I am started on trying to lear how to use tkinter for GUI programming. Any tips and guide on how to learn it the right way [eg: resources, tips]
does anyone have any good article/tutorial on how to use sphinx?
anyone familiar with dockers
Hey I have installed the Discord Rich Presence Extension on vsc, but it still is not showing me playing a game.
Does anybody know why?
And how i can fix that
why u want it to show you playing a game lol
just because i want to
The main point is that Discord Rich Presence not working on vsc for me
not helpful
I used official docs: https://www.sphinx-doc.org/en/master/usage/index.html
What do you need?
Maybe there is some video tutorial or something but I am using official resources if it's possible π
Hey guys, I have some questions concerning FTP server, I am in the right topic ?
hello guys, I need a help with pyinstaller. my application(PyQt5) doesn't have window, but is not a console app... it's only a system tray and a menu. the packaged application works fine in console mode, but it crashes in window mode. I've tried all possibilities to build the package that I found in doc, without success. In debug mode, I have no error, no stdout even stderr messages.. it's running smooth, but when I build it in windowed mode, I get the error: 'Failed to execute script...'
anybody here familiar with kubernetes, ansible and gitops?
someone now why im getting this error after compiling a pyarmor obf script? like the first part of the script runs good but then i got this
Guys any one use nerd tree
Not sure if its the corrrect section
but i have a prolem with importing modules from pip into sublime text
can anyone help me with it
Is it okay to ask about Windows' WSL2 here?
Okay from the description of this channel, this seems to be the right place.
If I start a service(SSH server, flask, etc) within WSL2 I can;t access it from other machines. This is a known issue: https://github.com/microsoft/WSL/issues/4150
So, I have this script (from here https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723 ) which forwards the IP address of WSL2's virtual network adapter to Windows:
$remoteport = bash.exe -c "ip addr | grep -Ee 'inet.*eth0'"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
Write-Output "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
#[Ports]
#All the ports you want to forward separated by comma
#Added 1883 for MQTT
$ports=@(80,443,1883,8083,8883,10000,3000,5000);
#[Static ip]
#You can change the addr to your ip config to listen to a specific address
$addr='0.0.0.0';
$ports_a = $ports -join ",";
#Remove Firewall Exception Rules
Invoke-Expression "Remove-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' ";
#adding Exception Rules for inbound and outbound Rules
Invoke-Expression "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Outbound -LocalPort $ports_a -Action Allow -Protocol TCP";
Invoke-Expression "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Inbound -LocalPort $ports_a -Action Allow -Protocol TCP";
for( $i = 0; $i -lt $ports.length; $i++ ){
$port = $ports[$i];
Invoke-Expression "netsh interface portproxy delete v4tov4 listenport=$port listenaddress=$addr";
Invoke-Expression "netsh interface portproxy add v4tov4 listenport=$port listenaddress=$addr connectport=$port connectaddress=$remoteport";
}
This script runs post user login at startup through the Win Task Scheduler. So it opens up a powershell window, but this can take somewhere from 2-10 minutes to execute. Until then I have to stare at the blank blue screen of Powershell. Sometime I close the Powershell window and execute the script on my own.
Some thing I have observed: If I stay at the post-PowerOn login screen of Windows for ~5 minutes, the script is executed faster, around 10s after login and sometimes the script has already been executed when I login.
Possible Reason: I think this is happening because other services are being prioritised by windows. Maybe I need to increase the script's priority, so its executed before some other services are started.
Does anyone have any ideas how I can make sure this script is executed fast/earlier?
Please @ me if someone can figure this out^
Probably not.
this is Python (the language), not FTP support.
!ot
Off-topic channels
There are three off-topic channels:
β’ #ot0-psvmβs-eternal-disapproval
β’ #ot1-perplexing-regexing
β’ #ot2-never-nesterβs-nightmare
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
WSL was never designed to be Linux server. Itβs Linux development environment
Hello, may I ask something? Does wsl could be installed in gaming laptop?
because I think linux is not compatible with gaming laptop
As far as I can tell, the only hardware requirement is an x64 or ARM CPU - which virtually any new PC sold will have these days.
Other than that, if your laptop supports Windows 10 1607 or later then it supports WSL.
hmm i see, thanks!
Hey so in vsc how can I check where a specifc object is being used across the entire project?
I m using vscode instead of jupyter notebook,where i convert the jupyter interface to a simple python script and add cells using the percent markdown using jupytext
The problem is notebook to script conversion works successfully but script to notebook conversion doesn't add the newly addded cells to the notebook
I tried pairing syncing updating but still it doesn't update the cells
Any reason why this might be happening?
Not sure you can. Vscode even with all the cool python plugins still isnβt an IDE. Itβs just a text editor with syntax highlighting and some intellisense.
Maybe see if there is a python refactor plugin. That might have that feature.
Yes u can, by doing "see refrences"
which I didn't know before
Awesome! TIL
i think its the good chan
I have a project to make a voice assistant with python, so I found a piece of code that I'm modifying, shortening, enlarging and all, and what I want to do is that my assistant starts listening to me when I tell him the word that calls him so for me: Hey Bob.
https://pastebin.com/sed4PuNZ
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.
pls @ me if you know
is there any guide for the module mem-edit?
@mild bloom wrong channel see #βο½how-to-get-help
Finally I understand PEP517/518. I didn't know that package building process now creates isolated environments with exact build dependencies installed as configured in pyproject.toml. This is so neat.
Unfortunately there're uncovered cases of frontend/backend interactions. E.g. pip as a frontend, when invoked as pip install -e ., doesn't actually use backend (like flit) and requires setup.py to exist. Of course in case of flit I must use flit install --symlink, but I had to rant about another case of leaky abstractions.
I don't understand why the jupyter/tensorflow-notebook docker image won't start running an instance if I set in my docker-compose to
command: pip install -r requirements
https://github.com/jupyter/docker-stacks/blob/master/tensorflow-notebook/Dockerfile
I also don't understand how
tty: true
stdin_open: true
``` connects a user's terminal with stdin and stdout.
hi i want to make a vocal assist, i use pyttsx3 and speech recognition, i want if i say the code to start like HEY GOOGLE, how to do that ?
and add action after like Hey Google wath the weather like and other
Hey dumb question: is there any way to get Sublime text to have goto definition also look inside imported packages installed in, well, wherever pip installs stuff
Oh okay i figured it out i need to do add folder to project
\o/
someone can help me about pymiere ?
Hey guys how do I stop this
its in an inifinite loop and since its no terminal I cant CTRL C
well done CTRL ALT M i forgotthe name of my extension
alt f4
Hello
I am trying to add docstrings to my code
and I am using the sphinx template
:rtype: [type]
there is this element
but
I need to replace [type] with an actual type
the function returns a class
so can I just type
the name of the class?
or do I need to type something like
:class: MyClass
I am new to docstrings
Thanks in advance π
and what if it can return different classes
Is there a tool that can help me run multiple development servers easily?
Right now I use this script but it comes with a lot of issues (example: I can't stop the servers once I am done with them):
#!/usr/bin/env bash
# Start the django development server
cd /home/vagrant/bynkc/bynkc
python3 manage.py runserver 0.0.0.0:8000 > /home/vagrant/bynkc/bynkc-backend.log 2>&1 &
# Start the nuxtjs development server
cd /home/vagrant/bynkc/bynkc-frontend
npm run dev > /home/vagrant/bynkc/bynkc-frontend.log 2>&1 &
# Start the documentation development server
cd /home/vagrant/bynkc/bynkc-docs/website
npm run start > /home/vagrant/bynkc/bynkc-docs.log 2>&1 &
Can you run them behind something such as Apache or Nginx? Then you can start / stop services if you middle man Django with say, wsgi
I could use them, but i also need django and npm's hot reload option. Could nginx support that?
@rigid vapor
I mean it calls your django server, its just working as a reverse proxy n stuff. So afaik yes
ok thanks will try it out
Open-source & free to use video player, button, textbox, textarea, website designs and templates for web developers and designers. | DW Assistance
Hi, Guys. Just been playing around with CUDA and OpenCV. Since you have to build from source OpenCV inorder to use the GPU CUDA, if say you would want to package the application using PyInstaller afterwards, would this then be useable if i distribute the application to other systems that have CUDA (same version) out of the box?
Or am i missing something here
how can help me to bypass cloudflare pls
!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.
#help-chestnut if someone is able to help me. some users wrote something but then stopped responsing...
Let's make a simple aimbot within 100 lines of Python code using Tensorflow Hub.
anybody who can make this run for me?
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.
Hey guys I want to encode a quote into ascii, how would I do that without having to encode one character at a time. this is my code so far
def main():
print(ord("We've all got both light and dark inside us. What matters is the part we choose to act on. That's who we really are."))
main()
Anyone know nexus
Which Nexus? Give more details
so I created new branch to test a feature,
there are modified and unstaged files.
now I am done and don't care about this branch. how do I delete it completely?
git branch --delete <branch name>
but unstaged files?
will all be gone?
cause I want them to be
well, your solution sucks
What's the problem with that solution?
that was helpful.
Try this: ```sh
Assuming that you currently have the branch to delete checked out.
git reset --hard
git switch master
git branch --delete <branch name>
The reset will delete staged and unstaged files
The switch is necessary because the branch cannot be deleted if it's currently checked out
Hey Does anyone know aboutGit lfs?
@safe mantle what do you want to know?
how can i restrict pycharm from opening a tab to the external module that threw the error?
Hey
can anyone explain me what are refspec in git?
Hey @wintry arch!
It looks like you tried to attach file type(s) that we do not allow (.pdf). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.
Feel free to ask in #community-meta if you think this is a mistake.
hey guys, so this is a very blatant and basic question: How do you round a result (in terms of numbers)
You're in the wrong channel. See #βο½how-to-get-help
Because depends_on is naΓ―ve and just makes sure the db container is started
Of course starting the container β the database being ready
A common workaround I've seen is to have the API container poll the database to make sure it's ready before starting the web server
Thanks
No, not a healthcheck. You'd need to write your own code to poll it - Docker can't really do this afaik
This Docker article covers the situation https://docs.docker.com/compose/startup-order/
Alright, I'll add a system for it to retry the db connection x amount of times
How can you talk in chats?
I am following a blockchain tutorial in python. I am gonna use flask but I don't want it in my system so I decided to use a virtual environment for that(I will remove the project from my system after it's done). In addition to that I need a mysql server. This mysql server will run on a docker container. These two technologies are fairly new to me and I want to use them for learning purposes but I am not sure how the structure should be. Should I run blockchain on my host and mysql on a container or both on a single container? What is the best practice?
run both in separate containers
@desert night
if you're using containers, you always want to have 1 service/container
no
each dockerfile is for a separate container
use docker-compose for multiple containers
okay thank you very much
regex for any path that starts with /mnt/ and ends with /npm
can be
/mnt/c/nodejs/npm
or
/mnt/c/whatever/w/w/npm
I'm wanting to write a python 3 script to SSH into a remote server and then tail a given log file. I was thinking of just using Paramiko to connect and then running the usual tail -f command on the system. Is there anything intrinsically wrong with this approach?
Sounds fine but this seems simple enough to just do in a shell script using the ssh CLI tool.
I'm adding this feature to a larger CLI toolkit written in python, otherwise I think that'd be the way to go
Okay, that makes sense.
Thanks for your input
so my friend gets an error of:
running sdist
running check
warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)
warning: sdist: standard file not found: should have one of README, README.txt, README.rst```
he's trying to get to work:
the github he used to get to try to get it on pip is https://github.com/JDJGInc/asuna_api
Python wrapper for asuna.ga. Contribute to JDJGInc/asuna_api development by creating an account on GitHub.
he ran: python setup.py sdist
yes
he followed the https://medium.com/@joel.barmettler/how-to-upload-your-python-package-to-pypi-65edc5fe9c56 guide
setuptools is better
doesn't pip depend on setuptools or something
so the pip commands already downloads it right?
it should be default
what happened to LuigiDancer94?
what?
https://setuptools.readthedocs.io/en/latest/setuptools.html take a quick read on this
I was just messing with ya hahaha
He'll need to move over:
setup(
name = 'asuna_api',
packages = ['asuna_api'],
version = '0.1',
license='MIT',
description = 'An async python wrapper for the asuna api',
author = 'JDJGIncOfficial',
author_email = 'jdjgbot@gmail.com',
url = 'https://github.com/JDJGInc/asuna_api',
download_url = 'https://github.com/JDJGInc/asuna_api/archive/0.0.02.tar.gz',
keywords = ['wrapper', 'api', 'random'],
install_requires=['aiohttp','yarl'],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
)
since it should have back-compat
yeah
setup(
name = 'asuna_api',
packages = ['asuna_api'],
version = '0.1',
license='MIT',
description = 'An async python wrapper for the asuna api',
author = 'JDJGIncOfficial',
author_email = 'jdjgbot@gmail.com',
url = 'https://github.com/JDJGInc/asuna_api',
download_url = 'https://github.com/JDJGInc/asuna_api/archive/0.0.02.tar.gz',
keywords = ['wrapper', 'api', 'random'],
install_requires=['aiohttp','yarl'],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
)```
so this?
i think setuptools should work with setup.cfg
https://packaging.python.org/tutorials/packaging-projects/ is the setuptools docs for building for pip
does he need to make a new github release for this change?
normally most packages only github release whenever the package version gets bumped
or do I only need to worry about it?
but your package hasn't been uploaded yet
so you dont really need to even release at all
it uploaded earlier
there's one version for the pip
the main issue is trying to deal with the no description
he's trying to use the READme.md page for the description there
but what about the readme.MD?
his library is based on https://github.com/iDutchy/sr_api
which this one doesn't have such issue
for instance, one of mine: https://github.com/SuperStormer/pyl/blob/master/setup.py
long_description = f.read()```
```long_description=long_description,
long_description_content_type="text/markdown",```
that only?
wait what about setup.cfg?
does he get rid of it now?
idt that even does anything: https://stackoverflow.com/questions/60084128/does-description-file-in-setup-cfg-section-metadata-have-any-effect
so yeah you only need the long_description in setup.py
so he can yeet it?
yep
yeah
he created:
writing asuna_api.egg-info\PKG-INFO
writing dependency_links to asuna_api.egg-info\dependency_links.txt
writing requirements to asuna_api.egg-info\requires.txt
writing top-level names to asuna_api.egg-info\top_level.txt
writing manifest file 'asuna_api.egg-info\SOURCES.txt'
reading manifest file 'asuna_api.egg-info\SOURCES.txt'
writing manifest file 'asuna_api.egg-info\SOURCES.txt'
running check
creating asuna_api-0.2
creating asuna_api-0.2\asuna_api
creating asuna_api-0.2\asuna_api.egg-info
copying files to asuna_api-0.2...
copying README.md -> asuna_api-0.2
copying setup.py -> asuna_api-0.2
copying asuna_api\__init__.py -> asuna_api-0.2\asuna_api
copying asuna_api\client.py -> asuna_api-0.2\asuna_api
copying asuna_api\http.py -> asuna_api-0.2\asuna_api
copying asuna_api\image.py -> asuna_api-0.2\asuna_api
copying asuna_api.egg-info\PKG-INFO -> asuna_api-0.2\asuna_api.egg-info
copying asuna_api.egg-info\SOURCES.txt -> asuna_api-0.2\asuna_api.egg-info
copying asuna_api.egg-info\dependency_links.txt -> asuna_api-0.2\asuna_api.egg-info
copying asuna_api.egg-info\requires.txt -> asuna_api-0.2\asuna_api.egg-info
copying asuna_api.egg-info\top_level.txt -> asuna_api-0.2\asuna_api.egg-info
Writing asuna_api-0.2\setup.cfg
creating dist
Creating tar archive
removing 'asuna_api-0.2' (and everything under it)```
he got that
also he asks if he should upload the manifest file the program generates
he says it doesn't seem to hav emade one lol
is that a good or bad thing?
oh cool he got it: https://pypi.org/project/asuna-api/#description
@sly sleet thank you π
Hello. I need a help. I hope this is appropriate channel to ask. I was googling without luck a lot, so please help me figured out here.......
I am coding in Atom. And I have autocomplete-plus enabled, cause I like suggestions, but I am facing a problem here. Whenever I type first 3 words and the pop-up with suggestions shows up, I let's say select a suggestion and insert it with Tab or Enter (depend o settings, but I try them all with no difference), the suggested word just append on the end of my first 3 words typed, and its useless cause then I need to delet those first 3 words, so I have even more work to do....
I hope I explain clearly enough..... So, let's say I type : pri, then pop-up shows up, I select "print", and instead of replace my first 3 words with "print", atom do - priprint..........
Tnx in advance for help....
weird
Hey, I'm having a small hiccup in trying to set up a git server with Apache. I have a test repo on my server, but attempting to clone it gives a 403 error. There is some documentation about how to do this, chiefly at https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP. The issue I'm having is, I think, a result of how my domain is set up. I decided not to set up my git server at <domain>/git, but instead at git.<domain>. I also host my personal website at this domain. This means that I have two directories named <domain> and git.<domain> in /var/www/html. I also have two .conf files, <domain>.conf and git.<domain>.conf in /etc/apache2/sites-available. The <domain>.conf file is pretty standard, as is the git.<domain>.conf file, with the exception of the inclusion of these lines:
SetEnv GIT_PROJECT_ROOT /var/www/html/git.<domain>
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias / /usr/lib/git-core/git-http-backend/
I suspect that the issue is in either the first SetEnv or the ScriptAlias, but I'm stumped. I have confirmed that the issue is not with file permissions, and changing the / in the ScriptAlias to anything else causes a simple repository does not exist error. I have also confirmed that the test repo is functional, as cloning it via SSH works completely fine.
<domain> is just a placeholder for the actual domain, as I have yet to implement any security, and don't want to reveal an insecure domain.
I'm looking for a cross-platform solution that manages Python even when it's not present initially and the Python virtual environment. Normally most people would suggest freezing the program but for my type of application that's really not a feasible solution. The closest I found is pyflow https://github.com/David-OConnor/pyflow. Any suggestions?
Yeah pyflow is still in early stages and a bit finicky in my experience, even if you overlook the poor support for macOS installation. Have you looked into conda?
Thank you Mark I had not considered conda because of its install size. However miniconda might be a candidate!
Yeah, get conda through miniconda rather than Anaconda. Those are just distribution names, but conda is the actual tool.
Hello, is possible to directly clone a repo with the head at a specific commit?
not working git clone https://github.com/author/repo/sha1_commit.git
man git clone says that there is something like --branch option.
thanks, actually it seems I'm reinventing the wheel, in that case git submodules
Git submodule always refer to specific commit
yeah but I wasn't using it at first π submodules is exactly what I need
At last, I can convert to the one true Base to rule all others: https://prnt.sc/wg6uoq
Base10 is for the weak
My eyes are feeling pain now : )
lol
Should I use this instead of the suggested method by a member of our team?
https://github.com/marketplace/actions/build-and-push-docker-images
Image is what he wanted us to use
I believe the only difference is whether you prefer to interact with docker directly through its CLI or through YAML.
The YAML version sure looks much cleaner
What I dont understand at the moment is the correct way to migrate
Where do I look for the correct syntax to do it like we've done it
@tawny temple
I think I got it
I mean, you should use Docker Compose
Hello people, could you please advise, do you use Atom for Python coding?
I prefer PyCharm
And I can recommend this IDE
There is free version too
Thank you. I am just starting to learn coding. Is it a good IDE for beginners?
I think that it's a lot better than Atom/VS Code
It's all-in tool
You can easly create venv to manage multiple projects, create run actions and don't even open terminal π
ok. I will check PyCharm. Thank you.
Your welcome!
Hello, I am into system/platform automation, would like to read good python code with sys, os ,re, requests, shutils and similar related modules that would help me in my job and career, what code/repos would you advise me to check? I was thinking maybe Ansible? or is there like an awesome list for sre/devops/automation/system-engineering?
Hello, is this good place to ask about CLI tools?
so i have a file which is supposed to create the tables for the db, but how would i run that file in docker?
@rich nymph volumes: - ".data/mysql:/var/lib/mysql" - "./dump/:/docker-entrypoint-initdb.d"
I store these files in "dump" directory and mount it in the docker like that
if you want to run them at start up ofc
huh?
i am confused
i couldn't figure out how to do it so i decided to add another RUN psql -d rationals -f db/init.sql in dockerfile
btw this is my docerk-compose
version: "3.8"
services:
postgres:
image: postgres:latest
init: true
restart: always
environment:
postgres_db: ...
postgres_user: ...
developer_password: ...
env_file:
- ./.env
expose:
- 5432
volumes:
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
Rationals:
container_name: Rationals
init: true
restart: always
depends_on:
- postgres
env_file:
- ./.env
build:
context: .
dockerfile: Dockerfile
volumes:
- ./logs:/Rationals/logs:rw
- .:/Rationals:ro
ports:
- "5005:5000"
you want to run these sql at the very beginning?
after database created
yes
then make a directory in your host
huh
then mount it at /docker-entrypoint-initdb.d
wdym by host?
nvm go to the directory in which docker-compose resides
then make a directory
place these sql files in there
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql```
this should be
- ./db/:/docker-entrypoint-initdb.d/```
why?
you cannot mount to a file
ok first of all could u explain to me what's happening in volumes
you can mount to a directory
i don't get what u are saying
okay when you are creating a docker container it's like another computer but you need a way of sharing persistent data
so say hey container I have this db directory I want to sync with your /docker-entrypoint-initdb.d/
ye the first part i understand but what is happening in volumes
if you don't use that volume thing. when container is removed the data is gone when you use "volume" container writes to "db" so db is always there when you create another container
ohh i see so one more question
https://mystb.in/InformativeCrashIntl.dockerfile
this is my dockerfile
https://mystb.in/DiyExhibitionsCapable.less
and this is my dockercompose file
now how do i actually run this ?
do i simply do docker compose up?
read the man pages
docker-compose up --help
docker-compose --help
for general usage
i don't get it
@desert night could u please explain how i am supposed to run my containers now
docker is a complex technology, I get the impression that I am making things harder for you. I suggest that you find some good tutorial and read the documentation before getting into it. There is a huge learning curve
u are not making anything harder for me
i just don't understand how i am supposed to run the docker container
What are people using to host small python scripts/bots? I am currently spinning up containers for them but they aren't very resource heavy and it seems like a waste to have a separate containers for each script. Just looking for some options that people like/prefer.
containers are best way to roll
but I don't use Python for scripts so I can't speak for that
Hello, I have a question regarding GITHUB, i hope this is a good channel. I am having two branches master and test. I am trying to merge test into master, I've run git merge command and it merged the branches but only in my local repository, how do I push this into github?
Is it possible to merge github branches from command line or do I have to use the website?
Im so dumb.... Even though git status doesn't show anything after merging you just write git push and i works
can someone help me how to deploy fast api on a ubuntu server?
Any guides or anything?
Its a simple api (2 routes) which just has get requests, and doesnt need any authentication or anything for now.
On the fastapi documentation it says you can do uvicorn main:app --host 0.0.0.0 --port 80 but i was thinking if that is the correct way for production? And if that uvicorn thing is fast/slow or can be faster?
I heard that PyCharm Professional has a free license for students, but it seems that they mean university students only. Is there any way for me to obtain a free license in secondary school? Thanks in advance.
Why do you need professional version?
I don't need it as such, it's just that it's got a bunch of useful tools which the community edition doesn't have. It would be nice to get it for free though, if the option exists.
@timber silo just git push it to update remote
My coworker wrote a directory of Python files and she doesn't know what the dependencies are. Also I can't install it on my computer--I can only use it on an SSH connection. Is there a command line tool that determines (not necessarily with perfect accuracy) what the top-level dependencies of all the files in a directory are?
She just gave me a pip freeze of her whole python environment.
Could maybe a linter could scan the code repo and report on all missing libraries?
I ended up grepping the directory for import statements
did that work well enough?
https://pypi.org/project/pipreqs/ @analog kettle ?
Hello, because I've already got Visual Studio for something else installed I've tried to set it up for python. Python support is installed, but it doesn't know async/await syntax. Does that work for you?
it should
Everything above 1GB is just annoying. Maybe the install is just damaged. It's not VS Code, but they should have the same language support.
@floral olive define "doesn't know"
lint error?
from pylint?
or is it a runtime error
Maybe ask her what the dependencies are, or ask to generate just a top-level requirements.txt?
she thinks she's created a pip freeze that will install correctly, but I don't think she ultimately knows what the dependencies really are.
Well, she known what libraries the project is using, right?
I haven't tried it yet because I'm glued to the coverage coming out of DC 
no
how so π
By the way, Python packages can be distributed using a remote git repo, public or private.
For example, I wanted to make multiple packages, but I didn't want to pollute PyPi or the test PyPi storage, so I have two repos:
- https://github.com/decorator-factory/python-fnl/
- https://github.com/decorator-factory/context-manager-patma/
and project 1 depends on project 2
hello I have a question concerning MYSQLCLIENT, does 64 bit version of python work ona 32 bit version of windows?
i dont see what that has to do with mysqlclient but ok
answer is no
@nova igloo
64 bit progams dont work on 32bit
@sly sleet , VS underlines "def" after "async" and lists that as error "unexpected def". But it runs completely fine.
import asyncio
async def test():
print("hello world")
asyncio.run(test())
@floral olive that aint vscode
visual studio is really shit for python
use a better ide
Thanks @sly sleet
I've noticed it π Thanks, that was what I wanted to know. Like I wrote I don't want to have a bunch of 10GB IDEs on my disk. Than I will keep using Sublime Text or IDLE, or is there something lightweight and powerful?
hmm sublime should be fine if you're used to it
It's a bit of configuration work. Like setting up running the script directly from the editor. Then I'm going to look a bit closer!
Visual Studio is ok for Python but I would only use it if you are .Net developer normally
Anyone know of a tool to strip comments (TODOs and such) out of a python module before packaging? Or have any experience with minifiers?
why though @swift spindle
theres no point to trimming a few hundred bytes of comments at most
same for minifiers
wtf
if you want "obfuscation", you can use pyarmor or something
though security by obscurity is a bad idea
This code appears like 30 times in a directory I'm using:
if "\t" not in line:
raise InvalidAnnotationError("Line chunks in ANN files are separated by tabs, see BRAT guidelines. %s"
% line)
I never want that exception to be raised, so I want to insert continue between line: and the line break
is there a fast way to do that from bash?
(this is in a for loop btw)
Hmm
Can't you just use the replace feature of your IDE?
It will be easier for sure
Hey guys, I'm not really sure where to put this, but I have no idea how to use macOs (
I really only know how to use *nix os'), but would I just brew link --override node? What does that do and are there any negative consequences
For preface, node seems to be already installed from something else, but it's a very old version and I deleted everything related to node that I could find. I want to reinstall it with homebrew, which is what I'm doing now
I may have further complicated things by uninstalling those directories
sudo rm '/usr/local/share/systemtap/tapset/node.stp' I also ran this
Oh boy
--overwrite will replace the files it should be installing if they already exist
It may end up ok. Realisticcally, there should have been an uninstaller to run, but probably too late now
The suggested dry-run command would be a good thing to run, so you can manually search the directories of existing node stuff to erase them.
As for the systemtap error,
Run brew doctor and take all the warnings seriously and see what you can fix up.
@mild lance
Yes
What on earth
So, this is probably an artifact of an OS upgrade breaking brew. Probably. I'll see if we can fix it nicely.. 
Ok
lets try this
$ sudo mv /usr/local/share/systemtap/tapset/node.stp ~/.throwaway
was there a macos question @mild lance ?
brew is a MacOS package manager
yes, im aware. π
<
hold on one second, can work on this soon
afk for a moment
ok, I'm back :D
sudo rm '/usr/local/share/systemtap/tapset/node.stp', I ran this before, so it shouldn't have been there i think @compact valley
You do have a .throwaway right?
I just dropped it in there because I didn't want to specify a directory
just, somewhere taht isn't there so it can't cause problems and I guess is undoable
which may be an undue amount of caution
ugh
But, I already deleted the file previosuly
then you'll just have to do sudo chown -R :admin /usr/local/share/systemtap
Well, there is literally nothing there since I deleted the file before
Then I suspect the issue is node's installer creates the folder with wrong permissions
wouldn't be the first time
well, it was there previously
I just removed it
because I thought it was the source of the problem
ohh, I see, yes let me take ownership of the file
@compact valley
You.. are on an admin user right?
I guess try username:admin instead of just :admin?
:admin should have worked though
π₯³

Alright, is my account not an admin account then, if we had to do that?/what is an admin account
No, just some stupid quirk probably
Admin accounts are, I believe, part of the "admin" group since osx uses mostly unix-like perms
the :admin is supposed to change the accessing group to "admin" so all admin accounts to do it, but I'm too tired to bother figuring out why it didn't work
probably something fucked in the permission bits, now that I think of it
yeah, it defaults to XR for group, which is stupid
but whatever
anyway to check if I am part of this "admin" group
$ id -Gn bast
yeah, I am
weird
is the folder normally with :admin access, and I just couldn't access it for some reason?
I'm still on catalina, I doubt updating would fix the issue though
Things in user/local are supposed to be
But various installers are lazy and drop things with bad permissions a lot
For example, sudoing into making files as root:root
Is there an extension in vsc that sorts your imports?
i dont know
i thought it looked nice
i found it here https://www.youtube.com/watch?v=rR4n-0KYeKQ
π Video courses from JomaClass:
π New to programming? Learn Python here: https://joma.tech/35gCJTd
π Learn SQL for data science and data analytics: https://joma.tech/3nteQih
π Data Structures and Algorithms: https://joma.tech/2W89H33
π¬ Chat with me on Discord:
https://discord.gg/EQwMWFsmQs
β Support my channel to access my Private Discord Chat...
probably some text editor
if you were working massive app, you would probably want IDE just for all unit testing/git management
@atomic crest not sure tbh but prob doesnβt matter depending on da specific project
I have this issue where PyCharm thinks __init__.py is a Django file, and it's quite annoying. Does anyone have any suggestions for fixes? Thanks in advance!
May be wrong, but I feel like that's some kind of edior along the lines of vim or neovim or emacs or something
how do i change the colour scheme to a dark black one in Sublime text
[Pycharm]
hi, can sb explain me why the "detail.css" is not properly marked as a css file? I tried deleting it, creating a new file (that displayed as css) and renamed it to detail.css - which then changed the symbol back again
use vscode /s
This is a bug with the icon plugin that will supposedly get fixed in the next release.
There is no fix on your end besides disabling the plugin for atom icons
how do i open multiple folders in the same window in pycharm?
i have 4 folders
html, js, python, and c source codes
i wanna open them all in one window
just create a parent directory and put all these inside it
but is it possible without creating a parent folder?
can i screen share
oh what?
nah just tell me
i donno how to explain that
im in class rn
select the folder and press okj
im not finished yet
kk thanks!
ohh
oh ok thanks man!!
np
bye gtg
maam is asking questions to me
I see, thanks! I've taken a look at the regex patterns for the plugin, and __init__.py matches one of the Django icons, but unfortunately there's no way to edit the patterns :/
Yeah I reported it to the developer
They introduced that bug after they fixed another bug I reported regarding the flake8 file having a django icon
Hey guys, so, I recently needed to start using pyenv. However, after installing it, I can't seem to get it to work. Does anyone know how I could fix it?
My github actions workflow is not being ran on pull_request
name: Lint & Test
on:
push:
branches:
- 'rewrite'
pull_request:
Please mention me if you reply, I'm going to sleep.
Hi all!
**Quick question **- is there a VScode setting or extension that will allow me to see variable values **within the code **during a breakpoint of debugging?
The longer version of the same question - Going back to Uni, we've been told that this semester we must use VScode. I come from using PyCharm, a fellow student from thonny. When we would debug in PyCharm or thonny, during breakpoint stages you could see what each variable was holding at that particular stage.
I've been running through the VScode and Python documentation to no avail.
I should note that you can hover your mouse over variables and that will show you what the variable value is.... but.... you know... that isn't great.
Would enabling this do what you're looking for?
You can hover to see the variable and it's stored value.... but that does suck.
It's a setting, if that wasn't clear.
You can also see some of the variables if you open the debug side panel
Additionally you can watch certain variables so the side panel can show their values in real time
Well, maybe real time is the wrong word. I just mean watched values will automatically update as you step through the code.
trynba make a bot that lists all users of a role how would i do this? and make it auto updating every 10 secs
Thanks @tawny temple again for the assistance. You've no doubt saved what little hair I have left.
You're welcome
Did you mean to ask this in #discord-bots ?
@elder sable press ctrl + shift + p
Then search for "convert indentation"
And choose to either convert it all to tabs or spaces
Whichever you prefer
that problem is fixed... but now 4 other errors popped up
I'll just work is out for now
Hello XlanKar Terminal I want the summer to stand side by side, but it doesn't work.
My github actions workflow is not being ran on pull_request
name: Lint & Test
on:
push:
branches:
- 'rewrite'
pull_request:
I've tried specifying '**' as branches for both of them but still doesn't work
Only working on push
Whats the state of pipenv in 2021?
You mean branches: ['*']?
https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#example-including-branches-and-tags
https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
A workflow is a configurable automated process made up of one or more jobs. You must create a YAML file to define your workflow configuration.
What do you need?
I mean ```yml
on:
push:
branches:
- ''
pull_request:
branches:
- ''
Which should be the same as
on:
push:
pull_request:
?
But we want to specify a branch on push
According to GitHub docs - yes.
Hmm... Are your actions working for some branches and for some not?
Or they are not working at all
How about repo options? You can disable some jobs there
wdym
Ah I see the issue
The issue was not in the repository settings, rather the organization secrets
I have a very basilar question, where do I post it?
I've run into lambda, but I don't understand it quite well, at least given the explanation that has already been delivered, can anyone give me a definition of its use? Thanks
I don't know where to post this either
You can pick help channel, I can look at that: #βο½how-to-get-help
I need help with vs code please help
When i am writting mv filename .. the file should be moved from the inner folder to the original one
But it's showing mv can't stat 'file1.py': No such file or directory
Got the problem i was in wrong location
Kinda new in these things
Happens!
Just proposed to use poetry instead of pipenv at work
pipenv's dependency solver doesn't work good enough for us. Had a few cases, where we had to manually aid it in order to build a working environment
poetry's solver could handle cases where pipenv failed
I heard good things about poetry, but i dont like the fact that theres yet another tool for the same purpose
Sure, but having to manually solve dependencies since the solver can't do it is a killer criterium
that's its main job
others at work agreed and we're now going into a test phase for poetry, so I can't tell yet, if it's the better alternative
but so far everything hints to it
Pipenv is a Python packaging tool that does one thing reasonably well. It tries to promote itself as much more than it is.
that article was updated in May 2020 just in case you think 2018 is not up to date
and that's an example where pipenv fails
and yes, got a lot of negative bias towards pipenv, since it's been a constant struggle to use it till today (only a half year)
Personally, I love Pycharm, since it is an easy to comprehend IDE(Also the new update is really cool), but at one point, for advanced programmers, I'd say it's functionality starts to become limiting. This is the point where u really should start to look for more advanced IDE's
However, I would definitely not say vscode is better, and especially for beginners, Pycharm is far easier to understand, although I know many people who disagree. It all boils down to what you are looking for in an IDE
Totally agree, PyCharm is one of the best tools for new developers
If you are advanced one you can work even with vim/nano/whatever but for newcomers I recommend PyCharm
thank you for your opinion!
advanced IDEs such as what?
never used pycharm
but based on my experience with intellij I feel like jetbeans IDEs all have a lot of built-in features which may overwhelm users
You don't need to use all of available features
My development laptop's mobo died 2 months ago. I bought a new laptop and fixed my old laptop, and am now in the process of setting up my dev environment on my new laptop. I am realizing this is going to be a bit of a pain in the butt. So, I figure, maybe I should get smarter about this.
First I thought... maybe I will setup the dev environment inside of a VM. And that thought process, evolved into:
A bunch of people in the past sang the praises of Docker and how a lot of the cloud services support docker. AND, I have been wanting to move my app to the cloud, or at least an offsite server. Would it be a good idea for me to setup my dev environment in a docker VM? Previously my dev environment was in Windows, with VSCode, Python 3.8, Pandas, Numpy, and a few other packages.
I am not a professional developer, so please be kind.
Hi @lunar holly , I think it makes a lot of sense to learn docker in your particular context
The way I would think about it is that you can "dockerify" one of your projects, i.e. set it up in a way such that it can run in a container or a set of containers, instead of directly on your laptop (sometimes it really takes surprisingly not so much effort to do so)
For that, I find that docker-compose is very nice (it's a tool that makes it easy to coordinate a project which requires multiple containers running and talking together)
Note however that although they share some features, a docker container is not a VM in the traditional sense
Hello everyone !
I've created a CLI tool that bootstraps a project from a published template on GitHub. It downloads the template, replace user-defined properties with given values and put everything in a new directory.
For example, now I can create a new Flask project from a published template ( https://github.com/helkaroui/simple-flask-server.slh ) by running the following command :
slh new helkaroui/simple-flask-server.slh ./
The tool is simple to install, just run pip install silhouette-cli
Just thought I would share. Any ideas of directions I could take this project in ?
Here is the GitHub page : https://github.com/sharek-org/Silhouette
Thanks !
what can i do after learning python to make money
i don't want to be an employee of any company
i just provide serveice on my own
and earn on my own as much as i work
!rule 6
6. No spamming or unapproved advertising, including requests for paid work. Open-source projects can be shared with others in #python-general and code reviews can be asked for in a help channel.
you rock π
I am a bit autistic and I just love the rules π
I hesitated to ask where to post it, since I'm new in the server. "Rules are made to be broken" hahaha
just kidding, I love the rules myself
Im New I Dont Know How To Code
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
i am currently trying to make a proxy scraper that scrapes proxies from multiple sources, can anyone help?
Why doesnt it make the folders as intended ? import os
import shutil
current_dir = os.getcwd()
for f in os.listdir(current_dir):
filename, file_ext = os.path.splitext(f)
try:
if not file_ext:
pass
elif file_ext in ('.py'):
shutil.move(
os.path.join(current_dir, f'{filename}{file_ext}'),
os.path.join(current_dir, 'Python files', f'{filename}{file_ext}'))
elif file_ext in ('.jpg', '.png', '.gif'):
else:
shutil.move(
os.path.join(current_dir, f'{filename}{file_ext}'),
os.path.join(current_dir, 'Andre filer', f'{filename}{file_ext}'))
except (FileNotFoundError, PermissionError) :
pass
@sinful trout we can discuss your topic in #unit-testing if you'd like to
please,
my spammer webhook bug:
webhookSend = DiscordWebhook(avatar_url=avatar, username=username, url=url, content=msg)
webhookSend.execute()
print('\n\nThe webhook spam has just been activated.')
cls()
main()
I want the webhookSend.execute() to work all the time even when I come back to main
What is a popular version manager for python similar to nvm (node)?
meh, gonna give venv a try
pyenv does that
venv/virtualenv help set up development environments although if you need a build tool/dependency manager that also automatically works with virtual environments for you, you might want to look into pipenv and poetry
Both have their own merits, but pipenv is more commonly used for "live" projects as in applications and poetry leans more towards pip-installable packages
I've been getting my hands dirty (and enjoying) pytest, but I find myself asserting on things like os.path.isfile/isdir or data structure which doesn't seem pythonic if I have to include an example an example dir to provide a case that always works
I peruse the big OSS projects for test inspiration, but I don't see a lot of test coverage involving file-checking, mostly logic or numerical checks
Am I approaching testing wrong?
@stiff dragon Let's move to #unit-testing
Dang, and I tried looking for testing, sorry about that, lets
What exactly is Docker? From what I have been able to understand, it generates an isolated place to run an app? So is it sort of like a Virtual Machine?
Please ping me when you reply
Docker is lightware virtual machine - not like Qemu or VirtualBox where you can put something different (like different system or even different architecture). Docker uses host's environment to create a container where you can run your application. This is how I understand what Docker is.
Hmm... I think I understand better now. Thank you!
Is it possible to remove windows from a laptop an install linux for free
@viscid cipher you can install linux on windows using virtual box
In most cases, yes
No need to remove windows
Whats vitural box
Hello
I'm trying to merge a folder of a different repo into mine via git
Not submoduleing
repo B has a utils folder which I want
I want the history and the folder on top of my head
Yes, most linux distributions are for free. Linux Mint or Manjaro are good for starting when coming from the windows world
is there a way to switch to a different linux distribution and still keep your stuff from the previous one?
what kind of dstuff
guys my pycharm shows a red line under this line
from LabelGenerator import CreateLabel, PrintLabel```
but no errors while running this is a python file in the current working directory pycharm doesnt recognize it
I hope this is the right channel, I have to come up with an "cloud" architecture for a project and I'm kinda stuck at what to use and how it could work.
Basically, I have IoT devices that connect to this "cloud" via websocket and keep the connection open permanently, these devices would sign up with an ID/key or something like that to identify what user-account they belong to. From the other side the "cloud" provides a REST API where users can control their IoT devices, again with authentication and providing the ID of what device they want to control.
All that doesn't sound do complicated if it's only one application that handles all websocket connections and all REST requests, but what if the websocket connections scale to over a million, I doubt that one application would be capable of handling that? So I'd need to be able to run multiple instances of this application and have some form of "load balancer", right?
But, that's the biggest piece where I'm stuck. If I have multiple instances, how do I know which instance is handling the websocket connection that the REST request wants to send something to? Hope that whole thing makes sense
i don't really know much about linux and process managers as such, but tmux was rather simple to use
it's a terminal multiplexer
i actually know how to use tmux , but didn't use it
i didn't think it will work
ok I'll use tmux and see if it works
well it works for me
ask mesub how he does it though, this may not be best practice
i just used what i thought of, and as it worked fine i didn't bother trying to find other options
oh yeah , thank you so much , i tried it and the bot seems to stay online rn ,
How to develop app
hello, does anybody know how to operate the atoms code editor on mac or knows another good code editor
Hi, I want to ensure the following:
for github actions, every pull_request includes a push - is that correct?
I have a github action like this:
on:
push:
branches:
- master
- prod
pull_request:
master and prod are protected branches. It is not possible to push to them directly, you need to do a PR.
So should I just change it to:
on:
pull_request:
- master
- prod
```?
I don't believe PRs create push events for their target branch
PRs create pushes for their source branches
Based on those branch names, I doubt you'd be opening PRs from a master or prod branch.
So yeah, the latter should be correct
Actually, I'm not sure what the branches mean for pull_request
If it's specifying the source branch then that's incorrect
If it's the target branch then it's correct
It seems to filter on the target branch. Just don't forget to include branches: in your YAML.
That's not really intuitive since the documentation says a PR event's ref will be refs/pull/:prNumber/merge, but also says that the specified branches for on: are matched against the ref. Since that ref never includes the branch name, I don't see how this works, but I'm reading from multiple sources that it would indeed filter on the target.
PR donβt create merge so GitHub actions wonβt fire
It should fire on merging of PR
Every push creates a commit which simulates a merge into the target branch
That commit is what CI checks out by default.
i have problem with nginx and docker
project structure
nginx.conf
events{}
http{
upstream django {
server api:8000;
}
server {
listen 80;
root /project/static-media/;
location / {
try_files $uri @django;
}
location @django {
proxy_pass http://django;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
}
im trying to serve media files there
and ofc django uploads them there
but nginx dont see them
version: "3.9"
services:
db:
image: postgres:13.1-alpine
environment:
- POSTGRES_DB=db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"
volumes:
- postgres:/var/lib/postgresql/data
api:
build:
context: ./project
command: /bin/sh -c "/entrypoint.sh"
volumes:
- volume:/project/static-media/
env_file:
- ./.env
ports:
- "8000:8000"
depends_on:
- db
nginx:
image: nginx:1.17
build:
context: ./nginx
volumes:
- volume:/project/static-media/
ports:
- "127.0.0.1:80:80"
depends_on:
- api
volumes:
postgres:
volume:
thats my compose ^^
any idea?
entrypoint just migrate,collectstatic and host with gunicorn
According to Docker-Compose file reference it seems that it's valid syntax: https://docs.docker.com/compose/compose-file/compose-file-v3/#ports
Ah ok, just something i found odd. So it might have been a cause of a problem
Is this the correct place to ask about stubs in vscode?
I'm just gonna go ahead. I'm trying to make typing stubs work with vscode (python 3.8.5) which, from what I understand, should be able to provide type information for various libraries, much like facades to js when using scala.js
However I'm unable to make even numpy and matplotlib stubs work
I pip3 install data-science-types but I still get scary squiggly lines
For types such as int64
I am starting a new project to create a tool for developers. Where can I post asking for collaboration. My github: https://github.com/Inaruslynx/SmtApi
can someone help me, im trying to make a PDF Invoice generator from this website https://invoice-generator.com/, i cant locate the textboxes can someone help me?
what do you mean?
wrong channel, #βο½how-to-get-help
Hi can anyone help me with PyInstaller issues?
I've narrowed down the culprit libraries to: Matplotlib, OpenCV and Scikit-Image
@graceful moat can I get a bit more information?
idk how but it's working now...
I spent hours upon hours but the last steps I remembered were uninstalling/reinstalling pyinstaller, wxpython, setuptools in my conda
but much appreciated
I have another issue with PyInstaller and Cefpython3 though...
Got the error message?
hey I'm a bit busy rn but thanks so much for the response!
I might check in later tonight when I have time.
π
Hi guys !
I need someone to help me with a regular expression (regex)
"Some word here other_word_here"
I need the regex to find a group of words that are only separated with 1 space
Found it: ^\S+( \S+)*
That doesn't seem to be completely accurate
For example
word word word word word word word word word
That regex would only match the first three
even though the middle word of the 2nd and 3rd groups technically is also only separated by one space
And depending on what you even mean by separated by one space, one could argue each group matches and its the groups that are separated by more than 1 space, not the individual words
What's the normal way of running tests that include a database?
im using sublime for python but the suggestions arent showing any help?
Hiya, just found this discord. A question - does anyone know of any tools that can make code more minimal?
I'm looking for anything that can, for example, reduce this:
var_a = "a"
var_b = "b"
if var_b == "c":
pass
if var_a == "s":
pass
print(var_a)
to:
var_a = "a"
print(var_a)
The endgoal in mind is to create minimal working examples from large scripts
Hmm, pyenv has decided to break, I'm in a virtualenv, but pyenv is still taking control of the path
Any ideas on how I could fix it?
What VPS's do you all use?
I use GCP, works well
If you want, there's a list of VPSes in the pinned messages of #discord-bots (it's the second pin)
What does your PATH look like?
Does anybody know how I would specify vscode to use flake8 as linter?
If you type linter in the command bar, donβt you have a select linter entry ?
Hello, i have a problem with Python in Doom Emacs
got it thx
Whenever i create a python file, this error appears:
Does anybody know how to solve this?
Hello I am planning on making a web app that would be a bug tracker, the question that I wanted to ask is:
In your opinion, what are the features every bug tracker needs?
Comments, labels/tags, priorities, assignees, search/filtering, closing or resolving tickets
Being able to keep tickets private e.g. for reported security vulnerabilities
Support marking duplicates and showing which tickets are duplicates of others
how come that, in debug mode, pycharm will sometimes kill my program after error, and sometimes let me execute more code in the debug console?
hey
i wanna stucked in python
When I Type Python to open it in my Terminator
I don't know Why its not openning
Plz see this
@idle cosmos Per Rule 6, your invite link has been removed. If you believe this was a mistake, please let staff know!
Our server rules can be found here: https://pythondiscord.com/pages/rules
@stable olive maybe u messed up the installlation
need some github actinos help:
https://github.com/Shivansh-007/gurkbot/runs/1722697371?check_suite_focus=true
why is this getting skipped
https://github.com/Shivansh-007/gurkbot/tree/main/.github/workflows all the workflows
What's the problem here?
@mild lance Does python exist on your venv/bin?
Might be a platform-specific thing but venv on Mac not producing the python alias is understandable
What do you mean?
Changing it to .env seemed to fix it, but I'm not sure if it's because I just created an entirely new venv or renamed it
The Python interpreter in your venv is just a symlink, you could change which file it is pointing to @mild lance
@prisma cipher one of them is a tab, one of them is 4 spaces
convert all tabs to 4 spaces
How to code π ?
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
i made a web based app using django and vue. Though it is web based, it is supposed to be used locally. The vue code can be made available easily (I can simply package the dist folder that is generated). But for the backend (made using django), I have no idea what to do. Should I make a script that users can run so that a virtual environment is created automatically and activated every time this app is used? Or are there better ways to do this?
Containers
Please tell me if I haven't been clear. I will try to explain more
Or if you can trick whatever server runs Django to serve up your Vue app would work
I don't really want to use them since containers are large and people tend to avoid them for small use cases. However I would keep them in mind
And venv is light?
The vue app can be served easily using a Python Server. However since the project depends on django, ariadne etc I am not sure, should I create a new venv?
argon2-cffi==20.1.0; python_version >= "3.6"
ariadne==0.12.0
asgiref==3.3.1; python_version >= "3.6"
cffi==1.14.4; python_version >= "3.6"
django-cors-headers==3.6.0; python_version >= "3.6"
django==3.1.5; python_version >= "3.6"
gitdb==4.0.5; python_version >= "3.4"
gitpython==3.1.12; python_version >= "3.4"
graphql-core==3.0.5; python_version >= "3.6" and python_version < "4"
gunicorn==20.0.4; python_version >= "3.4"
pycparser==2.20; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.4.0"
pytz==2020.5; python_version >= "3.6"
six==1.15.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.3.0"
smmap==3.0.4; python_version >= "3.4" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.4"
sqlparse==0.4.1; python_version >= "3.6"
starlette==0.13.8; python_version >= "3.6"
typing-extensions==3.7.4.3
Thats my requirements.txt
By containers do you mean docker?
The users should have docker installed in their system then, right?
any one got suggestions on dual booting kali linux with chrome os
Are there tools to somehow input keyboard events into a running process in Windows?
Or if the process is opened / user is interacting with it?
hello anyone that knows how to use win32printing module ?
idk if iam at the right channel
If I have 8 pods in k8s, is it possible to load balance to 7 of the 8?
I've never used kubernetes before, which is why I'm asking
Another question is: What's the point of having multiple containers in a pod and why would that be useful? As well as: How would you distribute information to the different containers in a pod?
Why would one pod be left out?
Some stuff is linked really tightly
They're two different applications
I'm not sure if I'm supposed to run multiple applications which do different things in one cluster
you can if you want
New job issued me with a Win10 laptop on which I'll be mainly doing Python development. Does anybody know of a good alternative to direnv on Windows?
Can't be bothered to develop on wsl only for that dependency but I am just too used to it as it's such an elegant solution to avoid cluttering the system with too many project env vars
Hey guys, I am new to auto deploying and have run into an error.
I've been following this tutorial to deploy my script to my server on git push to master, but I've run into a problem:
2021/01/20 12:38:58 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Tutorial I've been following: https://www.youtube.com/watch?v=gW1TDirJ5E4
Would be this be the appropriate way to structure my yaml file?
name: Deployment Workflow
on:
push:
branches: [ master ]
jobs:
job_one:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: testing Cetti Server ssh connection
uses: appleboy/ssh-action@master
with:
host: IP-ADDRESS
username: USERNAME
key: ${{ secrets.DEPLOY_TEST }}
port: 22
script: |
cd deploytest
git pull origin master
git status
Could someone please help me set up a venv on pycharm? A link to a decent tutorial would be appreciated also since none of the ones I could find were very informative
Add Interpreter -> Virtualenv Environment -> New environment -> Fill Location and choose Base Interpreter -> Done
I can't configure the correct libraries to it, how would I go about doing that?
So for example discord.py and all its' dependencies
After setting venv in your project you can go to Terminal and install them by entering pip install [library] or pip install -r requirements.txt
Oh that makes sense, tyvm
Additionally when you import unknown library in your code, like urllib3 for example, PyCharm is going to ask you about installing this library
For some reason the libraries are available to the project even if it's not in the venv libraries, that's what's confusing me the most
You can check that global installed librares are available also in your venv
I see, doesn't pycharm handle that for you though?
How do I uncheck that?
Nope, you must agree for installation
When you are adding new venv
I see, I'll try it out. Tyvm π
Your welcome
How can I merge a change on the master branch to a different branch? (github)
git merge master (from the other branch)
Yeah I figured, thanks
No problem, in the future, it's ideal to seperate branches by features, master, and hotfixes so that you can merge a hotfix branch into development rather than into master and master into the feature branch.
This image is a really nice standard to follow
@muted cobalt
Thanks, will save that
Awesome, glad I could help :D
How should we do tests that require a db connection?
Is there anything we can use to mock a postgres server?
Hmm, could you make a test database?
I am using anaconda python 2020.7. Will conda update --all be good enough to upgrade my existing version to 2020.11? Are there things that I am missing out if I don't install 2020.11 directly from installation file?
does anyone know how to check XPath version?
I have anaconda-navigator installed via homebrew. The conda command or python doesn't work in the terminal (I'm on mac. the python is the system default for some reason). How do i fix this?
I followed this: https://medium.com/ayuth/install-anaconda-on-macos-with-homebrew-c94437d63a37
I have another pipenv shell session running in another directory on tmux, I'm trying to run a new one in a different directory, says ones already activated and can't exit the other one for some reason
I am using vs code for python but the output box contains the whole file directory and then the output. How do I remove the directory and only let it show the output?
https://imgur.com/TbB7LBm
:x: According to my records, this user already has a mute infraction. See infraction #26977.
:incoming_envelope: :ok_hand: applied mute to @true lark until 2021-01-21 19:09 (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
Click the trash button and then click run.
I have a postgres database that I want to access from inside a docker container, how should I do so? Right now, I am forwarding port 5432 from the host machine to 5432 of the container, but it doesn't seem to work.
are you using docker-compose?
right, so, just so I understand
you've got postgres locally?
and then you wanna access that postgres from inside a docker container?
Yes, or, ideally, on a VPS, I would access the external (local to the VPS) database from the container (on the database)
right, let's see the dockerfile. you'll basically need to grant the container access to the local network to do this
which feels a little hacky to me
The database is on localhost
yeah
often, you would have a container for the database
1 container per service
and then you'd set up a virtual network between the two services
which docker makes very easy
especially with docker-compose.
this is how we do it in our infrastructure here at python discord, for example
If the container dies wouldn't all of the data be lost?
no, you'd store the data in a volume of some sort
ah
So, the server is running on a container, but the data is stored via a volume?
I'll need to figure out how to create a database server on a container
The PostgreSQL object-relational database system provides reliability and data integrity.
postgres have an official image
so it's very easy to set up.
awesome!
on our website, we have a docker-compose file with postgres set up so you can see an example of that
pythondiscord.com - A Django and Bulma web application. - python-discord/site
we only use it for local testing, but still
I've actually never used docker-compose before, so I'll use that
so actually this docker-compose does not have data persistence for postgres, but basically you just add another volume and you're good
Sounds good, thanks for the help :)
no problem, poke me if you get stuck
Where do I run it from? it is blank now
I was configuring vs code to look more like repl.it
your file needs to end with ".py" for vscode to detect it as a python file
normally the run button would be in the top right if it was actually a python file
@glass geyser
Finally got it working, but I do not want all the extra text. I just want the output of the code
how do I remove all that text
i dont think you can
I don't know how to do it inside vs code, but if you really wanted to, you could create a utility which clears the console before running
Anyone know if they can help with this issue?
Hey guys even though for vsc my font is set to Fira Code, why isn't it changing it???
@rich nymph check the settings.json
ok
If I write unit tests in pycharm using unittest.TestCase, pycharm immediately knows that those modules are unit tests. But now I'm using pytest and it doesn't know that.
I don't know how to get that functionality
Python can make your computer do whatever your computer could possibly do, so it's always a matter of "how".
I think I got it
then howw?π
theres a library i dont remember the name of which does that
it cannot be too hard, if i work hard i think i can make it myself
like, i can just store every letter and number by writing on the same paper, than read the text, and use pillow or something to join the images according to the letters
not that neat but could work out
maybe
just use a handwriting number like mnist and then lookup
Is this a bug in PyCharm's linter? https://i.imgur.com/d17M6T4.png
code ```py
total_fuel = 0
for mass in module_masses:
while (mass := mass//3 - 2) > 0:
total_fuel += mass
print(total_fuel)
not detecting the walrus assignment?
@stoic bear i remember someone told that need ML (tensorflow)

