#tools-and-devops
1 messages ยท Page 51 of 1
@sage perch so like a web communication thing? Is this for like email or what?
Honestly, encryption with python is pretty easy and well documented
Well, I misspoke, common encryption is well documented. If you are using some off the wall or custom encryption, that won't be lol
But really, unless you are a government, no reason not to just use common encryption
Personally, I like ECC
Are you wanting to do shared keys or a pki style?
I'm gonna try to make smth like the enigma machine
But I'll probably give up half way thru and use smth else
You put a key in at the beginning and then everything you send is encrypted with that key
And someone else has to have the same key to understand it
@gusty willow
Thanks
So I'm currently using Travis CI for a project I'm working on, and I'm using tox to run tests on two different Python versions. I'm thinking of caching the .tox directory in the project directory so they persist between builds. Would there be any disadvantages in that?
I'm having a very odd error with my gitlab CI pipeline, where i'm cross compiling python packages. it does not work if i use the shared runner, neither if i use my own gitlab-runner running on ubuntu 2004. the only place where it works for some reason is a gitlab-runner on windows (with docker+wsl2)
these are the different platform uname outputs:
gitlab shared runner (provided by gitlab)
Linux runner-72989761-project-19839097-concurrent-0 4.19.78-coreos #1 SMP Mon Oct 14 22:56:39 -00 2019 x86_64 GNU/Linux
my runner on ubuntu 2004
Linux runner-f4dyxxgj-project-19839097-concurrent-0 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 GNU/Linux
my runner on windows
Linux runner-zylfxwum-project-19839097-concurrent-0 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 GNU/Linux
This is the error i'm getting:
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /tmp/pip-install-uhs3msru/uvloop/build/libuv/.libs/libuv.a: error adding symbols: file format not recognized
I have got this sick problem with pycharm professional on Ubuntu, I have installed all the packages and setup 'Project Structure' sources but I can't understand why this is not working:
Opening python shell using venv Terminal in pycharm:
>>> import os
>>> os.getcwd()
'/home/dude/Documents/WebDev-Training/Restful Python Web Services/Chapter 2'
>>> import flask_sqlalchemy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'flask_sqlalchemy'
>>>
Opening python console (solo):
>>> import os
>>> os.getcwd()
'/home/dude/Documents/WebDev-Training/Restful Python Web Services/Chapter 2'
>>> import flask_sqlalchemy
>>>
How there is a difference between them? both of them seem to use python virtual environment that I have setup but only one of them is working, I actually need the python venv shell to work
Any help?
[Solved]
I am using windows 10 and pycharm. In my Users/<username> folder, I find many pycharm folders of older IDE versions like .PyCharmCE2019.1, .PyCharmCE2018.3. THey take up GByte of space. Can they be deleted safely?
So, I keep conda around as my default Python. Work wants me to set an orchestration thing in motion tomorrow on my local machine (they're still setting up my logins and stuff).
the whole thing is in a Poetry environment - are Poetry and Conda gonna cause trouble alongside each other?
should I maybe just install the Poetry env into like a Docker container or something?
You can install poetry inside a conda env
Bois
I need some help
I'm trying to make the most complicated thing I can
That does absolutely nothing
Maybe prints smth
If anyone can help with making it more complicated please @ me
Sorry for posting this in 2 different channels, not sure which would be better. Me and my friend are trying to make a discord bot which i plan to host on my linux server. Are there any free python ide's that can connect to a server(i guess ssh support) so we could both work on it?
VSCode can but that's now how you cooperate
take a few hours to learn Git and Github
Ok, thank you. I will look into Git/Github
@ebon sail Bituckets also good, it has unlimited free repos
is there certain config u need to set for elixir in travis.yml file ?
does anyone know why my vs code editor doesnt auto save anything? i have the auto save turned on
@river sinew Thank you
does anyone know why my vs code editor doesnt auto save anything? i have the auto save turned on
@heavy knot do u have it set to delay?
i figured it out thank you
you're welcome
@ebon sail I would be amiss if I didn't mention Gitlab in the "git" discussion (it has the best built-in CI and unlimited teams/private repos)
Awesome, thank yall for all the suggestions
so, i created a new user on my digital ocean, ubuntu droplet, I was advised that I would have to go and create a new user on there; for reasons I won't go into detail here, however now I actually need to log in to this new user that I've created
how would I accomplish that?
is that something that is done during the ssh process?
You can directly login as the user via ssh
@sand thistle ssh <new user>@<droplet ip>
also ... i can't remember if DO forces you to use SSH keys or not, but if so, you will have to create one and drop the pub key on the droplet and pull down the priv key
does digitalocean give you a place to put a "public key" @sand thistle ?
or an "SSH key"
Yes sir
@sand thistle then you need to generate an "SSH keypair", and upload the public key to DO
Gotcha
i forget, do you use windows or linux?
Unix
ok good
So, I did this already
do you have a ~/.ssh/id_rsa file?
But for root
Yea
I've done this before, I just wasn't sure.
I guess I have to make another keypair
you can use the same keypair. in general you dont want to log in as root
if your private key is compromised you are screwed anyway
no, do not modify that file
Loll
definitely do not modify that file
how about this
go make a 2nd key
there is nothing wrong with having 2 keys
you just need to keep track of which key is for which account
i've seen a variety of recommendations
nowadays i just have 1 keypair per machine that i use
but my hosting company (hetzner) gives me the ability to log in via a virtual console
so i dont need to be able to ssh in as root at all
so for example if i have 3 computers, A B and C. i make 1 private key on each computer
then i can use those public keys in all the places i need to access
so i have a public key for A, B, and C on github.com and on my servers
note that i am not a security expert
however there are several questions about this topic on https://security.stackexchange.com
Hey everyone
Is there anyway to install python 3.8 on shared hosting
and setup a virtualenv
@hexed arch you can use pyenv, which installs python in your home dir
you just need to add the pyenv bin directory to your PATH
I've tried I couldn't seem to get it to work
you tried this? https://github.com/pyenv/pyenv-installer
what went wrong?
and what was the problem?
Can't remember it was a couple hours ago after that I had such a bad time trying to install conda
So I run curl https://pyenv.run | bash
right
another option is brew (aka "linuxbrew"), which is a general-purpose package manager that also installs itself to your home directory https://brew.sh/
if you install conda, i recommend miniconda3
do not use the full anaconda, it installs a bunch of extra junk
miniconda3, homebrew, and pyenv should all do what you need
Ok so install homebrew to install pyenv
you can install pyenv using homebrew
but i don't recommend it unless you already know what you're doing
it's better to just pick one of these tools for now
usually you can just rm -rf if the installation fails
Yea I suck at linux so I probably don't want to touch that
let me try pyenv again
Just to clarify i run
curl https://pyenv.run | bash
So I've installed
and then used
export PATH="/home/u876004025/.pyenv/bin:$PATH"
to add it to PATH
Ok this is the error I get
python-build: TMPDIR=/tmp cannot hold executables (partition possibly mounted with noexec)
I guess I have to change the TMPDIR
how do I do this? thats what I need to know
mkdir ~/tmp
curl https://pyenv.run | TMPDIR=$HOME/tmp bash
So I install again in $HOME/tmp?
no thats just tmpdir
ohh ok it sets the tmpdir
hopefully yes
python-build: TMPDIR=/tmp cannot hold executables (partition possibly mounted with noexec)
same thing again ๐ฆ
did you add it to bashrc?
nope
you should probably set that in your .bashrc
yes, in the file ~/.bashrc
ok
export TMPDIR=$HOME/tmp
problem is i don't have access to .bashrc and even if i do i suck at linux and don't know where it is
so i have a file start.sh
you dont have access to it?
export PATH=$PATH:~/.local/bin
export TMPDIR=$HOME/tmp
and i just run this everytime i login
it sets up pip and now the tmp dir
why do you think you don't have access to it?
shared hosting
...have you tried creating one?
however there are several questions about this topic on https://security.stackexchange.com
@tawdry needle thx!
i mean, i guess it's possible that your shared host would block it from being created
but i kind of doubt it
i guess you should check to make sure if compiling software is allowed under the terms of service
i'd be kind of horrified if it wasn't allowed
it looks like you already have a .bashrc file
so what if you just edit the bashrc?
yea im doing rn
didn't even see it mv
mb**
didn't work
thats ok i have custom method of doing it
ok its installing python i think
downloading currently
configure: error: no acceptable C compiler found in $PATH
Now I have to install a C complier
ah
that might be a bigger problem
i don't think you can easily install GCC yourself
conda is a much better option in this case
When I was going to enroll in a Data Analytics course, I was told to install Anaconda on my MAC. I did and the latest version of python from Anaconda shows as pthyon 3.7.6. When I type python into terminal, it warns me not to use Python 2. Why does it see Python 2.7 when i have 3.7.6? Do I always have to type in python3 when in terminal?
@heavy spire macs come with both python 2 and python 3
do not mess with the system installed pythons
make 100% sure you have a conda env activated
@tawdry needle how do I ensure I have conda env activated?
@heavy spire if you didn't type conda activate you probably don't have a conda env active ๐
it will say
it should also adjust your prompt accordingly
(envName) at the beginning of the cmd line
ah, that worked. When I type in conda activate, it finds python 3.7.6. Thanks!
use conda env list to list the conda environments you have available
in general it's recommended not to install things into the base env
ideally you create 1 env per project
but for simplicity you can create a "sandbox" env or something like that, and activate that env before installing things
as a general rule, when working with package managers, you should try to keep the "main" environment clean
I haven't even gotten that far. I was just trying to use something other than repl.it to write some python code
But that's good to know for later!
Salt I had a weird error while installing conda
./Miniconda2-latest-Linux-x86_64.sh: line 409: /home/u876004025/miniconda2/preconda.tar.bz2: No such file or directory
Any fix?
you know what let me try reinstalled conda
from the start
I go to
and download miniconda for python 2.7
@tawdry needle Quick questions
Should I be getting miniconda3 or miniconda2?
Miniconda3 will now be installed into this location:
/home/u876004025/miniconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/home/u876004025/miniconda3] >>>
PREFIX=/home/u876004025/miniconda3
Unpacking payload ...
Miniconda3-latest-Linux-x86_64.sh: line 409: /home/u876004025/miniconda3/preconda.tar.bz2: No such file or directory
-bash-4.2$
I got 3
This is the error that i've been trying to fix for a while now
minconda 3
always 3
i have no idea what that's about. maybe your shared host is blocking certain requests and causing the download to fail
you might be stuck tbh
what python version is on your shared host?
2.7.5
I've done a bit a google to no avail
Nothing
that I found that helped in the first few results
@tawdry needle Do you think I could use my linux laptop to install conda into a folder put it onto a usb
put it on my main machine
and upload it to the server?
would that work
im downloading redhat linux right now so i dont have any problems with different linux distros
im gonna install it on my old laptop
install conda
and then move it to the server
hope this works ๐
im going to long ass long route
Today is first time I opened a ipynb file. I noticed I can open this file using jupyterlab and jupyter notebook. I'm confused here.
Since lab is newer, is it better to use jupyterlab instead of notebook?
Both are fine, lab is newer but if you don't need it's features notebook is fine too.
Both are fine, lab is newer but if you don't need it's features notebook is fine too.
@sleek grove is lab more unstable since it's newer?
In my experience, it depends. Sometimes labs is more unstable but it does have a lot of nice features. I tend to use notebooks but its also what I'm more used to
some ipynb files are huge. Is there a way to set bookmark on an ipynb file?
what are pros and cons of jupyterlab vs jupternotebook?
labs = more features, potential instability, notebooks = stability, fewer features
what does a directory with a yellow highlight mean in PyCharm? (in the project panel)
Like this... and why is the folder icon for .vscode orange
.vscode is orange because it's excluded. I'm not 100% sure what the yellow highlight means, but I think it might mean gitignored or something.
If you look in settings, and project structure - you can see what the different file icon colours mean
fitle -> settings -> project -> project structure
thank you
Is there any way to allow interoperability between a Conda env and pip?
@tawdry needle Thanks so much for your help yesterday
I got conda working ๐
Heres how
- Install centos on my laptop
- waste 40 mins trying to figure out how to make gnome work
- install conda and put it on a usb
- upload it via filezilla on my main machine
- turns out conda files have some hardcoded paths depending on where you install
- on my linux machine in the home folder make a folder called u876004025 (hosting username) and then install conda again
- upload it to the server again
- add it to path
and now it works
Heres some context
I'm trying to run django but my hosting has python 2.7.5
So I need to use conda to install python 3.8
Conda is not only a virtual environment tool, it's a package manager too. So it supports packages beyond Python ones. In fact, you can even install Python itself via conda.
Yup
Fair enough. I just scrolled back and saw your issue. That's nuts
Yea ๐
I wonder would pyinstaller help here...
That's used to install python packages, not for Python itself.
No, it's used to create a single executable that contains a python interpreter, the application, and dependencies
Yes, that is what I mean
Are you proposing to use it to create a dummy package just so you can obtain an interpreter?
Conda will be better in the long run because I can use it on the whole server
Is pyinstaller like a env?
Yeah that's fair. I reread the original problem and using conda is definitely better. I was under the wrong impression that you just wanted to run some script (and pyinstaller would probably be able to do that reasonably well), but having a full interpreter wouldn't really work with pyinstaller
pyinstaller is a tool to run some python app as a single executable. it bundles the interpreter and dependencies with the application into an archive. so it essentially contains an env, but it isn't as flexible as having your own installed interpreter like what conda gives you
Yea plus I'm not only using this to run django
I don't need python 3 for flask
I used python 2 and It worked just fine but 3 would be better I guess
yeah with py3 you get f-strings \o/
Yep
Ok so making a new env didn't work for some reason
it got stuck with python at 97% everytime
so im packing my current env and moving it over
how would I actually copy a directory within my digital ocean droplet
i have to copy something from root
to a user
Hey all
I been working on a flask project and suddenly there was a power-cut and a sudden shutdown, after that when I opened the project, only the index page is rendering, and issues are as follows:
1: everything was working fine before shutdown
2: I am not getting any exceptions or errors at all, so I am blind here, I don't even know what the problem is
Also, this is what my terminal shows when I run ./pycharm.sh:
https://pastebin.com/rkz2Hfj2
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.
Looks like something your text editor uses got corrupted
Well I use pycharm for everything I do
I also created another flask project and moved all the files there, still it doesn't work
I could also use the application without pycharm, I activated venv in a terminal and still couldn't render anything except index page
Anyone know how to encrypt a password for a 7z shell function?
In my .bashrc file, I have a function for calling 7z on a folder and encrypting/password protecting the output. The only problem is that the password is in plain-text, so if someone gets into my .bashrc file then it's totally exposed. I'm looking for a way to encrypt it and keep the password safely inside my password manager.
function r-nest {
# Backup PortableApps directory
# --- Variables ---
current_date=$(date +"%m_%d")
input="/A/nest"
output="/B/Temp/nest_$current_date.exe"
password="supersecret_plain-text_password!"
# --- 7-zip ---
7z a -mhe=on -bsp1 -sfx7z.sfx -xr!plex -p"$password" "$output" "$input"
7z t "$backup_file" -p"$password"
}
@covert kindle set the permissions to 600 at least
or have your bashrc read your password from a file with 600 permissions
that way in theory nobody can read the file without "hacking"
(or being root)
That was my best guess at a solution, but since I use GitBash permissions mean nothing ๐
Guess I'll just ๐ค
@sand thistle sudo cp <thing> /home/<user>/<thing> && sudo chown <user>:<user> /home/<user>/<thing>
can anyone help me with this
i want to get a result like i said above
and loop over the code
since there is a file which contains many lines of the similar format
im tryng to work with some like 7 year old code
written in python 2
whats the best way to do this in pycharm without fucking up my main python install
on ubuntu btw
I suggest looking into installing Python 2 through pyenv
It should be relatively painless
pyenv manages paths for you as well actually
will that mess with paths at all
so
im supposed to run make
inside this one directory
this src directory
but when i run it
i get this error
here are the contents of setup.py
#! /usr/bin/python
import distutils.sysconfig
from distutils.core import setup, Extension
import numpy as np
numod = Extension('mpolar',
sources = ['mpolarmod.c'],
extra_objects = ['misc.o', 'multipol.o', 'efield.o'],
include_dirs = [np.get_include(),
distutils.sysconfig.get_python_inc()]
)
setup (ext_modules = [numod],
name = 'mpolar',
version = '1.0',
description = 'Multipolar expansions',
author = 'Alejandro Luque',
author_email = 'aluque@iaa.es')
my pycharm seems to be underlining quite a bit of shit but im not sure how to go about debugging this
a lot of the components might have changed since python 2, i suggest looking up everything and substituting for the new components/rewriting the code
For now the problem is not even python related, he gets a command not found when make tries to execute the python file
Doesn't seem like the shebang is being taken into account
So I recently just completed a job using nomad instead of kubernetes and I highly recommend it.
@gusty willow I have a "core" Docker stack that is just Consul, Vault and Nomad. Makes a base for a good deal of my work.
I have a repository where we used to use a development branch which merged with the main branch via a merge commit. We then started committing directly to master and as such the dev branch has been out of sync for a long time.
I'd like to sync these branches up now so future development can be done in the development branch instead. would git checkout development && git rebase master do the trick? Will git understand that master has had a merge/pull come in from develop in the past and that the branches are identical until then?
not sure if this makes any sense, but basically:
master:
some commits -> merge/pull from development commit abc123 -> new commits
development:
cloned from master -> lots of commits -> commit abc123
I want to get the new commits on top of development, add more commits, then rebase those on top of master at some point.
You should just be able to merge master into develop
I should be able to use rebase as well right? I much prefer rebase to keep the commit history clean
You don't want a merge commit?
not if I can avoid it
though if I can't it's not a huge deal
does the merge commit serve some kind of purpose, such as telling git which branch it merged from so it's able to do things such as rebase and merging better in the future?
It's signal to whomever stumbles upon it in the future, should they need it. Who did it, why, any notes. It makes a commit with a message that you can edit or keep as-is.
But yeah either method should work I guess.
hm. you're right. maybe it's better in this case.
What's your source of truth stored on? Github/lab? Bitbucket?
github
My personal preference is to rebase from features and other short lived branches (except for hot fixes) and merge on larger branches so I can easily search for merge commits.
yeah, that seems to be best practice. the work on this project hasn't been very well organised before, almost all work has been done on master
Eh, however gets you there. You can always tighten up going forward as needed.
true true. got it all up to speed now. turns out git merge doesn't even create a merge commit in this case
here anyone configured apache to serve flask app? with cgi?
With cgi? I thought that was more of a PHP construct. But yes Apache is ok with flask (just have to build out the wsgi script) @viscid schooner
okay
how to install libpng12 package in heroku
it was in response to the previous message
the name of libpng12 might vary depending on your OS
assuming heroku allows you to install anything at all
oh ok
Ok. I am having issues activating a Python virtualenv inside a docker container and keeping that container interactive for use both locally and in a Gitlab CI/CD Job. I have tried both (and various form of):
CMD [ "/bin/bash", "-l", "-c", "source /app/venv/bin/activate; exec /bin/bash $@" ]
ENTRYPOINT [ "/bin/bash", "-l", "-c", "source /app/venv/bin/activate; exec /bin/bash $@" ]
This will launch a local interactive run just fun using docker run -it, but fails when being run in Gitlab:
/bin/sh: /bin/sh: cannot execute binary file
ERROR: Job failed: exit code 126
How do I get the python virtualenv activated in such a way that I can maintain an interactive shell in both a local environment and CI/CD environment?
I have also trying using an entrypoint script:
entrypoint.sh:
#!/bin/bash
VIRTUAL_ENV=/app/venv
source $VIRTUAL_ENV/bin/activate
/bin/bash "$@"
ENTRYPOINT ["/app/entrypoint.sh"]
Why do you need an interactive shell for CICD?
In a CICD context, I don't use virtual envs. I have a container per version I need to run it on
In a dev env, I understand the shell, but not CICD
The whole dockerfile is here: https://pastebin.com/f26ni1LZ
First, in CD, I don't use virtalenv, I use the built-in venv
I will look into that
Also, I know nothing of Apache spark, but I guess it's a java app?
Otherwise, idk why you are using a jdk base image
yes its java
Generally, I would sperate the py and Java stuff into separate containers
But like I said, never used it
Spark itself is Java, but it lets you run Python on it (as well as Scala, R, and SQL)
Also, what is your pipeline trying to do even?
There really is no reason to have an interactive shell in a CICD context
If you need like a spark instance to run tests and stuff on, I would build out a runner to do that
The CI/CD Job would be something like:
Test Job:
image: my_image
stage: test
script:
- do x before tests
- run pytest
- do y after tests
The goal of this docker image is to provide a reproducible execution environment in which tests can be run locally by developers as well as by a CI/CD Job in a CI/CD Pipeline
The developer would run the image using docker run and mount their workspace as a docker volume. then they would run the tests locally inside their local image
Well, not to knock it, but that is a general misuse of volumes in my opinion
There is a small mountain of dependencies that are required before you can even execute the tests: Java, Python, Spark, and misc python libs and OS packages. It is not trivial to get an execution environment up an running
any fix?
ERROR: Could not find a version that satisfies the requirement pyinput (from versions: none)
ERROR: No matching distribution found for pyinput
@ornate lodge yeah, which is why I suggest a runner rather than image
@polar crow sounds like it doesn't exist lol
@polar crow https://pypi.org/search/?q=pyinput
No such package pyinput
Granted, you have given me zero context, so I assume you typed pip install pyinput
@ornate lodge I totally get what you are trying to do though, I had a similar, but not as terrible an experience with Jenkins
I just need to try it myself in gitlab
@gusty willow thx
@gusty willow I found a way to get the virtualenv activated by default without resorting to ENTRYPOINT or CMD shenanigans.
RUN echo "source /app/venv/bin/activate" >> /root/.bashrc
CMD bash
Does anyone know how I would go about fixing a git repo that's linked with a local directory on my PC? I accidentally made a few commits with a file size that exceeds the GitHub limit, but I don't know how to get a list of all the files so I can uncommit/unstage them. By the time it gives me a list, it's too late and stuff messes up.
You will have to rewrite git history and it's a pain in the butt lol
how might I go about that?
Unless it's an important repo, I usually just suggest deleting the GitHub repo, starting a new one with the same name, changing the git remote, and try not to make the same mistakes lol
hmm that was one approach
It is possible though, but I'd have to look it up
And I'm not in a position to do so
I'm confused by this image ranking python IDEs. Is Jupyter Notebook an IDE for python? I thought it's some kind of software to read books that can run python code
@umbral jay Just ignore it all and get vs code ๐
Its so versatile and has thousands of plugins
its also developed by Microsoft
Its so versatile and has thousands of plugins
@hexed arch pycharm is still more popular than VS code today.
Is python the only language your going to be using?
If not, vs code 100%
if only python well pycharm as its tailored especially for python
ONe can use pycharm for python and VS code for the rest. Hard to beat pycharm for python
Surprisingly, free VS code is even more popular than paid Visual Studio. I wonder who's using visual studio and why are they paying when free VS code is so good
because visual studio is for c#
its made mainly for c# like pycharm is for python
its also alot heavier than vs code
but for vs you can also use it for c++, f# all microsoft languages basically
I use IntelliJ IDEA Ult because I appreciate the tools. There is a lot that the jetbrains tools do that VSCode doesn't or can't yet.
Although, the fight is getting less interesting due to LSP
Also, I despise Microsoft
So that plays in lol
Although, the fight is getting less interesting due to LSP
@gusty willow what is LSP?
Microsoft has changed. it's friendly to open source today
@umbral jay language server protocol
And they haven't changed, they are pandering because they lost a ton of developers
I'll be the first to say I was wrong if they remain as "friendly" if they win the cloud wars
But even vs code, the best parts are still proprietary
how can we see/check deleted text message?
Use the on_message_delete event
You'll be able to access message.content from the message object it gives you
Oh this isnรคt #discord-bots sorry
๐
I guess you mean SMS right?
I don't think the sender is notified when a text message is deleted ๐ค
I mean, if someone sent any text message then after sometime he/she deleted it.
How can we see/check it?
does python have RCS libraries tho?
rcs might support it, if the person has a capable phone
I understand. I'm saying that I don't think SMS will inherently be able to provide that information.
okay! thanks @tawny temple
Anyone tried using Jupyter to replace Excel spreadsheet? possible?
@umbral jay very possible, although it looks a bit different obviously
@umbral jay very possible, although it looks a bit different obviously
@gusty willow do you think jupyter can be used to replace web dashboards if one can host them online? This way, developers can write simpler python code instead of using complex javascript frontend frameworks like angular or react.
@umbral jay I've not heard of them used in this way, but I don't see why not. Although, it sounds like you have significant investment in a dashboard lol. Not sure it's worth throwing that all away
no investment in dashboard. lol. I want to avoid complex frontend frameworks and prefer simpler python. Looking for easy way out
I'll you have to do is build the widgets in those
@gusty willow those are new to me. Reading up on them now. Thanks.
does anyone here use VS Code?
is this supposed to look like this?
can I change some settings to make it look right or am I stuck with this
how do people typically install a particular version of python on Ubuntu?
suppose that I wanted 3.7.6, I think I've heard of deadsnakes, is this recommended?
Pyenv is another idea
@tawny temple i ended up using pyenv, deadsnakes seemed a bit funky
or at least - i didnt' really get it
I thought dead snakes was just a repo
But yeah, pyenv is what most use, though I tend to just build a particular version from source (with the --alt-install) flag -- which is just the slower way of doing what dead snakes does
Or use that versions docker container
docker
Apm commands not working on atom terminal
It pop up with bash apm command not found
A help would be appreciated
Also bash pip not found
@wooden ibex i have never used docker, but am curious as some projects use R as well (so maybe it will help control envs for that per-project too).
I'm wondering what the workflow is like though - I have ~/.virtualenvs at the moment where all envs are stored, would I instead put docker files in that?
also the original question was about having a different version of python available to generate venvs from, so maybe that's more what was meant than what i've just said
Does anyone have any recommendations/ guides for deploying/delivering a python project from Jenkins? (for a discord bot) [@ me when you respond pls]
@gusty willow "or use that versions docker container" - do you know where i could read about that please?
I've found this https://hub.docker.com/_/python
@topaz aspen that's the ones, those are the official ones
cool, thanks
@topaz aspen but yes, docker also helps with R environments
I've been writing some shell scripts to setup a server -- install neovim / setup zshell etc... i'm wondering if this is something that docker would typically be used for?
can someone please help with source control I'm panicking and I think I may have lost 2 weeks of progress
I think github overrode a lot of the files I had locally
or restored them to a past point
and now my progress is all gone
What did you do, it doesn't just overwrite things without action
Any honestly, you have to try really hard to do that
@nocturne yoke
idk I'm really confused right now and can only really explain on a call
but it looks like a lot of my local changes disappeared
but only in some directories
and it's back to what I have from two weeks ago
i want to find out if there are any records of the files anywhere
I can see parts of the files in pychace
pycache
so there's still a trace
git log will show everything that happened
i tried it and it's weird
This is the latest entry
but I made a lot of changes in the past two days so I don't know what's going on
git log isn't really showing me stuff that I did
@gusty willow i think i stashed the changes
would you be able to help me recover stashed changes?
Help๐ฅด ๐ฅด
I typed git stash apply but I'm not sure where to go from here
i see some of the files
@elfin rivet I honestly don't know anyone that uses atom
@elfin rivet I honestly don't know anyone that uses atom
@gusty willow setting up atom is hard![]()
oh wait i was dumb git stash apply did everything already
my files are back and my life is saved
@nocturne yoke I figured it would lol
@elfin rivet it's not hard, it's just not that great of an ide lol
@elfin rivet it's not hard, it's just not that great of an ide lol
@gusty willow it require packages, and neither package working fine!!
I installed linter
Flake8
Error pop up "error with flake 8 "
@elfin rivet just use vscode
@elfin rivet you still have to install plugins, if you want an all inclusive ide, get pycharm
@elfin rivet you still have to install plugins, if you want an all inclusive ide, get pycharm
@gusty willow well pycharm is a python specific ide only right??
@elfin rivet kind of, there are plugins for other languages though
@elfin rivet kind of, there are plugins for other languages though
@gusty willow ohkk
Unless jetbrains makes a dedicated ide, there are plugins
Yes, pycharm is the gold standard
I'm not going to copy and paste the features, you can read those on your own
Whats a faster alternative of repl for python ?
I feel pycharm and repl are slow if I simply want to see a result of statement in python.
@past gull just run it on your terminal
Any difference between vscode and code?
I heard that code is the open-source version of it
visual studio has community, pro and enterprise version. community version is free, its an ide for windows and mac. visual studio code is an opensource text editor, that's vscode.
vscode and code is the same i guess
@nocturne yoke git reflog can help you too
@nocturne yoke if you can back up and write a detailed description of what happened, i might be able to help
No worries @tawdry needle turns out I had a git stash so all is good. Thanks for the offer though!
๐
@gleaming quartz vscodium is the open source version, vscode and code are usually the same thing depending on OS
@gleaming quartz but yes, there is quite a bit of difference between the oss version and the proprietary version (in that it takes a lot of work to get the oss version workable like the proprietary version)
i don't know if this is the correct place to ask this thing, but we are hosting a discord bot on a vps, and we have a repo on github. Now everytime we want to update anything on the bot, we have to connect to the vps, and then replace the files. then run the bot again. Is there any way to make this more sort of automated?
Sure
create github action upon master/main branch push to login to VPS and stop the bot/git pull/start the bot
or cron job that does that nightly depending on downtime acceptability
poetry vs pipenv
Which do we prefer and why?
(or a third option?)
Reason I ask is because I need to decide how to manage dependencies/environments for a dev team to work on an existing project together.
Invest in poetry because it's actively maintained. The state of the pipenv project isn't good. Earlier this year they finally released an update but I'm still not very optimistic.
The only complaint I have with poetry is that it doesn't (easily/conveniently) support storing arbitrary scripts to run, though if you're fine with relying on an external for that (I've seen ones in Python like taskipy, but even make will do), then that's not going to be a huge turn off.
Another one to keep an eye on is pyflow. It encapsulates more features than tools like poetry and pipenv aim to. However, it's still relatively new. I don't know how stable it is. Last time I checked, macOS support wasn't great.
@warm fern
Thanks @tawny temple . I'll go with poetry.
Yeah, poetry is my choice as well
ive heard some complaints about poetry creeping in too
got a link for pyflow? @tawny temple
@tawdry needle https://github.com/David-OConnor/pyflow
thanks
Lol, it's in rust. But that means I can contribute ยฏ_(ใ)_/ยฏ
Probably going to look into it though
But yeah, there are some gotchas in poetry
Last time I checked, the .whl still didn't work
@wooden ibex do you think you will be able to guide me a bit?
I'm not familiar with Github actions for SSH
oh ok
Is there a way to send a KeyboardInterrupt through pycharm's run window without the emulate terminal setting enabled?
Does anyone reading this endorse and actively use virtualenvwrapper or does anyone else actively think I should not waste my time looking into it?
Iโd only consider it if you critically need it
ive never seen a need for it i just use venv
i do like some of the tools they provide but im just not sure how necessary it is nowadays
workon is pretty nice
Hello, I'm new here and with Python. I dont really know where this problem should be put, but I think library argparse is kind of tools in Python. The problem is that i get error " error: the following arguments are required: -i/--image." and I don't know how to fix it and cant handle it myself, would be very appreciated for explain it to me.
Hey @nocturne anchor!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
โข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
โข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Here is the code: ```python import argparse
import cv2
import numpy as np
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="Path to the image")
args = vars(ap.parse_args())
def resize_to_screen(src, maxw=1380, maxh=600, copy=False):
height, width = src.shape[:2]
scl_x = float(width)/maxw
scl_y = float(height)/maxh
scl = int(np.ceil(max(scl_x, scl_y)))
if scl > 1.0:
inv_scl = 1.0/scl
img = cv2.resize(src, (0, 0), None, inv_scl, inv_scl, cv2.INTER_AREA)
elif copy:
img = src.copy()
else:
img = src
return img
image_name = args["image"]
image = cv2.imread(image_name)
image = resize_to_screen(image)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (11, 11), 0)
canny = cv2.Canny(blurred, 30, 150)
(_, cnts, _) = cv2.findContours(canny.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
print("Contours in the image, %d" % (len(cnts)))
shape = image.copy()
cv2.drawContours(shape, cnts, -1, (0, 255, 0), 2)
cv2.imshow("Edges", shape)
cv2.imwrite("output.jpg", shape)
cv2.waitKey(0) ```
With PyCharm, what are the $1, $2 plugins?, is the autocomplete extra???
@nocturne anchor so what is the problem exactly? Your argument is set to required, so I would expect that error if you don't provide the argument
@cobalt cargo so no, the auto complete isn't extra, but they recently started letting extension devs ask for money
I'm just not sure how many folks will pay, or if other, free extensions will just replace them
@gusty willow so it does have autocomplete/snippets? But more precise is extra?
Yes it does autocomplete and has snippets, no it doesn't cost for those features
But there are things that aren't free (like database integration - you would need pro for that -- or now some of the third-party extensions)
@gusty willow ok, these are some of the plugins
@cobalt cargo those are community made plugins. You don't need them, and probably don't want them
@true vapor ok, how about โintelliJIDEAโ? Or the pro version?
Idea is mostly for java, but IDEA ultimate allows for multiple languages
Pycharm pro is only useful if you want the web/db integration
@gusty willow ok, Iโm going to do the monthly plan, $25. So ultimate will work with python?
@cobalt cargo yes, but it's not really necessary lol
Not sure what you are doing
I just use vscode now for the multi language support
@gusty willow what edge does PyCharm and the plan have over VSC?,
Nothing really any more
Support plans maybe
I would wager that VSCode has more value now, and is free lol
Honestly, for python, I find that pycharm quickly becomes a crutch for people
@tawdry needle yeah workon is nice, but i have also ditched virtualenv... this is my workon hack :
workon(){
proj=$(gfind ~/.virtualenvs -maxdepth 1 -type d | fzf)
source "${proj}/bin/activate"
}
@gusty willow so, donโt go with PyCharm yet?
@topaz aspen i just use zsh-autoenv, all problems solved ๐
@gusty willow ๐, I have noticed that React is better with local host then Vue is. Python is good with when I start the server. But I think some of the snippets are kinda out of place or donโt show all the time
I have that actually, when you go in a dir and it activates? Though sometimes it doesn't work ๐ค
I like how a IDLE has the cli/CDN in place to add
@gusty willow is VSC the editor even in data science? Or, when would a IDLE be used? or needed? Thanks!
@cobalt cargo idle is the built in editor and only used when nothing else is there lol
I've never had good luck with it
@cobalt cargo but yes, you can do DS notebooks and things like that in VSC, or if you only care about libraries, it supports conda well
@gusty willow ok, so when would there be a โproblemโ that VSC canโt handle? Yea I meant IDE
i never got on with notebooks in vsc , jupyter lab is ok
"It is completely written inย Pythonย and the Tkinter GUI toolkit (wrapper functions for Tcl/Tk). IDLE is intended to be a simple IDE and suitable for beginners, especially in an educational environment."
nice
@cobalt cargo I've only met one problem that wasn't already solved for me via an extension or LSP, and for that, I wrote the extension lol
but there are so many people using vsc now that most of the blind spots are gone
have you tried kite completion in vsc or elsewhere? Idk if it's any use or not
i just have coc
I just use the MS defaults
For python anyway
But admittedly, I do less python now than I use to
I use Kite, itโs good. I also have another AI, but I forgot itโs name
I, as DevOps/SRE, spend most of my time with Go, and Rust in my free time. My career is leading me towards data engineering though now, so I'm getting back into the python ecosystem
@gusty willow so whatโs a good path to gear towards learning/using? I know mainly React and Vue. Then Python is kinda catching on now
im new to python and testing on windows does anyone know of a premade vm setup for testing python or should i just build one, prefreably unbunto based but bsd is ok too , big ask i know lol
@gusty willow with the free/community version of PyCharm, can I use Django with it? Where would I run into problems?
@cobalt cargo I don't use Django, so I really don't know
@gusty willow ok. Whatโs a stable path forward with python? Or what to focus on? I can see that Thereโs allot of possibilities.
@cobalt cargo what do you want to do? I have a hard time suggesting anything other than generic stuff without any input from you lol
@gusty willow I like web, but itโs very vague with styling. Then I like JS, but python seems to be better narrowed down at times. I think I might like DS, but Iโm not too sure where to start
@cobalt cargo well, if you like web, stick with JS for a while. That can be applied most places. But if you want a more rounded language, python is a great one. So really bone up on the basics and build things. Once you are comfortable, then branch out to more DS things.
I really like the course progression at RealPython, so that might be worth looking into
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
These are good too@cobalt cargo
@gusty willow thank you!, it helps when what your learning, is put to practice, or even SHOWN , instead of just console concepts. Thatโs where Iโve ran into problems with JS. Modules are putting things together now.
How do I package an application for distribution when the application relies on third party modules?
Simple python scripts that use pure pythonare simple as I can just copy the python file itself.
@gusty willow ok, understand that, can you explain me where exacly should I provide that argument?
im getting a requests.exceptions.ConnectionError
requests.exceptions.ConnectionError: HTTPConnectionPool(host='wasimd', port=80): Max retries exceeded with url: /service2:5001/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f837c5d9510>: Failed to establish a new connection: [Errno -2] Name or service not known'))
when using my flask api
this is my api routes:
from flask import render_template, redirect, url_for
from application import app
import requests import
from service2src import animalname, animalnoise
@app.route('/')
@app.route('/name', methods=['GET'])
def getname():
animals = ['Dog','Cat','Tiger','Cow','Owl']
animal = animals[random.randrange(4)]
return Response(animal,mimetype='text/plain')```
this is my main app api
i mean routes
from flask import render_template, redirect, url_for
from application import app
import requests
@app.route('/')
@app.route('/home')
def home():
return render_template('home.html', title='Home')
@app.route('/generate', methods=['GET','POST'])
def generate():
r = requests.get('http://wasimd/service2:5001/')
return render_template('generate.html', animalname = r.text)
i also tried service2:5001
no luck
I have a python script I want to run and finish everyday, but I don't want it dependent on my computer. How could I implement this? I have a Heroku account
@nocturne anchor when you call the script
@severe flax what does the script do, that will sway my suggestion lol
@heavy knot that URL in the GET request is really strange looking, that is probably your problem
It runs selenium.webdriver and logins into a website and posts something
I"m trying to use Github actions rn, but I don't know how to use it or docker especially installing selenium, plus how to use environment variables for username and psswd. In dockerfile/yaml
so anything that requires webdriver eleminates running only on a serverless function, so you are limited to a container or a server and usually in regards to selenium, i suggest an actual hosted server due to the weight of the browsers (although, I've had pretty good luck with the selenium docker container).
do you think I can create something that uses selenium docker container as a base image
yeah, that is typically how it's done
ok, nice
as far as running it on a schedule, i think right away of just triggering the container with a time based lambda or something in AWS
How would I do a thing a certain amount of times? Such as if I am writing a file, I don't want to repeat f.write("Text) I want to do it like 10 times
Please open a help channel to ask that question. This channel is for tools and devops, as the name says, not for general Python questions
Ah sorry about that
@cobalt cargo I believe it has support built-in for Django. At least the enterprise version does.
When Iโm working on a Django project..... should I be switching around paths? I was watching a tutorial and the guy switched around paths and urls... like urls.py? And it messed me up
@cobalt cargo Not sure what you mean by that?
I'm having some difficulty onfiguring nginx to serve multiple subdomains
i read that you can just put multiple server blocks inside the config file
should those be before or after the certbot information
What are some reasons to not use Python within a Docker container?
the maintainence cost of using one, some slight annoyances with debugging containers, mostly things like that ๐คทโโ๏ธ
how would I change the background of a slave frame in tkinter
# I am trying to set a frame color but said frame is declaired in a different file and returned to this one
# but it does appear in the GUI so I assume it is still loaded into memory and editable
# So I want to do something like "DimmOne.RamDimm.LED0.bg = 'blue'" ```
something like that
I am trying to make an effects engine for OpenRGB and I need a way to visualize it in the software
@sand thistle just put them with your other server block
i got it to work
just need to get my actual files on there now
and umm, mess with the systemd file I think
@heavy knot no reason that I know of really but Brunckek had obviously had problems in the past lol. Other than the obvious size of the python containers, I don't really have many complains.
@sand thistle I wouldn't mess too much with the service files. What do you think you need to do that can't be done in a config?
well currently it's not set to server the correct html files
@trail geyser probably better asked in #user-interfaces
because well, I didn't put any of the html files up
only the ones I had for the other subdomain
@sand thistle no reason to mess with systemd then, that is config file stuff
im trying to set up vdi with hyper v, but when i try to connect, it just rdps me into the server and not one of the virtual machines, and the server gives this error
Error: NULL```
i see
@gusty willow
well currently it's serving the same html files
trying to figure out how to rsync, and exclude the venv folder, and some other files
I'm not sure exactly what you are trying to serve, but every python web framework I know of has a WSGI or ASGI interface, so you can just use that instead of trying to serve an entire project root
right, but you need to actually have the html files on the server
and whatever files you need
anyone here good with docker
I build a container and made a bunch of changes, needed to expose another port, made a commit and now when I try to start the container, i'm getting an error that says "docker: Error response from daemon: cannot mount volume over existing file, file exists /var/lib/docker/overlay2/"
I had two files mounted, but I can't seem to get it to start now, with or without mounting anything
maybe i didnt commit it right
Hi All, any preferences on a python image processing framework? Will be started a project shortly and would like to get others opinion.
Badsockets, I think you have to stop if volume is required, it's also good reason not use volumes unless required
@thorn kraken when you say commit, what do you mean
@stark hill images like digital photos or images like disk images?
sounds like docker is messing with his volumes
Yeah
@thorn kraken when you say commit, what do you mean
@gusty willow Ended up just redoing all the changes i had made
and docker commit currentcontainer currentcontainerv1.2
then tried to run currentcontainerv1.2
I think i was missing a flag that would have prevented the error
The inbuilt terminal in my VSCode installation doesn't take user input via program's input functions anymore. Pressing the return key simply enters a new line and the input is never actually sent to the program. Would appreciate some pointers on what's going on here:
It works perfectly fine with the system terminal
Hi everyone
I have found a script made in python which download some videos from a site
but it needs some improvments
here is the script
https://github.com/Jayapraveen/INE-courses-downloader/
GitHub
Jayapraveen/INE-courses-downloader
Python Script to download coures from INE.com website for personal and educational use - Jayapraveen/INE-courses-downloader
For example: the download progress bar does not working
extracting real names from the site, does not working well
you cannot select more courses to download only one at a time
also the script can be improved to download a playlist and not only a course
i am not that good in python and that's why i am posting here
Python Script to download coures from INE.com website for personal and educational use - Jayapraveen/INE-courses-downloader
@shrewd basin so what do you need help with exactly? This isn't generally a "hey, I have a thing, go make it better" channel.
I have a cluster on ECS and a service using EC2 type and i have been testing the performance with Apache Bench
Now i have made a SAME cluster with a service but using Fargate type
Everything is the same: Containers, Tasks, Services, Autoscaling...
Now when i was testing
Fargate for some reason has significantly worse performance
The mean response time is about 2x longer than with using EC2
Does someone have an idea why this might be the case?
Ec2 backed instances use a more traditional networking back end, fargate is more kubernetes like, and therefore, has further to travel. 2x wouldn't honestly surprised me. @marble spade
More hops, more infrastructure to move through
oh okay, i get it
do you maybe know where can I read about this?
is this because of the awsvpc network mode to be more specific?
or smthn else
It's just the way it's architected
Aws has a few docs on the fargate architecture you can search for
Alright, thank you @gusty willow !
Not a lot of deep technical things because fargate is a "secret sauce" though
At least not that I've found
Yeah i kind of noticed that haha
But admittedly, I'm more GCP these days
You prefer kubernetes?
It's like everything else, kubernetes is great for some things, but generally yes
for a beginner like me trying out some orchestration methods, kubernetes was 100% easier to start with tbh
than ecs
the main reason being that the configuration is way more easier, aws cli was very complicated for me
Lol I find that hard to believe, but they have been working hard on that
Take a look at Hashicorp Nomad also. It's my pre-k8s tool now
And sometimes, is the end all be all lol
i know but I found all that terminology on aws (security groups, vpcs, subnets, services, tasks and whatnot) very confusing lol
oh i will check it
on kubernetes you can configure some nodeports, deployments, ingress and you have a basic cluster already
Yeah, I gets a little crazier at scale, but the same paradigms hold
im having an issue
with hosting my bot
on heroku
im getting this error:
Push rejected, failed to compile Python app.
! Push failed
when i try to deploy
Show what it says when you try to push something
@heavy knot have you tried to run your app locally
I'm trying to use enums as a key to index into a dictionary but I keep getting a keyerror. Observe...
from enum import Enum
class MyColor(Enum):
WHITE = 'white'
RED = 'red'
mydict = {'white': '#ffffff', 'red': '#ff0000'}
print(mydict[MyColor.WHITE])
This will result on a KeyError. However, doing print(mydict['white']) will work.
@sudden lagoon The enums themselves aren't actually the strings that you set them to, in this case I believe you'll have to extract it by using the value attribute
@dusty maple
Is there any better way to do this?
mydict[MyColor.WHITE.value]
I thought I could override the built in function as such...
class MyColor(Enum):
WHITE = 'white'
RED = 'red'
def __str__(self):
return self.value
...then this would suffice in doing the following...
mydict[MyColor.WHITE]
but it still doesn't work. I was kind of hoping there's an easier way than just mydict[MyColor.WHITE.value]
I think you could use enums as dictionary keys
!e
from enum import Enum
class Colors(Enum):
red = 0
blue = 1
green = 2
colors = {
Colors.red: (255, 0, 0),
Colors.blue: (0, 255, 0),
Colors.green: (0, 0, 255),
}
print(colors[Colors.red])
@dusty maple :white_check_mark: Your eval job has completed with return code 0.
(255, 0, 0)
But in this case, there's no real advantage over just setting the appropriate tuples for each enum unless you have multiple dictionaries where you need the enums as keys
ah i see. yea i have a yaml file that is a list of dictionaries...
polybar:
- grey: '#ffff00'
red: '#fff0ff'
...and so on
p10k:
- grey: '#fffc00'
red: '#fff0fa'
...and so on
...and so on
After I read the yaml file in I was hoping to avoid hard coding my strings and just use an enum class to define them instead. Would make it alittle easier to maintain.
in other words the enums in this case are acting as accessors mydict[MyEnum.RED] versus mydict['stringvalue']
thanks for the help
hello there can you help me
hello, i have an issue with a VPS (heroku) - i have a script that downloads mp3 files via urllib, and the files are there (i can request them via the same script), but whenever the script restarts the files arent there anymore, and if i check via bash the files arent there either - do hosters use some sort of cashed file system? im giga confused
@ionic nexus need a whole lot more info lol
@mystic flint heroku uses containers, so yes, the filesystem is "cached" (more accurately, it's an ephemeral file system lol). You would need to store your MP3s somewhere else, rather than on disk (think AWS S3 and the like)
argh, thats depressing, guess ill have to host it locally or sth... storing new files is core part of my script :/
@mystic flint you still can, but you just need different storage lol
i have no idea how i would do that, whats the point in storing files on another hoster, in that case i should just host the entire script on AWS...? or what
Well, that's your call, but yeah, that's my suggestion
I think heroku has a paid plan that includes persistent storage as well
damn, was hoping that theres a way to just stop heroku from resetting my container on every restart
oh, that might be the case too, right
@mystic flint heroku specifically calls out S3 for persistent storage: https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted
ah yea i see, i think ill just host it on a server of a friend of mine, though i have no idea how i would push with git on another machine except RDPing onto it and pulling manually
@mystic flint as far as deploying on your friends machine, you pushing to git can trigger a webhook that can make your friends machine download and run your code, just food for thought :)
Although, maybe I'll make a heroku alternative that includes a db, a cache, and persistent storage in the service APIs
Has anyone created a Automator quick action to enter โpython manage.py runserverโ
@cobalt cargo I don't know what "Automator" is
@gusty willow its on Mac
sounds like it's just a script runner, why not just make a terminal alias that points to a script that just does that ... no third-party tools needed
personally though, as far as script runners on a mac goes, I like bitbar
@gusty willow Iโve entered a AppleScript to execute, but it dosnt do anything. To even have a shortcut to just paste in the terminal, that would be fine
Is anybody aware of a library that can parse various markup languages like Markdown/reStructuredText/AsciiDoc ? I'm only interested in parsing, not generating output.
@cobalt cargo create an alias in your bashrc file
echo "alias django-run='python manage.py runserver'" >> ~/.bashrc
@cobalt cargo
@gray condor pandoc
although i dont think asciidoc is supported (yet)
@tawdry needle interesting idea, I guess the idea would be that I just parse one format and let pandoc convert to that.
im not sure what your goal is. but pandoc keeps an internal syntax-agnostic representation of the document
im not sure how easily accessible it is from python though
or if theres some way to dump that representation to json or a similar format
@tawdry needle such a dump would be ideal, esp. if it preserves line numbers of the input files
ahh it only has an asciidoc writer, not reader
i remember now, theres an issue for asciidoc reader support on github
apparently you can write custom output formatters with lua
pandoc --from markdown --to json
I think this is just what the doctor ordered, thanks a bunch @tawdry needle ๐ค
oh yeah, nice!
https://groups.google.com/g/pandoc-discuss/c/99d9mOU15M0/m/b1XOI2HIBgAJ seems like the asciidoc reader is still WIP
personally I only care about Markdown, I just didn't want to lock in that decision for people who have other preferences.
by the looks of it, AsciiDoc support is only a matter of time
yeah
i quite like asciidoc, lack of pandoc support is one of the reasons i havent switched
Am i able to use only 4 IP adresses on GKE per location?
This is from resource quotas on GKE
I was just trying to scale up my cluster
add more vms
does anyone have an idea how i can increase the number of vms without hitting those limits
or am I doing something terribly wrong lol
when i try to increase the size of my nodepool it displays an error because of resource quotas
oh
i remember something
i actually use nodeports instead of clusterip
so every node gets an external IP
should switching to clusterip solve this problem? hmm..
should switching to clusterip solve this problem? hmm..
@marble spade yes, in production clusters, nodeport isn't used
@gusty willow yeah i know, but i dont actually need going to production right now, for now i am just testing some autoscaling
Its a bit of a hassle that i need to contact google everytime i want to increase my resource quotas...
I dont even know what specific quotas should i increase
Autoscaling with node ports doesn't work well lol
why?
They are very hard to load balance
hmm i dont know, ill probably try cluster ip sometime in the future too
the reason i used nodeports is because the google just creates a load balancer for you and just follows your ingress rules
but that was just a temporary solution of course
i didnt want to create my own nginx ingress controller right away
google load balancer cannot be used directly with cluster ip, because it cannot reach them since it is external (from my understanding)
Yup, but an ingress is the correct way to do it
you mean ingress like pure rules or the ingress controller?
oh i heard about istio, never really understood what it does ๐ฉ
some kind of service discovery
It's a service mesh first and foremost, but integrates envoy nicely for ingress
And it's the preferred Google method for getting traffic into a cluster
gotta read some more about that stuff
Yeah, istio is damn near it's own thing now
Almost as complex as the cluster itself lol
But it's super powerful
cool, thanks for info ๐
Should using the --user as an option to pip install in a way that makes it not show up in the local venv?
pytest somehow shows up as in the venv, but I can't use it or the package I'm working on
I'm on Windows
and not used to it at all
so
pip list shows that yes, i have pytest installed in the venv
but the pycharm package list does not show it
or anything else that i should have installed
i have a bit of a problem
I can't find my wsgi file
i did locate, and it gave me a bunch of locations where a wsgi.py file exists
they seem to be in site packages folders, or dist-packages folders,
but the tutorial I was following wouldn't had me install it in one of thise, it seems to have replicated it to multiple directories
I need to modify the wsgi.py file, because I am attempting to serve another .py file
I mean it clearly exists since I'm able to serve my app
i am in way over my head, and I am freaking the fuck out
how does one decrypt a gpg file and read the contents into a variable instead of stdouting the contents
i really dont want to write the contents to a file then read that file and delete it...................ugh
In python or in the shell? @gentle apex
shell @tawdry needle
r u supposed to like pipe the output or sth
rn im kinda tempted to ditch shell and just use python ugh
Why not write to file then read it?
benefit to writing to file is make sure it's properly sent written
@gentle apex you want to save the output of a command to a shell parameter?
use the read command
some-command | read -r -d '' command_result
echo "${command_result}"
oh thats for zsh
im not sure how to do it in bash, 1 sec
blah bash executes pipes in a subshell
so in bash you have to do this
read -r -d '' command_result < <(some-command)
echo "${command_result}"
you can also use process substitution but that's my least-favorite option
command_result="$(some-command)"
echo "${command_result}"
ya im using bash
just want to read the contents of a gpg file after i decrypt it thats all
cuz normally it stdouts the contents if u decrypt it
@tawdry needle
ok, so does that help?
i gave you 3 options + a fourth option if youre not using bash
could someone please explain this portion to me
Next, letโs create a file that will serve as the entry point for our application. This will tell our Gunicorn server how to interact with the application.
Letโs call the file wsgi.py:
nano ~/myproject/wsgi.py
In this file, letโs import the Flask instance from our application and then run it:
~/myproject/wsgi.py
from myproject import app
if __name__ == "__main__":
app.run()
Save and close the file when you are finished.```
from this tut
@sand thistle what part is confusing?
basically, you don't run your app. gunicorn runs your app for you. so gunicorn needs to know how to start your app. it uses the wsgi.py file to start your app.
does mypy -p not work on editable installed packages? i did pip install -e lib/my-thing which installs the my_thing package, and then did mypy -p my_thing. but got the error "Can't find package my_thing", even though it can be imported. mypy -p doesn't even work on stdlib packages, so i'm pretty confused.
anyone here know if there exists a discord image in dockerhub that you can expose to a port? thanks!
man
I am in over my head
burnt out
depressed
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.
plz help
so i was able to get it to work @tawdry needle
I looked through the gunicorn docs
I can't seem to find a command that would allow me to check if a script is bound to gunicorn
Hi guys! Does anyone here have experience with xlswriter?
Writing obtained data to excel file
@lethal belfry I normally just use csv because it's a pretty universal spreadsheet format. Not sure what benefits (other than maybe some formatting things) you would get from an XLS library
@sand thistle are you talking about just seeing if gunicorn is running something?
that would work ๐
and I'm getting an error, so I'm trying to see if I actually bound anything
apparently the wsgi module is missing
remind me again what framework?
flask
nginx
digital ocean droplet
gunicorn
im following this tutorial, and I've been working on this project, but I think I actually skipped the wsgi creation process
but my server is able to serve the app if I just do the ip and the port
though it is not able to serve it through the domain name, I get a bad gateway 502
TBH, the DO docs are among the best i've read, so yeah, you would have had to of skipped something lol
but would it still be able to serve it via the ip and port, without the wsgi?
Also reason docker is cool #201
but would it still be able to serve it via the ip and port, without the wsgi?
I've never deployed anything
Morning
so re: 502 ... is your NGINX configured to listen to that domain name?
nginx will return that if it doesn't know how to do something
so that i think is a separate problem
but ill check
it should be ok
because gunicorn is telling me the worker couldnt start
and that the wsgi module is missing
I have 2 server blocks in the nginx config
yeah ... you need to follow the instructions and build out your wsgi.py to run your app ๐
@gusty willow Sorry for not replying but someone actually started helping me in the Help-Nitrogen channel
and at the same time I was trying to fix the issue
Came to the point where I'm pretty sure what the problem is. However, I'm not exactly sure how to fix it ๐
@gusty willow do you know if I have two apps on this server, with each their own directories
do I need to rename wsgi.py to something else? since it will be the same filename? how does that work
nah, just launch gunicorn in a way that you are pointing to the individal files ... but really, you are getting into "it would be nice if these were running in containers" territory
gotcha
if I have multiple apps do they need to listen to different ports?
like
ip:5000
and
ip:5001
?
yes
Hey @round kettle!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
this channel is for devops
sry id dont know which channel is appropriate for this
I know nothing of PIL and OCR, maybe that question is better in #data-science-and-ml @round kettle
ok thx
oy, converting a 1TB SDD from XFS to BTRFS is a long process -_-
10:21:41 fsmove: progress: 70.0% done, 28.8 gigabytes still to move, estimated 15 minutes left my fingers are crossed that it is actually 15 minutes lol
but it's been 15 minutes for a while now lol
hey
well
I'm having issues with the firewall now
I added both rules, and now it's blocking both ports for some reason
I deleted the rules
and then just made one for 5000
restarted nginx
and then tried it, and it's still blocking it
it said that it refused to connect
I hate everything
I'm making things worse
