#tools-and-devops
1 messages · Page 72 of 1
Got it working
I needed to do docker pull docker/getting-started
then run the command
my bad
=> ERROR [2/5] RUN apk add --no-cache python g++ make 6.2s
------
> [2/5] RUN apk add --no-cache python g++ make:
#6 0.425 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
#6 5.314 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
#6 5.893 ERROR: unable to select packages:
#6 5.928 python (no such package):
#6 5.928 required by: world[python]
------
executor failed running [/bin/sh -c apk add --no-cache python g++ make]: exit code: 1
docker build failed....
Error : unable to select packages, Python?
I have python installed on my laptop
how to fix this error
it asks for python inside the image.
technically easiest way to get python is just using images with python
otherwise you need to google how to install python in the chose OS for the image
for example this looks like fitting for alpine images
Does anyone have any Ai Dev Ideas?
Hey @fast pollen!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
hi can i get some help with my terminal?
WARNING: The scripts pip, pip3 and pip3.8 are installed in '/Users/aarav/Library/Python/3.8/bin' which is not on PATH
im getting this error
how do i solve it
how to update the code after switching the branch for example i wrote some code via vs code and then created new branch and pushed the code but now i wanna see the code in my main branch again but the code is still the same after switching to main
How did you switch back to the main branch?
git checkout main
is there a faster way to compare all changes at once in vs code? like instead of viewing every single change i just wanna revert all code to what it normally was on that branch
there's the discard button in the source control sidebar
ig it says discard all changes on hover
I’m having trouble with some code for a Mario-inspired video game
Do you guys know where I can get help
?
maybe you need to merge the new branch into main
when you execute a program on the command line (like python3), your shell looks up the full filename of the program in order to run it. the PATH environment variable is used to look it up.
the warning says: that directory is not in PATH, so you won't be able to run programs in it without using the full name. so if that directory contains a program hello, you will have to run ~/Library/Python/3.8/bin/hello, you won't be able to just run hello.
if you are OK with that, then you don't need to do anything.
since you appear to be using a mac, we need to know what shell you are using, if you do want to add it to PATH. what does echo $SHELL emit in your terminal?
maybe i misunderstood. is it possible that changes to the file in question were not added and committed on the branch? untracked changes will persist if you change branches
thanks
Im not sure if this is the right chat for this, but i want to create a custom python module with some custom functions etc, but i dont know where to put it to make it accessible to all python files.
You could package your code, and then install it such that it ends up in the global or user sites, which are generally automatically looked in for modules upon import. If that sounds confusing, another way of saying the same thing is "do it the same way libraries you install with pip do it".
I think this tutorial should get you started with that https://packaging.python.org/tutorials/packaging-projects/
using setuptools can we have a monorepo?
in the js ecosystem, projects like gatsby have multiple packages per repo:
https://github.com/gatsbyjs/gatsby
is it possible to do something similar in Python? I know we have namespace
packages, but that's not what I'm looking for!
that is possible, but you have to manually call each setup.py iirc
I think setuptools is not setup to locate the dependencies in separate folders
Heya, setting up my setup.py and setup.cfg, what is the best way to enforce a dependency on gcc and cc1plus? I have tried to install my package on some machines where gcc was not installed and I had to install it manually using conda install -c conda-forge gcc gxx_linux-64
you can't really specify non-python deps from a python package specification, kind of by design. maybe you can distribute a conda env file along with your program.
i guess in setup.py you could check for the existence of gcc and cc1plus executables
maybe it would be interesting if pep517 frontends could check for the presence of a certain executable, eg using an env var
luarocks does that
eg if your lua package depends on readline you might have to pass luarocks install READLINE_DIR=/path/to/readline my-pkg
thanks for the tips! @tawdry needle will give some of these things a go
tbh i think the best solution is the conda env file
putting "logic" in setup.py should be a last resort imo
don't put too much stock in the other stuff, it's a wishlist item 🙂
iirc build requirements and pep 517 can block it
like, failed to build wheels
i thought those had to be python package specifiers
i get that error trying to install pygit2==1.2.1 on a raspberry pi
one sec i'll do it
by conda env file, do you mean just the dependencies or the actual packages?
conda env export --from-history > deps.yaml or similar
and then conda env create -f deps.yaml
yes
i do know that pygit2 does depend on gcc or something when it is installed IIRC
!pypi pygit2
!pip pygit2
well yeah if it tries to build the wheel and it can't find a c compiler it's going to fail one way or another
yeah
i guess by the time you are building wheels with c extensions all bets are off with respect to not putting logic in the setup file
but if trying to block an install because of that, you could do that
although at the same time, if its not required for install, then no one would like it if you blocked it then
also @sand gorge i have a script that will include the pip-installed stuff in the conda env export https://gist.github.com/gwerbin/dab3cf5f8db07611c6e0aeec177916d8
is that your github?
yes
thank you that's useful
...
but in the case of building up an environment specifically for building a wheel, i would argue against including pip deps in it, or actually against installing any python deps with conda
ERROR: Could not find a version that satisfies the requirement pygit2==1.2.1 (from versions: 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.21.2, 0.21.3, 0.21.4, 0.22.0, 0.22.1, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.26.0, 0.26.1, 0.26.2, 0.26.3, 0.26.4, 0.27.0, 0.27.1, 0.27.2, 0.27.3, 0.27.4, 0.28.0, 0.28.1, 0.28.2, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.7.0)
ERROR: No matching distribution found for pygit2==1.2.1
its in that list....
lol i've had issues like this before. can't say i ever managed to fix them 😆
maybe some other package specifier?
idk
so @sand gorge what i recommend is something like this:
conda create -n my-app
conda install -n my-app -c conda-forge gcc gxx_linux-64 python==3.9
conda env export > my-app.yml
pip install ./
i'm just going to try installing the entire problematic requirements.txt
i've never had that error before
what platform are you using? mac windows linux etc
funny sad solution tho, if I install 1.5.1 I don't get an issue
raspberry pi os buster iirc
and what version of python?
https://pypi.org/project/pygit2/1.2.1/#files these are the wheels they have
plus the one source tarball
this is 3.9.6 but when i get the other issue its always been on 3.7 or 3.8
hm, well if you do pip install --only-binary=pygit2 pygit2==1.2.1 on python 3.9 then yes, there won't be a wheel available for you
in fact i don't think there are arm/aarch wheels at all, i don't see them in the list
hang on, switching to 3.8 to fix that dumb identifier issue
it works with at least 1.5.x
piwheels
pi@rasp-server:~/test $ cat /etc/pip.conf
[global]
extra-index-url=https://www.piwheels.org/simple
ye
nice
that's the whole point of it 😛
https://www.piwheels.org/project/pygit2/ well that doesn't look promising
lmfao
thing is, it builds successfully on pi with version 1.5
this is a new error which I've never gotten before
i stopped looking into it for the moment 
remaking a py 3.8 venv
i've been working on some random scripts
@tawdry needleLOL
Collecting pygit2==1.2.1
Using cached pygit2-1.2.1.tar.gz (235 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
then it showed this...
;-;
we've collected the correct version
uh oh! we can't find that version!
after trying to build it:
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include -I/home/pi/test/.venv/include -I/home/pi/.pyenv/versions/3.8.11/include/python3.8 -c src/blob.c -o build/temp.linux-armv7l-3.8/src/blob.o
In file included from src/blob.h:34,
from src/blob.c:30:
src/types.h:36:2: error: #error You need a compatible libgit2 version (1.0.x)
#error You need a compatible libgit2 version (1.0.x)
^~~~~
error: command 'gcc' failed with exit status 1
ERROR: Failed building wheel for pygit2
Failed to build pygit2
ERROR: Could not build wheels for pygit2, which is required to install pyproject.toml-based projects
(.venv) pi@rasp-server:~/test $ libgit2
ah, that explains it
yeah, i think their attempt to make build failure non-fatal has led to confusing issues like this... need to read the entire error output
so the problem is that the build fails, then it can't find a suitable version and gives up?
I don't know.
the invalid version I only got on python 3.9.7
this error is from trying to install on 3.8.11
did you check the setup.py/setup.cfg/whatever for the package? maybe they wrote python_version<3.9 in the older version
does this make a difference with pip?? https://github.com/libgit2/pygit2/compare/v1.2.1...v1.5.0#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7R83
no.. weird
i assume you meant to link to the setup.py? https://github.com/libgit2/pygit2/compare/v1.2.1...v1.5.0#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7
I've setup an nginx reverse proxy/ load balancer and another web server for the frontend right now.
I'll switch to traefik later when I learn more about it, but for now, the frontend throws up 404s
https://github.com/aryaniyaps/todos
I think that I haven't copied the compiled build properly, maybe?
I think that the reverse proxy is correctly setup, because the API works fine. It's the web server that is misconfigured, I think!
could someone please help me with this? thanks a lot!
I remember free nginx version having a lot of limitation to be used correctly as load balancer, I would recommend haproxy as a better alternative
free nginx will work correctly purely as reverse proxy to alone target
thanks a lot! I was actually considering traefik too
I don't know about traefik a lot, beyond that it is the one of the most recommended choices for intricate caching setups.
Considering that you wish load balancing, you would be better checking haproxy first. Or you could go with cloud provider's load balancers.
so nginx can handle the react app and haproxy as a balancer? is that good?
yeah. surely.
chain them 😉
if you have at your disposal infrastructure provisioning tools, I would recommend cloud provider's load balancers though.
but haproxy will work too.
well, this is just a local hobby project
I wont be deploying to cloud anytime soon
This is my current release: https://github.com/doodspav/atomics/tree/v0.0.33a
In the build_py command (which gets called in build and bdist_wheel), it clones another repo, builds it, and places the built shared library into my source tree at src/atomics/_clib (before anything else happens)
Python setuptools then copies that file along with the rest of the sources into a wheel
It works on windows and linux
On Mac, everything I do works correctly, but then setuptools (or distutils) refuses to copy over the .dylib file, and i have no idea why
https://github.com/doodspav/atomics/runs/4149839144?check_suite_focus=true example run here (debug stuff is purple)
[build_patomic] [DEBUG] Files in /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-req-build-itfnwrqz/src/atomics/_clib: [PosixPath('/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-req-build-itfnwrqz/src/atomics/_clib/libpatomic.dylib'), PosixPath('/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-req-build-itfnwrqz/src/atomics/_clib/README.txt')]
evidently both README.txt and libpatomic.dylib are there
creating build/lib.macosx-10.9-x86_64-3.8/atomics/_clib
copying src/atomics/_clib/README.txt -> build/lib.macosx-10.9-x86_64-3.8/atomics/_clib
running build_ext
but it only copies over README.txt for some reason?
ok well i think for now my workaround is going to be just naming the shared library file libpatomic.dylib.txt
wtf that doesn't work either
wtf is happening
ugh i'll find a mac and test this locally somehow
most likely there is some #define LIBGIT2_VERSION
and a #if LIBGIT2_VERSION < 100 #error you need a compatible version
you could run the same command with -dD -E to dump out the preprocessed code if you haven't already solved it
Huh, interesting
solved it (i'm a moron basically)
On windows you only get .dll so that's easy
On linux you get .so.x.y.z and then the symlinks .so.x and .so
so i sort the file paths in reverse, and the first one is now .so.x.y.z
But on mac you get .x.y.z.dylib, with .dylib as a symlink
which sorted in reverse gave me .dylib as the first one
and then python does an isfile check, which that fails because it's a symlink and not a file
thank fuck that's over with, i had to debug by running it in github actions, took like 50 releases :/
I can't for the life of me figure out how to configure mypy to work properly with Ale
I have a config file at the root of my sourcefiles:
[mypy-*]
disable_error_code=501
Anyone know what I might be doing wrong?
... I think this didn't work because the error was flake8 not mypy... I guess always print which linter is generating the error in ale 😄
Solved...
👋🏿 Hi all! Anyone here have experience using BumpVersion, to update the release number? https://pypi.org/project/bumpversion/
This is my first time using it. It looks like all I have to do to update the minor release number is run bumpversion minor and it will update that version everywhere in my directory of files. Does that sound right?
For example, if my version is currently 3.1.0 and I want to bump the minor to 3.2.0, I'd just run bumpversion minor?
I think poetry has something similar built in to it
HI @thick sinew ok, I'll have to check out Poetry but I have to use BumpVersion for work.
Here's another quick article on BumpVersion https://williamhayes.medium.com/versioning-using-bumpversion-4d13c914e9b8
It seems straightforward as we're already configured for it. I just don't want to screw anything up LOL
I'd also like to know if I can undo a bumpversion if something get's messed up
oh if you have to use it for work that's different yeah, my mistake
That's ok 🙂
I see python has the logging module... does this integrate with any logging systems?
what kinds of logging systems, like datadog?
I guess
Just not finding much info
We are in AWS
Ideally we could leverage some AWS service
I suppose everything is possible using a separate log agent, but was initially curious about something I didn't have to "install", just reference in python
yes does anyone know how to clear the console in pycharm?
is someone able to help me with custom modules?
Me searching for the answers custom modules for what and which thing, what's the language at least?
I mean.. This is the python discord right...?
this is tools and devops section. it assumes using more than python.
in #databases section, we aren't using just python too, we use SQL
u a probably looking for #software-architecture section I guess, if your question is python specific.
Can someone explain why is round-robin the standard algorithm for load balancing for pretty much everything? I'm doing some kind of load balancing in all of my apps and round-robin was never ever a good idea for me. As in evenly distributing tasks between nodes/workers. Why evenly? If node-1 has a backlog of 100 tasks already and node-2 has zero, I don't want to distribute new tasks evenly, that makes no sense. It should always go either to the least used node, or if there's some kind of priority implemented, all should go to node-1 until it hits it utilization limit, then all the overflow to node-2 and so on
Is it just because it's easy to implement and not because it's the best generally?
I'm just curious as we're talking about load balancing but round-robin is doing zero balancing
yes
Great, thanks lol
Anyone here knows ansible?
I have this repo of ansible that I have been assigned to recreate for my courseworl
However I am not able to figure out the repo
It anyone is aware do dm
A guide for how to ask good questions in our community.
8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.
I need some advice for how to set up my powershell environment on windows so that it's able to execute some python scripts stored in a folder available on the $PATH.
I have a few scripts with a shebang #! /usr/bin/env python3 at the top which is recognized and used by the py launcher on windows.
I have a %USERPROFILE%\pythonbin folder containing a bunch of utility scripts which I want to be able to execute in powershell using py mytool.py, where mytool.py is residing in the pythonbin folder. I want mytool.py to run with the context of the current directory I'm on, like any cli tool.
I'm wracking my brains trying to figure it out, and have put the directory on the path, but whenever I run py mytool.py, it tries to look for the script in the current dir, not the one in the environment.
How can I force docker build to use the latest version of files? I'm building with docker build --no-cache -f Dockerfile -t consumer:latest . but the files in it are a day old
make sure you are copy them
Copy what?
usually you do "COPY" in Dockerfile, are those the files you mean?
Yeah of course I'm copying the source files lol
FROM python:3.10
COPY /backend/consumer/consumer.py /backend/consumer/
COPY /backend/consumer/requirements.txt /backend/consumer/
COPY /functions.py .
COPY /variables.py .
COPY /settings.py .
ENV PYTHONUNBUFFERED True
RUN pip install -r /backend/consumer/requirements.txt
I'm pushing the image then to my repo
And deploy to the swarm via compose
And make sure they pull the latest image (they do I've confirmed)
But the image itself used outdated source files
Which I can't figure out how
trying editing the file(s) you see outdated, do a build (no need to push), ~then build~, run and explore the container, check the edition you made is in the correct place. This will discard the problem is on build time
You mean do two builds in a row without changing stuff between the builds?
Hm it seems to have the up to date files like that
So the issue isn't with the build
That makes me even more confused
Because on the swarm I see the container match the image id
sha I mean
But when I inspect the volume the files are outdated
I do the exact same process every time and it worked fine until today
use different tags on images. Something like this
TAG=$(date "+TEST-%Y%m%d%H%M%S")
docker build --no-cache -t consumer:${TAG} .
docker tag consumer:${TAG} <your-repo-uri>:${TAG}
docker push <your-repo-uri>:${TAG}
no need to -f if filename is Dockerfile
which image is the latest if you always override it?
It's always the one with the latest tag
how to track builds?
I always just push the latest and redeploy with the latest
which can be out of date
But it isn't, I can see the sha match the image
mm
The sha in the container matches the image sha I just built
Which is why I'm clueless lol
That's why I thought the image itself included outdated files
But that wasn't the case
Might be something with the volumes?
Do I need to do something extra to overwrite the files if they already exist on the volume?
Let me try deleting the file from the volume manually quick
I don't think binding volumes is the best way to overwrite files
doesn't compose bind directories when mounting volumes?
Under the service I have
volumes:
- consumer:/backend/consumer
and in the root
volumes:
consumer:
No idea
This is how I've done it and always worked
I've removed the files manually from the volume and gonna redeploy now with the latest image and see
Hm...
python: can't open file '/backend/consumer/consumer.py': [Errno 2] No such file or directory
But why
The dockerfile does copy the files I've seen them when I inspected it
But not in the swarm
when you mount the volume, binding overrides the content
I'm deploying via compose
And I have it setup the way it shows in the example above that part
I.e.
services:
frontend:
image: node:lts
volumes:
- myapp:/home/node/app
volumes:
myapp:
Do I need to add external?
That created a whole new volume
Can you clarify what you want to achieve?
What I've gathered so far is that your new image contains updated files, but your existing volume is out of date. But if you delete your volume's content, then some files are missing?
Maybe what you need to do is make what you're mounting more narrow, so that your volume can use more of the files that are within the image. For example, by creating a subdirectory specifically for files that you expect to override or for files that are only need to be present in the mount but not the image.
But it's just a guess cause I am not sure what your goal is.
These are the files that are needed to be up to date with every update:
COPY /backend/consumer/consumer.py /backend/consumer/
COPY /backend/consumer/requirements.txt /backend/consumer/
COPY /functions.py .
COPY /variables.py .
COPY /settings.py .
In the compose file I've got something like this:
consumer:
image: 192.168.0.100:5000/dev/consumer:latest
volumes:
- consumer:/backend/consumer
working_dir: /backend/consumer
command: ["python", "consumer.py"]
Then consumer.py uses /backend/consumer/logs/consumer.log for logs, which I need to preserve between updates and redeployments
The python script logs to /logs/consumer.py so since the working dir is /backend/consumer it should log to /backend/consumer/logs/consumer.log
Which it does
But if I delete consumer.py from the volume it breaks
(I don't want to delete it was just for testing)
(I do want to keep it up to date though)
Yeah, sounds like you need to narrow what's being mounted. You should try creating a volume just for /backend/consumer/logs/
Since it contains the files you want to preserve. Doing it for all of /backend/consumer/ is not necessary and is causing issues cause the volume is overriding the container.
@smoky stratus
What is in those volumes?
So like this you mean?
consumer:
image: 192.168.0.100:5000/dev/consumer:latest
volumes:
- consumer:/backend/consumer/logs
working_dir: /backend/consumer
command: ["python", "consumer.py"]
Yes, I believe so.
Please tell me what to do in this situation? I did not find it in Google. I apologize in advance if I wrote to the wrong channel
You're in the wrong channel. Please ask in #user-interfaces
Okay thank you
Hello, so I'm thinking on adding a workflow_dispatch event to my github action so I can run it manually. Will anyone who visits my repo be able to trigger the workflow or only the owner/admins can
!pypi virtualenv-clone
😛
Anybody know of any good videos that might help me get my way through PyCharm? I want to understand how to create multiple files easily that run off the same editor? And use good techniques to do so.
I would advise just using terminal multiplexor.
Terminator and Konsole are good ones... They are for Linux though.
Not sure which multiplexors exist in other OSes
Hello, so in git I accidentally created a new branch and commited the changed and ran git checkout main. how can I enter the previous branch again (I cant remember the name) and merge it with the main brach?
I did a lot of changes in that branch, Thanks
Is it possible to get those changes back? and merge the branch
in order to return back to new branch
git checkout NameOfNewBranch
in order to merge branch to main.
git checkout main
git merge NameOfNewBranch
Hey guys! I have just released a VSCode extension for boto3 code auto-complete and type checking. Please let me know if it is easy to use https://marketplace.visualstudio.com/items?itemName=Boto3typed.boto3-ide
it took me a while to figure out how to get correct pythonPath, so I wonder if it works for everyone now
Sorry, the issue seems to be something else, when I run git branch I get this ```
-
(HEAD detached at origin/main)
main
no other branches, and `git log` shows this
commit 23e948427368237388a116c853db8dc050b501ec (HEAD -> main)
Author: ...
Date: Sat Nov 13 16:53:15 2021 +0530Updated INSTALLED_APPS
``` I have made commits after this commit, maybe thedetached HEADis the issue?
surely. it is some weird branchless state. I usually always avoided that
no idea how to help you fixing it without knowing which commits you are expecting to have and what not
analyzie with git log -n 5 and e.t.c.
as far as i remember the last commit i made has a message like this "Added ChannelViewSet"
the order of the out put is most recent right?
git reflog shows the commit I was searching for
(Chat app) C:\Users\Desktop\Programming\Chat app>git reflog
23e9484 (HEAD -> main) HEAD@{0}: checkout: moving from 99dec4e6e388a1cd50fc7182529c6adecf19d699 to main
99dec4e (origin/main) HEAD@{1}: checkout: moving from main to remotes/origin/main
23e9484 (HEAD -> main) HEAD@{2}: checkout: moving from 3c2982ec553e0b845da8bd81809fcc074ed1b4eb to main
3c2982e HEAD@{3}: commit: Implemented ChannelSerializer.messages
8190173 HEAD@{4}: commit: Added MessageCreateSerializer
f627351 HEAD@{5}: commit: Fixed AttributeError
How do I exit this 😅
create a new branch ;b
push to it
compare branch with main
if there are just new commits, and everything else main has, just merge it from branch to main
if not... then pull from main to branch, resolve conflits, then can merge branch to main ;b
that's how I would have solved it at least.
git checkout -b "BranchName" creates new branch I think
Thanks 👍, I'll try that
Thanks a lot!!!, it worked 
I was trying to fix that for hours
xD, hours?
well, u a welcome anyway
@vocal quiver git checkout -b creates a new branch from the one you are currently using. so checkout to main or whatever branch you need before running the command
thanks 😄, already fixed it
👍
errr having some git issues
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> expedien-staffing_website/tf_for_exp
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached```
i deleted the file in my directory that contained my ill-imported code
but i guess the VCS still sees it as a sub module?
i follwed the instructions, and it's given me a loop
like i get a
fatal: not removing 'asdkasjdla' recursively without -r
so i use it and it appears to delete recursively
then I do a git add .
and i end up right back here
any advice would be appreciated
Does anybody know what signal is sent when the debugging session is stopped in vscode? I want to capture that signal
ok so how can i make in python voice text to speech with my own voice
That's a Google question, tons of articles but here's a quick and simple one: https://pythonbasics.org/text-to-speech/
SIGKILL, but it might not be trappable
yeah I wanted to capture it
i don't know how they would stop you though
I have a branch with two git commits.
I want to throw away the first commit and keep the changes from the second commit.
Basically, I only want the most recent commit.
How can I accomplish this?
maybe at the C level it could be caught?
Do we agree that doing
docker run -itd XX YY
Does not make sense because the container will be detached and therefore no tty access?
Anyone know git well?
I’m trying to do the following:
I have a branch with two git commits.
I want to throw away the first commit and keep the changes from the second commit.
Basically, I only want the most recent commit.
any good alternatives to invoke release for a version management system that's friendly with poetry?
there's versioneer but that seems to be stuck on distutils
(is this really a tools/devops question? dunno where else it'd go)
Conceptually, it helps to think about these situations if you remember that git stores snapshots, and it doesn't store "diffs"
@maiden shadow the tool for this is rebase or cherry-pick. If your branch is ahead of master by two commits, git rebase -i master and delete the first line (the commit you don't want) in the editor window that comes up
@tawdry needle thanks! I’ll try the rebase approach
I think poetry has some basic version management built in. You can run, for instance, poetry version major to bump the major version in pyproject.toml.
yeah, I think we'd want something a bit more fully-featured, e.g. to cut a release branch and tags on git
....
@flat path yknow how i tell you to use poetry sometimes
but its times like this which make me regret it
poetry remove pydantic
uninstalled python-dotenv
No clue on which channel I need to ask this question but does anyone know where is the best place to start at while learning python? I'm new to it all and just want to find the best place to self teach myself.
hello people how do i fix fix Cannot connect to host www.somewebsite.com:443 ssl:default [[SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:1129)] in Ubuntu 21.04 x64 i did my research and believe this is related to OpenSSL
!resources The right channel is #python-discussion but check this out first...
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Hello!
I want to read .xls files in my project. Also I want my project to be installed with ./setup.py install.
The problem is with the following setup.py. ./setup.py install crashes when executed the first time but completes successfully on the second execution.
Why does it fail on the first execution and how to fix that? Manually installing packages via pip works fine.
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='test-scripts',
version='0.0.1',
install_requires=[
'pyexcel-xls',
'pyexcel'
]
)
Excerpt from the log of ./setup.py install. It looks like it tries to install pyexcel-xls instead of pyexcel.
... part of the log omitted ...
Searching for pyexcel
Downloading https://files.pythonhosted.org/packages/71/20/a8945b1acc2076b78c3a2319389364f088a75474e07178ac8d9250dd0a48/pyexcel-xls-0.7.0.tar.gz#sha256=5ec606ef8667aafbb0c3fbd8242a7c23bf175ee7c10b08f70799b84fb2db84cb
Best match: pyexcel xls-0.7.0
Processing pyexcel-xls-0.7.0.tar.gz
Writing /tmp/easy_install-84mdsfn6/pyexcel-xls-0.7.0/setup.cfg
Running pyexcel-xls-0.7.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-84mdsfn6/pyexcel-xls-0.7.0/egg-dist-tmp-gse4h1ts
removing '/home/artur/xx/venv/lib/python3.8/site-packages/pyexcel_xls-0.7.0-py3.8.egg' (and everything under it)
creating /home/artur/xx/venv/lib/python3.8/site-packages/pyexcel_xls-0.7.0-py3.8.egg
Extracting pyexcel_xls-0.7.0-py3.8.egg to /home/artur/xx/venv/lib/python3.8/site-packages
pyexcel-xls 0.7.0 is already the active version in easy-install.pth
Installed /home/artur/xx/venv/lib/python3.8/site-packages/pyexcel_xls-0.7.0-py3.8.egg
error: The 'pyexcel' distribution was not found and is required by test-scripts
Python 3.8.10 is used with Ubuntu 20.04.
I managed to fix the problem by adding a lower bound for pyexcel version: pyexcel>=0.6.7. However I still don't understand the cause of the problem.
Docker:
How can I containerize the following application?
Repository called: ‘env’
Repository called: ‘code 1’
Repository called: ‘code 2’
‘code 1’ and ‘code 2’ both need/depend on ‘env’ since that’s the Python libraries and licenses etc
Code 1 and code 2 can each be their own container since they’re separate services.
Just pull the python image. Install package Copy repos. Run repo
@trim ermine I can’t just “install” anything
I need to specifically use the repo called env since those contain all the packages and software licenses
What do you mean by repo something hosted on git? And yes you can install packages with pip thats what its for. You build a docker file layer by layer. You can install depedencies. You can copy files. You change permissions. Thats the beauty of Dockerfiles
So if all of your code is local. You COPY files and folders over
If its in a repo. You pip install, ADD, or use a package manager.
If its in subversion you clone it.
If its in git you clone it or use PIP if its python.
What am i missing? @maiden shadow
Hey folks, I'm attempting to swap from a setup.py to a setup.cfg file, mostly it's straight forward, but I seem to have hit something of a snag. Our CI/CD pipelines uses a version.py file to extract and increment a __version__ string when we do various releases. In setup.py it's pretty simple to just say "read the value of __version__ from that file" but it's much less obvious how to do that in setutp.cfg. I'd prefer not to have to modify our CI/CD pipelines, so what's the best way to extract said value from the file into the setup.cfg . The documentation says you can use file: or attr: but I can find nothing on how those actually work.
I found this, and it says "version is the package version. See PEP 440 for more details on versions. You can use file: or attr: directives to read from a file or package attribute."
Does this mean I can read __version__ using attr?
https://packaging.python.org/tutorials/packaging-projects/#packaging-python-projects
after wasting hours on that move myself a while ago, i reverted it and just stayed with setup.py
if it ain't broke..
i think file: ./version.txt reads the entire contents of ./version.txt, and attr: myapp.__version__ reads the attribute myapp.__version__
Hi, I am trying to make a project to be setup.cfg project. In the old version, we letted the setup.py read a version number from a file inside the package. def get_version() -> dict: version...
When making a utility docker image (like adding a root certificate), how should I name it?
Just make it under my own name?
Hi, I am making an open source project, but what I have noticed is people take the code and publish to their own github/gitlab without consent and proceed to change the liscense and claim the project is their own. I want a liscense similar to th MIT one, which allows all uses but the person must have the original liscense in their code unchanged
that is MIT
MIT says you have to distribute a copy of the license wherever you have taken code and redistributed it
if you want something stricter than MIT, you should look at GPL

Alright thanks, can I modify the gpl liscense to my own needs and at the top saying something like BSD 3-Clause License MODIFIED
I'm not sure of a reason why you can't modify a license, you'd have to check though, technically licenses themselves are copyrighted and not all behave the same. I'm not a lawyer, though.
Alright I will look into the same
Last question, will the gpl liscense force th party to retain the liscense unmodified? I could not find the answer online, and looking at the liscense itself was vague because it says the redistrobution and binary must have the liscense and disclaimer but it dosent say it cannot be modified
oh also
note that a license change only affects it going forward
so all of your previous code is still mit
hey
i am trying to install one pip module and i am getting error
running build_ext
building 'pdftotext' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
i am trying in docker image
docker image is of ubuntu with wines
sudo docker pull cdrx/pyinstaller-windows
here is the image
after pulling when i am connecting the image shell
and trying to install pdftotext it keep showing error of need build tools 14 or above
i cant find any solution to fix this
this is inside the container itself?
i dont understand
no i mean i am connected to the container with bash and the image doesnt have build tools and i have no idea like how to install build tools in it
you can just try pull the image sudo docker pull cdrx/pyinstaller-windows and after connecting to the container with image ID try installing pip install pdftotext
Some licenses prohibit nonstandard extensions/modifications, i think
does anybody know how wiremock works?
Hi, I am making a python project with a python backend, such as the flask library (specifically using streamlit). How would I be able to tell github to host the site? all thats needed is
pip install -r requirements.txt
cd src/
streamlit run app.py --port 80
:/
+ docker build . -f docker/Dockerfile
Sending build context to Docker daemon 184.3kB
Step 1/43 : FROM python:3.9-slim as python-base
Error parsing reference: "python:3.9-slim as python-base" is not a valid repository/tag: invalid reference format
@gentle solstice does it need to be upper-case AS?
it works locally. It just doesn't when I run it in the docker image on kubernetes
huh
I tried using podman, but I get a different error.
+ podman build . -f docker/Dockerfile
time="2021-11-17T16:11:19Z" level=warning msg="\"/\" is not a shared mount, this could cause issues or missing mounts with rootless containers"
cannot clone: Invalid argument
user namespaces are not enabled in /proc/sys/user/max_user_namespaces
Error: cannot re-exec process
It was because my kubernetes cluster was running docker 1.13
Hey @golden flax!
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:
order-service:
container_name: api
build:
context: src
dockerfile: Dockerfile
target: dev-build
environment:
DEBUG: ${OS_DEBUG}
DB_USER: ${OS_DB_USER}
DB_NAME: ${OS_DB_NAME}
DB_PASSWORD: ${OS_DB_PWD}
DB_HOST: ${OS_DB_HOST}
DB_PORT: ${OS_DB_PORT}
ALLOWED_HOSTS: ${OS_ALLOWED_HOSTS}
SECRET_KEY: ${SECRET_KEY}
CORS_ORIGIN_ALLOW_ALL: ${OS_CORS_ORIGIN_ALLOW_ALL}
CORS_ORIGIN_WHITELIST: ${OS_CORS_ORIGIN_WHITELIST}
DJANGO_LOG_LEVEL: ${OS_DJANGO_LOG_LEVEL}
VIRTUAL_ENV: /home/app/.venv
PATH: /home/app/.venv/bin:/home/app/.poetry/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
command: bash -c "cd src && gunicorn --bind 0.0.0.0:8000 --timeout 600 --reload --env DJANGO_SETTINGS_MODULE=order_service.settings order_service.wsgi"
links:
- db
- product-service
depends_on:
- db
- product-service
volumes:
- ${OS_HOST_PROJECT_DIR}:/home/app/src
- ${OS_HOST_PROJECT_DIR}/pyproject.toml:/home/app/pyproject.toml
- ${OS_HOST_PROJECT_DIR}/poetry.lock:/home/app/poetry.lock
ports:
- 8000:8000
networks:
- internal
- external
product-service:
image: rodolpheche/wiremock:2.23.2-alpine
command: --verbose
hostname: productservice
volumes:
- ./wiremock/product-service/stubs:/home/wiremock
networks:
- internal
- external
ports:
- "8081:8080"
i am unable to call api from order-service to product-service... this is my docker compose can someone help
@golden flax do you get any error for the call? does it time out? is the connection refused?
i have a venv with a bunch of dependencies, and I want to create a standalone exe for the python file in it
i tried pyinstaller inside the venv, but I am getting a dependency problem
how can i squash two merge commits from the same branch
interactive rebase?
ended up just redoing the merge conflicts
always rebase and avoid them altogether 😛
I do now.... but this is an old branch
rebase the old branch
nope, too many merge conflicts to do that
haha, when thats the case, i squash the old branch into one commit and then just deal with the conflicts once
youre gonna deal with the conflicts no matter if you rebase or merge so, meh
rebase conflicts are way worse than merge conflicts
why am i getting this error....
i have Kivy installed as a extension...
fixed it was using the wrong ports while calling, MB
uhm, no they arent
I'm getting "client unexpectedly closed TCP connection for rabbit mq" while publishing does anybody know whats goin on?
Im new to rabbit mq
your vs code interpreter is not seeing kivy, make sure you selected the same one you installed kivy on
could you elaborate?
check vs code's configured interpreter , control/cmd + p, then type python select and look for interpreter
make sure it matches where you installed kivy
im sorry if this is common knowledge to you but do i do this in CMD or Visual studio if so what do i type and where do i type it "control/cmd + p"
That's a keyboard shortcut, it brings up a command palette where you can type commands
ya i came to the conclusion that maybe kivy doesn't support python 3.10
if i choose to revert back do i need to do anything special or does VS automaticity search for python again
you need to select whichever interpreter has kivy, you can have multiple ones installed at the same time
im sorry,im trying to learn VS could you tell me where is the interpreter
im following a tutorial and it tells me to write "where python3 " in the terminal
and a thing is suppose to show up at the top of the screen but i dont see it
if i type in install pip kivy will it have problems with what im doing
its all in vs code
i got passed the "can not find kivy" thing but when i try to run it
i get this
"WIDE GET"
ya i painfully found this out
thanks tho
do you know about kivy
bc if you do i really need help
the tutorial im following says i need to create a file and give it a ".kv" at the end but visual studio doesn't recognize it
Why would it? Its a text editor
Kubernetes has a lot of abstraction layers. Rn I'm familiar with docker and docker compose, but k8s is overwhelming, it seems like it might take a month to learn
Any tips to Speeden the process? I'm willing to put the hours in. The thing that bothers me is the yaml file boilerplate
yeah, SRE guys tell that it would take in average half of year to get through its stuff
which makes me putting it as at last thing to learn 😦
because there are so many easier and faster things to learn
No but there is an interactive tutorial. Then you can always setup a local kubernetes cluster with a docker back end. Then mess around with it. Write your own "Pods", "Service", "Config" and "Volume" resources. Deploy those. Get a feel for it. Then actually do a project. Its a lot of stuff for sure but what you need is a solid foundation
Hello!
I am trying to build a small python code for productivity purposes (https://github.com/thomashirtz/notion-scholar). I would like to be able to make it easy for people to install it and use it. I have several requirements though, it must be easy to install, and I would also need an easy way for the user to set up some permanent variables for the configuration of the software.
Does someone know a good way to do that ? I found many information about PEX or else. However I didn't find much answer for the user config part
Thanks 🙂
for permanent config, it's usually good enough to store it in a json, toml, yaml, etc. file somewhere on the user's system, e.g. on windows %LocalAppData%/MyVeryCoolApp/config.json and on linux $XDG_CONFIG_HOME/my-very-cool-app/config.json
you can use https://pypi.org/project/xdg/ to figure out what that directory should be on any given system.
see also
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
https://wiki.archlinux.org/title/XDG_Base_Directory
https://stackoverflow.com/questions/43853548/xdg-basedir-directories-for-windows
https://stackoverflow.com/questions/3373948/equivalents-of-xdg-config-home-and-xdg-data-home-on-mac-os-x
on windows and mac, maybe pyinstaller is the right tool for the job
i think pyinstaller works for linux too
hey
so, i stumbled over https://drewdevault.com/2021/11/16/Python-stop-screwing-distros-over.html
sent the guy an email to explain what actually are the problems with python packaging on distros
here's the answer
you're heavily complaining (quite rightfully so) about the state of
packaging in Python, but I don't see any mention or link to what exactly
are "the needs of any of the distros, despite our repeated pleas." -
could you please elaborate?
Here are a few common use-cases which are forgotten or explicitly
ignored by various newfangled Python build systems/package managers/bit
twiddlers:
- Building & running tests without the network and without fetching
dependencies during the build - Installing into an arbitrary prefix
- Installing into an arbitrary prefix within a DESTDIR
- Working with sysroots when linking to native code
- Correct use of pkg-config
now, i'm wondering if there is anything that could be done to address those issues with justuse 
i guess we're guilty of some of those points, too (at least having packages in ~/.justuse)
i'm not even sure what "installing into an arbitrary prefix" or "DESTDIR" means?
I don't understand about PREFIX though, afaik you can build python with any prefix and DESTDIR you want
prefix is where python is hard-coded to look for stuff like /usr vs /usr/local vs /opt, DESTDIR is the "staging area" where everything is copied to during "make install" (so you could use /tmp/output and then create an atrchive from the files there, which would include /tmp/output/usr/bin/python etc)
hmm.. couldn't we solve those dir questions via our config?
we'd still have a ~/.justuse folder, but only with the config, logs and registry
we don't need our packages to live in our home
i wonder if that would suffice to appease the distro maintainers
I don't understand these complaints
Good idea to email and ask but his response makes no sense
They apply equally well to perl and ruby
And nobody is complaining about packaging perl applications
how would you "fetch" dependencies without a network, I wonder
if you run pip with a specific, local index, and the .whl files are either all local or in pip's cache, no fetching should be required. so no network
I think they can be worked around -- sysroot can be avoided by using docker, which is the strategy cibuildwheel uses
what's the concern with fetching exactly? pep 517 build deps?
having a full local mirror of pypi seems excessive (but maybe good for other reasons like not abusing their servers). can't you disable build isolation in pip, and otherwise declare the pep 517 build deps as build deps for the distro package?
not sure
turns out pip calls itself when PEP 517 is used
which might be part of the pain point around passing flags and sysroot and such
Just pack to docker, and ship it. Everything is already installed/ frozen there
Have containers in your docker registry history with different tags in order to have previous app versions
That makes u exposed only to be not having some dependency during development of future versions, but I think it is sacraficable enough thing. For all small products and up to medium it looks like having containers enough
If your target computer is not having docker, then download docker installers offline ;b
what's the best way to get binaries for a specific micro version of python on linux? here's where i'm at:
- deadsnakes ppa works great in general, but i can't figure out how to trick it into giving me a micro version that isn't latest
- pyenv works great for dev, but in prod i want a python compiled with
--enable-optimizations, because python is much slower without it. unfortunately, it then takes a long time for it to compile python - conda? i've tried to stay away from conda ever since i had to spend a day debugging a pip + conda package clobber. but maybe it's my best option here?
What's its the type of application? Tell a bit more to describe, is it pure console application / web application / GUI application, a bit what is it doing?
yeah
any standard dependencies certainly could be
you could do it with pip once and then reuse right
yup
@tawdry needle @next spruce there have been some more responses to my inquiry https://lists.sr.ht/~sircmpwn/public-inbox/<dee09ae9-eab7-09e3-fea8-8385a38a8919%40anselm.kiefner.de>#<CFTP7VNFU4TX.3H72X3I9WCQXM@taiga> (mailinglists.. never been a fan)
confusion and blame for the confusion going around 😄
hopefully there will be some more answers from the maintainer
it would be nice to know exactly what he expects to do
yeah
I have to remember to respond to this later
Ty I didn't know there was a public inbox thing
yeah, me neither
I have many nodes with random branches and versions of services, and whant to create universal jenkinsfile for them.
I make jenkinsfile with properties like node name and branch, etc.
But i don't need to display all of them (node names) in single select action on build page (by default).
How to create auto selection for node name from properties in jenkinsfile per project?
Maybe create jenkins pipeline with node name, and get its name to select node name in build menu? (And make other node name in list disable?)

this might be a stupid question but I am learning docker and have a little python script that I am trying to package up and I was just curious if there was any way to force a container to always be run in interactive mode
Does anyone know of any tool, that is free, for designing the architecture of a software?
basically graphs
i use this one https://app.diagrams.net/ (it comes in online and in desktop version)
u a welcome
it can design anything
from database models, to UI interface 😉
yeah that is pretty sick
shot in the dark but this seems like the right channel:
anyone have experience with talos/rancherOS/k3os/k0s? Looking to build my own multi-master k8s cluster the proper™ way and to not treat my previous single master/worker node like a precious pet any more
...
Honestly I wouldn't bother with caching for pip
Caching pip's cache is IMO not that useful since it's only downloads and local wheel builds you're saving yourself from doing. The installation is still slow (I'm eagerly waiting for parallelized wheel installs from pip).
You could cache the whole site-packages but that's actively discouraged as it's prone to breakage.
@velvet spire 😄
ngl i took this from pydis
that's what it does
but it stores it as the key being the hash of the files that build it (pyproject.toml and poetry.lock) and rebuilds it when those don't hit a cache
hi do I know you
And OS and Python version down to the bugfix version?
hmmmm
Not best idea
well the os isn't an issue... and the worst that happens in the cache breaks temporarily on release.... I wonder if it does use bugfix
will check
hey taking stuff from pydis is a pretty good idea smh
The desire for “efficiency” can override common sense
How long does it really take for pip to run in your container?
2-3 minutes to install the dependencies iirc
Yea, caching and introducing something else to break vs just letting it build fresh from pip every time seems to weigh heavily on, let it build fresh
meh
nothing has broken yet due to that
and actually
I can add a small if to never hit the cache on a rerun of a workflow
I’m getting my DevOps self out of this mess
lol
honestly tho
github actions has bigger problems
specifically that merging with the target branch on every pr workflow
like
why
tldr I'm very much a fan of automation automation automation
if I ever get any problems from the caches I'll remove them
No, you will bolt for new job in 2 years and next person will be looking at build pipeline wondering why this is here and is it absolutely required when it breaks b
it's my project and I doubt that I'll be bolting anywhere, also when it breaks it'll probably be sooner than later
can you explain?
is there another way to do a PR?
wdym?
yeah, github IMO shouldn't do that on every workflow
it only would if someone opens a PR, right? and the PR was merged
is there some other merging?
no. every single workflow that github actions runs, if its checked out, it merges it with the base branch and runs the workflows
ohhh yeah
which is utterly stupid
its also why workflows won't run if there are merge conflicts ;-;
I don't even know if it warns about it. it's surprised me before
the worst I think was, I made a PR from my fork to an upstream repo, and somehow it ended up altering the PR and used main as its scratch space
was quite surprised to find commits on main (it had not been merged)
- created a PR from my fork's
topicto upstreammain - made a PR to that PR (on upstream), say
topic-patchintotopic(details fuzzy, I realize it may not make complete sense) - merged the second PR in upstream
- github actually committed the result on the upstream (!) main instead of making a topic branch to match the fork one
that is what I remember, not sure how I specifically did it
hi all. can I ask here a question about an error I get in VS CODE and Github?
interesting, someone just showed pex to me, and now I'm curious, what are the ideas of using pex for test environments, to be able to test optional dependencies
!pip pex
pylance be like
not sure if thats a bug on their end or what but yeah i'll just ignore it
hm strange, u have the @classmethod decorator?
its from the huggingface tokenizers package
but i'm pretty sure that's written mostly in rust
which could be the reason
oh, so its not in python.. then yeah i would expect odd pylance behavior
although they should have stubs setup
did you check "from_file" has a class method decorator though
Light mode content, dark mode interface.
Have done a fair bit of graphic design and UX/UI work, I know that certain things come into and out of fashion, and certain other things don't
Pair your serifs with sans serifs, never use a colored font, the only trustworthy color is blue
I can't shake the idea that when working with a complex problem, most people think better in dark mode
I'd bet a few dollars its not a fad is what I'm getting at
just cuz its comfortable to see in dark mode
i like programming in dark mode, but reading texts i prefer light mode
I use a monospace font throughout my entire editor
i actually need to update
first world problems: need to update font
updated
yeah, not a bad font. i like
I had more been talking about for websites. How fonts relate to information transfer is interesting. It'd make for a great essay
But yeah, for programming, monospace is best for technical reasons. I can't imagine using anything else (though, spacing and serifs are orthogonal to each other)
Cascadia Code is very nice. i have also been enjoying Recursive Mono lately https://www.recursive.design/
the jetbrains font is pretty good too
huh interesting
I'll have to check it out
lol
fira code
Hi, have any of you used a tool called mkdocs? I love it, but I'm not sure if any of you have tried to add a figma design to it? I'm trying to see export a UI/UX library into mkdocs for viewing. I don't really want to just add a pdf export but ideally a markup implementation but I don't need it to be data-driven or interactive like storybook
what format would you want to export? svg?
tool for people who want to reverse a text:
#Imports
import PySimpleGUIQt as sg
import pyperclip
#theme
sg.theme("dark")
#layout
layout=[
[sg.Text("Text Reverser by blabla_lab!")],
[sg.Text("Text:")],
[sg.Multiline("", size=(None, 10), key="-TEXT-")],
[sg.OK(), sg.Exit()]
]
# show window
window = sg.Window('Text reverser', layout)
#Events
while True:
event, values = window.read()
if event == sg.WIN_CLOSED or event == 'Exit':
break
elif event == "OK":
text = values["-TEXT-"]
print(text) # debug
text = text.split(" ")
print(text) # debug
text = text[::-1]
results_popup_window = sg.popup_ok(f"result:\n{' '.join(text)}\n\nclick ok to copy the result", ) # ' '.join(text) to join text in list with a space
pyperclip.copy(' '.join(text))
sg.popup_no_border
window.close()
I could export it as an SVG, it might be lighter I'd have to compare.
https://discourse.jupyter.org/t/clicking-a-notebook-should-pass-the-link-to-custom-js-instead-of-opening/11826?u=luciddhairya (question regarding jupyter notebooks)
When I click on a .ipynb notebook on the Jupyter dashboard, it opens the notebook in a new tab in the same browser. Instead, when I click on the notebook, I would like to get the link to the notebook in custom js and send it to cpp using a wink request, the cpp would then open the link in another browser. Sending the link to cpp is not a probl...
Hello
Hi
I'm switching to coveralls from codecov 👀
and ensured I set up my workflow so it wouldn't fail when coveralls is down lol
okay so i got a small poetry project thats going to be used by a non technical person
right now its being invoked through a powershell script, what would be the easiest way to distribute this
ideally i would rather avoid having to install poetry on their machine
should i bake the powershell bit into the python project and use pyinstaller or something like that?
Can you deploy it onto a server?
See im not sure what i can or cant do with it
We have a sharepoint site where we dump data files and "deploy" internal products like a tkinter app i work on and a bunch of macro books
I was thinking of just dumping it in there but the powershell script calls the python code through poetry atm
So i'd have to install poetry
Could someone help with this devops question:
https://devops.stackexchange.com/questions/15005/gitlab-run-ci-when-a-dependency-is-updated-on-pypi-or-on-its-master-branch
I don't think that's exactly possible
.
hey
i want to connect to this wss://streamer.cryptocompare.com/v2 in python
and it connects in postman
but when i write my code it says getaddrinfo failed
HOST = 'wss://streamer.cryptocompare.com/v2
socket_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket_client.connect((HOST, 80))
Can you guys help me to Scraping this web https://www.asahi.com/news/
this is definitely not something you want to use the raw socket API for, thats far too low-level to sanely deal with websockets. use a websocket library like https://github.com/websocket-client/websocket-client instead
what do their terms of service say regarding automated scraping?
most news websites are not happy with it. i can't read chinese / japanese though
Do we have any vim/gvim user in here?
map <F5> i{<Esc>:w}<Esc>
map <F6> i{<Esc>:!%:p}<Esc>
If so would these vimrc mappings work cause i cant make them work
I am trying to make f5 save and f6 run the code
ping me
Nvm i got my vim fully configured now :DDDD
https://www.asahi.com/ajw/help/policy.html suggests it should be fine @ionic trellis
Also make sure you follow https://www.asahi.com/robots.txt
Hello, I posted a question about celery in #help-bread id someone could help
Having a little trouble, trying to use pip in shell but it 'is not recognized as an internal or external command', I type in python but don't get the version back
python --version
python -m pip --version
optionally perhaps python3 instead of python, and pip3 instead of pip
"python was not found"
python3 --version ?
what's your operational system
python is not written into shell path then
"python was not found" windows 10, and I was pretty certain of that just didn't know how to fix it, although when I was typing my message earlier i couldn't remember the term shell path so I just left that part out
python was not added to PATH then
find where it is installed
and request
"C:\full_path_to_python3.exe" --version
global python is needed only to use the one and only command anyway, to create local python environments with venv
"path to python\python3.exe" -m venv venv
venv/bin/activate.bat
and u have local project python environment
if venv is not existing, make sure to install, pip3 install python3-venv
Thanks! I'll look that all over when I wake up.
Hello. What programming language is needed to develop a web-based website like discord? Also discord has its own "sort like" language for its bot.
do we need to use virtual env when using docker-compose?
In my opinion, not really. We are venved by container anyway
Web part:
Javascript/typescript for frontend
Anything u prefer for backend
Optionally
Anything u prefer for desktop application that can use popular open source web engines
Accidentally switched off a warning or more like a suggestion where PyCharm asks to change every variable inside a function to small letters
Any idea how to turn it back on? (Ping while replying, Thank you)
it's very important to distinguish between the concept of an "import package" (a module that contains other modules) and a "distribution package" (what you install with pip) - which one are you asking about?
a distribution package can contain several import packages, but each setup.py file can declare exactly 1 distribution package
thank you, that is a very useful distinction indeed. I mean distribution packages because I was expecting to see 2 lines on pip but maybe import packages are what I need. Do they need to share a namespace to live on the same setup.py?
no, import packages can be entirely arbitrary. for example, the setuptools distribution package includes the setuptools and pkg_resources import packages
however this is considered bad practice nowadays and is liable to confuse the hell out of users
if you want 2 separate entries on pypi.org, then you want 2 separate setup.py files
however, you can have two separate distribution packages that use the same namespace
look up "implicit namespace packages", you just have to change what you specify in setup.py
understood, I'll have a look at that thank you. I think my_distribution_package containing my_distribution_package.reusable_stuff and my_distribution_package.more_reusable_stuff is the way to go for me
e.g. you can do this
project1/
setup.py
src/
my_namespace/
pkg1/
__init__.py
a.py
b.py
project2/
setup.py
src/
my_namespace/
pkg2/
__init__.py
c.py
d.py
if you correctly set up setup.py in both cases, the user can pip install the two projects separately, and then import my_namespace.pkg1.a and my_namespace.pkg2.d
In some cases we are still forced to use venv in containers though
I just remembered that I had a situation
When image had an older pip package six installed
I was forced to use venv in order to solve conflict versioning issue
Is it weird to proxy_pass to a lambda in a reverse proxy?
do lambdas have static IPs?
I don't know actually.
There's just a static link to it
why does it matter?
well, if the IP address (or well, your reference to it) would change every now and then, then that would be a problem. But if you have a static link, I don't see anything wrong with it
The reference to a particular version is permanent, yeah
So this is my nginx setup:
- If the request matches
location /foo, redirect to my magic lambda - Otherwise, try to serve static content
does this make sense, somewhat?
I'm redirecting to a lambda because the VPS is really crappy XD
Yup, apart from the "magic lambda" part that's a common setup for sites that have static CSS etc.
TIL certbot automagically modifies your nginx configuration
yup yup yup
just doesnt play super nicely with things like ansible
but you can tell it not to
@vague silo oof, on my other domain certbot successfully created an infinite redirect in my nginx conf
because I already had a handcrafted redirect in there
for certbot?
hm?
like, did you already have a handcrafted redirect in there for certbot
I have a configuration file like this:
location ^~ /.well-known/acme-challenge/ {
root /var/www/_letsencrypt;
}
which is then included in the HTTP server (server 80) block for certbot
What's the .well-known thing? I've seen it somewhere
that's where lets encrypt requests the challenge files from
I have a repo on GitHub that has 2 apps in it, a consumer and a publisher. I deploy the two apps as a stack with 2 services on a Docker swarm via compose. Can I setup CI/CD in a way where if the commit changed consumer it will rebuild and redeploy that, but not publisher?
I have separate repos both both on the registry, but the Git is the same for the project it's not separated by app
It sounds possible, if you have some way of detecting if either changed, like checking specific subdirectories in a diff
The reason I'm asking is because it's pointless to rebuild & redeploy publisher if it's not getting modified, only the other one
Can GitHub actions do that?
They are in different directories
You should be able to create a diff between commit hashes, and compute something based on that, potentially in a step before the buidl that sets variables
And then make the build steps conditional on the result variables of that pre step
Not sure if that is the best way to do it, but it should work
What would be the ideal way? I don't want to use multiple GitHub repos because the repo is for the same project just different parts of it, but I also don't want to redeploy the entire project then only one part of it changes because that would be inefficient
Honestly, they sound like different apps to me; I'd probably have placed them in a different, dedicated repository as well
But, you could use the diff strategy to look at if something changed in a subdir, I guess
in general you can use git diff --name-status to get the list of files changed between two commits. no idea bout github actions
have a Pycharm/git question: Using pycharm I create a project and started working on it, went through the usual setup for a venv and such, then committed it to git using command line to push it to github (should have used the integrated approach, ohh well).
How do I add project settings/venv settings to the git repo? right now my python files, license, gitignore, readme, etc are all in git, but not my venv directory, nore any of the project settings, when opening it on another computer I have to go through trying to configure things to work (run configurations, etc), and no venv option shows up.
Is it a good idea to use Google's distroless images for containerizing application?
(https://github.com/GoogleContainerTools/distroless/tree/main/examples/python3)
Your venv should not be in git
The venv is built specifically for one system, so you can't really move or share it. Instead, you should save the list of packages (using poetry or just requirements.txt) that your project needs
is there any other advantage than less disk usage?
Honestly I don't know, It's just that I have heard a lot people say, "The smaller the image the better" (the reason to which I don't know)
Less stuff in container to be hacked but most likely, it makes sense for companies really deep into their container journey
so it's like alpine on caffeine?
How can I push an image to Docker Hub in a way that actually updates it on the repo?
PS C:\Users\Martin> docker push markomartin/test:latest
The push refers to repository [docker.io/markomartin/test]
b7e5d2286d77: Layer already exists
9053d005a9e4: Layer already exists
48a1228e9de5: Layer already exists
6f06b418d75b: Layer already exists
42ce61e841fa: Layer already exists
a9b125f164c3: Layer already exists
e24045f8c247: Layer already exists
b7b662b31e70: Layer already exists
6f5234c0aacd: Layer already exists
8a5844586fdb: Layer already exists
a4aba4e59b40: Layer already exists
5499f2905579: Layer already exists
a36ba9e322f7: Layer already exists
latest: digest: sha256:097e60c5940d3f0e4261e564b1c2af5d18b0ad19a9c635e8bd40acffedbc830b size: 3053
How can I update the image on the hub?
If the layer already exists, that means it is up to date from the last build
So if you have made changes, re-build the docker-image, then push the changes
I did, the image on the repo is outdated
Well... you can't of. Otherwise it would have updated
Can I see all the commands you are using
And how do you know it is out of date?
I'm just running the Dockerfile in PyCharm I'm not sure what command it runs exactly
My guess is you have mistyped something somewhere
Ah
I'm sorry but I can't be of much more help if you can't get my commands. I don't use PyCharm
I see the commends are not recent in the image on the hub when I inspect it
Is it a private repo?
Yes
Right. Again, can't really help you there either
Put the command you sent in suggests it is 100% up to date according to docker
But I pushed an update a few minutes ago
I don't think you have re-built the image
It doesn't count as an update unless docker sees there are changes, the command you sent in means docker disagrees
Let me try it manually with commands
So it'll show the time as the last time the build changed, which, according to docker, must've been 9 hrs ago
What should I run on the Dockerfile?
Let me see if I can see what PyCharm runs
I found it
docker build -t markomartin/test:latest .
Does that look correct?
And then docker push markomartin/test:latest
So then what am I doing wrong?
Can I see the output of both of those commands: can you change the Dockerfile to so that it does update?
Sure 1 sec
[+] Building 36.3s (10/10) FINISHED
=> [internal] load build definition from Dockerfile 0.2s
=> => transferring dockerfile: 304B 0.1s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/python:3.10 0.0s
=> [1/5] FROM docker.io/library/python:3.10 0.7s
=> [internal] load build context 0.3s
=> => transferring context: 26.94kB 0.0s
=> [2/5] COPY /api_scraper/api_scraper.py /api_scraper/api_scraper.py 0.1s
=> [3/5] COPY /collection_scraper/collection_scraper.py /collection_scraper/collection_scraper.py 0.1s
=> [4/5] COPY requirements.txt . 0.1s
=> [5/5] RUN pip install -r requirements.txt 32.0s
=> exporting to image 2.8s
=> => exporting layers 2.8s
=> => writing image sha256:bb79f774ca1fbcb70b2040b5cdcde32bd1bb80c81f4f59611e00023486822d67 0.0s
=> => naming to docker.io/markomartin/nft-scraper:latest 0.0s
The push refers to repository [docker.io/markomartin/nft-scraper]
aa1bde3a80a0: Pushed
9053d005a9e4: Layer already exists
c2d42bf2a6fb: Pushed
c8a06d87a25e: Pushed
42ce61e841fa: Layer already exists
a9b125f164c3: Layer already exists
e24045f8c247: Layer already exists
b7b662b31e70: Layer already exists
6f5234c0aacd: Layer already exists
8a5844586fdb: Layer already exists
a4aba4e59b40: Layer already exists
5499f2905579: Layer already exists
a36ba9e322f7: Layer already exists
latest: digest: sha256:a437841600a4aaa054904f8ab052c877f3683931f2f9cfbd147e00c351328485 size: 3053
Still 9 hours ago and the commands in the image layers are not updated
Well, now I think its something to do with private dockerhub limits?
How the hell am I supposed to do it then?
It's a closed project for a client not public
Yeah I tried with the actual one I want to push not the test one
Neither works
COPY file:a29aecd233088a0cfdbcc34d9422c3fd7abf8446e5039943a115ce7df132e9a8 in /collection_scraper
I don't have that in my Dockerfile anymore
Sure let me make an example
In my Dockerfile:
ENV PYTHONUNBUFFERED False
Not sure what else to show
Local image:
So I am in indeed rebuilding it
And then pushing it to the repo which succeeds and says "pushed"
But it does nothing
is docker.io the right place?
I don't think it is...
hub.docker.com is what I would say it should be?
Well how would have I been able to push it then?
I am not sure tho
I just deleted the repo and pushed again, it worked like that
But updating the image does absolutely nothing
Or does it just take forever for whatever reason?
Neither do I but it most certainly not updating lol
And I don't trust Pycharm
I pushed manually, it had the same output
Most layers didn't get pushed (makes sense cause I only changed the Dockerfile)
Local image is fine, remote one isn't
Last pushed: a few seconds ago
Wait what
I did it like 10 minutes ago
It just updated
generally the pull command should fetch the latest image for certain, but the site might take a few mins
Ohh
That makes sense
I didn't try to pull was just waiting for it to update on the dashboard
It would've updated in the 10mins me and him were talking tho joe?
Thank Joe
Ah sorry didn't read up high enough
Thanks both in fact
Yeah I just tested it, when I push and pull it uses the fresh image instantly, but the site does take a bit to update and gives a false "last pushed" date (as in not accurate to the minute) - makes sense just confusing
In fact the "pushed" date makes no sense, it is jumping between 10 minutes, 45 minutes and 1 hour with every refresh
I broke their site I guess
I'm not attached to Docker Hub just thought that's what you are supposed to use
maybe a year or two ago, gone very downhill lately
I want to setup automatic build & deployment when I push to the Git
Can I do that with GHCR?
implemented some quite harsh ratelimits on how much you can pull images
yep
GHCR is just docker hub but provided by GitHub instead
you have ghcr.io/<gh-user>/<package>
Thanks for the recommendation, was just about to pay for an annual docker hub but I already hated it lol
I'll look into it, thanks!
I use portainer to manage the Docker swarm, do I just add that as a custom repo and nothing much really changes?
Let me try and see
yea
Out of interest why not just self host?
self-host a container registry?
a) bandwidth costs b) integrations with github c) what benefit does it actually give us? we pay more for minimal benefit
there are many more reasons not to self-host than to self-host
it's not something where you get a benefit from self-hosting, you're just paying for more storage to host your images
Yeah. I'd say a major reason for you guys is downtime. You don't want your docker repo to go down
Yeah cheers :)
on top of that ghcr is globally replicated, free, integrated with github permissions, works out of the box with github actions, a whole load of reasons why it's more suitable for any developer, not just organisations
Yeah for your usecase it makes a lot of sense. Was just curious to get someone else's thoughts
Thanks
I'm in the middle of getting familiar with GHCR and loving it so far
I'm just stepping into CI/CD but this tech is amazing
awesome 😄
First time using GitHub Actions also, it's insane how much GitHub gives us... for free
created this small tool to delete the file/directory if it is create by this tool. I am looking for advise on how to kill the daemon process after it finishes its task of deleting the file
https://github.com/Agent-Hellboy/dswell
os.exit?
os._exit is best 
😀
Looks like I have to reconsider the design or maybe move on with other things. 😜
is there a standalone library for working with / generating ninja build files?
i see some build tools written in python that use ninja as a backend, but i don't see any standalone library for that purpose (as opposed to a "tool")
https://github.com/ninja-build/ninja/blob/master/misc/ninja_syntax.py
https://pypi.org/project/ninja_syntax/
this seems to be an official interface
Hi...I have a task in my work.. we have a application mobil built with react native and flask as backend... Currently the application mobile is authenticating with Aws cognito service from backend. But my team determinated that this implementation is wrong. They want use AWS lambda like microservice that it can authenticate the user with diferentes providers of authentication such auth0 or cognito. They want have this flexibility when will be necessary. Finally the team too want social login. I have investigated other service such AWS ALB and AWS Api gateway these are others alternatives. I want read us about your opinions. how would you solve this problem? what are your tips?
Is there a way to make virtual environments that automatically install certain libraries, or should I just make a bash script for that?
uhhhh brb
I want to always update pip setuptools wheel and the install numpy, pandas, sklearn, and ipython.
no, not that i can tell
however virtualenv installed setuptools and wheel, but doesn't update them iirc
i've made a special requirements.txt in my home dir which has all of the packages, so i just invoke pip around that
How can I send a POST request within a GitHub Actions workflow? I need to call a webhook. Is there a built-in function for making a request or do I have to rely on a third-party marketplace solution like this one? https://github.com/marketplace/actions/http-request-action
nothing in-built, though you've probably got curl in the default runner images
Just solved it, I've went with this for now:
- name: Call Portainer webhook
uses: fjogeleit/http-request-action@v1.8.1
with:
url: http://1.2.3.4:9000/api/stacks/webhooks/abc123
timeout: 10000
There are probably better ways but it works so
out of curiosity, what's a tool on windows that can do it?
cURL
Install it
how would you do that on windows runner?
Oh I thought you meant locally, my bad
lol got a 502 from google trying to find an answer, that's new
I know we use curl somewhere in one of our windows runners
smh its pydis server so i presume that's what you mean when you say 'we' here smh
Same lol
we might have used this https://github.com/wei/curl
probably
What doee 502 mean tho?
502 is the HTTP error code for Bad Gateway
when you make a request to a service like Google, you actually pass through a lot of servers that make other HTTP requests down the line, then once a response is created it's pushed back to you as the client
when one of those servers fails, a 502 is emitted, because the "gateway" to the application has failed
Anyone got a good reference for writing python dockerfiles? I get the feeling i should be using multistage builds
I want to learn how message queues work. What would be a good pet project for that?
typical use case is sending emails
our organization has our own pre-built base image that we host on google container registry, with python 3.8 and some other stuff installed
but a multi-stage build for python itself seems worthwhile
mainly for the size
im down to 3 gb
not sure what else to do though 😦
after playing with golang static binary + alpine 15 mb containters this is torture
FROM continuumio/miniconda3 AS build
ARG ENV_FILE=dev-env.yml
ARG ENV_NAME=devenv
COPY ${ENV_FILE} .
RUN conda env create -f ${ENV_FILE}
RUN conda install -c conda-forge conda-pack
RUN conda-pack -n ${ENV_NAME} -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
RUN /venv/bin/conda-unpack
#----------------------------------
FROM debian:buster AS runtime
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
WORKDIR /app
RUN apt-get update && apt-get -yq upgrade && apt-get install -yq --no-install-recommends libgl1-mesa-glx && rm -rf /var/lib/apt/lists/*
COPY --from=build /venv /app/venv
CMD TODO```
conda envs tend to be on the big side
yeah doesnt help that the dev pulls in giant libraries for just one function call
grrrrr
i don't think you should use it unless you need it
there's no reason to use it if you're going to use venv anyway
we have some c deps that arent on pypi
that are in conda-forge? interesting
maybe old news
or are you using your own anaconda repo?
might of been a version conflict or seomthing
no just things like pypi doesnt have numpy with mkl
defaults to openblas
no idea i figured it would cache more nicely
those machine learning libraries tend to just be big
if you're pulling in pandas and tensorflow and stuff yeah you're looking at 1-2 gb
good to know, wont spend too much time on it
that actually was an issue on my laptop at work in a past job, it was getting full from too many conda envs with those packages in it
yeah were using self-hosted github actions runners, they don't run in a container so you have to clean it up yourself (which is why im writing this docker file). I had a cron job to clean up the stuff everynow and then but of course it wasn't enough and the disk got filled
hopefully itll go more smoothly with the containersnow...
Thanks for the advice
FROM ubuntu:20.04
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y linux-perf
...
throws me the error #6 0.596 E: Unable to locate package linux-perf. Googling tells me I should update upgrade apt but that's what I'm doing already
not sure that package exists
what command are you trying to get
if its the perf command
i mean ubuntu has it too the package is jsut named differently
apt-get install linux-tools-$(uname -r) linux-tools-generic -y this didn't work
Debian worked though
kk
thanks for the help!
every tool's a hammer
How to use GitHub actions or when I push the code to master branch it should be get automatically update to my nginx web server(on my instance) django
is there any tool out there to help me audit my packages for reported/known vulnerabilities/security concerns?
or do i just update to most recent version and hope for the best
first result i found is snyk.io but i dont really see an API/package for it and i'd rather do these things programmatically
can someone explain to me what validation testing and unexpected failure testing is
version: "3.7"
services:
postgres:
image: postgres
environment:
POSTGRES_USER: test
POSTGRES_PASSWORD: test123
POSTGRES_DB: idmaker
PGDATA: /data/postgres
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
- ./postgres-data:/data/postgres
ports:
- "5432:5432"
restart: unless-stopped
seems like the docker user doesnt have permissions to write that dir
running the command with sudo has no effect on the user
change the write permissions of that directory you mount
already did
nothing change
i want all the data in my local dir
so incase of any problem i can have everything in my drive
yes, snyk
oh, there's a free tier, at least for github projects
but yeah, they have an agenda
Docker compose question - I've got a service that goes like this
services:
price_bot:
image: ghcr.io/martin-marko/scraper:master
volumes:
- price_bot:/price_bot/logs
working_dir: /price_bot
command: ["python", "price_bot.py"]
deploy:
mode: replicated
placement:
constraints:
- node.labels.price_bot==true
<< : *deploy
<< : *default
logging: *logging
secrets: *secrets
environment: *environment
volumes:
price_bot:
price_bot.py creates its log files at /logs so /logs/price_bot.log etc., but in the container the logs are in the root directory of the volume so at /var/lib/docker/volumes/scraper_price_bot/_data. What am I doing wrong and how should I mount the volume so it mounts the entire directory not just the logs in the directory?