#tools-and-devops
1 messages Β· Page 67 of 1
it works for me
yes but it is not history
I mean not in branch history but commits were available via links
yes
Yeah
right
it can be done, but it is magic beyond my level
as easy way... just git rebase -i I guess
You have no power here, Gandalf the Gray
yeah, I will rebase, but I'll also tell them to just get a new token, I'll do rebase just to keep the history cleaner
I know that there is some smoother way to rewrite history perhaps
that is using for merging commits right? that's what i do for squashing
I saw mention about it in some article
how to handle transition from no formatting / formatting by another tool to black with keeping your git history clean
not remembering already what was recommended about it
and merging branches
git rebase -i is interfactive rebase, it can do everything
it offers like 10 different options to apply for each separated commit
yeah, i was saying the main thing i use that for
I am trying to get used...
to use git revert
instead of git reset --soft HEAD~1
but habits die hard.
^^^ so true, whats the difference in the two?
git reset --soft HEAD~1 cancels the last commit, while keeping the code from it.
but if you do it in public branch...
you can't, it's pointless to try and remove it, the key has already been crawled and published by automated tools - you must simply admit the fault, revoke and replace the API key, and move on .. it's 100% waste of time to try and remove it
you break their branches, since your branch would have diverted git history from theirs, and they will not be able to pull commits
git revert cancels the commit by making another reverting commit
it is safer to use for public branches
it can be pulled by others without breaking their stuff
(no need for git push with force also)
Ah shhgit! Find secrets in your code. Secrets detection for your GitHub, GitLab and Bitbucket repositories: www.shhgit.com - GitHub - eth0izzle/shhgit: Ah shhgit! Find secrets in your code. Secrets...
yea, but i never push to main branch :D, i wouldn't like to have two commits for an unnecesarry thing
these guys had a public service for viewing such pushed secrets basically in real time
we will squash at the end anyway, if necessary.
https://www.shhgit.com there seems to be a bit filtered version on their website right now
hmmm, well personal opinions, just doing a soft reset is better than reverting and then squashing
github also has their own secret checking thing, but I am not sure how to opt into that
gitguardian is also there
anyway after publishing the secret there is no point in trying to "undo the damage", it's done, you can't undo it, you must invalidate the credential ASAP and then you can just do a normal commit to delete the secret
indeed. the damage is irreversible anyway
Piracy would be 99% of the streams
Trust and Safety is massive cost of Discord, one reason Microsoft was hesitant, they have experience with XBox Live
on:
workflow_run:
workflows: ["Lint & Test"]
branches:
- main
paths:
- bots/**
- pyproject.toml
- poetry.lock
types:
- completed
I'm so confused, why does this workflow run even if the file changed is not in any of the paths
I changed README.md and it still runs
is it github or gitlab
github
https://github.community/t/is-it-possible-to-run-the-job-only-when-a-specific-file-changes/115484
on:
push:
paths:
- 'example.c'
this example offers on push too
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.
official documentation
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
# Also trigger on page_build, as well as release created events
page_build:
release:
types: # This configuration does not affect the page_build event above
- created
hmm, path thing is offered too
on:
push:
paths:
- 'sub-project/**'
- '!sub-project/docs/**'
Ye but I want the workflow to trigger only if its in the main branch, if the directory bots is changed and if the workflow Lint & Test is completed
perhaps you need having paths in ' '
wait imma try that
they offer how to ignore file changs too
on:
push:
paths-ignore:
- 'docs/**'
Or you can add a ! Exclamation mark to do opposite behaviour
yeah, that would be more convinient
Like !docs/**
That didn't work
ill try that
That also didn't work, weird lol
Is it possible for pycharm to display the .git folder in the project view, while also not indexing it for things like searches?
you can set folders to be "excluded" from indexing
you can probably also enable showing hidden folders but idk how
The only thing I've found are "Ignored Files and Folders" under Editor, which makes it show up in the tree but also makes project wide searches look into it
Hi,
My python isn't that great yet and I'm still trying to learn many of the basics.
I have a lot of code in JavaScript and I need to convert it to python. Are there any reliable programs that do a decent job with simple code?
Please tag me. Thank you in advance.
You have to right-click it in the tree and mark as excluded
not that i know of, but our help channels are a good place to ask about entry-level python questions. just make sure to clarify that you're a JS programmer trying to translate some code
Thank you. I know enough to get myself in trouble. π
Ah that works, sucks that I need to do it manually for every project but at least I get quick access to the folder now
How often do you need to access the .git directory?
I guess it's useful for config, excludes, description, etc
not too often, but it's annoying to step out of the ide just to grab the file and open it in the same ide
basically never
Does anyone here have any experience in screen-scraping tools?
specifically tn3270 emulators
https://github.com/marketplace/actions/deploy-to-kubernetes-cluster
Hey! I have a question, Iβm not sure what this action does, does it perform a rolling update? Or it just simply deploys an app? What if I want to do a rolling update using gh. Actions?
I have the main branch on my local clone, but there are two more branches on origin that I'd like to get into local. How do I do this?
Never mind got it
A shorter command is git checkout -t origin/branch
why do they stream the secrets? isn't that... bad for the security of the people? or is it just a fake animation?
they used to have a real time unfiltered unobfuscated stream of those, that was sure fun times .. now they obfuscate usernames and reponames a bit, and claim to notify owners first, so dunno
Please any answers if possible inside stack
Is there some simple example of a mypy plugin to get how they work?
Granted Iβve only been working with AWS for three weeks now, but dear good why does it get so much hype. Even though azure is IAAS and not PAAS it is much more usable then AWS. Iβve been trying to figure out how to have my jenkins space connect to the code commit repo for an absurd amount of time. Also the horror that is S3 buckets and IAM keys.
not sure it's simple, but this is the first mypy plugin i've actually seen in the wild https://github.com/dry-python/classes/blob/master/classes/contrib/mypy/classes_plugin.py
doesn't look that bad really
thanks, I'll take a look
Say what? Azure is IaaS and PaaS
PLease any answer
Building wheel for mayavi is stuck
is my pycharm being weird or does anyone else get a completely wrong inferred type on item with
for item in sorted(range(10)):
...
?
Well I suppose it isn't completely wrong but it definitely could do better, it looks like it's having trouble with the typevars in the stubs
a: dict[int, None] = dict.fromkeys(range(10))
for item in sorted(a.items()):
print(item)
also gives int for item
If you defined the header in the postman request, and it doesn't come out in the generated example, it might just be a bug in postman
what did it think item was? pycharm definitely does struggle with some of the complicated variadic iteration functions
for the first snippet it gives SupportsLessThan which is a protocol from the stub file
looks like it just gives that because the typevar is bound to it
I actually think that's not wrong
What is the return type of range in the stub file?
That protocol? Has range worked on strings this entire time??
I am on my phone so I can't check right now
the iteration on range is Iterator[int]
What do you mean with it working on strings?
I was kidding π
adding the typehint to b here makes it work properly so I guess it has problems with extracting that from the typehinted __iter__
def f(a: collections.abc.Iterable[T]) -> list[T]: ...
b: collections.abc.Iterator[int] = range(10)
for i in f(b):
...
I would usually write Iterable and not Iterator but yeah
Does mypy infer correctly if you use reveal_type?
yeah mypy does all of them properly https://mypy-play.net/?mypy=latest&python=3.9&gist=39904f73ce2c1963eed320ab5eb4f487
I don't think so because i tried in two version. For information it is generated with headers for the curl request in the code section of postman ! However, in the doc it still without headers... So weird
@round mortar No, the tool itself doesn't take much space. For example, on Windows, the portable version seems to be about 50 megabytes. I don't have on hand its size on other operating systems.
That being said, the repositories you clone (if you're unfamiliar with that term, it basically means to download code onto your computer) can be of an arbitrary size.
im gonna use it with vs code so yea
i watched a video and it said i can do that but if im done editing and no longer want to do anything can i just delete the whole folder on my local device?
or if i delete it will cause problems with the github repo
If you pushed your changes to GitHub, then all your code is saved on their servers. You can then do whatever you want with the repositories on your computer, including deleting the folder, without it affecting what's on GitHub.
Well, not "whatever" you want. Of course, if you push more changes to GitHub, then that will affect what's on their servers. But that requires running git commands. Just deleting a folder doesn't tell git to push any data.
okay thanks
aws free account also needs credit card details, do they charge anything ?
No, just standard taxes after you avail some service
Oh, okay
Hi, is there a good "automating git stuff" library out there? I'm working in a team with 99 git repos (not literally) and would like to fetch them, show some stats about what's up today (many changesets in repo XX), etc
how do i connect my postgres db to vultr?
depending on the git hosting provider you may be able to get away with using their API instead
postgresql db where? with your app on vultr?
yes
github; yes, it did occur to me.
where is the database hosted?
hmm, you could maybe get away with pygit2 for plain git operations then
Currently I'm self hosting my bot
so postgresql and your app are running on the same server?
Okay. Do you want to do the simple way or the correct way?
Why do those two things have to be mutually exclusive π
I know right π
The simple way is to add
host all all 127.0.0.1/32 trust
to /etc/postgresql/VERSION/main/pg_hba.conf, run systemctl reload postgresql@VERSION-main, replacing VERSION with your installed postgresql version, and then connecting with your bot to the database you want to, and you can use the postgres superuser.
The correct way is to use host BOTDB BOTUSER 127.0.0.1/32 md5 to said file, run said command, then creating the bot database user via createuser, and connect as that user. That will also involve storing the credentials somewhere secure
Another option is to run your bot account on a locked down linux user (which you should do anyways), then create the same named user in postgresql, and you can connect to the database user withotu password (from the operating system user, via the postgresql unix socket)
that's a bit more complicated but also very nice
Alright, thanks
can I open the corresponding local file instead of only displaying the diff from the PR tab in pycharm?
Any mac users here? Especially VS Code users? β€οΈ
Hi I am looking for something that can scan an image for something uniformally circular, then cut that circle from the image and create a new image file with just that circle in it
Sounds like a time for neural networks.
oh boy
Segmentation/classification problem
You could make it of course perhaps with more primitive instruments. I think I read somewhere how to solve it with with a bit simpler algorithm
But it would be essentially same field
I actually just found a github repository of exactly what I'm trying to do so I'm going to check that out and see(probably) if they found an easier way to do what I want
;) that is great
opencv / cv2
I'm using openCV but it seems to only check the difference between the exact same image in the same place, IE if i took two pictures of something IRL it seems to show differences all over because everything isn't completely lined up
which is why I was looking to find a way to scan for only certain parts and put those onto a fresh image to compare so everything would be lined up
Lenz in my experience, scikit-image is easier to use, opencv is faster. Do you have any code, though? I don't get the question (from the description)
@frank ravine that was for you. And, if it's really close to circular, you probably don't need a neural net, but maybe a convolution trick of some sort will do (faster, easier)
What library do you reccommend for sending mouse input and keyboard presses in python
@ruby spoke do have a look at pyautogui!
What does ** do in .gitignore when used like this? **/FolderName ?
hey guys, I am new to docker and I want to create a conda env inside a docker image with libraries installation. This is my code:
FROM anibali/pytorch:1.5.0-cuda10.2-ubuntu18.04
COPY requirements.txt requirements.txt
RUN bash ~/miniconda/etc/profile.d/conda.sh &&\
conda init bash &&\
conda create --name layoutlm python=3.7 &&\
conda init bash &&\
exec bash &&\
echo "source activate layoutlm" > ~/.bashrc &&\
pip install -r requirements.txt
when I run the container and do pip freeze, the requirements are not installed.
How can I solve it ?
Anyone available to help for some git issue
''''remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/d5423197/titanic/': The requested URL returned error: 403''
well as it says you gotta create a PAT to access the git repo
403 means unauthorized
well you are trying to use a https connection not ssh
use ssh for ssh key or create a pat for https
So you mean when I clone repo from gihub, I need to use ssh address?
I dont know how to switch to SSH now
I will try google it. At least now I know what the issue is
Thank you btw
Thanks bro you save me. I have been trying to figure this error out for like 2 hours....
no problem π
Hi, I am trying to setup codespeed python package, but the documentation is not clear how to setup it up for a new project, can someone help? Is it available only for Django applications?
Mask, telling that folder should be match in any subfolder.
But really it is a mistake. Because if you write FolderName/ it will match all of them anyway
In any path
Yeah, was wondering why I never saw it used before
the person mistook it with searching in other tools.
like it works in Linux bash for example:
grep PATTERN **/trunk/src/**/*.@(h|cpp)
Hey guys, I was wondering how I could get my exe to work on another person's PC, I have the exe working on mine but when I gave it to someone else, it just crashed midway - maybe because of the packages etc
What language
python
Hello, i have a question, can use github for permanantly runed programs
like a discord bot per exemple
What do you mean by "runed"?
Like projects that are always running?
yes
sorry for bad english i'm frensh
Yeah, sure! You can put any type of code on GitHub, as long as it doesn't violated their ToS.
You can use Heroku for that (there is free tier)
GitHub won't run the program though, only store the code.
ok thanks, i'll try tomorow
Yes, itβs not something I recommend
@wooden ibex what other libraries do you recommend in place of it?
Depends on what you want to do
I heard of pyautowin but I haven't seen it be able to send keys to inactive windows
or unselected windows
oh, afk bot
well I want to create a twitch chat plays - where given chat typing a command it sends a key to the game.
apps need admin privileges to interact with other apps
but probably pyautowin is better for what you need
sounds good, yeah the idea I had was the chat has control of certain keys in the game while I get to still interact with the game. But in case I go onto other windows to check things I didn't want the server to continue sending keys to my pc.
i'll take a look
you try autoit / ahk module of python . you can send keys as well as taps to inactive windows. i was able to do it.
how do pypi mirrors work.... do they only get packages on demand or do they clone the entire metadata like apt and yum will so you can seach locally? if so, where is the metadata for pypi?
ghosting problem with command prompt in #help-popcorn if anyone could take a look that'd be great
It depends on how you set things up.
You can set up your own "package index" and use --extra-index-url in Pip, as in https://packaging.python.org/guides/hosting-your-own-index/ and https://mothergeo-py.readthedocs.io/en/latest/development/how-to/private-pypi.html. This way you aren't mirroring PyPI at all, but you're adding an extra location for Pip to search before searching PyPI itself.
If you really do want to host a mirror, you can use Devpi (https://pypi.org/project/devpi , https://devpi.net/docs/devpi/devpi/stable/%2Bd/index.html) to actively mirror PyPI by fetching files once from PyPI and locally caching them thereafter. Or use Bandersnatch (https://pypi.org/project/bandersnatch/) to "statically" dump the state of all packages on PyPI, which will need to be refreshed periodically. In both cases, you can use the --index-url instead of --extra-index-url so your client never has to touch PyPI directly.
I'd like a local cache so if I have a few projects using foo at v3.14.159 then I don't have to hit the web. And if I'm messing with docker files it also shouldn't need to hit the web. For working on trains. On planes. Or Jenkins locked in chains.
A bit like nexus or artefactory tbh
Issue regarding git add, can you help me at #help-pear ?
then bandersnatch sounds like what you want
i agree i like the idea of not having docker spamming pypi every time i need a clean rebuild
Amazing. Will check it out.
How to run codes in github || sry it is not releated to python but sadly there is no github discord server || :)
wdym run codes in github || ||?
I dont find a button to run code
what are you trying to do?
I thought i would code on github
Learn js
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.
Please read our off-topic etiquette before participating in conversations.
You can actually. Its called github codespace
Just go to a repository and click . on your keyboard
I presume if they have this pc they can't afford github codespaces
that opens the online editor, which I don't believe is paid
I had a fairly good experience with it
Yeah it is. But its very cheap
unless you can tell me otherwise, I thiiink that . will remain free?
Yeah that's just the viewer i think
because you aren't actually running in their codespaces
You can't really run the code
yeah exactly
Use gitpod its free for 50.hrs a month
you've used github codespaces for real?
not the online editor
Nope, couldn't get into the beta
(which is literally just vscode in browser)
Yes
And something called theia too
Can't say i liked it
We used gitpod for a college project
nice
Since i couldn't install docker on all my teammates computers
Some of them didn't support it at all
good news:
Yep it was in the works a few months ago when i last used it
what the f
Good riddance lmao
?
What
Oh wow
github student pack
The ones who used gitpod didn't come close to 50 hrs tho
that's why
Student unleashed lmao
Ok thanks man @velvet spire :)
@heavy knot ^
:)
@tawdry needle I took a look at bandersnatch. Thanks! It's a cool project and will be a good start for my work.
py2exe?
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /source
# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore
# copy everything else and build app
COPY aspnetapp/. ./aspnetapp/
WORKDIR /source/aspnetapp
RUN dotnet publish -c release -o /app --no-restore
# final stage/image
====> FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build /app ./
ENTRYPOINT ["dotnet", "aspnetapp.dll"]
```I get to "FROM mcr.microsoft.com/dotnet/aspnet:5.0" and get the error `Get https://mcr.microsoft.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)` Is this a network provider error?
is the error coming from your laptop or a CI instance?
but there's nothing here https://mcr.microsoft.com/v2/dotnet/aspnet/tags/list
so i think it's a bug on their end.
Does it work on your device?
Contrast with https://mcr.microsoft.com/v2/dotnet/poop/tags/list
no it doesnt work on mine
Imagine that smh
and I need this to work tomorrow
i think that's why its broken. the universe determined that you had a deadline so it decided to break everythin
π
pyinstaller
i've actually started thinking about using it myself after suggesting it to you. let me know if you end up with a good workflow
bandersnatch? no i wont use it. it makes a full mirror with the wheels. this could be an issue with e.g. tensorflow which is stonking.
Bandersnatch maintainer here, you can filter what packages it mirrors fyi
There's quite a few filtering options but I don't remember π
oh hi @flat path ! Thanks for the cool project!
FWIW the docs and the code are out of step wrt the configuration and defaults. e.g. you need to set various values even if the docs say they have a default value. This is because fallback= is not used everywhere it should be in mirror.py
it's often useful to have a mirror.conf.example which can be chopped up by users
https://github.com/marketplace/actions/deploy-to-kubernetes-cluster
Hey! I have a question, Iβm not sure what this action does, does it perform a rolling update? If not, what does it do?
to be clear I didn't make it, I joined quite late in the project life. Thanks for the feedback!
hi, does anyone know any extension for vscode to parse the structure of a python script?
whats the structure of a python script? You mean to summarise the functions and types like you might have in pycharm?
The normal python one does. You need to go to View -> Open View ... "Outline"
ΒΏmaybe exist a tool more visual? like visustin
Not as far as I'm aware. If I can be frank these tools don't work well as they scale to larger code bases.
yeah, I have tried 2 and they do not understand part of the code
thanks for your help
Hello, I need help to use heroku with python
whatcha making?
I would like to create a discord bot
so i don't need django
should we move the chat to #discord-bots ? Otherwise, you may want to consider free tiers of google cloud or AWS in conjunction with e.g. free tier of mongo atlas
docker run --gpus 1 -t rt:2.0 -c "clear && conda activate env && cd example && python main.py" does not work but docker run --gpus 1 -ti rt:2.0 and doing those commands manually does. Is there a way to make it work without doing it manually? I tried a bash script but that didn't work either
In the first example it just hangs
docker ru n--gpus 1 -t rt:2.0 docker-entrypoint.sh hangs? is docker-entrypoint.sh copied into the image?
is bash installed or do you need /bin/sh?
oh i can try this
and yea
so in the entry point ill add /bin/sh?
$ cat docker-entrypoint.sh
#!/bin/bash
clear && conda activate env && cd example && python main.py
clear shouldn't be needed π€·ββοΈ
ah yea i just had it there haha sry
should this be in the dockerfile or some bash script?
ty for your help btw
it should be in your directory with the dockerfile and then in the dockerfile you have a line with COPY docker-entrypoint.sh .
it's after midnight in belgium so ... probably not
thanks
hi idk if this is the right chat but: is there someone known with the bert-base-uncased extension form huggingface
Can I use this channel for Telegram bots?
Or is there a better channel for things like that.
@warm pollen heyyyy, I heard you're pretty good at git...
lol, sorry but I'm currently at work
Aight, lol. I'll still send it anyhow since it's a public channel π
Hypothetically, if the branch that a feature is being merged into was force pushed, how would I rebase my changes onto that new branch, without rebasing the entire branch. Tldr I need to get a few commits off of that branch without getting all of them.
worst-case scenario is you can cherry-pick those commits
can't you do a normal recursive merge?
actually i don't see why rebasing would be an issue either
unless they force pushed changes that are incompatible and then you'd get rebase conflicts
we ended up deciding not to do it
better to resolve 1 merge conflict than to resolve a chain of rebase conflicts imo
Hi, i need some help in creating a CLI package which is to be installed via pip install git+<url> During testing when i install it via pip install --editable . it works fine but when i push to git and then do it, it throws an error saying there is no module named edge
this is my directory structure
my setup.py file
from setuptools import setup
setup(
name="Edge",
version="0.1",
py_modules=['edge'],
install_requires=[
'Click',
'boto3',
],
entry_points='''
[console_scripts]
edge=edge.main:main
'''
)
@lost mantle this only works because you're running it in the current directory. py_modules=['edge'] isn't sufficient for all modules. you need to list packages in the packages= parameter, usually you use find_packages to assist:
from setuptools import find_packages, setup
setup(
name="Edge",
version="0.1",
packages=find_packages(),
install_requires=[
'Click',
'boto3',
],
entry_points='''
[console_scripts]
edge=edge.main:main
'''
)
also the user should write pip install 'git+<url>#egg=edge'
you can test this without pushing to github by creating a 2nd git repo on your filesystem and installing with pip install git+file:///path/to/test/repo#egg=edge
in this case, it tells pip what the name of the "project" is, which it tries to infer from the url. if you omit it, pip has to re-clone the repo every time the user installs or updates. the egg= parameter should be whatever is in edge.egg/top_level.txt
use poetry
thanks! π
one other thing, i am doing these imports in main.py
from .commands.init import Initialize
from .commands.build import Build
from .commands.upload import Upload
from .commands.deploy import Deploy
if there a way to make this short by doing something like from commands import Initialize, Build, Upload, Deploy
yes
i tried putting this in commands/__init__.py
from .init import Initialize
from .build import Build
from .upload import Upload
from .deploy import Deploy
but it didnt work
# main.py
import commands
commands.Initalize
commands.Build
commands.Upload
commands.Deploy
so you are saying without mentioning file name i can directly import them?
yeah, provided you've also done this
i had tried that previously but it didnt work, let me try again
make sure you've saved your files lol
oh so it doesnt work when i test it with pip install --editable . but works with pip install git+
why is that?
oh anyway the primary method using git is working so it should be fine i guess
it will be from . import commands if you're using relative imports
otherwise if you're using absolute imports it will be from edge import commands
or just import edge.commands then you can write edge.commands.Initialize
yeah
it worked thanks!
i'm surprised that didn't work. this is why i use absolute imports though π
# edge/commands/__init__.py
from edge.commands.init import Initialize
from edge.commands.build import Build
from edge.commands.upload import Upload
from edge.commands.deploy import Deploy
# edge/main.py
from commands import Initialize, Build, Upload, Depoy
it worked now
side note: i have code and cannot find the logic where something i just wrote happens
don't be like me
oh just found it whew
thanks a lot @tawdry needle and @velvet spire π
salt rock lamp did it all don't thank me lol
you did give the clue to the issue xD
I have a docker image that I've been using for local development now and then, and need to be able to use gsutils within it - things like gsutil ls, or making calls to bigquery etc from notebooks.
I'm not sure what the typical workflow is for doing this though, and as I'm inexperienced with docker i'm wondering whether I just don't know what to google here.
I don't want to use a different base image - I'm using ubuntu and want to continue doing so, and I'm (for now) only trying to do this on a local machine, not a VM on gcp.
Any pointers on going about setting this up would be appreciated.
Use
docker exec -it {{beginning of your container ID}} /bin/bash
It will make you access inside the container
Find the steps to install things for gsutils
Add the necessary steps to dockerfile
<@&831776746206265384> scam filter fail
ty
(user id 755032484026122250 if they deleted it themselves)
nope, we gottem
some who know well heroku here ?
@heavy knot Please don't ping anyone for help.
Only ping moderators if you need something moderated.
How do you handle logs? I am looking for tools to better format my logs and maybe process and filter them
In python there's loguru
Is colorizing your logs useful? what do you think?
I have written a quick gist for you that hopefully explains how I go about solving this problem in a professional environment.
https://gist.github.com/osulli/0ed2c5512c9c3193bf8ed4d39f2065f6
I just took a look at the loguru suggestion above which looks really nice - notably the formatting of the stack trace.
I'll be adding that to a tech improvement board at work to see if there's value to be had.
Thanks for rec!
loguru is neat
Traceback (most recent call last):
File "c:\Users\isaYILDIZ\Desktop\Decoy\app\worker.py", line 7, in <module>
from database import *
File "c:\Users\isaYILDIZ\Desktop\Decoy\app\database.py", line 274, in <module>
class Lobby(BaseModel):
File "c:\Users\isaYILDIZ\Desktop\Decoy\app\database.py", line 280, in Lobby
members = ArrayField(IntegerField, 5, default=[])
File "C:\Users\isaYILDIZ\AppData\Local\Programs\Python\Python39\lib\site-packages\playhouse\postgres_ext.py", line 171, in init
self.__field = field_class(**(field_kwargs or {}))
TypeError: peewee.IntegerField() argument after ** must be a mapping, not int
hi guys i trying convert this repo https://github.com/b1naryth1ef/GoPlayNao from python2 to python3 i fixed some lines and sytax but i stuck here.
I want to make code that presses ctrl + v + enter and waits the time you input into a window that pops up when you open the program
ah yes, when you accidently make a commit instead of amending it π
git reset HEAD^ --soft && git commit --amend
i strongly recommend against using the top-level logging functions and basicConfig in anything bigger than a one-off script. i usually create 1 logger per module, and write my own logging setup code that only applies to my own app's loggers. that way i don't get erroneous log messages from other libraries, nor do my libraries pollute the root logger
hm, I should change that tbh
rather than modify the shit outta root, should modify it outta my own module
https://gist.github.com/gwerbin/0d49fe66a1876405fe591b2dd32d5a58 this is how i do it
all of these files would be under myapp/, so logging.py is the myapp.logging module
usually i also have a custom formatter in setup_toplevel_logging
as well as other stuff like filters for doing data type conversions
π
do you have an example of one of these?
π₯Ί
not offhand. but i did once set up a logging filter that pulled the current request ID off flask.g when it was present
that was probably one of the most useful things i ever did in python
oh not a filter, it was this https://docs.python.org/3/library/logging.html#loggeradapter-objects
rn its in __init__.py because I mean like, you shouldn't be importing this specific project, and if you are, you're doing it wrong
that's fair enough. i still like to make my own applications as "library"-like as possible
for my own sake if nobody else's
its a discord bot lel
Anyone tried this alternative to git? Seems interesting https://fossil-scm.org/home/doc/trunk/www/index.wiki
might move logging to __main__.py regardless tho
i haven't, but sqlite uses it, so there's at least 1 major project using it
speaking of git.. have you ever used a git client in python?
I'm thinking of using dulwich
since it doesn't require git to be installed
What is the use case here?
hi, i want to do kind of game bot it will see my screen and move the character with mouse and keyboard.which library should i use
never heard of such a thing. i tried using libgit2 bindings once but i think i ended up just using subprocess for whatever i was trying to do
download git repos from github/gitlab/bitbucket automatically, possibly to a specific version
"not use the shitty git CLI"
Just use shell scripts/commands ?
I'd perfer to use python, since git might not even be installed
funny thing is
!pypi dulwich
this apparently doesn't require git to be installed
i'm reading this now... must have been a huge amount of work
i assume the C backend is libgit2
pure python
it says there's an optional C backend
Python snail sadly
dulwich/tests/test_objects.py lines 305 to 312
class ShaFileTests(TestCase):
def test_deflated_smaller_window_buffer(self):
# zlib on some systems uses smaller buffers,
# resulting in a different header.
# See https://github.com/libgit2/libgit2/pull/464
sf = ShaFile.from_file(BytesIO(small_buffer_zlib_object))
self.assertEqual(sf.type_name, b"tag")
self.assertEqual(sf.tagger, b" <@localhost>")```
The reason to use dulwich over anything else is to ensure minimal dependencies, if I want to install something from gitI'd rather use dulwich over subprocess and git π
dependencies or not, this might just be a lot nicer when scripting git things in general
ironically one of my dependencies is currently a git repo so
lol
there's also GitPython but it does require git to be installed Β―_(γ)_/Β―
heh, that is probably a wrapper around subprocess
and is in maintainence mode
i've used pygit2 as well
There is one thing I could do which I haven't tried yet
but github allows a zip download of every single commit
so I may just be able to do that instead
the question is does gitlab support that too
yes
yes it does
which means I probably don't even need dulwich π
I think I'm branching out (π) of the topic of this channel, could we move to a help channel or something else?
this seems on topic to me
well, the entire feature is actually downloading and importing python modules from github or gitlab repos
not sure if downloading it as a full repo (shallow ofc) would make more sense, or as a single zip
there is...
!d zipimport
Source code: Lib/zipimport.py
This module adds the ability to import Python modules (*.py, *.pyc) and packages from ZIP-format archives. It is usually not needed to use the zipimport module explicitly; it is automatically used by the built-in import mechanism for sys.path items that are paths to ZIP archives.
Typically, sys.path is a list of directory names as strings. This module also allows an item of sys.path to be a string naming a ZIP file archive. The ZIP archive can contain a subdirectory structure to support package imports, and a path within the archive can be specified to only import from a subdirectory. For example, the path example.zip/lib/ would only import from the lib/ subdirectory within the archive.
thoughts? @tawdry needle
doesn't pip already do that
they may not have installation files
they're extensions of this project, to be put in its own source
i see
its an addon system for a bot I'm writing
i would use the zip archive if you know the host supports it, and fall back to git shallow clone otherwise
yeah
if is_github(host):
path = fetch_ziparchive_github(repo_url)
elif is_gitlab(host):
path = fetch_ziparchive_gitlab(repo_url)
else:
path = clone_shallow(repo_url)
and then how would I load them, would it make sense to extract the zip or just read everything in it without extracting using zipimport?
if you know you only need 1 file then just extract that file
wait you can extract single files
i should have remembered that
then in that case, makes more sense to extract all of the files we need
especially given this:
Note that if an archive only contains .py files, Python will not attempt to modify the archive by adding the corresponding .pyc file, meaning that if a ZIP archive doesnβt contain .pyc files, importing may be rather slow.
thanks!
you can extract single files from zip, yes. and sometimes from tarballs (tgz, tar.gz if your file is in the beginning of the tar file you only need to decompress the beginning)
How can i open an website with an proxy in pycharm, and let it close the website after like 30 seconds or something
and i dont understand how i can let it do an automated command only how to let it open the site
PS C:\Users\space> conda install tensorflow keras
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions
Package python conflicts for:
pkgs/main|pkgs/main/win-64::python==3.8.11=h6244533_1
pkgs/main/win-64::python==3.8.11=h6244533_1
what does this mean? From what I see it's saying that the python install isnt compatible with itself, wtf?
i'm not sure what pkgs/main| means in this case. but that appears to be the difference between the two
I figured it out, i ran it again with just installing tensorflow and apparently tensorflow is incompatible with 3.8
huh
which doesnt make sense since it should be
what channels do you have selected?
i have conda forge in my defaults but thats it
conda install tensorflow
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
|failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- tensorflow -> python[version='3.5.*|3.6.*|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
Your python: pkgs/main/win-64::python==3.8.11=h6244533_1
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
oh and pytorch is also in the defaults
huh, looks like it just isn't packaged for 3.8+
try using -c conda-forge or set conda-forge above defaults in your condarc
the anaconda defaults generally seem to be behind
huh
conda-forge and pytorch are both in my default channels in condarc
auto_activate_base: false
always_yes: True
default_channels:
- conda-forge
- pytorch
create_default_packages:
- pip
- ipython
- pylint
``` That's my full .condarc file
ah
i'm gonna try making another blank test env with 3.8.11 and see if it works there
yeah doesnt work in a blank test env either
i figured it out, it was a stupid mistake
this was using default_channels instead of channels as it should have used
therefore it wasnt checking the default anaconda repo
Changed my .condarc to
auto_activate_base: false
always_yes: True
channels:
- conda-forge
- pytorch
- defaults
create_default_packages:
- pip
- ipython
- pylint
and it works now, thanks a lot for the help!
Error while installing rabbitmq in m1 mac : /usr/local/sbin/rabbitmq-server: line 154: 5407 Segmentation fault: 11 start_rabbitmq_server "$@"
You will need to grab Arm64 build or use docker https://hub.docker.com/r/arm64v8/rabbitmq/
i want to install git. and it asks me what editor should i choose? what do you guys think is the best editor?
atom
Depends what do you like. I like vim for editing commit messages, someone uses nano, others prefer VS Code or Atom or Sublime Text
I don't like to leave from terminal and wait for VS Code/Atom/whatever
okay, but i can change it in the future right? or do i need to reinstall to change the editor?
You can change in the config
okay thanks
notepad++ if you are in windows
or your IDE ^
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
!rules 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
!warn 840047422734598164 We will not help you with acquiring cracked PyCharm. Please stop asking about it. This includes DMing people. Re-read our #rules.
:incoming_envelope: :ok_hand: applied warning to @brazen dragon.
π
Thought this channel might appreciate it, lol
(no that is not my reddit)
Hey guys, I made a webapp for a python tool called spleeter, It allows you to split .mp3 files into multiple tracks. The webapp is hosted at https://spleeter.io, and the original project can be found here: https://github.com/deezer/spleeter
You work for deezer?
No i do not
The project is licensed under the MIT license, and is freely available to the public.
So then, how about linking your source code? π
I do not have to as it is not a requirement of the license.
Although, there is a source one my github which is open to the public, and allows you to build sites easily with python. https://github.com/brobbins2001/flask-website-template
No, but this is definitely not the purpose of this channel
Ah sorry, I did not realize that tools was referring specifically to dev tools
& if youre sharing a closed source project, I would use! offtopic
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.
Please read our off-topic etiquette before participating in conversations.
awesome thank you!
I am using ubuntu 20.04 and I want to write a bash script that checks if specified scripts crashed in the background. Can anyone provide a bash script code for that?
Hi all, how much django do you need to get started and be dangerous?
It's a big framework and I don't know if I know enough
Let's get dangerous:
a map to check yourself
https://github.com/kamranahmedse/developer-roadmap
Additional map a bit more python oriented
pyenv install --list | grep '^ 3\.10'
3.10.0b4
3.10-dev
Where's rc1? π€
I am getting dns resolution errors when I attach my docker container to a non-default bridge network (created by compose). i.e. connecting to login.microsoftonline.com results in a "Name or service not found" error in httpx
this is pretty interesting. i'd add that you probably don't need all 4 of ruby, python, node/js, php
Bah, I'll just blame cisco anyconnect and hard-code the dns in the docker-compose file
I see some people using a editor that has a terminal "built-in". Is that a specific editor or can multiple of them do that?
I'm now just constantly switching between powershell and sublime
there should be sublime plugins for that
https://packagecontrol.io/packages/Terminus for instance
@valid reef
Thank you π
Perhaps can I automatically make an SSL certificate by using docker ?
I know kuberneties can do it
Okie
Take a look at Traefik, certbot or acme.sh
for docker specific
If u need unverified one, openssl program can create it in one command
nobody tried to build nginx from binaries to remove header "server: nginx"?
I tried but for some reason it did not work as I wished
RUN sed -i 's/Server: nginx/Server: Apache/g' /nginx-1.20.0/src/http/ngx_http_header_filter_module.c
RUN sed -i 's/nginx\//Apache\//g' /nginx-1.20.0/src/core/nginx.h
not sure where else I am supposed to hide
Hey guys, what are some good ways to deploy your own python scripts to a small (~10), medium (~50-100) or large ( 100+) amount of people? Are there any industry standards or clearly better solutions?
as a lazy arse solution, I would just put it into some form of auto restart in case of failure
that would be the minimum I would do
fair, but how do you deliver the tool to the people? I mean, an example solution I can think of is to put up a Flask app and give them the public URL, this works well for 10 people, but for 50 it's already prohibitive.
if you will put to flask or any other framework
then you launch it with gunicorn (instead of python)
with multiple workers
they will be able to process a lot of people in parallel (sort of inbuilt multithreading)
(it handles auto restart of died workers too)
it will be able to process thousands of people ;b
Even on my home pc?
usually we set amount of workers = AmountOfCores * 2
if you have 4 core PC
it will be 8 workers
they will be able to process a lot of people
that's cool, i'll definitely check the tool out!
since u a going with flask... (or any other web server)
we use in addition nginx usually
it serves as a reverse proxy to gunicorn
which attaches ssl certificates (for https connection)
and services static files super fast
gunicorn is not capable to serve static files (html/css/js)
lol I'll write down all of this and have an extensive google search. I have a vague knowledge of all these terms and I guess i'll have to know them inside out pretty soon
this rabbit hole is a deep one π
so let's say this takes care of the small and medium problem, what if you want to deploy an app to, i dunno, 1000 people?
I could say you more tools to simplify deployments
but it will increase the amount of tools to learn%
there are many tecniques to speed up, lets start with simple one...
u could launch redis server, connect to your application
and to use it to cache stuff, so the repeated things would not request sql database too many times
plus you can set caching at level of nginx too I think
then some of your urls would be served super duper fast before it touches the gunicorn
mm...
besides caching (btw varnish is popular as web accelerator too)
the often used technique named load balancing
we distribute the load between multiple equal servers with the same application
and using haproxy to send user randomly to one of them
of course it all... adds complication to setup things up....
...that's why we use docker, docker-compose tools to wrap it into containers
and deploy to servers with remote tools like ansible for quick setup from the code of your project to multiple servers
anyway, it is a deep rabbit hole
I still wish to learn terraform and k8s one day, which would simplify the process further %
lol i bet. So if I want the weight of the calculation on the user instead, I'd go docker? Like If i want to pack up my scripts into something that resembles a .exe
if you wish to give in the form of windows application, use pyinstaller, it will give you exe
docker is a way to pack all your dependencies into... analog of exe for linux servers.
huh that's cool, definitely going to check pyinstaller
!pypi ansible
Packages discussed here?
If yes, then can someone answer this? https://replit.com/talk/ask/Error-PyPi-package-uploaded-from-replit/144677
@fervent osprey there are platforms like heroku, aws, azure, ... that let you pay as you go for hosting, some are even free up to some point
kubernetes: Can I ask here? Is there a dedicated server/slack/... somewhere? And how does livenessProbe work - if one container fails, what happens to the others in the same pod?
@fervent osprey did you check out anvil? Never tried it but maybe it is relevant for you
This is my Dockerfile: ```dockerfile
FROM python:3.9-slim
STOPSIGNAL SIGQUIT
ENV POETRY_VIRTUALENVS_CREATE=false
RUN pip install -U poetry
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-dev
COPY . .
RUN python -m migrations
CMD [ "/bin/sh", "debug.sh" ]
At `RUN poetry install --no-dev` I get this:
OSError
Could not find a suitable TLS CA certificate bundle, invalid path: /usr/local/lib/python3.9/site-packages/certifi/cacert.pem
at /usr/local/lib/python3.9/site-packages/requests/adapters.py:227 in cert_verify
OSError
Could not find a suitable TLS CA certificate bundle, invalid path: /usr/local/lib/python3.9/site-packages/certifi/cacert.pem
at /usr/local/lib/python3.9/site-packages/requests/adapters.py:227 in cert_verify
What's wrong, and how can I fix it? Google didn't show anything useful
These are my dependencies:
python = "^3.9"
starlette = "^0.16.0"
asyncpg = "^0.23.0"
uvicorn = {version = "^0.14", extras = ["standard"]}
aiohttp = "^3.7.4"
python-dotenv = "^0.19.0"
yoyo-migrations = "^7.3.2"
psycopg2 = "^2.9.1"
Looking for suggestions. I have a microservice style architecture on small python scripts hung of a message bus. Currently each script launches in a docker of it's own coordinated by docker-compose. Presently I have a dozen of these scripts, but it looks like that will double in short time. As all of these run on the same physical host it is starting to feel a bit in efficient running so many dockers for such small scripts.
I am thinking of a way to manage multiple scripts per host. Currently everything binds/bridges to the same local IP anyway.
I run this command =>docker run -d --rm --name mongo -p 27017:27017 -v mongodbdata:/data/db mongo and get the error Error response from daemon: invalid volume specification: 'mongodbdata:/data/db'. I am not like into devops per say just a humble web dev but this was done in a tutorial and worked flawlessly, I need this container so that I can host on azure
hi so i converted an py file to exe and i want to to auto updates for the file how can i do tthat?
add ENV SSL_CERT_DIR=/etc/ssl/certs
That didn't help.
I think I figured out the issue -- I had requests in dev-dependencies. Because I was running it in --no-dev mode, poetry planned the removing of requests and removed it, which made poetry really sad. So I fixed it by enabling creating a venv.
Not sure if it's an issue with poetry, or if I'm really supposed to make a venv.
Using a venv allows you to easily copy it to another stage
I'm just starting out with docker, so I looked at how it's done in python-discord's projects on GitHub
is that generally a bad idea?
at the step where you stuck, comment the rest of the next lines
and put just
CMD while true; do sleep 15 ; echo "background"; done
launch the container
access with
docker ps
docker exec -it container_id /bin/bash
and find out manually with experiments whatever you need to do ;b
π€ not sure how that helps
just a bit more comfortable debug
btw, is poetry your preferable env?
I am usually used to venv
OSError
Could not find a suitable TLS CA certificate bundle, invalid path: /usr/local/lib/python3.9/site-packages/certifi/cacert.pem
at /usr/local/lib/python3.9/site-packages/requests/adapters.py:227 in cert_verify
OSError
Could not find a suitable TLS CA certificate bundle, invalid path: /usr/local/lib/python3.9/site-packages/certifi/cacert.pem
at /usr/local/lib/python3.9/site-packages/requests/adapters.py:227 in cert_verify
anyway
you can access the inside of the container
and see, if it is missing the certificates
if it is missing.. you know, to try finding a way to copy them, where they are expected
I already figured out the issue, as I explained above.
all right
we discussed in #dev-contrib and decided that creating a requirements.txt from poetry and then installing from it was the best solution
The purpose of poetry is to resolve the correct versions of dependencies, and then keep a lock with the concrete versions for stability. Creating a requirements.txt and then installing it isn't much different from just installing with poetry.
poetry or pipenv? 
honestly the only downsight of poetry vs pipenv that I see is that poetry doesn't have as straightforward install procedure, so it might be a turn back for any poor souls that decide to contribute to my projects, or just setting them locally
Wdym?
Poetry is pretty easy to install and use
Pipenv is slow and harder to use IMO
is it? From what I see in the docs (first time using poetry) I have to run some scary script
You mean to install poetry?
ye
You can also install poetry via pipx or pip
Tldr can install poetry same way as pipenv
pip install pipenv
vs
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
I can use pipx but then that's additional thing to install 
Or just use pip install poetry then
going through pip should work fine in most cases
I use the script first most, then pipx, then pip if necessary
not sure what dependencies it has? Wihat are the chances it will conflict if I install with pip
and well, you only install it once
ok time to look up pipx 
Therefore it's just pip install pipx && pipx install poetry
Yeah I use pipx for some of my dev packages I use on all projects
just pipx install poetry will work properly?
looks good, I'll probably switch to poetry then
I've also heard about PDM, but it looks really new
My dev tools are always pyenv for python version, then use 3.9.6 to install pipx, then install black, autopep8, flake8, and pre-commit with pipx
Install poetry via the script piped to 3.9.6, and then poetry env use 3.9.6, and wait for poetry install to install my 100+ dev dependencies
@lost dustany other questions rn?
nop
cool
@olive path wonderful play
ty ty
i am trying to deploy my django and react project on elastic bean stack. but i am getting the following error
File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/util.py", line 350, in import_app
Aug 28 05:36:35 ip web: __import__(module)
Aug 28 05:36:35 ip web: ModuleNotFoundError: No module named 'home/wsgi/prod'
Aug 28 05:36:35 ip web: During handling of the above exception, another exception occurred:
Aug 28 05:36:35 ip web: Traceback (most recent call last):
Aug 28 05:36:35 ip web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
Aug 28 05:36:35 ip web: worker.init_process()
Aug 28 05:36:35 ip web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 104, in init_proces
here is my project django.config file in .ebextensions
option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE: "home.settings.prod.py"
"PYTHONPATH": "/opt/python/current/app/home:$PYTHONPATH"
"aws:elasticbeanstalk:container:python":
WSGIPath: home/wsgi/prod.py
NumProcesses: 3
NumThreads: 20
my root tree and home tree
//root
.
βββ README.md
βββ build
βββ buildspec.yml
βββ db.sqlite3
βββ env
βββ home
βββ manage.py
βββ node_modules
βββ package-lock.json
βββ package.json
βββ public
βββ requirements.txt
βββ src
//home
home
βββ __init__.py
βββ __pycache__
β βββ __init__.cpython-38.pyc
β βββ urls.cpython-38.pyc
βββ settings
β βββ __init__.py
β βββ __pycache__
β βββ base.py
β βββ dev.py
β βββ prod.py
βββ urls.py
βββ wsgi
βββ __pycache__
βββ dev.py
βββ prod.py
any kind of help will help me a lot. thanks
also please ping me.
how can i add an auto updater into my exe file and i convertet the file from py to exe
pyinstaller for convertion from py to exe
i already did that
hosting server with updates, and attaching those self updates being downloaded from it
how
simple scheme...
you split your application into two parts
- updater/downloader
- your main application
yes
updater just checks and downloads if necessary, the newest version from the server with updates
and launches your main application, whatever it is current or downloaded new one
uhm i was trying to use github actions and this happened for python3.6, can anyone decipher this?
nevermind i think gh was acting weird, i removed 3.6 anyway since it didnt have dataclasses yet
Do anyone have experience with Google cloud platform and Kubernetes?
I have few questions
i am back with a question
name: Python package
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, 3.10.0-rc.1]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
# the line below fails for windows and possibly macos
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# ideally i want
# if windows -> do appropriate command to find requirements.txt
# if macos -> ...
# if ubuntu -> ...
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
i need help setting the line that pip installs requirements.txt. basically windows doesnt support bash and i need it so that it can detect which os it currently is running on and then execute the correct statement (this is for github actions)
Have you tried specifying shell: bash?
i actually have not, i will try that
@civic grove can't you simply skip the whole if? Don't you know that there is a requirements.txt anyway?
this worked thanks
i'm a bit surprised though, how does windows support bash?
The runners on actions have additional software installed
Why Windows?
But I would switch to Powershell for Windows to make your life easier
most people use windows so i thought why not
i will keep this in mind
Not for running Python stuff generally
@wooden ibex many python programmers use windows. I do. (Not by choice, not at all. )
Sure but it's rare to run your Python WebServer or whatever on Windows
I thought u used it in order to check testing and compiling of your desktop application ;)
It made sense for me to test for windows and macos then
Does linix mint have a disk portioning tool
does poetry do the same things as pipenv does?
Pretty much, yeah
poetry install requests... then it will create a virtual environment like pipenv?
Hey anyone know an aarch64 headless chromium driver for Selenium? It auto downloads x86/x64 ones which isnt supported(obviously)
poetry is alternative to what? pipenv or pip or pipx?
I cant install Ta-lib on windows. What should i do?
Python isnβt a common Desktop GUI language.
But it is a common language for automation tools which can conceivably be used on any OS
this looks like it could help https://community.linuxmint.com/software/view/gnu-fdisk
Linux Mint - Community
has anybody read "The Phoenix Project"? would you recommend it?
Yes and no, it's cool book but it's more management book then doer book
thank you!
poetry somewhat of an alternative to pipenv. Pip and pipx are different things.
Pip is the Python package manager, I think that poetry may even use it internally.
Pipx is a way to install python packages into their own lil virtual environments. You can use pipx to install pipenv and poetry.
Pipenv manages a venv for a project, but only one venv, and imo pipenv is incredibly slow.
Poetry can manage multiple venvs for one project, and is much faster, and has dependency manangement, so as long as your requirements have at least one combination of supported versions, it will find that combination.
There is also Flit, which does the same things as Pipenv and Poetry. It somehow received less attention than the other two, not sure why.
pipenv used to be unmaintained for a long time. We have bad experience with it in our team. Broken stuff; not just slow
There's also conda which is same but different - better for data analysis, simulations, numpy etc with C or Fortradependencies
Fortran
Hey
Where to Host python Webapplicatoins normally? (im from the php universe). Are there Manged Python hosters or, do i need to setup a root server by myself?
some people use solutions like heroku.
I prefer hosting on my own, renting vps servers
systemd daemon as default in built solution
supervisorctl as installed solution
or pack to docker, and use docker-compose restarting functions
Okay, but then you need to manage the deamon by your self?
well, you make config
and then enable systemctl/service yourserice enable
it will make it auto start on restart
And for SSL Setup an apache Reverse proxy? or what is the way to go there?
apache is still a solution, but nginx grows more popular and considered better
does certbot work with nginx (im a nginx noob) π
it should be, I remember somewhere guides about it
Nice thanks! How do you deploy your apps? (For My Job i use GitLab ci push deployments)
I would like to learn how to deploy with ci push
but at the moment I am using ansible (+ adding docker-compose to it)
i just used ansible to "sync" my development computers so far
one day I would wish to learn k8s
nginx popular functions:
enabling ssl
enabling different other security settings, from cors to sts + many others
caching with it.
caching server side requests to your API
or having client-side caching for static files
How do you manage environments variables ? or "what files to gitignore" normally in pyhton projects
nginx offers many other functionality.. but lets have it not mentioned for now
usually... with OS environment variables
to handle more confortably we use .env file
which is loaded with python-dotenv or with docker env
Yeah i absolutly should learn mor about nginx, i use it for my docker dev enrivonments for now. But i just copy paste setup it before
Okay like we do this stuff in PHP
I found super tutorial but priorities request to learn other tools first%
I need log aggreagtor more desperately than k8s at the moment
and then I would need learning kafka first for event based architecture
log aggregator?
elastic or loki
ah, we use logstash > es > grafana
yeah
anyway, k8s has awesome interactive official docs
they enable you temporal linux OS in your browser just for training
but i do not have root access on this environments, so its a bit limited what we can do
yeah i should give k8s a try again... but im to involved in many other projects and there is soooo much to learn
I think to try with loki first, it is more lightweight solution and it will be easy k8s compatible
same thing, same thing
do you know scrapy?
I am at the moment BackendArchitectDevSecOps, fulfilling three-four roles at the same time
just read a book about it, but nah, not used
not needed yet
haha yeah me to BackendArchitect/DevOp/EndToEndTestSetup/TeamLeader
but in PHP
mostly
yeah i like "Clean Code"
me three
going to learn DDD as next step, not tried yet
a book of Eric Evans awaits me about it
I am more of a Learning Driven Design
I can admit, that I often choose tools just for the sake of learning them ;b
We had a Big Monolith application and now we go to a More Service Oriented Architecture
oh, I jumped straight to Microservices
I've read recently two good books from O'Reilly about it, to make sure everything goes right
I find it hard to define what is a microservice and what not
*From monolith to microservices" and "Building microservces"
We got some tiny applicatons in our ecosystem e.G an Onboarding form another Identiy Provider
but IDK if i should call this a microservice or just a Service
I just have certain goals I follow in microservices
keeping as much of my applications in stateless state for easier horizontal scaling and for easier fault tollerance. if it died, all right, I can replace with clone.
and at the same time to have as less rippling effect as possible, when I change smth
xD I feel like we are brothers almost after this conversation
so many similarities
Web Devlopers live
if I enable firewall first
- name: Allow connections on multiple ports
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_ports:
- "5432"
- "22"
jump: ACCEPT
rule_num: 1
- name: conntrack allow RELATED and ESTABLISHED
ansible.builtin.iptables:
chain: INPUT
ctstate: ESTABLISHED,RELATED
jump: ACCEPT
rule_num: 2
- name: Block all the rest
ansible.builtin.iptables:
chain: INPUT
policy: DROP
rule_num: 5
docker is not wishing to connect %
ERROR: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io: Temporary failure in name resolution
probably all I need
- name: Allow connections for docker
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
source: registry-1.docker.io
jump: ACCEPT
rule_num: 3
it sounds like an issue for a help channel, but according to my google search that's slightly more complex than anticipated: how to get a list of all dependencies for a specific package (using pip for example) without installing them?
no idea how to that properly, but you can create new virtual env for that
@deep estuary ..somehow the github filter worker just filtered a pull request creation by my own account
what do you mean link?
to the PR
what do you see in honeycomb & the webhook page
won't send it here, dms if you want?
nop the worker went fine
I just disabled an event that was sending that discord was never emitting, but didn't notice previously---that event is workflow jobs and is sent 4+ times for every commit.....
Disabling that will fix the problems, since the actual problem here is it got 429ed
I redelivered the pull request creation, and hopefully this will help in the future since its gotten ratelimited before
lol
i'm new to releasing packages and versioning and devops in general, what's a common workflow for keeping PyPI release and Github release in sync? do you just publish(in my case poetry publish) whenever you create a release on github?
You can create GitHub Action for automatic publishing after creating release
ohhhh
https://github.com/marketplace/actions/python-poetry-action
https://github.com/marketplace/actions/pypi-publish
so i can combine these nice
This might be completely off-topic, if so, I apologize. But - does anyone have experience with neovim? I have a super dumb question, but can't seem to get it to work.
I got a really strange annoying issue, wondering if anyone knows a solution. If got tensorflow running on my machine, and via python ide i can do something fine, but as soon as i try attempt that in a program that supports python scripting, i get an error "tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize"
Are you sure that the "program that supports python scripting" is configured to use the same Python installation your IDE is?
that is what ive been checking, seems so
all i have is a py.exe in windows, and then python in appdata/programs
trying both via cmd prompt works
trying inside each interp works fine
but then the program(DaVinci Resolve) gives that error in consolle
even more bizaare. I tried to get the Resolve python scripting to just run 'py scriptname.py' as a subproccess
and it gives the same error lol
but its opening up a whole new cmd prompt and new python that is external
and doing CPU tensorcore via Resolve works fine
print(os.environ['PATH']) is the same on both
super strange
its happening on loading up a tensorflow model
hmm
"With the new DaVinci Neural Engine using NVIDIA CUDA 10 and TensorFlow acceleration"
could it be that there is some sort of built in tensorflow conflicting ?
Quick question: is it possible to check out a specific commit on Github?
yes
hello i froze some python code with cx_freeze. it returned me no errors but all my methods with which i was writing files or creating directory are no being called anymore. Idk if this is the right Chanel to ask ... but ahh pls help | no one on the internet seem to have had that issue strange --> i put my program folder into another folder of the same name now it works - strange
you can substitute the branch for a rev
Erm, so what do I do? Sorry π
Thanks π
When doing a PR review, is there a way to leave comments on any part of the code in the working tree, rather than just the parts in the diff?
On Github, that is.
Not to my knowledge
only a few lines around the diff, but not for the parts you expand
you click the lines dont you, and it lets you add a comment
oi any part of the working tree, dont think so. You can prob reference it in an issue post or something
You can manually permalink to a given code range though? Permalinks point to a specific commit though. Not as slick but doable
hello, i am trying to create an exe using pyinstaller, the exe is getting created just fine but the program requires a pickle file which contains credentials and an ico file which has the application icon. could someone please advise how could i achieve this ?
anyone up for a devops question?
Got a bunch of microservice style python scripts, currently running each in a docker container. I like the architecture but it seems a little overkill. Is there any middle ground python process manager that I can run on docker which could run 2, 3 or more scripts.
daemons, inbuilt solution
https://linuxhint.com/install-prometheus-on-ubuntu/
in this instruction there is mention of daemons
Prometheus is open-source software that is used to monitor computers, software, and services. It also offers real-time scraping of different metrics and alerts for users from different sources. In this article, we will further learn about this awesome tool and how we can easily install it in our Ubuntu 20.04.
create cfg to run your thing
sydo systemctl daemon-reload, load daemon configs
sydo systemctl start daemon_name.serivce, to enable it
this solution is better suiting when you don't use docker though
if you use docker, I think probably better putting everything to separate container
because it will allow easily making health checks
hmm, u could add your own custom healthcheck to container though, which would check health of multiple apps
then it will matter less if more than one process running in container
Better than my current approach which is basically instantiating multiple service objects (basically mqtt event handlers) sharing a cache in the same process. eg. All my radiator and boiler controllers are in the same process. All the schedulers run in one process. One process per docker. However, this limits flexibility, in the ability to update or restart a single component within. It also provides the ability to circumvent the architecture and sneaky things across in memory, which leads to bugs.
I'm still at the stage of wondering if it's worth going to aggregate process dockers and a management API. It might not be worth it. Asides a bit of clean up once in a while, the one docker, one process resulting in about 20 containers running, isn't that bad.
just for you to know
if you have multi container solution, it is handled nicely with docker-compose
Yea, I have docker-compose. I think one thing would help is using a single parameterized image, rather than building each
they are all alpine with a custom pip file
anyway, the daemon solution above, can be nicely put into ansible
that's why I like it
so, essentially we could have the same... building instruction from zero ;b
without any unnecessary dependencies
from typing import Text
from telegram import *
import telegram
from telegram.ext import *
import latino
from latino import lat_ita
from latino import lat_eng
bot = Bot("censored")
updater = Updater("censored", use_context = True)
dispatcher = updater.dispatcher
#if you want to make another command for your telegram bot
#start copying there
def test_function(update:Update, context:CallbackContext):
bot.send_message(
chat_id = update.effective_chat.id,
text = "Hi! I am a Latin dictionary! At the moment I support only two languages, English and Italian.\nThe complete list of my commands is avaible with /commands.\nIf you have some problems or any type of issues you can type /help."
)
start_value = CommandHandler("start", test_function)
dispatcher.add_handler(start_value)
#and finish here
#start pasting here your new commands
def commands_list_function(update:Update, context:CallbackContext):
bot.send_message(
chat_id = update.effective_chat.id,
text = "Command list:"
)
start_value1 = CommandHandler("commands", commands_list_function)
dispatcher.add_handler(start_value1)
#end
def word_function(update:Update, context:CallbackContext):
bot.send_message(
chat_id = update.effective_chat.id,
text = latino.lat_eng()
)
start_value2 = CommandHandler(, word_function)
dispatcher.add_handler(start_value2)
#end
#do not tuch this
updater.start_polling()
#do not touch this
Hi! I'm trying to make a Latin dictionary in a Telegram bot. I did all, but now in the last function I don't know how to implement that if I type every Latin word I want it automatically recognizes it as a word in the library latino. How can I do it?
It is very hard, I know, but if you help me I will really appreciate it.
from latino import lat_eng, lat_ita
from typing import Text
from telegram import *
import telegram
from telegram.ext import *
bot = Bot("")
updater = Updater("", use_context = True)
dispatcher = updater.dispatcher
def test_function(update:Update, context:CallbackContext):
bot.send_message(
chat_id = update.effective_chat.id,
text = "Hi! I am a Latin dictionary! At the moment I support only two languages, English and Italian.\nThe complete list of my commands is avaible with /commands.\nIf you have some problems or any type of issues you can type /help."
)
start_value = CommandHandler("start", test_function)
dispatcher.add_handler(start_value)
def commands_list_function(update:Update, context:CallbackContext):
bot.send_message(
chat_id = update.effective_chat.id,
text = "Command list:"
)
start_value1 = CommandHandler("commands", commands_list_function)
dispatcher.add_handler(start_value1)
#end
def word_function(update:Update, context:CallbackContext):
word = update.effective_message.text.split()[1]
bot.send_message(
chat_id = update.effective_chat.id,
text = lat_eng(word)[0]["traduzione"]
)
start_value2 = CommandHandler("eng", word_function)
dispatcher.add_handler(start_value2)
#end
#do not tuch this
updater.start_polling()
#do not touch this
the solution
I'm remaking an app, where practically the whole source will be rewritten (except for a few files like utils) but the behaviour will mostly be kept the same, would it make sense to make a new orphan branch to then replace main with, or to incrementally update the old tree? (I don't care about forks as there are no active ones)
I would make a new branch, branch off that, push and merge request to it and once you have fully converted, push into main/master
In case you need to make bug fixes to old app
That's also not a huge concern as it has been around 2 years since I did any meaningful contribution to it and most things will require the rewrite
I'm wondering whether it's worth it to preserve the old history, if it's not going to be valuable in the future considering I'm rewriting it as a whole and will make the new commits a bit uglier unless I make an "initial" commit from master that will just replace it whole anyway
Thatβs hard to answer.
Hey, I have couple questions about using tox.
- Is it worth moving to tox in a project that is proprietary/corporate and does not need support for different python versions, etc., so it won't be using the "matrix" python/libraries versions feature of tox?
- Do you think it is worth having both Makefile and tox in a project (since tox is kinda like virtualenv and Makefile combined)?
I just made a branch named "archive/name"
"/" sort of makes folders in my branches
From time to time I even open it
tox itself can act like a makefile surrogate in some cases, e.g. if you have developers on windows machines that might not be working within wsl
i personally like makefiles a lot, i tend to use them to provide a unified set of "entry points" into the dev side of my projects
guys, my github workflows take approximately 6 minutes to complete, would there be any ways to bring this down?
I tried to cache deps, what else could be done?
https://github.com/canopusgraphql/canopus
please ping me when help, thanks!
also, does unittest support async functions
can I cut it down?
I didnt cache CodeQL alone, because if I do, I might hit the cache limit
idk, I don't use codeql
wait, do I even need codeQL
for starters, I think you would only need to run codeql if a *.py file changed
rather than this
my tests run in parallel across different python versions and os
do you know how to do that?
.github/workflows/codeql-analysis.yml lines 7 to 10
paths-ignore:
- 'docs/*'
- '*.rst'
- '*.md'```
thats alr done, right?
trying to find the right docs one sec
okay, thank you!


