#tools-and-devops
1 messages ยท Page 60 of 1
That won't work because the history after the reset commit still exists and is still shared
so the only way is to sort through these changes
the problem is that there are so many, literally it was a branch dedicated to refactoring
that got pulled into the test branch prematurely
and i accidentally commited over with this pulled version
my master branch is up to date
so id like to just replace the current test branch, with the content of the master branch
ive done so locally
by deleting the test branch
and pulling from the remote master branch, after recreating test
But the test branch is also a shared branch, right?
So you can't just delete it if others are using it
this is what happens when I use git push --all in the pycharm terminal```py
To https://github.com/ChiliPy/fuck-me.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/ChiliPy/fuck-me.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
the last line
And you can't do that as well because the other commit history after that commit is shared
You can use something like git cherry-pick instead
If you cherry pick a commit
It should recreate any commit you specify but at the tip of the branch
Which is what I think you want. You want to basically undo all the changes in the branch, but you need to do so in a way that doesn't fuck up existing shared history
I think cherry-pick would do it
its only 1 commit ahead
Yeah but that doesn't matter
If it's shared history you need to keep it
Otherwise you'll cause issues for the next person who wants to commit on top
If you cherry pick your original commit, that should do it
ok
Learn about git cherry-pick, including usage, benefits, and examples using the cherry pick command.
The --no-commit option will execute the cherry pick but instead of making a new commit it will move the contents of the target commit into the working directory of the current branch.
i guess i do have to commit though
Yeah, you can use that option if you are unsure of the final result
But obviously you will have to commit it eventually
\
e - f - g Feature```
the problem in the example
is not equivalent
\
e - f - g Feature```
So you don't have to cherry pick from another branch
You can cherry pick any commit, I believe
Yes I believe so
but wouldnt the ideal solution be to get rid of g
No lol
There is a golden rule of Git
One that you must never break if you are working with others
Never change shared commits!
If commit g was only on your machine, it would be no problem
You could git reset to e and get on with your life
but that only matters if anyones pulled
But if commit g is shared, it must stay there
Well eventually someone will want to commit on top of the branch no?
but cherry picking messes up the history anyway?
but how, in this situation im literally pulling an old commit ahead of a new one
i see
Lol sure
Ok
I would suggest reset to the tip of the branch first
And then do the cherry pick
how
git reset sha for the tip?
I think you can reset to HEAD
I think lol
If you do git log
Is HEAD pointing to the tip of the branch?
Heck, even if it isn't, you can just reset to the tip of the branch using the SHA
uhh
The idea is that you want to be equivalent to the GitHub state of the branch
doing git log
Actually scratch what I said
You want to git reset to the last commit from GitHub
For your branch
ok
done
went onto the test branch on my github
found the commit from that branch that i want to go back to
copied the sha
git reset sha
Yeah, that should bring you to the tip of the test branch from GitHub
And then you can cherry-pick the commit and place it on top
You are currently cherry-picking commit 057b4df.
nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
Otherwise, please use 'git cherry-pick --skip'
uhh
i looked at the commit i want to move to
i copied the sha
i did git reset sha
oh you don't want to reset to the commit you want to move to
if you have e f g
and you want to go to e f g f'
Then you reset to g and then cherry pick f
ohh
Btw did you say it was just one commit behind?
so
lets say
a b and c
im at c
my commit that i want to be the new tip of my code
is a
right
so if you are already at c you don't need to do any reset
and then you just cherry pick a
to create a b c a'
Btw, how many people are working on the test branch?
so, if you wanted to make it so that master and test were the exact same commit object
then you could do git reset a and then force push it
However everyone would have to delete their test branch and recreate it
because you rewrote shared history
so that is an option if you communicate that to people who are working on test
lets stick to one thing
lol ok
error: could not apply 057b4df... working on db issues
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
seems some merge conflicts
i resovled them
but its talking about a path
it means just git add the filename im assuming
yeah
yeah but like..
this version that im on
the tip
it still has all the code and stuff that im not trying to commit
What code? The code on top of the cherry pick?
i have a b c
i reset to c
c has code i dont want
i cherry pick a
fix merge conflicts
but now there's still the content from c
are you talking about stuff you didn't commit previously?
wait what do you mean
use the symbols a b c
so i know what you mean
so, if you are at c, you may have also started developing on top of c
no
its not uncommitted changes
i reset to c
that means i have the code that exists at c
Not quite
because by default a git reset does not wipe away all uncommitted changes
you can have soft, mixed and hard git reset
by default, git reset is mixed, which means that all staged changes are unstaged
but they aren't completely removed
they still exist in an unstaged state
i see
if you really want to get rid of those changes, you can do this
First do a git stash to save a snapshot in case you screw things up
then, you git reset --hard to c
That will reset to c and remove all changes, even those ones that were unstaged previously
then you can cherry pick again
if you commit the cherry pick, then you could reapply your unstaged changes by doing git stash apply
if you wanted to
ok so
i did a hard reset
to the tip
then tried to cherry pick
and ok fixed the merge conflict
but what i was saying, and trying to explain
is
since i am on c
the garbage commit
i still have the code from c
even if i fix the merge conflicts
literally the code im looking at in my ide, is that of c
which is not what i want to add
so how are you fixing the merge conflicts? When you have a merge conflict you basically want to take the a version completely
you don't want to keep anything from c
yes
but i only have merge conflicts in one .py file
my models
the system is flagging only a merge issue on a
it does not
hmm, not sure how that's happened then
This is literally what cherry pick is meant to do, recreate the contents of a
9ts ok appreciate the time
Hi everyone, I have a question which I think falls under tools-and-devops : after uninstalling poetry, does this mean that all the dependencies from the apps/venvs made using poetry also got deleted? or do i now have to hunt around for them? i think i pulled the trigger too soon ^^;
it does say here https://stackoverflow.com/questions/50267732/what-will-happen-to-packages-installed-when-the-virtual-environment-is-deleted that YES they do get deleted, but this is my first time with poetry. i have previously used virtualenv and virtualenvwrapper ๐
||url = 'https://accounts.spotify.com/login/password'
PostAtma = {"username": data[0]
"password": data[1]}||
"password": data[1]}
^
SyntaxError: invalid syntax``` how can i fix it?
Use comma , like {"username": data[0], "password": data[1]}
ty
url = 'https://accounts.spotify.com/login/password'
PostAtma = {"username": data[0],
"password": data[1]}```
Traceback (most recent call last):
File "/storage/emulated/0/Download/spotify-checker/spotify.py", line 36, in <module>
"password": data[1]}
IndexError: list index out of range
Heyo, was trying to poetry add more-itertools and got this error - https://mystb.in/FirewallHolyGonna.sql
What is going on?
hello when every i open my python file it just closes rightaway
that means your getting an error
your python file is a txt file...?
You are not allowed to use that command here. Please use the #bot-commands channel instead.
@heavy knot um just rename it?
and if you double-click from file explorer or whatever
the window is going to close when the program ends
so instead run it from command prompt/powershell
hey folks, is there a way or a tool to inspect what's occupying memory at any point in time? I can use trace malloc to identify what's allocated during a certain period of time, but I expect much of that to be garbage collected after the work is done. Ideally I could find a tool that let's me snapshot exactly what's taking up memory at one point in time so that I can verify that I'm not hanging onto stuff that should have been GC'd
Are you facing a memory leak? That is, is your process continuing to grow?
appears to be yea
it looks like I'm probably not dropping some references that I should be dropping
but I'm not sure how to track them down
@vital epoch what does your program do?
generally coordinates a few independent processes via socket communication and sends some REST request up to the cloud
leans very much on asyncio
I'm wondering if maybe, when I asyncio.create_task if I need to be explicit about how and when to clean that task up
is there a way more generally to just see where I'm holding references?
interesting, when I use python's gc module to print stats, I often see this: gc: done, 460 unreachable, 0 uncollectable, 0.0596s elapsed
very curious to see exactly what is unreachable
I have a Github action that connects to a database. I don't want the DB information to be public.
For my dev and prod environments, I use env variables and would like to be able to do that on a github action as well.
I have set up an environment in github, lets call it myenv. How do I tell my github actions worker to select that env for the action?
postgres:
image: postgres:13
env:
POSTGRES_USER: ???
POSTGRES_PASSWORD: ???
POSTGRES_DB: ???
what do I have to enter here?
Does this also allow for os.getenv or are there more steps to take?
'NAME': os.getenv('DATABASE_NAME'),
'USER': os.getenv('DATABASE_USER'),
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
Full github action code: https://paste.pythondiscord.com/ewuwiraquw.yaml
@frozen anchor you can create secrets in your repo, and use them in actioins
How can I get the all time downloads of a pip package?
I have been using https://pypistats.org/ but it is not enough
PyPI Download Stats
I was already that far. Question is - how do i access them? How does actions know which of the X environments to pick? I found nothing about that in 4 different docs
i guess you'll need differently named secrets for each environment? How many wilil your action be using?
for now the 3 env variables for the DB but once I implement more test cases that number will increase.
Different names for each env sounds off tho - lets say I have 2 github actions workflows that need the same env variables named differently - for example access to the DB with different permissions - that would not be possible. I doubt that this is the case tbh
why would more test cases need more environemnt variables?
for example to check if the email validation for a newly created account works
Generally, the db credentials don't change for each new user of the application
found it tho, it is the environment keyword, overlooked that I guess
not talking about DB here, my dev and prod env have EMAIL_NOREPLY_USERNAME and EMAIL_NOREPLY_PASSWORD that are used to send emails from noreply@mywebsite.com
i guess i don;t understand what your X different environments are.
or why your REPLY_USERNAME needs to be a secret for your tests
you can set environment variables in your tests, not in actions
well, it does not have to be secret for those - but as the project is public I prefer to not give away that much information of how my backend looks like
is your code public?
yes, hosted on github
what information are you trying to not give away?
if your code is public, why do you need any secrets for the tests?
using env variables for the tests is perhaps overkill, you are right about that
but I don't want to make another conditional in settings.py.
I want to have it managed via env variables in all cases like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('DATABASE_NAME'),
'USER': os.getenv('DATABASE_USER'),
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
and not
if DJANGO_HOST == 'github_action'
....
'NAME' = 'postgres'
ok, so you will have a half dozen variables.
I have these variables for dev and prod either way, so I don't think it matters that much if I use env vars for actions as well.
right, it's fine to have some secrets for actions, but you were talking about needing more and more as you added tests. i dont see that happening.
also, btw, a db password for tests? what db are you connecting to?
it's very common to have a tests settings file
no, I create a new DB, run migrations and then run my tests. This was just an example of why you might want secrets for actions.
i see
So, you are right and I should not use secret env variables. Instead I went for
env:
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_NAME: github_actions
hi, i have a data engineering question. i am storing and updating many pandas dataframes
hdf5 looks ideal, but im concerned with corruption
is something like storing each dataframe as a sql blob a more reasonable strategy?
Hello, I'm looking for someone who knows a lot about the selenium python's tool and especially about loading DRM-protected content in headless mode
gonna sleep asap feel free to dm or ping me btw
what are you testing?
@rugged hare some browser automation stuff, i used to test my program in "classic" selenium mod because i thought that headless mode was working the same, but apparently headless mode doesn't have feature that classical one have that's why i want to learn more about how to make things like protected contents works
Guys, is there an open source for http://pythontutor.com/visualize.html#mode=edit ? I can't find it. Woo-hoo.
someone got tips for pycharm
Just call python setup.py install
i figured this out, somehow run pip install .
did not install requirements that i specified in setup
Can you show your setup.py and setup.cfg?
from setuptools import setup, find_packages
def read_req():
with open("requirements.txt") as req:
content = req.read()
requirements = content.split("\n")
setup(
name="task",
version="0.1",
packages=find_packages(),
include_package_data=True,
install_requires=read_req(),
entry_points="""
[console_scripts]
task=task.cli:cli
""",
)
Your read_req doesn't return anything
Your welcome!
hey does anyone know the best coding software to use
I like PyCharm, many other use VS Code for example
Hey folks! Just a note that we've added a channel for editors and IDE discussion! #editors-ides
Hi guys , i'm trying to deploy an app to apache2 with mod_wsgi but i'm getting an ImportError , and I don't know why ? May I get some help?
And tha'ts the apache conf
Hey all, got a question about paring down a requirements.txt file automatically but my reddit post got automodded: https://www.reddit.com/r/Python/comments/lpftn3/paring_down_pip_requirements/
What are your opinions on pipenv vs poetry?
for whatever reason pipenv seems to error out for me with an odd error (says path not found pointing at an old install of python that I've since deleted), and have been using poetry only
Am I missing out on anything great that pipenv offers that poetry doesn't?
I tried poetry in one project and I liked it. The only thing I'd love to see is to handle run as npm/yarn does so we can be able to simply run regular cli commands through poetry
๐ค
I've liked poetry so far too fwiw, just wanna know if I should be using pipenv for some cases or if they're comparable on all fronts
Hello, I would like to ask something if what I'm doing is correct, this is basically a like a insert and get items list with redis caching
POST item in the list
-get the data
-insert in database
-insert in redis cache (with key of user_id_items_list)
GET all items list
-check if user_id_items_list exists
-if it exists, returns the cache value
-else, do query
-save the result of list in the redis cache with key of user_id_items_list
Hi, is there an extension in vscode that automatically generates getter and setter methods?
Ah it's still there for me sorry
Basically I'm trying to automatically prune my requirements.txt down to just the immediate dependencies of the app
I don't want to list all of their dependencies as well
So for example, I want to list flask but not werkzeug
But this is an old project I inherited with a lot of deps so I'm wondering if there's a way to automate it
A good Calculator
Program make a simple calculator
This function adds two numbers
def add(x, y):
return x + y
This function subtracts two numbers
def subtract(x, y):
return x - y
This function multiplies two numbers
def multiply(x, y):
return x * y
This function divides two numbers
def divide(x, y):
return x / y
print("Select operation.")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
while True:
# Take input from the user
choice = input("Enter choice(1/2/3/4): ")
# Check if choice is one of the four options
if choice in ('1', '2', '3', '4'):
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
if choice == '1':
print(num1, "+", num2, "=", add(num1, num2))
elif choice == '2':
print(num1, "-", num2, "=", subtract(num1, num2))
elif choice == '3':
print(num1, "*", num2, "=", multiply(num1, num2))
elif choice == '4':
print(num1, "/", num2, "=", divide(num1, num2))
break
else:
print("Invalid Input")
Umm is this the channel for that?
This is for python related tooling and devops style tasks so no
this is python, not java โข๏ธ
if you're writting getters/setters for ordinary attrs, you're doing something wrong
ah yep it gets shown for you i think, no worries
and for your actual question, i've often wondered about this
never found a good way other than just starting with a fresh venv and installing everything again
doesn't seem to be a way to tell pip freeze to do that
yeah I guess I could iterate over the requirements and see which ones are listed as deps of others
@ember canopy hm checkout pipdeptree
np
Hey all. To learn Python i'm working down a list of 50 project idea's. I was planning on using GitHub to store them and keep track of everything. Is there an easy way to organise my learning projects, i.e, folder directories, or should I just prefix my repo's with python-learning or something?
I recommend to split your work into multiple repositories. When you are going to find a job then you can select few of them and send as attachements. If someone is going to be interested then is able to check all of them. When you have all in single repo then you have fewer repos but you should write some guideline what your repo contains because directories like game-2d or example-gui-calculator don't have enough information like used technologies.
So bundling all my little learning projects into one repo isnโt an issue aslong as I am descriptive? Iโm not planning on sending any of this off with job applications, Iโm just learning to be more productive in my current job as a server admin
Single repo has this advantage that you have all your learning stuff in one place so I think that it's not the problem in this case
However being descriptive is also good for you because after some time you can easily find interesting part of code even if you don't remember directory name
Very helpful. Thanks mate
Your welcome
aha, lol. Thanks for that, completely forgot, Java is my first language.๐ฉ
hey, i need some help. I have something to do in turtle, you can call it the sun. it consists of 120 elements and must be in a square. I can make this so-called sun, but I don't know how to make this 'trace' from the right side of the square. can someone help me?
Is this where we discuss about sphinx?
I guess yes
It looks like I did not get help on #help-avocado
I have an issue regarding the creation of documentation using sphinx. Sphinx runs fine on my local machine and generates API documentation using autosummary, but not on docker (Gitlab CI). It throws a warning saying failed to import (and no autosummary API documentation appears). Here is my project: https://gitlab.com/rebornos-team/fenix/libraries/analyzing. Since the documentation is generated fine on my computer, I think it may be a problem with Gitlab's package versions. I am not sure
I run a similar thing (with the same Gitlab script) on a different project: https://gitlab.com/rebornos-team/fenix/fenix-installer and for that project, there are no issues on Docker while generating documentation
On Gitlab CI/Docker:
On my local machine:
In order to help me troubleshoot, you can clone the project locally and try the documentation generation yourself (I even have a script there in the documentation directory). This is open source
Have you tried to run it inside Docker container manually?
That is a good idea. Let me set it up
You can run Docker container in interactive mode and see which components are missing
I just realized I have no idea how to set it up. I downloaded Docker and I pulled the Python image
docker run --name mycontainer -it python:3.9-alpine bash
Add something like -v $PWD:/code to create volume from current directory
Thanks. I will run it. I have never used Docker by myself. Always through Gitlab CI
I am always testing locally before I push changes to CI
$ docker run --name FenixTest -it python:3.9-alpine bash
Unable to find image 'python:3.9-alpine' locally
3.9-alpine: Pulling from library/python
ba3557a56b15: Pull complete
ffd49e023448: Pull complete
46ec0d464620: Pull complete
44e992cdfdac: Pull complete
7c71687af071: Pull complete
Digest: sha256:95217fdd1431fe6230e033513670673c81a50debdb0065e54cbda261f3d76528
Status: Downloaded newer image for python:3.9-alpine
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "bash": executable file not found in $PATH: unknown.
ERRO[0010] error waiting for container: context canceled
Lol. I have bash. I am on Arch Linux
There are no bash inside container
Ah..
Too late. The container is running. Can I still enter a shell?
-it is shorthand from --tty and --interactive
Kill it docker container kill FenixTest
It is apparently not running. It has to be removed
You can check status with docker container ps --all
It says created.
Try docker run --name FenixTest -it python:3.9-alpine sh
$ docker run --name FenixTest -it python:3.9-alpine sh
docker: Error response from daemon: Conflict. The container name "/FenixTest" is already in use by container "cc9dbb7fcf2f3c142eecef8ab50e072cae47a824de096b1e9b951129c2647a27". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
Nevermind. Removed and restarting
Will test. The container is up. Thanks @night quest ๐
It's not the end of this story!
Have you attached volume?
I did not. I downloaded my project from git and ran everything in the CI script.
Same issue as in Gitlab. I am testing it on a virtual machine now
You can use -v $PWD:/mycode to mount your currect directory to /mycode directory inside Docker container
Ah...How can I mount another directory?
-v /path/to/my/dir:/my-dir-inside-container
Good idea. That way I will know if it is the environment or the files that are at fault
I am not sure but is the project in your working path?
I do not know what a working path is, but I don't think so
If your project is in /path/to/my/project and you have fenix_library/analyzing here it can cause error when you try to generate docs from /path directory 
I changed to the project directory and used PWD
So I generated the web pages for documentation. I need to test them. How can I get those files back on my host system?
From mounted directory?
Yes
It's already in
Oh
When you mount directory to Docker container you can easily interact with them from host or container
There are docker cp command too
Thanks. It seems like the problem only happens in that docker image. Even if I use the same project directory on my computer
I will have to see if there is an unstated dependency that I have installed on my local machine that docker image won't have
So. The problem is solved. There were two things: (1) pipenv,was not installing all the dependencies (especially the ones that are needed to check imports) from the lockfile because the lockfile was outdated. (2) The public folder in Gitlab CI was not empty and some files would not be updated
Thanks @night quest !
Nice!
Well done
Thanks for all your help ๐
Your welcome!
I can install a private repo from Gitlab with pip install -e git+https://gitlab.com/user/project#egg=project. I've heard that with using tags, I can get a specific version. Is it possible without tokens, like this? git+https://${GITLAB_TOKEN_USER}:${GITLAB_TOKEN}@gitlab.com/user/project.git@{version}, but without token just like I did before?
!paste
why is it telling me "position" is not accessed?
can you share the exact error?
can you also include the line numbers in the screnshot?
@toxic bough Do you happen to use mac?
Linux or Windows?
Ok cool so a similar platform at least, usually the tools work mostly the same between linux and mac
Are there any other tools you use on linux you suggest I look into?
Anyone familiar with Step Functions and choice conditions? Need to validate something real quick.
Is this the correct way to satisfy 2 conditions using the And operator?
"check-job-complete": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.training_job.status",
"StringEquals": "Failed",
"Next": "training-job-failed"
},
{
"Variable": "$.training_job.status",
"StringEquals": "Completed",
},
"AND:"
{
{
"Variable": "$.training_job.model_name",
"StringEquals": "web-annotation-extractor-${environment}",
},
"Next": "training-job-completed"
pipenv
for managing dependencies and virtual environments
I am a bit confused with all these similar sounding tools ๐คฏ
So pyenv is for managing my python installs and pipenv is for managing libraries and virtual environments? So pipenv replaces virtualenv?
yeah, iirc pipenv uses virtualenv
you need not worry about these tools as a beginner tbh
these tools will probably be overkill for learning basic syntax of the language
you can use pyenv to change the global python and not bother with pipenv until you start a project
ok frogive me here, first time using heroku and flask at a much more advanced level
here is my directory
and in my procfile i have ```bash
web: gunicorn decaturSite.api:api
but heroku dumps errors, give me a sec
idk what im doing wrong.... ive been trying different combinations with no luck :((
nvm
is there a library that can recognizee screen colors?
i think he's doing a series on like open csv or something rn
that can do image recognition
Is PyDatalog still being maintained now...?
Check their github for commit activity?
How I can run my github repo in heroku?
You'll have to link your github and select the repo
assuming it has all the necessary files you should be good to deploy
@smoky fog
Cool
I need anything else?
read the docs
My thing doesnโt clone tho
@frigid light
I did got clone and the link
But it doesnโt clone
โgitโ is mot recognized as an internal or external command, operable or batch file.
Do you have git installed on your pc?
I have git setup idk lol
Ah idk how to fix :/
Well, you can always learn
Yeah, maybe this might help
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
It aint even letting me uninstall github to install again and add to path @frigid light
Are you trying to create a folder with space in it's name?
then put that in quotes : cd "new folder"
next time an error comes up try googling it
Ok
I thought heroku login was a command
git add . command says fatal: not a git repository
@frigid light another gir process seems to be running in this repository............ remove the file manually to continue
Yeah I saw something crash
I hope this is the correct channel, if not I am sorry and would appreciate it very much if you could point me to the correct one.
My Question:
Does anyone have a link to some good documentation or tutorial, regarding packaging EXTRAS? How to structure the project, where to put the extras, how to declare them. Generally how to create a package, that has extras.
I can't seem to find really find anything that explains it from the ground up. I found a lot of info, how to declare extra dependencies and how to install packages with extras, but sadly not much else and I want to check if I am just bad at searching ๐ .
How to setup a git config file and remote urls for multiple github accounts / repos.
I have a seperate account for work and personal github. Tried setting up a config like
# githubPersonal
Host personal
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_personal
# githubWork
Host work
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_work```
and an remote origin `git@work:companyname/repository.git`
However it ended up creating a new branch on a repo for my github user, on a random project.
My GitHub remote is git@github.com:nickname/repository.git so maybe try companyname/companyproject.git?
If you're referring to the .git part, is just forgot to add that to the message. My bad
I am referring to nickname/repository, I never used nickname/branch 
Oh yeah, I am using repository, not branch. Just brainfarted
For some reason set my remote url to my own repo.. changed it, let's see how that goes
It's trying to push to git push origin branch:branch ๐ค
manually writing git push origin branch will work, so i guess it's a vs code issue now
~/.ssh/.config:
Host github
User git
HostName github.com
IdentityFile ~/.ssh/keys/github_rsa
$ git remote -v
gh github:nickname/project.git (fetch)
gh github:nickname/project.git (push)
Works perfect
git fetch gh
any idea to login google account using .chrome() selenium?
i've try cookie method but it doesnt work for me
Do check this out and provide feedback. https://github.com/Agent-Hellboy/Adorn
Thx, their up-to-date commit seems to be in 2017
I am looking for a way to publish my project to github. As the project is a command line tool (with the possibility of future gui) I was wandering should I distribute it with PyPi or require users to cone and run? Another question is how exactly should I figure out all of the dependencies for requirements .txt if I go with the latter?
anyone here aware of a json pretty printer that allows to compact display certain objects (im trying to get diff friendly but compact serializations of openapi specs)
I think clone n run will be good here. And you can create a virtual environment then install the dependencies in that environment and then freeze the dependencies using pip freeze > requirements.txt
@inner pollen wow thanks a lot!!!
@fickle finch it tends to be a good sport to publish via pypi if its a command so people can install in their own environments, if it turns out to be a gui, publishing as installable/startable artifact as well
One note, one main audience will be of no technical knowledge so i want it to be the easiest way for them possible
whats the use-case the tool gaters towards?
Basically I combine 2 existing tools to help language learners work with local media files in order to extract audio and sentences
And send them to the other learning program
then its important to know about the tools/systems of the target audience, linux/windows, cli savy or not
I thinks it shouldn't be a problem as long as python3 is installed
I used path lib so I think I am covered
Apaer from that ther should be no issues
so if a recent python 3 + pip is the only requirement, then having something that can be pip installed easily might be nice
I see
Yea
They would also need git if I go with github
As the only option I mean
if you know for sure that most of the users use something like windows, or a specific linux distro, it may also be a good idea to package for that in addition
Thats is something I am conflicted about
Almost all windows users use windows 10
They can get wsl running in 10 minutes as long as they know how to use a mouse
And it would take me a lot of time to figure and maintain the packaging thing
in that case having a pip package + a wsl howto is a fair starting point
later on if a gui is being added it may be sensible to bundle it as a app
Yea I doughty about using gooey for that as its a nice wrapper around argparser
But wsl doesn't have X running
Command line options are not that complicated I will wait for the feedback before messing with gui
yup start simple, then expand
Thanks a lot for the insight! Really helped me a lot
happy to help, good luck with helping your future users
Hello i'm trying to find a good programming environment for Python
does someone maye has tips for something easy to start with for a beginner
@hearty wind you might have to change the terminal font
how to detect motion gesture in python using OpenCV
can anyeone with selenium expereince pm me?
Hi @ all
i can't find the switch statement, does it have another name
it could look something like:
switch b:
case a:
case b:
case c:
@turbid hollow python doesnt have switch
just use a dict or something https://stackoverflow.com/questions/60208/replacements-for-switch-statement-in-python
there's also pattern matching coming in 3.10, which is arguably more powerful than switch
Thank you this is good
Depending on how you structure a if elif else ladder, it can look pretty much the same as a switch case.
is this the right channel to get help about installing pynput and/or activating conda enviroment
is there a reasonable way to install pyenv system-wide so that we can all share a common set of virtualenvs? is it a terrible idea? my boss wants me to set it up this way but i can't google up any authoritative discussion about it and i'm starting to suspect it's a bad way to operate
you typically want venv(s) per person, or people will stomp on each other's dependencies
i'm trying to setup a private repo to be pip install-able--my setup.py looks like
from setuptools import setup
setup(
name='Foo',
description='A learning experiment',
url='git@github.com/myOrg/foo.git',
packages=['src.foo'],
install_requires=[],
extras_require={},
)
and i'm able to pip install it, but none of my files wind up in the target virtualenv--am i missing something? fwiw my directory looks like:
โโโ Makefile
โโโ README.md
โโโ requirements.txt
โโโ setup.py
โโโ src
โโโ foo
โโโ __init__.py
โโโ external_requests.py
but when i pip install it, the install succeeds but the import fails. anything obvious?
@reef latch ```python
from setuptools import find_packages, setup
setup(
name='Foo',
description='A learning experiment',
url='git@github.com/myOrg/foo.git',
packages=find_packages('src'),
package_dir={'': 'src'},
install_requires=[],
extras_require={},
)
- use
find_packagesto automatically resolve all package names, there's almost no reason not to use this
- if you really wanted to manually specify, the package name here is
foo, notsrc.foo. that is whatfind_packages('src')returns. if you don't believe me, cd to your project top-level and run this:
python -c 'from setuptools import find_packages; print(find_packages("src"))'
- you forgot
package_dir
packages is a list of package names, package_dir is the location of each package
thanks, very thorough! appreciate ya
you're welcome and bless you for caring about packaging
if you want to be really thorough, add this pyproject.toml file alongside setup.py:
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
this tells the pip that is installing your package how to install it; e.g. if you need cython at install time then you can specify it here. this also lets you specify a minimum version of setuptools if you need a more recent feature or if you want to blacklist a certain version with a bug, etc.
related reading, if you are interested:
https://www.python.org/dev/peps/pep-0517/
https://www.python.org/dev/peps/pep-0518/
https://setuptools.readthedocs.io/en/latest/userguide/quickstart.html#basic-use
@reef latch ^
thank you so much! amazing
cool idea, am gonna spread the word, i use vs so i cant test it out...
As my first introduction to containerization, I'm putting together a simple website using docker. I'm not entirely clear on what the structure of one of these instances should be. I've got Nginx, Node.js backend, PostgreSQL, and Letsencrypt I want to use, generally, would I be deploying all of these to a single docker instance?
I will try to incorporate it in vs also. Actually people were not showing interest in it that's why I have made extension for gedit and sublime only. Thanks man. If you like it do give a star, this will be the source of motivation for me.
as introduction, you could. But usually it is a good idea to split components in different container, e.g. a container for a web server, one or more for your application, a container for your db, a container for background tasks. It really depends on the needs of the requirements and perhaps the budget of the project
What kinds of things impact the budget?
i like to push button instead of running commands, im sure im not alone
high availability, traffic load?, size of your team?
Exactly.
e.g. app can't be down, you might want to implement replicas. Need to handle thousands of requests per second, you might want to have several instances running. Your team requieres different environments for QA the app
Makes sense to me, I certainly don't foresee such large demand
And in this case, Nginx and the web server should be separate containers?
And what is the benefit of having separate containers? At least, aside from spreading out load
you can manage deployment separately
split point of failure
makes easy to manage each piece independently
I don't think main reason for that is the performance though it also helps to scale
Hmm, fair enough
And regarding Nginx and the web server? Should those be separate? I don't really have an application layer separate from the webserver atm
nginx is a web server
if you don't have a need to have your app and the web server in different boxes/containers, then don't ๐
Ahh, i see
Heh, this is good practice, i at least don't foresee needing to scale but it will be a learning opportunity. Thank you!
sure ๐
I don't think I have tested the sublime extension for windows, if someone will test it for windows and add the installation instruction then that will be a great help for me.
I like to run commands instead of pushing buttons
Like already mentioned the point of docker is to split containers up into separate services. If just running vanilla docker look into docker-compose. https://docs.docker.com/compose/
Docker-compose will let you define each service in the stack in one file. Then bring up everything at once with one command
if i have two services that require a postgresdb, do i make one or two postgres services in my docker-compose?
and how should i map out hte ports so they dont collide?
Ports are defined in docker-compose too
Are both services running their own db? If you are just deving on your local id put both dbs in the same PG instance
yeah they'd be running hteir own db
metadata store for both services
so run docker-compose --scale postgres=2 ?
wha about the ports
in your compose file you will define each service with what ports you want them to run on
ahh ok so the default port is 5432 (i believe) for hte second one i can make up any port ,say 5433?
Can you elaborate more? There is a library named cx_freeze that can be used to generate exe binary from python source code.
correct is this just for local dev?
if so id stick both dbs in the same pg instance
hyeah just poking around on my local
yeah in that case just run one pg container and create two dbs
thanks! , will try this now
in your compose file in the pg service bind a local folder mount into the container. This way your data persists
Example:
services:
db:
image: postgres
ports:
- "5432:5432"
volumes:
- /local/path:/var/lib/postgresql/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
thx, i am reading up on creating the multiple db script
awesome thank you!
after running git add ':!<folder>', I still see a few directories that are untracked (under Changes not staged for commit). The idea is to go into each folder and run git add . manually?
I'm looking for a software development project management tool that helps me estimate the total man hours required for our backlog of issues. Perhaps even slotting them into a calendar, where they do not overlap, so that I can see how far out they extend.
Does anyone know of a tool like that?
I would just git add . . Are there folders in the root directory you don't want to stage?
you're right, but you can tweak the filter in that page according your needs
Question: setuptools has a mechanism for defining optional features / extras via extras_require, which doesn't affect the package content, just it's dependencies, right? Is there a way to declare a module in a package as optional? E.g. include namespace/module_a.py only if extra-feature "a" is selected for install?
intentionally not - the extras turn availiable/enabled practically when the other stuff is installed and the installed package doesnt change
if you want to split up a package for features, split it into multiple packages that you can put into the feature requirements of the main one
I was afraid of that. It feels like splitting up packages is a bit overwhelming though. For instance, I have a project with a protocol definition, client code, and server code. In order to distribute a client package I'd need to separate and maintain 3 different code bases? I hoped I could get away with something like pip install mypackage[client].
git add -A
I tried to add a GUI to my otherwise terminal tool. I tried Gooey but got disappointed by the lack of the documentation and the flexibility I need compared to standard arg parser. What alternatives do I have? I would like to have some predefined widgets like radio buttons, file inputs, dropdowns... and be able to combine them. I also want to be able to monitor the state of one widget in order to turn on/off the other ones
@blissful ice just ship it together, and have the parts that lack dependencies fail ?
@blissful ice its entirely ok to have the parts that lack dependencies fail, just add a little extra that adds a extra note to the import errors
Hi,
When I try to clone a repository from internet to my HDD it copies all the files contained in the master Repository I want to just clone a subfolder of a repository Is this possible? If yes, then how?
With git? Seems possible even if its a bit involved https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934
You can also do a shallow clone if you are not interested in the commit history
Thanks for reply : D How do I do that?
For shallow clone i think its just adding --depth 1 to the git clone command
Im using desktop app & sorry i'm new to github ๐
How do I do with the desktop app?
No idea sorry I only use the cli ๐
Can I DM you?
If you want but I wont know anything more about the desktop app
Okay Thanks
Hello all
I have a challenge getting my API built using Django-REST framework to run on Docker
On the local machine, once I run manage.py runserver, the server runs and the app works accordingly
But from docker I get this error when I try to use the app with postgres in docker
I get this error -
django.db.utils.OperationalError: could not translate host name "postgresql" to address: Temporary failure in name resolution
PS - I am working on Windows OS
Are you using Compose?
Paste some code
My docker-compose.yml
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
My project structure -
The dockerfile for the API -
FROM python:3
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app/api
COPY requirements.txt /app/api
RUN pip install -r requirements.txt
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
Dockerfile for the frontend -
FROM node:13.12.0-alpine
WORKDIR /frontend
COPY package.json /frontend
RUN npm install
RUN npm install react-scripts@3.4.1 -g
COPY . ./
EXPOSE 3000
Your containers are in different networks
You can inspect it using docker inspect ...
I got this -
NETWORK ID NAME DRIVER SCOPE
c8f74f76e832 bridge bridge local
5e01270c53c9 host host local
070efbf04ddf indie-tour-app_db-net bridge local
ae9cddca6a4f indie-tour-app_default bridge local
7d9e9753173f none null local
..when I did docker network ls
@night quest hello ๐
Easy
This is not the case
As you can see you have two bridge networks in your project
default is default network - each container is attached to it
Yes.
Unless you change configuration in docker-compose.yml
Then you must explicitly set
networks:
- one
- default
So what can I do to have a single bridge network bridging all parts of the app
You can create internal network between API and database container
So would that be? -
networks:
- one
- default
db-net:
driver: bridge
I'm sorry, I'm a beginner at docker, so a lot of things are confusing
Forgive my ignorance
Rather:
services:
postgress:
...
networks:
- database
...
api:
networks:
- database
- default
networks:
database:
internal: true
No problem at all
You don't need to create different bridge network I think - because you have default
Yay, nice
Been battling this since Monday ๐ ๐ญ
Glad to help
Remember that internal containers don't have access to the Internet
What's up?
Apologies, power cuts and I had to get power up and running
Don't worry
I went to the swagger doc for the api on docker
I don't know what swagger is 
whats the general rule for building a docker-compose file with regards to number of services within a single docker-compose/
are there diminishing returns or confusion as it gets larger and larger?
most of the examples i see online have only a handful of services, mine is becoming like 15 services...i am wondering if this is bad practice
swagger - basically puts the API documentation on the web.
Not sure if there are general rules, but yes I think it would get rather confusing as you add more and more services. If you can, I'd recommend splitting them into grouped docker-compose files and then calling -f multiple times when building/running.
Other than that, have you considered moving to helm? I think 15 services would justify the move
I have a question for the channel: have you ever/do you currently use a monorepo? We're looking into the possibility of converting from multirepo at work. If you have tips, or can advise on any common pitfalls to avoid that would be awesome to hear
Yeah id say docker-compose is great for a single app stack. Anything larger or complex you'd prob want to use Kubernetes
hmm ok and just to confirm, some of the images that i am using just have multiple instances (ie. services) so, im not saying that there are 15 different images i am using as services... for example; apache druid has 5 services using the same image (ie. broker, coordinator, middlemanager, router)
i will look into kubernetes, i havent touched that or helm before
helm is a tool to template and deploy yaml
He's right, learn Kubernetes first if you've not touched it before ๐
Please how do I migrate models (Django) to docker?
I have the db and api linked now but I have to migrate my models to the dockerized postgres db
exec into the django container and run your migrations
docker exec -it <container name> bash
Hey, not sure if it's the right channel but i'll try
I'm working on a micro-service within few other micro services
I'm trying to manage dependencies correctly, right now using requirments.txt
the problem is that requirements.txt is only handles top level requirements and i also want to handle sub dependencies (sort of equivavlent to package-lock.json with npm)
I made a little research and read some about pipenv
does any one have experience with it? can recommend? have other recommendation?
Thanks in advance
Greetings brethren
So I found a way to migrate models to docker
But I want a situation where when I do a compose build I run migrations to check if there are changes to the model
Currently I was able to create ta bash script, run it in my dockerfile, then call that bash script in my docker-compose
It builds as expected
However, when I attempt running docker-compose up -d and I get the container in question, I see the particular image I'm trying to run migrations on restarting severally
In my migrations.sh file -
#!/bin/sh
python manage.py migrate
python manage.py makemigrations
Docker file for api -
FROM python:3
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app/api
COPY requirements.txt /app/api
RUN pip install -r requirements.txt
EXPOSE 8000
COPY migrations.sh /migrations.sh
RUN chmod +x /migrations.sh
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
In my docker-compose.yml file for the service api -
api:
restart: always
container_name: api
entrypoint: /migrations.sh
command :
- python manage.py runserver 0.0.0.0:8000
build: ./api
links:
- postgresql:db
volumes:
- ./api:/app/api
ports:
- "8000:8000"
depends_on:
- postgresql
networks:
- database
- default
Why you use command both in Compose file and in Dockerfile?
Why you use both command and entrypoint?
Agreed. Best to leave your migration commands out of the Dockerfile. If you want to automate migrations you could add them as a service in your compose file.
I have set up a Docker Django/PostgreSQL app closely following the Django Quick Start instructions on the Docker site.
The first time I run Django's manage.py migrate, using the command sudo docker-
Ideally migration happens in separate containers and their deployment is planned so that they enable deployment to the services without migration disruption at code update time
import smtplib, ssl
port = 587 # For starttls
smtp_server = "smtp.gmail.com"
sender_email = "diksaratower@gmail.com"
receiver_email = "diksaratower@gmail.com"
password = input("Type your password and press enter:")
message = """
Subject: Hi there
This message is sent from Python."""
context = ssl.create_default_context()
with smtplib.SMTP(smtp_server, port) as server:
server.ehlo() # Can be omitted
server.starttls(context=context)
server.ehlo() # Can be omitted
server.login(sender_email, password)
server.sendmail(sender_email, receiver_email, message)
Everything works on my computer, but when I give the program to a friend, he gets an error. hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf7 in position 7: invalid start byte
I think this is better suited for a help channel. Also use a code block and tell us which line the error is thrown at
I thought like auto mail is like devops automation.
but it is not related to automail, it is a unicode decode error.
Probably fair
Hi guys I'm quite comfortable with Python Flask API but was wondering how I could deploy a python backend in the cloud (AWS etc.)
I'm assuming I can process data and have backend python data processing methods
so I can call the api from another place in my ReactJS app
does this help? https://flask.palletsprojects.com/en/1.1.x/deploying/
can anyone point me somewhere
thanks, I'll check it tout
Do I have to cite the copyrights of a gohugo theme that has an MIT license? In other words - can I just change that text on the bottom?
@spark fjord im preparing the next iteration of setuptools_scm - dropping support for eol python versions - wondering what to use as minimal setuptools version supported
I'm again using docker for the first time, with docker-compose specifically. I've got a github repository of the form
docker-compose.yml
web/
server.js
Dockerfile
I've got several services running through docker compose, if I want my node stuff to be synced with my github repository, should I do that within the web service, or should I be doing that outside/between my docker-compose up?
Do it outside Docker. You'll have to rebuild images in order for them to get the changes. For local development, you can specify a bind mount in the compose file. It will then read from the host's files instead.
In which case, each time I update should I be stopping docker compose and restarting it after pulling the changes?
Yeah but maybe node has something that supports auto reloading your files, like the Django dev server does
@vale wedge I'm not aware of any constraints you need to apply. Projects can select minimum Python versions based on the features they need. I'd only specify a minimum Setuptools version if setuptools_scm has a requirement on a specific feature.
any idea why my postgres service wont docker-compose down? i keep getting: ERROR: for postgres UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=70) ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
docker logs returns database ready to accept connections
does anyone know the FEN string for chess board before any moves are made?
have you looked at this? https://python-chess.readthedocs.io/en/v0.24.1/core.html#chess.Board.fen
I want to stop the egg building, im experimenting with setuptools 45 as minimum atm
Hello, does anybody know how python applications can make files ?
More context please, open for writing should do already
basically creating a file
Just open it for writing?
that also, but mainly creating a new file
Opening for writing is how you create a new file in general
ok, but how can application make that ?
Now please explain what you want to achieve, not just a small piece of the issue
well i basically have a problem with app not working
i runned in shell or something like that, and it worked fine, but when i compiled it into app, it basically didnt worked
does app need some special perms to do that ?
should i also post the app ?
my time for helping is unfortunately up, and it seems like you keep asking incomplete questions and leave out the real issues and key details for whats actually wrong, so good luck
eh, ok, thanks for help anyway ๐ , bye bye
I just followed what I saw in a tutorial
I tried to mimic what was in that stackoverflow link -
api:
restart: always
container_name: api
#entrypoint: /migrations.sh
command : python manage.py runserver 0.0.0.0:8000
build: ./api
links:
- postgresql:db
volumes:
- ./api:/app/api
ports:
- "8000:8000"
depends_on:
- migrations
- postgresql
networks:
- database
- default
migrations:
container_name: db_migrations
command: python manage.py migrate --noinput
build: ./api
links:
- postgresql:db
volumes:
- ./api:/app/api
depends_on:
- postgresql
networks:
- database
- default
That was what I have currently in my docker-compose file
But each time I build and do compose up, I notice for the db_migrations image I get this error -
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Hmm, interesting.
So I made changes to the migrations service -
migrations:
container_name: db_migrations
command: python manage.py migrate --noinput
build: ./api
links:
- postgresql:db
volumes:
- ./api:/app/api
depends_on:
- postgresql
networks:
- database
And I got the expected message from the migrations image -
Operations to perform:
Apply all migrations: admin, auth, contenttypes, indieco, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
...etc
Hey there. Anyone aware of a way to have commands like docker build and docker push on a windows PC without having to install full docker desktop?
So I did a compose-down to rebuild this docker container and compose-up and I got a repeat of this error -|
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I checked the mount for db_migrations and it was mounting to the right path. But checking the port, I noticed this -
Port
8000/tcp
Not binded
More observations. Turns out the problem is not with the migrations. I removed the migrations service and spun the container
I checked the api service and got this -
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
It's a connection issue. Not sure why it connects, then I do a compose-down and rebuild and compose up and get the errors I'm seeing
Do I need to restart Docker?
Lemme try that
Restarted. And everything (without the migration service) works as it should
Added the migration service and we are back to the connection issue
I observed that when I decided to add -
restart: always to the migration service, I first got an error, then I got the successful migration message after a restart. But the service just kept on restarting
Smh, just decide to work alone with the api service and add a second command
So I removed the migrations service
And in the api service, just added
command : bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
*facepalm why didn't I think of this before?
Hi, we are working off of a manufacturer provided repository, but would also like to setup a local repo to track our changes to the manufacturer rpo
what is the best way about this? I read something in regards to manifest files. Is that better than adding multiple remotes to the repo?
can i get some docker help? this is my error ERROR:flask_appbuilder.security.sqla.manager:DB Creation and initialization failed: (psycopg2.OperationalError) could not connect to server: Connection refused Is the server running on host "postgres" (172.18.0.5) and accepting TCP/IP connections on port 5433? my port is currently port:5433 is the error msg telling me to change it to ports: "172.18.0.5:5433" instead?
So, as I was digging around the interwebs, is there no better way to enforce the order of containers in docker-compose? I have a rabbitmq container that takes some time to start. I found healthcheck, that seems to have no effect. Only solution I found was using sh scripts in the containers.
The most feasible I've seen is to use the depends_on property while declaring your services.
That exists, but only starts the containers in certain order. But doesn't wait for them to be available.
So I need combination of depends-on and my own scripts?
Hi please help. I was using github desktop and I accidently switched branches. It changed like almost every file. How do I revert?
SGTM.
That one is new to me
Sounds good to me.
Doh, so obvious when written out
I strongly recommend taking one of the help channels for your case, i can't help atm as i gotta run now
i switched back and now its gone
so it worked?
no the changes arent there
That should be handled in code
You could put retry in there or just crash the container and let docker restart the container
Network issues happen
can i get some docker help? getting this error:
Is the server running on host "superset_db" (172.22.0.5) and accepting
TCP/IP connections on port 5433?```
my ports for it: `ports: - "5433:5432"`
i have two postgres services, the error is happening on my second postgres service
I'm trying to package a CLI app as a standalone executable using PyInstaller. I don't have a Linux OS so I used Vagrant to package it, taking the CentOS 7 box since the server where the executable will run is also CentOS 7.
I was able to create a standalone executable and it ran successfully with a fresh CentOS 7 Vagrant machine (no python3 dependencies installed). But when I run the executable in the server, it gives me this error:
[user@server ~]$ emails_automation/emails --help
[22874] Error -3 from inflate: unknown compression method
[22874] Error decompressing _asyncio.cpython-38-x86_64-linux-gnu.so
Failed to write all bytes for _asyncio.cpython-38-x86_64-linux-gnu.so
fwrite: Bad address
Both VM and actual server has same glibc version:
VM:
[root@localhost emails]# ldd --version
ldd (GNU libc) 2.17
Server:
[user@server ~]$ ldd --version
ldd (GNU libc) 2.17
Any pointers?
The unknown compression errors seems relevant
Guys, what is the best python library you know for animation??
What type of animations, there is a number of different best in their field
I'm just looking for a python library for a typical 2d animation that is easy to learn
would anyone know why git is ignoring json files that arent in gitignore?
Hi, I'm trying to package a compiled library for easy installing with pip / setuptools but I don't know where to start. In Conda there are non-python packages for installing data to local /lib /include /bin folders. Does pip allow to do something like that or is this a conda-only feature?
I believe this is typically done by publishing wheels for supported platforms, although I'm personally not knowledgeable on packaging non-pure-Python packages
I know about https://docs.manim.community
You should be creating wheels something like https://cibuildwheel.readthedocs.io/en/stable/ would help :)
None
pip is primarily concerned with python packages, and not at all like conda in that regard
Allright, I knew conda was being advertised as being more 'open' for distributing non-python packages in comparison with pip. But I faintly recall someone saying that this isn't the case for "modern" pip anymore, given that there are wheel packages like cudatoolkit etc.
Btw, what's devops and where can I learn about It? Thx a million
Pip simply follows the python standards, wheels with binaries are a python standard, random non pythin blobs for non python folders are not
i.e. saving those into a file after each run
ok, rephrasing: Is it at all possible to include the debug console input when saving to log?
or else, is there any IDE that can do this?
Hi, I'm working on tool that checks MD5 hashes .. and I wonder if it's possible in python to make update just the variable with hashes on screen without having to clear whole screen
have a look at https://docs.python.org/3/library/hashlib.html
You need to take a look at something like ncurses 
well my problem is not connected with hashes but with "visualisation" of that program
ty I'll check it out
Hello everyone.
I just finished my first tool in Python today (I started learning Python recently). It works, but I don't know if there are a lot of begginer mistakes, or things that can be improved. Do we have here in the community any type of code reviewing? There are any online tools to check the code?
Thanks ๐
well I guess there is some web pages where you can paste your code and it will edit it to look better
you can try that
I don't need to format the code to look better, for that I have tools in VSCode. It's just that I don't know if what I did it's the most efficient way of doing it in Python. My background is PHP and lately a propriety language
Let's call it a "Senior" review ๐
I see
if you have it on github, you can just send a link and ask for suggestions ^^
Thanks a lot. That is what I will do
I made the following project as part of my Python learning. This is my first tool. Can someone give me feedback about it?
https://github.com/gh-rboliveira/fillnewcopy
I'd suggest to don't version your python environment (your env folder)
Thank for the input... I was wondering if someone cloned the repository how would they know the packages that they need to install. What is the alternative? Just don't commit them? ๐
I know a couple of options for that:
- Create a
requerirements.txtfile - https://stackoverflow.com/q/29938554 - Use poetry - https://python-poetry.org/
though 1st one is probably the most used one
I just made the change with requirements.txt ๐ Thanks a lot for the help here.
Is it possible to improve the flow of coders by designating one person to carry out all merge conflicts?
most companies have developer opening the pull request fix the merge conflicts
though merge conflicts can indicate poor branching practices
I would say that all merge conflicts should be addressed to the person that owns the code/change creating the conflict since it's the person that knows better the code. If you don't know the code, you don't know what to keep, what to remove from the merge conflict
hey, does anyone have an experience connecting to a docker mysql image from a django app in the same container ? I tried with different hosts from the app but it keep giving me:
2003: Can't connect to MySQL server on '0.0.0.0:3306' (111 Connection refused)
@wooden ibex do you have any recommendations if we were to look to improve our branching practices?
We do Main -> Development -> Feature branching
@silver marlin I thought this too, but I'm trying to be open to the other point of view because I understand the value in staying in the zone when coding rather than coming out of it to fix conflicts. But I worry we're going to hit problems if only one person is fixing conflicts
main is stable tagged prod code
development is test stable (hopefully) code
feature branches are developers currently working on something and may break at any time, generally two developers do their best not to touch same part of code but push into each other branches
At the moment we're doing Main -> dev -> subtask of story branching
in that case, how are you having conflicts, are devs not talking and touching same parts of code?
Yes
This is one of the suggestions I've put forward yep.
I feel like integration is a pain rather than easy, but also that trying to avoid doing it regularly and ourselves probably leads to worse pain. It seems like that's the general feeling from what I've read, but is there something I can show as evidence?
Also if anyone has arguments to support the other side they're equally welcome
And by anything I can show as evidence I guess I mean something particularly well regarded or compelling
I'm sure there is some management consultant book like "BETTER DEVELOPER MANAGEMENT"
but in general, I doubt there is hard and fast rule you can point to
people problems rarely have that
Ok, no worries. Thanks ๐
I'd like to work on this issue, I don't think this the contributors of this repo decided on a CI platform to use? Where do I start? https://github.com/softwaresaved/lowfat/issues/604
They are on github and github actions are free for x amount for open source projects, so start with that?
Hi, I installed docker today with the defaults settings and after this installation I get this message. I don't get what they are saying in the message, Thanks
I am using windows OS
Install wsl2 by following the link they provide
I guess Docker uses wsl2 as its back end by default but it's complaining cause you haven't installed wsl2
Hello,
I created from a script an executable file with pyinstaller:
pyinstaller --onefile --windowed myscript.py
It runs on my computer, it runs on another colleague's computer, but not in a third colleague's computer. We all have Windows 64bits.
Anyone is aware of this problem and how to solve it?
Who uses replit btw
i did for a while
..
hello,
i am trying to settup docker to be used to automatically update my bot from my repo on github.
what kind of packaging should i use for it?
are the depensiencys automatically added to it?
and how can i automatically start the wb.py file?
I want the server to transmit sound from the browser or from the video player, how can I do this? (I already have a server and a client ready, I just do not understand how I can catch the sound and play it on the client, I use the socket library for the server)
How do i begin creating devOps tools?
What is Git Credential Manager? it is in my github authorized apps and it says it was last used within last week. Should I revoke its authorization?
It's what saves your git credentials. I believe it's a Windows-only thing that comes with the standard Windows git installer.
Well, it may not exactly be that, since I don't believe it communicates with GH. But maybe it is something related.
Maybe it does... https://github.com/microsoft/Git-Credential-Manager-Core
I haven't used this new "core" version, since by the time it was released I had already moved on to using SSH keys.
stupid question but when i am writing config files inside a compute engine VM, do i leave localhost as is or do i replace localhost with internal or external IP?
the default config file example
druid.host=localhost
Hi, I used a script to auto commit to save my work. I want to merge all the commits to the latest commit I make, how can I do that?
Use an interactive rebase to either squash or fixup the commits. The command for an interactive rebase is git rebase -i <commit>, where the commit specified is the oldest commit that you want to squash/fixup.
If these commits have already been pushed, then you'll need to do a force push. This is because a rebase will rewrite history, and such pushes are normally rejected.
That is why this kind of git workflow is generally not advised. But if you're working alone on your branch then you do you.
They have not been pushed yet. Is there no way to squash like 60 commits into the LATEST one I make? I want to sqaush all into the one I have sqaured
Yes, there is a way and I just explained how.
Oh I thought you said oldest
The command takes the oldest commit, so it knows where to start from
It starts from the oldest and goes until the newest
Ah ok
If you have so many commits, a rebase may be too tedious
You could also do it with git reset
Alright, ill go with rebase since I want to be safe. So for example a SHA for a commit is 5c4ee8549644a3cf041b30f0245894c2674679c8 which is the one from where I want to start sqaushing from. So I would do git rebase -i 5c4ee8549644a3cf041b30f0245894c2674679c8
When you rebase, you have to individually mark every commit you want to squash. With a reset, you just specify the oldest commit and it will remove all those commits and then keep the changes unstaged (or staged with git reset --soft). So you'd lose the commits but not the actual changes within them.
Yeah, that is correct
Ah
Thought I always forget if the commit hash is exclusive or inclusive ๐
So if I specify a commit 3 days ago (5c4ee8549644a3cf041b30f0245894c2674679c8). I made 10 commits from then. Then it would erase the 10 commits and that commit I specified with the --soft flag but I would not lose any changes. I would use git reset 5c4ee8549644a3cf041b30f0245894c2674679c8 --soft
Thanks alot
Ah alright, so it will do what I intend it to? (by that I mean would it would erase the 10 commits and that commit I specified with the --soft flag but I would not lose any changes )
Yes. If you're worried you can create a backup branch: ```py
git checkout -b mybackup
git switch originalbranch
git reset ....
Alright, last time I did that it pulled the backup branch and I lost all my changes, thats why I used that auto commit script lol. Ill just do git stash and switch
Can you stash committed changes?
Dont think so. the commits that have not been pushed will persist if I switch or they will be destroyed
sorry for being so paranoid but this is how i lost 1 week of code
And I have just rewrote
Well if you're ultra paranoid, copy and paste the .git folder
But yes, the commits should persist. They'll just be on another branch.
your reflog should keep track of almost everything you do in case you mess it up
Well. You'll have them on both your backup and original branch.
Ah alright
\Thanks alot
Also, one more general question that I couldnt find the on the web. I usually push my code with varaibles that the user should configure when they git clone it. However, when I pull it I lose the the variable that I defined. So basically what I want to do is when I git pull I want some of the part of code remain unchanged. How to do that?
Don't check in that file. Add it it .gitignore.
Instead, add in your documentation that users need to create the files themselves. Tell them where to create it and what the format is.
If you think it helps, you can commit an example or template file with a different name so users can copy and rename it to the right thing then go from there.
No, I will be changing the code but one part is token = jwd8y7wed7qyw7y7dy7qaydjsad I wont want to reveal my token so I would just write toke = pasteyourtoken however every time I git clone or pull my token will be changed to pasteyourtoken and I would need to copy it again and again. How would I do that?
It is in the readme.md to paste your token there
Don't hard-code your token. Read it from a separate file that solely contains the token
Or read it from an environment variable
Also I used the reset thing which squashed 60 commits into one commit that I made 3 days ago. However, that commit isnt descriptive so I would like to make one more commit and squash the already sqaushed commit into the one I make. So the normal squash command can do that correct?
Use git rebase -i HEAD~1 and then replace "pick" with "r" for the commit shown
Then it will open your text editor and let you enter a new commit message
Crap, i squash 60 commits to one and switched branches. Now changes are all messed up
I opened reflog and I want to go to
the one i squared
What do you mean it's messed up?
Switching branches is a harmless operation
Just switch back.
Switching branches doesn't mutate commits on the branch you're leaving.
I switched to backup branch and did git reset.
I switched to main and now its messed up.
I brought the changes with me instead of leaving them on backup branch. Just how do I revert the commit I squared
the changes messed up main
it tried to merge them or something
Did you use git switch or git checkout?
git checkout
That shouldn't carry over changes. In fact, it complains if you have uncomitted changes.
sorry, I'm just having trouble understanding how this could happen
I do not know, I used the github desktop thing..
!!!!!
Okay, that's a significant detail
I do not use that app so I cannot help you with it. I am only familiar with behaviour of git via the command line.
Is your backup branch still intact?
any good resource to learn about openstack for cloud apis? Thankyou
Don't delete the folder.
Okay
Unlike last time I commited alot. Even If I lose my code now could I just revert to a commit?
Yes it probably stll exists somewhere
i did git reflog
i did git reflog
it says this:
when i try to revert
Revert is probably not the right command. You'd need to rebase. What are you trying to do right now?
And discard everything after it?
yup
git reset --hard <commit> would do that.
just to make sure
If I do git reset --hard 1020f4c it would revert to that commit and discar everything after it?
You're welcome
Either works but switch is a relatively newer command designed to have a more narrow focus, and therefore a simpler interface, than checkout
how does git stash work? if i change for example greeting.py Hi to Hello and I run git stash it would save Hello and i can just run git stash pop?
Also if I have changes on the main branch but I want them to be pushed to feature branch then how would I do that?
alright thanks
hi
Thanks, I installed it and now docker is not complaining
Is it possible to make a webinterface to remotely execute code on a Rasberry pi 4?
Yes
My Plan is to host a local Webserver on a Rasberry pi 4 and then control it trough that webinterface
How would make that? Could you give me a short explanation?
Do you want to have access to something like shell via browser or just few buttons like "Power off", "Reboot" etc?
You can install Jupyter and there is access to shell remotely
But can I put that on a Webserver?
Jupyter is available via browser, is it what are you asking for?
Here you have installation guide: https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html
The plan is that the Webserver automatically starts and I get shell access on startup
And if possible I want to create a WiFi from the Rasberry pi so that I can connect anywhere
You can set up any program to start with system