#tools-and-devops
1 messages Β· Page 53 of 1
yea, I know what a vm is
or have used Virtual Box or VMWare or something like that in the past?
ok
So, a virtual machine emulates all the hardware
Docker isn't a VM
Instead, it provides a little sandbox that looks like a base linux system
but uses the same kernel as the host OS
when you were running docker images in the past, did you see something about it pulling an ubuntu base or something like that?
I've literally only just installed docker
Ah, that's ok!
Never touched it before
You've used git though, right?
Do you know how different commits apply changes on top of the last, right?
yea
The idea is sort of the same for docker images
If I may add my own explanation fi that can help you understand, Docker will make so you'd run each container like they were their own little VM (even if they aren't), for example, if you select the debian base image, you'd run a sort of Debian VM. You can see the dockerfile as a recipe for making a container/image, which is basically the whole filesystem of your pseudo-VM. Docker will boot up the base image (the one in the FROM step), and run each and every step, in order to create your image. If you select a debian based image, you'd have to use Debian package manager, apt
That's what I was getting to: each "image" is a layer of changes, like a commit
By the way, Debian based images are a better choice for python container, because of the included C library
For example, let's say you told docker to run this https://hub.docker.com/_/hello-world
Hello World! (an example of minimal Dockerization)
you can try it right now actually
docker run hello-world
(you should add the --rm flag)
it might download a base image, then the hello-world layer over that
and then run it once all the layers are in place
if you're on windows, the Linux that you're running docker in will be inside some sort of VM (WSL, VBox, whatever)
but each docker container will still use the system's linux kernel
to get back to where we started, the package manager and disk image state isn't shared between docker images or containers
if you want to make your own docker container definition to run a python project you made, you will need to choose a base image (Debian, Ubuntu, a specific python pre-built base image, whatever you want)
after that, you can use the system package manager to install clib you might happen to need
and after that, use pip as normal, probably
make sense? @quaint saffron
If not, that's fine too.
It's understandable if this is all a bit overwhelming right now.
You might also be asking "why should I use docker? This seems like a bunch of pain for no reason"
If you're wondering that, we can explain why people use docker if you'd like.
There are pros and cons to it, and for some situations, it's a great idea.
It kinda does
I'm kinda confused on how I know what distro or whatever I'm using, because to my knowledge I'm not specifying one
Wait nvm I am
So
I have two services
A python one, and a linux (alpine) one
So if I need to install programs etc. do I need to use the linux service?
@rough marlin
Can you explain what services are, because I think that's what's confusing me right now
version: '3'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
redis:
image: "redis:alpine"```this is my docker-compose yml file
Ah
so
It looks like you have two containers
a web server that you're mounting a code folder into, and a redis:alpine container
im rusty with docker at the moment
Basically I've got a flask application, that I want to use redis in
The redis stuff (I think) is within the redis:alpine container
And I'm somehow like 'importing' that into the web container
To be honest I don't really understand how it actually works, and what relevance the redis container actually has
So
I'm not 100% sure how this works for compose either, but I don't think you're importing it exactly
docker compose, from what I remember, might help automate or at least describe port setups
Are you following a tutorial right now?
@quaint saffron
Redis does a bunch of stuff, but to my understand it's big draw is that it's like a dict as a network service that keeps everything in memory so it's fast, but it also can replicate the data across instances automatically
so you can use it for stuff like keeping track of which login sessions are still valid
If you're following a tutorial, I don't know what it uses it for, but there's a good chance it's login session tracking.
Regardless, the flask app will act as a client accessing redis
so it'll look like:
HTTP request -> Flask -> redis query
after which you'll have a chain of messages going the other way :
redis -> Flask -> http response to client
make sense?
Yea, that makes more sense, thanks @rough marlin
Sorry had to help my dad with something
I think I understand it all now, thank you π
You might need to specify ports to share on the redis container in the compose file, i don't remember exactly.
I think Akarys can help you better.
Your service is named redis, you should be able to access it at http://redis/ from the other container, if that's the question
A while back I restructured my project by moving modules into a package dir, but probably didn't do that through git and now I found out it thinks most of the files were deleted and then re-added (https://github.com/Numerlor/Auto_Neutron/pull/6/files); is there any (non messy) way of letting it know that they are the same file to get their history back and a normal diff?
I'm having an odd issue with black and github actions. running black in exactly the same way as it's run in the GA works fine locally, no changes - GA shows two files it would reformat.. any idea how something like that could happen?
@quaint saffron Two things, don't use Python-Alpine: https://pythonspeed.com/articles/alpine-docker-python/
Also, you really really shouldn't use mounts with docker images for code, mounts should be reserved for stuff that can't be rebuild like databases, with docker compose, it will build the new image with new code BEFORE it swaps out existing container, if py.dis bot is fine with it, you should be fine with it
When youβre choosing a base image for your Docker image, Alpine Linux is often recommended. Using Alpine, youβre told, will make your images smaller and speed up your builds. And if youβre using Go thatβs reasonable advice. But if youβre using Python, Alpine Linux will quite o...
Bind mounts are useful for code for local development. So, still copy the code into the container. But when you run with compose, the bind mount it uses will take precedence.
Sure but local development could also just be running the code locally
my point is code should be in container, if you need to deploy new code, swap out container, don't try and swap it out using bind mounts/volumes whatever
and if you get to the point where you have always on web service, it's time to talk about Load Balancers and warming up
from https://github.com/jazzband/pip-tools#without-setuppy is the following:
If you don't use setup.py (it's easy to write one), you can create a requirements.in file to declare the Django dependency...
The phrasing makes me feel as though they're implying a setup.py is preferred to a requirements.in file, is this the case? Is that just for packages, or for projects as well? Or, have I just misread that.
@topaz aspen setup.py and requirements.txt serve 2 fundamentally different purposes
setup.py tells Setuptools/Pip how to install your package, which includes the least-restrictive list of dependencies/requirements needed for installation
yes
its exactly for distribution
requirements.txt can be used for a variety of purposes, but imo it's best used for specifying and replicating an environment
not unlike conda's environment file
right cool - phrasing on pip-tools site seemed to imply they were interchangable, which didn't make so much sense to me as I understood things
requirements.in from Pip-Tools is just a tool to help you create a very strict requirements.txt
well if you arent distributing your django app (which you usually aren't) then the difference is less significant
you can use setup.py to "distribute" the application to yourself along w/ all your deps and such
or you can use requirements.txt
hrm - would you ever use setup.py for a project rather than a particular package? I guess it could be? I always use requirements.in
setup.py can install multiple packages π€·ββοΈ
sure - the deps for a particular package tho
so you can have src/pkg1, src/pkg2, and src/pkg3 and a single setup.py that installs all 3
oh ok π€ hrm
setup.py really is for a "distribution" i.e. a collection of one or more python packages
hi
I have a question about git.
Let's say I have two branches. If I want to merge commit from develop to master. Is it fine if I just do git merge master. Or do I ALSO need to do, git checkout master; git merge develop after that
@heavy knot the latter
you need to make sure you are on the "base" branch before merging
the current branch is always the "base" for the merge
obviously if you are already on master you don't need to check out master again
@tawdry needle hi.. sorry to tag you
but I don't understand clearly
let's say I'm on develop and added a test, master is working fine, but I want to add my commits from develop back to the master...
master is the main branch, it's just that I'm not on it right now, and develop is ahead because that's where my recent commits have been made
so in this case is it fine just to do git merge master.. all my changes on develop will get merged to master?
git switch master then git merge develop. Merging master into develop right before would be redundant.
So you need to do the latter, but not in addition to the former.
Only do the latter.
By latter/former I'm referring to your original message.
thanks Mark
oh yeah, switch is a thing now
git merge <thing> says "merge <thing> into my current branch"
Few people merge in git anyways
most of time it's a pull request in github or similar
For merging into master, yes. But merging master into a feature branch is more common, though I prefer to rebase.
It's still not too common though.
i merge all the time
Do you often work on large features?
It'd make more sense then
Unless I have a suspicion something in master interferes with what I'm working on, I won't merge. I'd rather finish my work and resolve conflicts all at once if needed.
i tend to use short lived feature branches
which i merge back to master
trunk-ish based development i guess
that's in solo projects though
actually i do that in most projects
Okay, so you mean you merge frequently into master?
We do trunk as well
I thought you meant merging master into feature branches.
oh, yuck no
If you do solo dev, then PRs make less sense.
So yeah, merges would be frequent through git
I do PRs in solo
interesting
it helps me to see what I've done
thats not a bad idea if you're doing it at work, for more visibility
I could see some merits to it, organisational purposes.
isnt that what commit history is for though? π
It's a way to group commits without actually squashing
GH will show the related PR for the commits
And you can view it for a broader context, without actually having to explain the same thing in every commit message
I can see some merit too it, but it doesn't really align with what I want to do
no, i am morally opposed to squashing
I'm not shocked
squashing rewrites history, thats bad to do :<
that said, i do support rebasing to clean your shit up before making a PR or pushing to a public repo
and if a branch goes stale?
obviously if it's too stale a rebase turns into a mess anyway
either delete the branch if not in use or resolve conflicts and merge
leaving a branch open is big no no at work
only time it happens is when a developer gets pulled off something
but it's great way to show that developer might be task switching too much
while we do a ton of JIRA bullshit, stale branches are actually developer easy way to see that someone is having issues
when a developer gets pulled off something
sounds like a regular week at my job π
either they are being tasked switched or having trouble completing work
"hey you know that thing you were working on that was urgent? well the VP is on vacation for 3 weeks, i need you to do this other urgent project that you didn't even know about until right now, do you think you can get it done for me 2 weeks from today?"
my work is better then that thankfully
sorry, all new work must enter at start of the sprint
my situation is a bit different because im not actually a programmer or in a software engineering dept
and data science is fundamentally more open ended and harder to jam into a "sprint" than programming
except in relatively straightforward easy projects
my friend works at a company that uses a method developed by basecamp (i think) that works in a six week cycle
there's some other structure around it, but it seems like a nice balance between the original goals of agile and not feeling like a race all the time
we do 2 weeks and there is some of bullshit of "SHIP SHIP SHIP"
how do i echo fancy text in a batch file?
is this the right topic to ask in relation to Packaging a .py script?
Hello! Can I ask questions about python pip here?
#help-kiwi #help-apple you can get support here if it's with python, stuff that is other than python is discussed here
There are screenshots readily available online already
Do people typically use pre-commit install, or just run it when they want π€
some tools (such as pylint) can be pretty slow, so making small commits can be a bit of a pain
hrm ok - yeah i think it makes sense, but pylint kills it
Try flake8?
Hello, I'd like to ask about helping (ctrl+space) in pycharm.
I am using pro version with venv and pycharm not prompting methods for vars, class etc. It's problem only with pip-installed imports.
Only special typing (like example: class.Type) helping.
But I know a lot of people has this working out of the box.
@tawny temple i think we're using both π
Hi. Anyone want to peer review/criticise my script? Try to get better at putting things in functions, or maybe classes.. rather than have it is a 50 line script. I was thinking I could have a router class and move some of the netconf connect and port gathering functions to the router class
It loops round a yaml file of hostname:ip, logs in to a box and grabs p2p links for core facing interfaces. Then it generates a BIND config file in the format interface.fqdn. Its just for a lab environment at the moment π
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.
So if I have a virtualenv in current directory of project, and later I move that project elsewhere it doesn't work anymore.
Since it uses absolute paths. Is there any tool/way to solve this
That's part of what venv tools aim to solve by not putting the venvs in the project directory by default.
guys I have an issue with docker and Travis CI, can anyone help me in #help-bagel please
You might have better luck just posting your question here
Basically I need all three services- frontend, backend and databasse to be started before the cypress stage but that doesnt happen
heres the full output https://paste.pythondiscord.com/qobaseqahu.makefile from travis CI
here's the docker-compose and travis files https://github.com/IgnisDa/unixporn/tree/dev
You can design a script that will poll for those services to be online and then launch cypress
Docker itself cannot do this inherently.
yep that's what I have been trying out for the past few hours, no such luck :/
is there any other way to make an .exe other than pyinstaller?
There's also nuitka and py2exe
well I tried pyinstaller but it gives probably false positives
I'm looking into signing my generated executables with a self signed cert. Since it won't be from a trusted CA windows and I'm not expecting users to install a certificate; so from an user view would there be any difference from running an exe signed by me and an exe signed by someone else with the same data?
Probably get same error
Yeah I'm expecting windows to complain (looks like it got lost in the sentence) while it does give it a better look compared to the unknown publisher, but even though the app is open source and nobody would probably try anything malicious it feels a bit pointless if somebody can just replicate what the user can see from it
Windows will screamf or sure
when pre-commit runs does it do any sort of make like process wrt checking modified times? Or just run over everything even if it's not been edited since pre-commit was last run
How do the "Run anyway" exclusions work? Would it use the cert when present so other apps with the same name etc. pop up or would those also get ignored
I think what's being committed is passed into script if you want but it's not mandatory
so you could do a full test on entire application if you want
hey yall just had a quick question regarding git. I'm testing out a new feature in my project. So I created a new branch. Anyway, I still want to make changes to the UI on the master branch. Will the changes persist across each branch? If it doesn't is there a way to do it?
merge them in? unless i've missed the point there π€
what's up with pre-commit hooks
@topaz aspen Basically I want to know if the changes I make to the master branch are going to persist in this new branch I created. So if I add, commit, and push from the master branch, will the changes to the code there persist to the new branch.
I'm assuming that pre-commit is referring to the tool pre-commit specifically.
what's annoying about it then, any examples?
it depends on how you think commits should be
some developers like to commit early and often so if you are running tests, it slows them down or even prohibits commits
right - I have wondered about that yeah, though if they're slow one can just not install pre-commit
and run it before pushing to master manually
I modified 80 line powershell script it had 5 commits because I was screwing with logic and tests did fail
@topaz aspen git hooks are just scripts you drop into .git/hooks, of which "pre-commit" is one
once I got it cleaned up, it was passing tests
so like theres no way to do what I'm asking
sorry for my ignorance I've never really dealt with git before
Jian-Yang, Merge often but generally you shouldn't work on multiple branches at same time
oh ok
I just find pre-commit hooks to be annoying to many developers work flow
@tawdry needle yeah - there's pre-commit in ./.git/hooks/pre-commit but there's also the tool pre-commit, so i find that confusing... unless they're the same π
@wooden ibex don't install it then
i assume the latter is a tool for managing the former
maybe it sets up .git/hooks/pre-commit as a shell script and appends stuff to it in a controlled way
just run it when you want, that's a pretty easy fix it seems.... I guess pre-push would be nice
Alright thanks! Also, I should also note that this is a personal project.
rie, that means all that work for pre commit hook is slightly wasted
But I get that I should practice this stuff
thus why most people stick with checking before push and that's it
@wooden ibex all what work, making a config file?
writing pre-commit hook
like what is your precommit hook doing?
i would like to have pre-commit run on pre-push instead of commit by default though i think
well it runs flake / pylint / black / isort and stuff
i just dont like having git do all that for me, idk why
id rather just do it manually
but its different if you have collaborators that you need to keep in line
i don't see the difference
that's something that should be done during pull request
^
I don't know what "during" a pull request means π€
with Github/GitLab/Azure Devops/Bitbucket, you can prohibit Pull requests from being merged if all tests don't past
yeah sure, but why not use it to keep things trim in the meanwhile?
white space / line endings etc
Resolves #217
This simplifies the implementations by relying on the function discord.py provides. with_role is entirely replaced by has_any_role since it was identical. The rest had their implement...
Because there might be reasons the developers are not caring about that, maybe they are hacking at code, they don't want their train of thought disrupted by whitespace check they can clean up easily
idk what you're doing for it to disrupt you
pre-commit run --all-files, that's it, run it when you like
when I'm stuck on a problem, YOU HAVE WHITESPACE SO NO COMMIT/PUSH FOR YOU BECAUSE FORMATTING
jesus, screw you git, git commit --no-verify and leave me alone
if removing whitespace ruins your train of thought i find that odd
recent commit message "FIrst attempt at fixing this mess, I hate this block of code"
I will commit code that doesn't work because I want to see attempt A vs Attempt B
i guess there are more commits like "pre commit fix" and stuff when doing it as the last thing before pushing, but that's nothing either
i think i get your point, i just don't agree
it's fine, do what you want
you should do all those checks PERIOD so it should be enforced on pull request
there is no reason to finger wave the devs twice
once is enough
it's automatic
are you going to block commit?
if someone's upset because their whitespace was removed they need to have a rest
it messes with diffs
if you run it consistently the diffs should be more consistent shouldn't they?
that's something I'm not too sure about
most people diff program show all lines, I don't need to see lines that it was "remove whitespace"
hrm - in this scenario are you assuming that a single dev is working on a particular file?
not always
rather than multiple people interacting with it
sometimes at work, when someone wants help, they will commit, push and ask developer to pull their branch and view
what if they have a different editor setting and it changes things
changes what things?
if you are doing python project, I hope you ahve some standards around whitespace and like
whitespace / line endings / whatever - how do you enforce consistency in a way that your diffs are as you've described them being when multiple people are working on the same file
we don't do a ton of python but C# allows standards to be set in a file
so it goes with project
pylint did recently annoy me though as it was quite slow and discouraged small regular commits when pre-commit was installed
I thought flake and like had similar
yeah flake does, hrm... maybe there can be pre-commit overkill
seems pokey to do to developer, write something that happens on git hoster of choice during pull request
and don't quibble over individual commits, they ultimately are not important
yeah maybe... sometimes a project can sit for a while without getting merged for us
which isn't great in itself, but it is what it is
can change to push i think, might try this instead
push again, someone might push because they want to save
we use VDIs you are encouraged to push before logging off because VDI might get closed, and if VDI god gets angry, you might come back to fresh work lost
fair, we're v. small so there's nothing like that going on
do yall use github or anything of the like?
I think you have bigger problems then your commit hooks
just have gitlab scan your pushes and enforce during pull requests
we use ci on gitlab, hrm... there's probably a bunch of shit going wrong in there tbh
with regards to best practices or whatever at least
Hey guys i need some advice using docker.
I am making a website which uses a django backend, vuejs frontend and postgres database. I am using tox to test the backed and cypress for the frontend. I execute the tox tests right in the backend container and it works fine. However the cypress tests have a lot more dependencies and has been proving difficult to execute in the same container as the frontend.
I tried to switch the base of my frontend from nodejs:alpine to cypress/included (which is a pre-configured image provided by cypress) and everything works fine.
However I am left wondering- is it better to just separate two containers, one for the frontend development and the other for executing cypress tests in?
hmmm, is pipenv uninstall the proper command to remove a package? When I do this, it says the package is uninstalled, but it remains in the Pipfile, making the uninstall useless.
ah, pipenv update apparently
hello all, ive just been playing around with AWS lambdas on python with npm serverless and the serverless-python-requirements plugin. Locally I have a conda environment setup with numpy/scipy/pandas/networkx.
Using serverless deploy and invoke I have managed to get my test program running (it just imports numpy/pandas and networkx and prints out some objects I make quickly) and everything works it seems.
What I am confused about is that the resulting AWS lambda function deployment package is >50MB (it is ~70MB) - so I was expecting for it to not work? I'm curious as to why it seems to be working?
i was following the approach here: https://www.serverless.com/blog/serverless-python-packaging
my handler function:
import numpy as np
import pandas as pd
import networkx as nx
def main(event, context):
a = np.arange(15).reshape(3, 5)
print("Your numpy array:")
print(a)
print('pandas')
print(pd.DataFrame.from_dict([dict(a=1, b=2), dict(a=3, b=4)]))
print('networkx')
g = nx.from_pandas_adjacency(pd.DataFrame([[1, 1], [2, 1]]))
print(g.nodes)
print(g.edges)
if __name__ == "__main__":
main('', '')
anyone really good with curl?
!ask
What kind of hardware do github actions run on? I'm looking into migrating pyinstaller building to them and would like to know roughly how much it'll take
Whatever is lying around
All they promise you is you will get OS you asked for and processor arch you asked for. Everything else is at whim of Azure gods
Guess that explains why I couldn't find much about it
Few people care
disregard
Anyone using dephell? https://github.com/dephell/dephell
hey, how do I add all things except what is in my .gitignore?
is it git add all .gitignore?
@idle swallow git add .
does it automatically exclude the files and directories specified in .gitignore?
that's the point of .gitignore, so, yes
@idle swallow if you already have stuff that would be excluded by the gitignore
you can use git rm -r --cached . first
then git add .
make sure you dont have uncommitted changes
oh awesome, ty you two. did not kno I could use that cmd
I have removed a file and pushed to a branch that's different than master, now I would like to revert that commit and not remove that file anymore. How do I revert that?
@inner mesa
git reset HEAD^1 --hard basically
Hello, I have a private repo and I wish to review merge requests locally , but the issue is , since the repo is private , forks would also be private and hence Im not able to git fetch from a forked repo to review changes locally , is there any way I can do this?
uh doesn't github have organizations or smth?
Im using gitlab @sly sleet
oh
gitlab has groups it looks like
Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner.
so with this , I can git fetch even private repos @sly sleet ?
actually , I dont intend to give maintainer access to others, all I want is to review their changes locally before merging
reviewing with gui is kinda painful
I'm using comtypes package to interface with Outlook. I want to use it to find people that have marked email as spam across our organization. However when I do:
I get a class object and I'm not sure how I can use that.
Is this Office365?
@errant gyro
i tried using dephell once to generate a setup.py from a poetry-based pyproject.toml and it just gave me weird errors @topaz aspen
@tawdry needle hmm ok, I've not really worked out what the point in it is yet tbh
it seems like it's pip-tools + a converter between python package spec formats
I think I read something about setup tools versions being an issue it solves, but I've never had that problem in the first place
Is this Office365?
@wooden ibex Sorry I was away from the PC this is outlook 2019 not office365 version
Is it hooked up to Office365 or Exchange server? Rules are stored server side so you can just use Powershell and pull from there
no it is on IMAP
Nevermind then, yea, you will have to parse the class
Do you know of some way I can start into that?
PyCharm has stopped automatically using cd <project-directory> in the alt + F12 triggered terminal.
Every time I have to navigate to wherever from $HOME dir for some reason
Spencer, I do not, haven't used Python against Outlook
So I'm working on introducing documentation to this project (it has none) and was curious for opinions. My initial thought was autodoc since that seems to be pretty well respected, but pydoc being part of the standard library makes it a tempting option. I also know of pdoc3 as a thing that exists, but have heard far less about it. Was curious what preferences you have since I've worked with none of these tools and I'm sure there are well informed opinions to be had.
@blazing magnet Sphinx is the standard when working with python projects. coincidentally you have that in your name too
that's the feeling I've been getting reading through stuff. Thanks for confirming that. I'm honestly sort of fuzzy what the difference between autodoc and sphinx is. Is autodoc a fork of sphinx?
don't take my word on this, but I think it's the other way round. Sphinx is just autodoc on steroids and automates a lot of the process and provides a nice plugin system too@blazing magnet
ahhhhh, okay. Cause I would see them used semi interchangeably, so that would make a lot of sense.
I'm also realizing dosctring style is an important choice
So even though pep 257 defines docstring conventions, the google, scipy, etc styles all conform to it?
there are many different ones, there's a Google one, one from numpy and a few others
i dont know which one is the most used, but I personally use the one from numpy
gotcha, it does look nice and verbose, which is something this project sorely needs
well, thanks for all the help. I was already leaning towards both those options so it is reassuring to know they are that well regarded.
yeah no problem and good luck
@blazing magnet Personally I recommend type annotations along with google style doc strings
And yes, sphinx
rST is not the best and sphinx is annoying to configure. But at the end of the day it does the job
Numpy style is fine too, but I find it too verbose and therefore intrusive in my source code
Is PyCharm Professional a reasonably good IDE for javascript development using frameworks like Vue, Angular? Wondering if it's worthwhile to upgrade to professional
@umbral jay you can go a lot way with vscode if you configure it correctly
@umbral jay you can go a lot way with vscode if you configure it correctly
@leaden tartan Thanks. I'll explore, though I'll be surprised if VS code can be better. Can VScode be better than pycharm professional since it's free? Nobody will buy pycharm pro or webstorm if VS code is just as good.
Very basic question: if I closed an issue in GitHub myself submitted, can people still comment on it?
Thank you very much beforehand :)
@umbral jay stack overflow did a survey of what editor or IDE developers used and vscode won overwhelmingly, I think it about a 50% use rate. It is highly configurable, and thus can really compete with just about anything. To give a comparable example, vim is free and I think you can find someone using it in just about every group.
@umbral jay adding to what @blazing magnet said, vscode is also much lighter compared to pycharm and thus much more preferred. the only reason why people would use pycharm professional is for example getting help and support quickly when something goes wrong.
This would have been a problem if vscode had a small community, but it doesn't, so most of the times support isn't a problem either. They have an excellent bug tracker and support group, and you can probably find a solution to your problem right here on python Discord before even having to open an issue on their github.
i dont really see why anyone would spend money on something which has an objectively better and free competitor in market
thank you for the comments on VScode. I think JetBrains is screwed by VS code. Haha. Seems like VS code might even kill Microsoft's visual studio.
Visual studio is a different story altogether. it has been in market for ages and is set there since many developers don't really want to have to master a new piece of software when visual studio works for them well.
my dad uses visual studio and when I asked him to start using vscode, he asked me to fuck off
so yeah visual studio is not gonna go anywhere anytime soon
Very basic question: if I closed an issue in GitHub myself submitted, can people still comment on it?
@rare mirage yeah they can
Hello,
i just started using docker and downloaded my first image from a github repo. Now my question is if docker is using my pip modules from the current env or does it have its own env?
@heavy knot you can consider docker to be a completely isolated operating system, it doesn't really depend on anything on your host system unless you explicitly mention it.
so to answer your question, yeah docker has its own python installation and pip modules
thank you very much IgnisDa.
Do you know how i can check which pip modules the docker image is using?
which image are you using? @heavy knot
https://github.com/Ciphey/Ciphey
docker run -it --rm remnux/ciphey
do you have a Dockerfile? @heavy knot
should be this one
# Name: Ciphey
# Website: https://github.com/Ciphey/Ciphey
# Description: Automatically recognize and decode/decrypt common encoding and encryption techniques.
# Author: Brandon Skerritt: https://twitter.com/brandon_skerrit
# License: MIT License: https://github.com/Ciphey/Ciphey/blob/master/license
# Notes: ciphey
#
# To run Ciphey using this Docker container, create a directory where you'll store
# your input and output files. Then, use a command like this to open a shell inside
# the container where you can run "ciphey" and have your directory mapped as
# /home/nonroot/workdir inside the container:
#
# docker run -it --rm -v ~/workdir:/home/nonroot/workdir remnux/ciphey
#
# The password for the container's user nonroot is nonroot. The remnux/ciphey image is
# hosted on its its Docker Hub page.
FROM ubuntu:18.04
LABEL version="1.0"
LABEL description="Ciphey - An Automated Decoding and Decryption Tool"
LABEL maintainer="Lenny Zeltser"
ENV LANG C.UTF-8
ENV LANGUAGE C.UTF-8
ENV LC_ALL C.UTF-8
USER root
RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-get install python -y \
python3-pip sudo && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install --upgrade pip && \
python3 -m pip install ciphey
RUN groupadd -r nonroot && \
useradd -m -r -g nonroot -d /home/nonroot -s /usr/sbin/nologin -c "Nonroot User" nonroot && \
mkdir -p /home/nonroot/workdir && \
chown -R nonroot:nonroot /home/nonroot && \
usermod -a -G sudo nonroot && echo 'nonroot:nonroot' | chpasswd
USER nonroot
ENV HOME /home/nonroot
WORKDIR /home/nonroot/workdir
VOLUME ["/home/nonroot/workdir"]
ENV USER nonroot
CMD ["/bin/bash"]
docker run <CONTAINER NAME> pip list @heavy knot
you can check CONTAINER NAME using docker ps -a. Note that the container should be running before you execute the above command
you're welcome
If you run docker-compose behind traefik, how do you run a staging and prod environment on the same server?
I think the envs need to be on the same network for traefik to work, which means that each container should have a unique name? (e.g. pg_staging and pg_prod for postgres, with connections to the DB defined in an env var?)
I have a feeling that my production Django is connecting to my staging db, so I figure that's the problem.
@ me if replying.
@obtuse rapids do you want to keep the two databases running on different engines?
How i can solve this error of pip install for tensor
i hope this is the right channel for this
Both Postgres. Same engine. Different volumes.
Okay, I'm assuming you use two different credentials for each environment?
Just want a staging.patryk.tech for automated staging, and a manual production job.
Yeah.
If you want to look at my current setup, it is here: https://gitlab.com/patryk.tech/patryk.tech
Sounds like you want to use two containers named differently, yeah
I thought docker would prefix things with the project name, but apparently that doesn't work for containers on the same external network lol

They need to share a network so Traefik can route to them.
Would be better to do it on separate hosts, I guess...
But servers get expensive.
I don't know especially about traefik, but it sounds like you want to make them into the same projects, so they can share the same database
No, I specifically one two separate but identical setups.
Separate databases.
Different engine, then.... I may have misunderstood the question.
You want one or two postgres containers?
Because having only one of them and making two databases on it would be totally doable
Two containers
Staging should be identical to Production
It should just be automatically built on every push
(So, identical, but the code can be a few commits ahead)
Two servers would be ideal.
I need a sponsor xD
In that case, you probably want to isolate them completely, so have two different projects
tell me if you find a sponsor, I'll try to get sponsored as well haha
No.... they should be as coupled as possible :p
The point is, I make changes, and gitlab-ci builds the staging environment.
I can test that everything works, and as the envs are nearly identical, it should also work in production.
It's just like the pre-release copy.
Right
I also don't want the staging DB to pollute my production site.
Like I have a check whether the environment is set to staging, and if so, it loads some initial data (blog posts, admin user) from a script.
The staging DB should/does not persist.
Make sense
Hello!
Fairly new to this group.
Wanted to check if anyone had any experience with jitsi?
Wanted to check if anyone had any experience with jitsi?
@round bone the zoom alternative? We used it for corona-distanced taco night lol
What about it?
ahaha
@obtuse rapids Wanted to see if anyone knew that if I updated jitsi if it has some impact on the preset network configs?
its on its own ubuntu server.
Oh, I haven't hosted it myself How did you install it? From the official repos? Third party repo?
its a docker imagine from the offical repos
image ~~~
I wanted to avoid changing any of the configs and just update it to the latest stable version.
How did you configure it?
Normally, you would keep config outside the image with docker.
Depending on the image, I either COPY foo.cfg /etc/foo in a DOCKERFILE, or mount it as a volume... Or use ENV variables.
Ah ok, I didnt configure anything at all so not sure, I think the port forwarding and proxy network configs are done through nginx
The reason why I wanted to keep the config same is because well it works. Its just that I though it will be better to update jitsi itself to the latest version.
In those cases, if they keep the images up to date, it should be safe to just docker pull the latest image.
In those cases, if they keep the images up to date, it should be safe to just
docker pullthe latest image.
@obtuse rapids Yah, thats what I was thinking
But as I said, I never ran it self-hosted, so don't blame me if your faucet catches fire π
good luck π
I have a docker container that's returning an error when downloading a file from remote; the old [Errno 30] Read-only file system. Anyone know why this might be happening? Super new to Docker, and I'm sure I'm doing something wrong.
The dockerfile in question:
# nvidia-docker 1.0
LABEL com.nvidia.volumes.needed="nvidia_driver"
LABEL com.nvidia.cuda.version="${CUDA_VERSION}"
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_DRIVER_CAPABILITIES=compute,utility \
NVIDIA_REQUIRE_CUDA="cuda>=8.0" \
LANG=C.UTF-8
RUN mkdir /gpt-2
WORKDIR /gpt-2
ADD . /gpt-2
RUN pip install -r requirements.txt
RUN python3 download_model.py 1558M```
https://discordapp.com/channels/267624335836053506/463035462760792066/753857464738250792
@leaden tartan Oh, I see, thank you very much :)
not sure if this is the right channel
i have a couple questions idk where to start
how come doing this
from staffDashboard.staff_app import app, db
from staffDashboard.models import User
from staffDashboard import load_parse_articles
if __name__ == "__main__":
db.create_all()
u1 = User(first_name="test")
db.session.add(u1)
db.session.commit()
app.run()
load_parse_articles.run_articles()
specifically the load_parse_articles.run_articles()
wont actually run my script when i run my flask app (my flask app works, but the code below I thought would run as well)
import csv
import requests
import xml.etree.ElementTree as ET
from datetime import datetime, timezone, timedelta
import dateutil.parser as dateparser
urls_311 = {}
def loadArticles():
# url for sitemap
url = "https://portal.311.nyc.gov/sitemapxml/"
resp = requests.get(url, verify=False) # creating HTTP response object from url
return resp.content
def parseXML(xml_string):
# parse xml
prefix = "{http://www.sitemaps.org/schemas/sitemap/0.9}"
dt = datetime.now(timezone.utc)
root = ET.fromstring(xml_string)
for url in root.iter(f"{prefix}url"):
for loc, time in zip(url.iter(f"{prefix}loc"), url.iter(f"{prefix}lastmod")):
obj_time = dateparser.parse(time.text)
if obj_time >= (dt - timedelta(days=3)):
# print(loc.text, "---", time.text)
urls_311[loc.text] = obj_time
#print(urls_311)
return urls_311
def savetoCSV(urls_to_update, filename):
# writing to csv file
with open(filename, "w") as csvfile:
writer = csv.DictWriter(csvfile, fieldnames=urls_to_update[0].keys())
writer.writeheader()
writer.writerows(urls_to_update)
def run_articles():
# load xml from web to update existing xml file
xml_string = loadArticles() # parse xml file
parseXML(xml_string) # store news items in a csv file
# savetoCSV(urls_311, 'new_urls.csv')
not sure if this is the right channel
@sand thistle sounds like a Flask question, so #web-development ... this is more for CI/CD,git, etc.
That said, do the other functions work? Maybeapp.run()is a blocking call / endless loop, so it runsapp.run()and never hits the next line? Try switching those two lines around.
I am not sure where to ask this question but here goes:
My docker-compose.yml defines a service for postgres called database. Note that everything works as expected, this is more of a doubt that I need cleared up.
Also here's a part of my settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'db',
'USER': 'user',
'PASSWORD': 'db-passwd',
'HOST': 'database', # <----- pay attention here
'PORT': '5432',
}
}
How does django know how to connect to the postgres container (even though they are in different containers)?
Here's a part of docker-compose.yml
services:
database:
image: postgres:alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=db-passwd
- POSTGRES_DB=db
backend:
build: ./backend/
command: python /app/manage.py runserver 0.0.0.0:8000
volumes:
- ./backend:/app
ports:
- "8000:8000"
depends_on:
- database
Or should I ask this question in #networks ?
services:
# The line below is used as the service name, so you can access it as database
database:
image: postgres:alpine
If you named it foo in docker-compose.yml, you would have to set "HOST": "foo" in your DATABASES["default"] dict as well.
yes I know that, but what i want to ask is, how does this work? I tried to look it up on net, but I don't really know what to search for. Loopback interfaces?
I'll give you another example- if i type http://localhost:8000/ on my browser, it automatically goes to http://127.0.0.1:8000/
Idk if they are related but I have no idea how this networking stuff works
docker-compose brings up a virtual network interface for your project.
And assigns those service names to the containers.
Is there any specific that I can search for to better understand this stuff?
docker ps # lists running containers, so you can note the names
docker inspect container_name # whill dump a TON of info about your container
Is there any specific that I can search for to better understand this stuff?
Let me get out of bed and look through the docker docs on my desktop lol
docker inspect will tell you what names the containers use.
"Networks": {
"default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"dd881b3dc8b4",
"database"
],
Is this what I am looking for? (output of docker inspect)
Yeah. Aliases
This assigns the auto-generated machine name (which is pretty useless), and the service name from the compose file.
do if i added "dd881b3dc8b4" to my DATABASES['default'] that would work too?
https://docs.docker.com/network/ these docs are very verbose... but if you want to understand how docker networking works, they are a great resource.
do if i added "dd881b3dc8b4" to my
DATABASES['default']that would work too?
Yes.... until your container's name changed, because e.g. you re-created it.
Or it gets generated with a different name on your dev machine and your production server.
Always use the name from the compose file.... that will persist.
alright I just checked, the name does get regenerated
It would work, until it doesn't :p
https://docs.docker.com/network/ these docs are very verbose... but if you want to understand how docker networking works, they are a great resource.
@obtuse rapids I will have a look at this. Thank you very much!
If you run docker exec -it project_django_1 bash (or whatever your django container is named), you can run commands inside that container.
Also, i presume my frontend and backend services also work in a similar way?
If you run
docker exec -it project_django_1 bash(or whatever your django container is named), you can run commands inside that container.
@obtuse rapids yeah I know this
From there, you can ping database and ping dd881b3dc8b4 and it should both work and ping the same IP
(or whatever your new name is, if you recreated it already)
oooh cool i did not know that
You can also try ping frontend and it should also work π
and ping backend which should ping the django container from within itself.
Also, all docker-compose does is the same things as in the Networking Overview ... It just automates them.
It creates the bridge network, creates the containers with a name (https://docs.docker.com/network/bridge/#connect-a-container-to-a-user-defined-bridge), and basically makes it really easy to link them.
If you really want to learn, you can do it all by hand to see how it works π
And np π π€
also this is the output of docker network ls
NETWORK ID NAME DRIVER SCOPE
e5bac06ff4ac bridge bridge local
93d0988de6ad host host local
988be0b459b3 none null local
c85762928b9d project_default bridge local
I presume this (last one) is where all the actual bridging between networks work?
Last one is specific to your project, I think... started by docker-compose
You can also inspect those...
docker network inspect c85762928b9d
yeah it dissapears after docker-compose down
by the way, is this a docker-only feature or present on all operating systems?
Is what a docker feature?
You can create virtual network devices on Linux fairly easily.
this netwoking stuff
They're just virtual devices with virtual IPs.
so if I want I can create something like http://mylocalhostnetwork/ ?
On Linux, pretty easy to create. On OSX, it should also be doable, because it's UNIX-based. Not sure about Windows.
You could
Would have to configure routing and whatnot.
Maybe I shouldn't have said easy rofl
but definitely doable. Docker just leverages existing OS features.
Can you just tell me the command to do this on Arch Linux? I will research it myself further
Been a long time since I've done this, tbh π
I have had to configure bridges manually in the past, but yeah... not in a while.
so behind the scenes, docker does all this for us?
If you use OpenVPN and whatnot, it also uses virtual network devices like a bridge or a tunnel.
Basically, yeah.
If you type ip a you can see a bunch of virtual devices if you have docker running.
16
One loopback, one WiFi, and 14 virtual lol
Just do ip a
That lists all the information.
| grep -v '^ ' <-- I added this so it only shows lines that don't start with a space
and | wc -l to count them
you do know a lot of stuff don't you?
<@&267628507062992896> <@&267629731250176001>
but wrong channel?
So, yeah... you'd be -14 years old when I got my first computer :p
!ban @heavy knot NSFW
:incoming_envelope: :ok_hand: applied ban to @stable timber permanently.
that's some swift action, good job
I've reported it to Discord.
So, yeah... you'd be
-14years old when I got my first computer :p
@obtuse rapids and how old where you when you got your first pc?
4
woah that's cool
It ran MS-DOS 3.0
my first ran Vista i think
So yeah, you'll collect knowledge and experience too, if you keep at it π
I was 17 first time I ran Linux
yeah I will, and thank you very much for spending so much time explaining all this
I was 17 first time I ran Linux
@obtuse rapids I win then, I was 16
yeah I will, and thank you very much for spending so much time explaining all this
What else would I spend my time doing? Actually working? Hah!
mood
I want to use a project with slight changes, but keep up to date with any changes that the project makes., I'm not sure what this is referred to as though. I'm pretty sure it's a thing.
So I clone proj to proj-custom, and in proj-custom i make some adjustments, proj is then updated, and I want to be able to track those updates and bring them into proj-custom, as well as keeping the customisations that I make π€
hopefully that's clear enough to ring any bells, never had to do this before.
- Fork "OriginalAuthor/Project" to "You/Project"
git clone https://github.com/You/Projectcd Projectgit remote add upstream http://github.com/OriginalAuthor/Project- To keep your project up-to-date with the actual project
git pull upstream master - To push the changes from the original project to your project
git push origin master
@topaz aspen
@leaden tartan ah ok - "upstream project" is what it's called then i guess
You can of course change the branch names as you wish
You can of course change the branch names as you wish
yeah all good - never had to use this particular work flow before, i'll look that up though
thanks π
yeah @topaz aspen upstream is a conventional name, you can call it Richard Hammond and type git push Richard-Hammond master if you want lol
yeah naming is fine - i wasn't sure what this sort of workflow was referred to as though
idk what this work flow is called but this is what I use
so you have your project with some remote, and the upstream is the original project - iiuc
yeah, and origin is "YourUsername/Project"
right, makes sense
im getting started in Python, is PyCharm Professional all that good?
Start with the community version if you are new to python. Not worth the paid upgrade unless you are literally a professional, at which point your employer should pay for it
im getting started in Python, is PyCharm Professional all that good?
@heady nexus Also depends what you do with it. Personally, for web dev, I find VSCode handles Docker and Vue.js better.
Hello I want to learn Python so Can you introduce some document for me?
@red lion Here is a good place to start https://www.youtube.com/playlist?list=PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU
thanks
@obtuse rapids Sorry to trouble you, but can you tell me whats happening here?
I can not contact my backend from the frontend service but can do so viceversa
# frontend
root@d03d3775ebe8:/app# ping backend:8000
ping: backend:8000: Name or service not known
/app # ping frontend:3000 -c 1
PING frontend:3000 (172.18.0.4): 56 data bytes
64 bytes from 172.18.0.4: seq=0 ttl=64 time=0.142 ms
--- frontend:3000 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.142/0.142/0.142 ms
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
docker compose for reference https://paste.pythondiscord.com/matucaxise.http
@obtuse rapids Sorry to trouble you, but can you tell me whats happening here?
I can not contact my backend from the frontend service but can do so viceversa# frontend root@d03d3775ebe8:/app# ping backend:8000 ping: backend:8000: Name or service not known/app # ping frontend:3000 -c 1 PING frontend:8000 (172.18.0.4): 56 data bytes 64 bytes from 172.18.0.4: seq=0 ttl=64 time=0.142 ms --- frontend:8000 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 0.142/0.142/0.142 ms
@leaden tartan ping requests are sent using the ICMP protocol, that doesn't use ports, unlike TCP/UDP.
Try just the service name: ping backend
alright, looks like I will have to look into network protocols next. Thanks
Hello, can anyone help me with connecting to google directory via python? I would want to list the objects and their properties to do some cleaning
Hey,So Im running Python on Atom
I wrote a Script that would give me a .PPM file,how would I see that file
Is there a Command Line or Terminal or something
@flint fog https://fileinfo.com/extension/ppm
Learn about .PPM files and view a list of programs that open them.
Yeah,I know what a .PPM file is,but Im wondering where I can access it
Oh,Nvm
Yeah,Im running Manjaro Linux,and for some reason while searching for test.ppm,It didn't show up
Hi guys, I'm using Github official library to get the info about all the repositories in my organization and right now I just want to label every repository somehow
Is it possible to do? I saw labels and tags for commits, but not for the whole repos
I think they are called topics, but I donβt see it in the API docs, Iβm guessing that you canβt modify it using the library too
Okay, thanks!
I am running my django webserver using docker. Everything works fine as expected but the problem is when I upload an image (for eg using the Django Admin), the files are created with rootpermissions inside my docker containers. This makes them unreadable (and undelete-able) to my host machine, since I have a shared volume on my project.
/app/media/images/posts/2 # ls -lR
.:
total 8
-rw-r--r-- 1 root root 7575 Sep 14 15:55 download.jpeg
I suppose there is something wrong with my Dockerfile?
FROM python:3.8.5-alpine
EXPOSE 8000
ENV PYTHONDONTWRITEBYTECODE 1 \
PYTHONUNBUFFERED 1
WORKDIR /app
ENV SECRET_KEY=e75)h*54#&*^&(secret-keyd+=^%mb0n \
SQL_USER=user \
SQL_PASSWORD=unip69204passwd \
SQL_HOST=database \
SQL_PORT=5432 \
SQL_ENGINE=django.db.backends.postgresql \
SQL_DATABASE=db
# install psycopg2, pillow and argon2_cffi dependencies
RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev libffi-dev openssl-dev jpeg-dev zlib-dev
COPY . /app/
RUN pip install -r requirements.txt
@leaden tartan I don't recommend using shared volumes in production. You should be using named volumes. That said, I always add a python user to my containers. I give it the same uid as my desktop user, so for dev where I do use mount volumes, all the files are owned by my user on the host and python in the container.
https://gitlab.com/patryk.tech/patryk.tech/-/blob/master/ptdjango/Dockerfile#L13
this is not for production ofc, I have shared volumes locally to take advantage of django's stat reloader. That being said, thank you @obtuse rapids
Then yes, match your user id to the one in docker π
I looked into the repo for a bit, I still couldn't understand- why exactly are you using supervisord?
Is anyone really familiar with using pexpect? I'm trying to parse output of a sudo systemctl status <service> call on a remote Raspberry Pi, but I think my encoding might be off. I set it to 'utf-8', but the output looks like garbage when I print output from systemctl status, perhaps because of the special characters being used and colorized output?
I'm simply trying to expect "Waiting for client connections" but it's not finding it for whatever reason
Oh gosh, I'm an idiot... s.expect('Waiting for client connection') is finding it so it's working... however, I guess my question still stands as to why terminal jumps all over the place and whatnot
I looked into the repo for a bit, I still couldn't understand- why exactly are you using
supervisord?
@leaden tartan not strictly necessary, but it is the recommended setup for Django Channels, that I plan on implementing (https://channels.readthedocs.io/en/latest/deploying.html).
It does have some advantages, e.g. restarting the server if it goes down for whatever reason.
If you notice, I am running daphne, which is an async server.
hello, I'm looking for someones creative input. I'm building my own smarthome controller. I have multiple classes controlling various things, Hue lights, computer on/off and more. What I need is a state controller. One that maintains differences between actual states of eg. a light, and the expected state. So I in code, can resend a command, if say a light doesn't match the desired state.
I have a hard time wrapping my head around, what the smartest way of keeping track of various states, other than hardcoding variables in each class for expected state / actual state (updated from the api's).
@steep sun how are your devices communicating? are they already using MQTT or LwM2M or something?
that might dictate an off the shelf "controller" that you decide to use
my setup is like so: 1x jetson nano running code, that communicates to various device controller API's.
I think I just wrote a state controller, can you have a look and see if it's pythonic ?
Eh.. you probably don't want me deciding what is idiomatic Python code π
I'm a C programmer, but trying to use pytest to automate some test stuff.. I'm a terrible python programmer compared to someone that does it every day π
okay, then it'll probably weird you out, anyways, the idea was that I created a class, that I can register values towards.
so I can say states.add("office_lamp",["on","brightness"])
it then creates a dict entry, with entries for on and brightness along with "actual" vs "expected" values of those.
then from my API communication part, I can set states.set("office_lamp","actual","on",True)
from my actions part I can say states.set("office_lamp","expected","on",False)
Then I can have code, that monitors for deviations and correct the actual states to match, between expectation and actual states of the devices controlled.
if that makes sense
Yeah, I think. I don't know if this helps @steep sun , but this sounds like you want to maintain a digital twin like representation of your devices. Azure IoT has a digital twin service and AWS IoT calls this device Shadow. you may be looking for an open source equivalent.
From my limited experience, in the cloud services, you could query for a device twin and you'd receive a JSON representation of the device as a response. This JSON packet would have a bunch of key-value pairs sorted in to "reported" (as last reported by the device) and "desired" (as requested by some application). Some middleware could worry about syncing the desired state to the device when its online which would trigger an update of the reported state, etc...
ahh, sweet .. something to read into. and those namings "reported" and "desired" actually sound better than "actual" and "expected".
thanks man
ShadowTwin
Going to call my class that
Sounds powerful
Yeah, I've never used it, but Eclipse IoT has a project called Ditto which is a digital twin service. Don't know if its any good, but it's at least one piece of FOSS you can look at, assuming you were implementing this stuff on a home server or something: https://www.eclipse.org/ditto/
Eclipse Ditto is an open source framework for creating and managing digital twins in the IoT.
I just wrote my own
Will check up on the link
I like to write my own stuff.
Not because I think I'm better, but to learn.
I'm currently using Pycharms to run unittests with coverage. The interpreter is a docker container that has a pipenv setup inside.
When I try to run coverage, it is informing me that I don't have coverage installed. However, it is in the Pipfile that I have setup both on the local host and the container itself.
Any ideas where I might be missing something?
Run it with bundle works
When I try to run coverage, it is informing me that I don't have coverage installed. However, it is in the Pipfile that I have setup both on the local host and the container itself.
@broken eagle What does yourDockerfilelook like?
I want to take an arbitrary Git clone URL, give it to GitHub when creating a new repository, and have GitHub git pull the repository regularly, e.g. daily.
For example, a https://github.com/aosp-mirror AOSP mirror which fetches/pulls every sometime automatically from original source.
when i want use python with vscode, do i just download it?
or i must install additional extensions?
You can just download VSCode, but I highly recommend installing the official Python extension from Microsoft...
Along with Flake8 and Black.
what is the flake8 and black?
and this is the official extension right, https://marketplace.visualstudio.com/items?itemName=ms-python.python ?
Yup, that's the one.
black is an automatic code formatter. You can configure vscode to run it whenever you save a python file, and it will automatically format your file in a pre-defined way.
It doesn't let you change the rules much, but at least your code will be consistent....
flake8 is a linter, which checks for code style in another way (mostly around pep 8).
ok thanks, and do you know if pycharm has flake8? because it also has similar feature correct?
is that included by default
Flake8 is an external tool. You can get it in your OS repos sometimes on Linux (e.g. Arch Linux) or from PyPI
I think pycharm supports is, but I am not really a fan of pycharm.
For Web Dev, VSCode fits my needs a lot better.
ok well let me try this, and thanks!
is there a way for auto complete to add brackets when you select function in vscode?
@heavy knot set python.autocomplete.addBrackets: true in your settings.json
alright thanks π
Hi
Hi
@lime roost Hi. Did you have a question?
please comment on the architecture of the package. I have added the architecture diagram in the README https://github.com/Agent-Hellboy/YouTubeDataApi_Wrapper/tree/dev.
please comment on the architecture of the package. I have added the architecture diagram in the README https://github.com/Agent-Hellboy/YouTubeDataApi_Wrapper/tree/dev.
@inner pollen>>> from pyytdata.pyytdata import PyYtData... you can make this nicer looking with an__init__.py...
# __init__.py
from .pyytdata import PyYtData
Then you should be able to do from pyytdata import PyYtData
sure thing.
Honestly not a big deal....
@obtuse rapids can you suggest something to add and improve.
Kinda curious why util is in the root and not a subdirectory of pyytdata
Ok, I will move it inside the subdirectory.
Anyone know a way to limit resources using docker-compose 3? This only works in swarm mode....
https://docs.docker.com/compose/compose-file/#resources
Never mind, I'm a fucking idiot and this compose file was already version 2 lol
so im having a weird issue
i just did a git fetch
and now when i try to run my code it's telling me i have syntax errors
but the syntax is fine
I think it's because im having an error on an fstring
but i had something weird happen too... where it was flagging some code that didn't exist anymore. a typehint
Hey I got a simple question for anyone who used PyCharm Edu, I'm currently running it on an ubuntu VM if it matters.
I made it so that run works on F4 however if i work on multiple files and i specifically want to run something on the current window, pressing F4 doesn't actually run it and I'm forced to right click the file in question and run it from there if I want F4 to start working there or else it will keep running the previous program.
How do I change it so that it will run the window I'm currently working on?
what's devops?
"developer operations", things like setting up automated testing infrastructure, source code version control, etc.
osx opendiff is quite nice
ive never used araxis
emerge is emacs and im not an emacs user so i dont use that, but its probably good if you are an emacs user
vimdiff is similar, use it if you really like vim
welp i use nano
so
:/
doing a brief google now between the 3
i know it's a simple quick editor, which is why i picked it up. but im at a point where I should probably pick a more complex editor. Since nano is actually not that good.
i will probably gravitate towards vim
@sand thistle or just use vscode. i use vim only for commit messages and when I need to make very minor changes somewhere and I'm too lazy to open up vscode.
lmao I use nano for any console editing
yeah nano is pretty fine, but vim is a lot more powerful, especially with its easy navigation system
vscode trumps them both tho
When installing local packages with pip is there a "good" way to make pip indicate that they're locally sourced, which doesn't involve -e? I have code in packages locally but I don't want them to be editable. However if I do pip install ./mypackage it just shows as mypackage==1.0.0 in a requirements.txt which makes installing it fail
how do I share my code to others so they can use them like apps
i went to help channel
they sent me to advanced discussion
they sent me here
i was curious, what is best practices for collaborating on a git repo
should everyone be doing pull requests?
or do people just pull, code, then push
can i open jupyet notebooks with pycharm, or i have to add an extension to do so?
should everyone be doing pull requests?
@sand thistle PRs are the standard, yes.
I just git rebase master onto feature branches because merges are lame but most people don't like that
how do I share my code to others so they can use them like apps
@restive moth push it to a git repo (like GitLab).
Is it python? You can also package it using e.g. poetry and publishingit on PyPI.
most people don't like that
I want some numbers, sir!
Akarys don't like that π
I justgit rebasemaster onto feature branches because merges are lame but most people don't like that
@obtuse rapids Rebases are cool. Normal merges don't make any sense further down the road, some time later
can i open jupyet notebooks with pycharm, or i have to add an extension to do so?
@supple venture jupyter*
so why rebase vs merge
Because you end up with 20-40% of your commits just being "merged branch foo" π©
And your histograph is full of branches.
Rebase gives you a linear history.
I prefer it, but it doesn't mean that it's better /right.
another way to look at it is merge preserves history, but rebase rewrites, so the latter isn't encouraged for public branches
I find this to be a clear writeup on merging vs rebasing https://www.atlassian.com/git/tutorials/merging-vs-rebasing
i dont think theres anything wrong with "merged branch foo" commits @obtuse rapids
history is history
can i open jupyet notebooks with pycharm, or i have to add an extension to do so?
@supple venture this is only possible with the professional (paid) version iirc
ah, sad
i dont think theres anything wrong with "merged branch foo" commits @obtuse rapids
As I said, personal preference :)
I have used both (on personal projects and public repos), and find arebaseflow cleaner.
Doesn't meanmergeis wrong, of course.
ah, sad
@supple venture VSCode can run jupyter notebooks.
Vscode runs jupyter natively. No extra installation
Hello, someone created a branch for me on gitlab and wanted me to use the git checkout command to work in that branch. Can someone help me with this? Iβm not really familiar with gitlab
I have my source code currently on my laptop and gitbash/windows power shell installed but donβt know what exactly to do
@heavy knot Just git checkout <branch-name>
both will work, but I suggest git bash @heavy knot
Ok, sorry just one more thing, Iβm getting a fatal: not a git repository
When I try that in either one
Ok, sorry just one more thing, Iβm getting a fatal: not a git repository
@heavy knot You are probably not in the correct directory
If you saved the repo to Desktop, you need to navigate to it
cd path\to\Desktop
Thanks a lot bro π
When I do docker-compose up -d locally, all the services are created and work as expected. But when I run this on CI (travis), only one service (out of three) is created. Any idea why this happens?
When I do
docker-compose up -dlocally, all the services are created and work as expected. But when I run this on CI (travis), only one service (out of three) is created. Any idea why this happens?
@leaden tartan check the Travis logs?
And if you can / necessary, ssh into the server, and check docker logs
igfrontendtesting_1_adf2212ada60 | Cypress could not verify that this server is running:
igfrontendtesting_1_adf2212ada60 |
igfrontendtesting_1_adf2212ada60 | > http://igfrontend:3000
This is quite weird
Hmmm.... maybe it's starting too early?
No its not
Since I am running the entire backend test suite prior to this that takes about 5 minutes
What is your front-end running? nginx, or node?
node
Which service is running? Back-end?
Looks like I have to email the travis ci customer support for ssh access
Which service is running? Back-end?
@obtuse rapids django drf- manage.py runserver
So igfrontend service isn't running either....
You need to figure out why.
Probably why the test container isn't either.
Yeah, the problem is it runs on mine
Does Travis not say anything about igfrontend?
Creating network "uni_default" with the default driver
Creating uni_igdatabase_1 ... done
Creating uni_igbackend_1 ... done
Creating uni_igfrontend_1 ... done
This is what the output is locally
On travis
Creating network "uni_default" with the default driver
Creating volume "uni_backend" with default driver
Creating volume "uni_frontend" with default driver
Creating volume "uni_postgres_data" with default driver
Creating unix_igdatabase_1_338aebc4e7d8 ...
So only database is created- both frontend and backend are not
The backend isn't a problem right now since the cypress tests are very useless and only test display: none; etc
But that would be a problem soon too once the cypress tests are a bit more extensive
sudo: required
language: node_js
node_js:
- 14.8.0
services:
- docker
before_script:
- docker-compose -f docker-compose.yml -f docker-compose.test.yml build
- docker-compose -f docker-compose.yml -f docker-compose.test.yml pull
script:
- docker-compose up --detach
- docker-compose -f docker-compose.test.yml run --entrypoint "pytest --flake8" igbackendtesting
- docker-compose -f docker-compose.test.yml up --exit-code-from igfrontendtesting igfrontendtesting
after_script:
- docker-compose down -v --remove-orphans
notifications:
email: false
I should probably remove sudo: required
Maybe you need a docker-compose down before you docker-compose up?
Maybe you have containers running from a previous commit.
Commit to what? Travis doesn't cache anything. Are you talking about docker?
I'll add it anyway, and check what happens
Oh.... Well, does it ever stop though?
I'm not familiar with Travis, TBH. I run my own gitlab-runner on my own server.
after_script:
- docker-compose logs igfrontend
- docker-compose down -v --remove-orphans
add a logs command.... it should tell you wtf the node image is doing
@ me when you have an update π
@obtuse rapids the build keeps hanging idk why. I'll get back to you once I fix it. I probably made too many requests today thats why it keeps hanging :/
No worries
so do you guys ever just
read digital ocean tutorials and then take the code and make a shell script
cuz i have the urge to make shell scripts out of these tuts
vault.service: Main process exited, code=exited, status=213/SECUREBITS
crap
bruh
Loaded: loaded (/etc/systemd/system/vault.service; disabled; vendor preset: enabled) disabled vendor O.o that don't sound right
vault is beating me up
hashicorp vault *
is there any cross platform apps for saving/importing and viewing docs offline? would like to be able to visually browse and click around the docs without having an internet connection.
@heavy knot If you mean like Github then I think Github Desktop lets you view your local repos offline
more like the python docs themselves, and other project docs on things like read the docs
i'll have a look at github desktop though
can someone help me convert python script to exe file
@jovial hound https://www.py2exe.org/
Can anybody pls help me installing this https://github.com/rickysarraf/apt-offline
I dont know how to install it
@pallid jacinth there is a file called INSTALL in that repo.
the instructions look simple enough
I tried them
what's the output?
pip install -r requirements.txt
This error comes when I try to runapt-offline-gui
bash: pip: command not found
How to install pip?
sudo apt install pip?
don't you have python installed?
yes I have
Python 2.7.18rc1 (default, Apr 7 2020, 12:05:55)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
How to install pip?
PyQT5 probably requires python 3
also your python is very old, upgrade to 3.8
ERROR: Could not find a version that satisfies the requirement magic (from -r requirements.txt (line 4)) (from versions: none)
ERROR: No matching distribution found for magic (from -r requirements.txt (line 4))
oh ok
ERROR: Could not find a version that satisfies the requirement magic (from -r requirements.txt (line 4)) (from versions: none)
ERROR: No matching distribution found for magic (from -r requirements.txt (line 4))
@pallid jacinth probably cause you're using an outdated version of python
How to upgrade?
you're on Ubuntu?
Itβs python3 most likely
is this the right channel to ask help on a library?
I need a bit of help rebasing git. I accidentally commited a credential file (locally only), subsequently moved it around with a couple of --fixup commands without realising it was in there. Then I finally tried to remove it with a final --fixup and rebase.
I've ended up with a merge conflict I don't know how to resolve.
I need a bit of help rebasing git. I accidentally commited a credential file (locally only), subsequently moved it around with a couple of --fixup commands without realising it was in there. Then I finally tried to remove it with a final --fixup and rebase.
Make a new branch (git branch -b backup), checkout the branch you have problems with (git checkout masteror whatever instead of master), and rebase interactively the last N commits (git rebase -i HEAD~5to edit the last 5 commits).
You can then undo the commits you don't want.
Another option is to branch from an earlier commit, and redoing your work.
Thanks - didn't occur to me to just back up the working directory and just restore files back
has anyone used hashicorp vault
We have it at work
no
I'm not sure that I've configured things correctly
their APIs are documented very well
ha ok well at least you're honest
so RTM
Are you trying to deploy it?
i have some software running on a server
I've installed the vault
I can run it in dev mode
but it's likely the config file that is incorrect
I don't deal with that
k
im getting an error while installing dlib in windows 10
@everyone its saying wheel error
can someone help
<@&267629731250176001> advertising
default_language_version:
python: python3.7
fail_fast: true
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: master
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-pylint
rev: master
hooks:
- id: pylint
files: coc
i have .pre-commit-config.yml
but its not getting triggered
its installing .git\hooks\pre-commit
@gilded horizon advertisements aren't allowed in this server
instead of .pre-commit-config.yml
any idea y this happening
please ping me when someone answer
I don't know hooks all that well
i wnt to install this .pre-commit-config.yml
but its installing default pre-commit hook
How to make app like vitetris using python i.e. some gui on terminal
How to make app like vitetris using python i.e. some gui on terminal
@tidal solstice secondcurses. Also, wrong channel. #user-interfaces would probably be better. Maybe #unix .
Hi I am doing the Automate the Boring Stuff for Python course and looking for the next stepping stone after this course. Appreciate more course and project/practice recommendations. Thanks!
hello @ocean wharf , this question might be more appropriate in #career-advice or #python-discussion
@ocean wharf Practical Python is another beginner course, but it's more "precise" and focused on python itself rather than "how to do things with python", so it might help to at least skim its content
@proud trout I will try those communities. I was sent here. Thanks for help!
@tawdry needle I will look at Practical Python. I was looking more for automation specific courses but regardless I will check out that course.
I will look at Practical Python. I was looking more for automation specific courses but regardless I will check out that course.
@ocean wharf what are you trying to automate?
I do not have a project in mind. I maybe will think of a project where I can implement the skills I learned in the Automate The Boring Stuff course. New to automation world
@obtuse rapids
Haha, ok. I would recommend thinking of things you would like to automate, and learn that.
Do you work with software?
Or hardware?
Studying a specific discipline?
Cyber Criminology
Maybe web scraping would be a good thing to study next, then.
Selenium, requests, etc.
Okay I will look into all of this. Thank you for recommendations. @obtuse rapids
hello, I am currently on python 3.8.2 - 64bit, using PyCharm as my IDE, with Anaconda3 -64bit installed. I've been trying to install the tensorflow package onto my IDE, but I got this error message:
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
The following specifications were found to be incompatible with your CUDA driver:
- feature:/win-64::__cuda==10.0=0
- feature:|@/win-64::__cuda==10.0=0
Your installed CUDA driver is: 10.0```
I have pip installed, and I've tried installing other packages such as matplotlib, panda, etc, but the tensorflow package won't download. I've tried searching on Google for answers, and have changed my project interpreter to Anaconda, with the base interpreter being from Anaconda3\python.exe.
I'm not sure if this is enough information, but thank you in advance for any help.
has anyone used docker-compose file to manage secrets
has anyone used
docker-composefile to manage secrets
@sand thistle I do.
Well, with environment variables and Gitlab-CI.
oh i was advised to place my secret key into a docker-compose file and add the docker-compose file to the .dockerignore file, so that the secret won't be pushed to dockerhub
but won't that just mean that when i deploy this to my server, the image wont contain the secret O.o
oh i was advised to place my secret key into a
docker-composefile and add thedocker-composefile to the.dockerignorefile, so that the secret won't be pushed to dockerhub
@sand thistle very odd. Normally, you don't hardcode it indocker-compose.ymlat all.
I pass the secret key to docker-compose as an environment variable.... https://gitlab.com/patryk.tech/patryk.tech/-/blob/master/docker-compose.yml#L14
But I also don't push my images to dockerhub ... they go to a private repo in my gitlab.
Yeah so I have a private repo
But the webhooks connected to the docker hub
So I push to repo and it auto builds an image
What can I do to improve the quality and comprehensiveness of autocompletion suggestions in Visual Studio Code?
I find them very useful when learning a new language. I tried switching to Microsoft Python Language Server and installing IntelliCode extension. They got better at detecting types and proposing methods, but they are still lacking (for example with arguments / flags).
Hello, I need some help, I am getting this error while doing pipenv install. I've already set the path
I am currently running Python 3.8.5
But I also don't push my images to
dockerhub... they go to a private repo in my gitlab.
@obtuse rapids so then I see you're storing it in variable format where is the actual value for the django secret key storedDJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}
I could solve the problem, but I'd like to know why I had to run pipenv --python 3.8 in my case for it to work
Every search in Google said it had to be pipenv install
Hi, I've never gotten this message when i've made a commit in the pawst.
-
Why would this occur?
-
Should I suppress it? or what should I do?
[master 189a579] Content is showing over the foreground image, but footer is still risng above overflowing, and content is overlapping strangely.
Committer: Brian Boros Bpower@tests-MBP.attlocal.net
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 1 insertion(+), 1 deletion(-)
hey so sublime text's command palette doesn't accept the "normal" ctrl key (the one on the left of my keyboard)- it only accepts the one on the right- is there a way to remedy this somehow?
(ping 2 reply th)
x
@obtuse rapids so then I see you're storing it in variable format where is the actual value for the django secret key stored
DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}
@sand thistle it's in Gitlab. It has its own secrets store (a bit like Hashicorp Vault), andgitlab-runnerpulls them automatically.
I have question for azure can I use azure for free always I am the only contributor for my repo ,my repo is private
Private repos have a limit for sure, a certain number of minutes per month iirc
And open source?
Is free?
And for private repos it is always free?
With certain minutes
1,800 minutes/month apparently, Iβm sure if it has some discount for open source
1800 minutes always free?
Yup
It's free for any account with the minutes limit or unlimited for public
1800 minutes is not a lot tbh. especially per month
Ty guys I wnt to learn azure in depth can I have some yt linksπ
Or some useful link which can help
Can azure host my bot too?
And db
Yes, thatβs Azure cloud iirc