#tools-and-devops
1 messages · Page 7 of 1
Student credits
Already burned it before working on some weird stuffs
if I am a F500, then azure may come into play
but at the end of the day, each one has a somewhat equivalent service named differently
So now I just do the ol' free trial jenkery
so potato potatoes
I still find Azure a bit more intuitive than GCP in terms of initial setup
I'll keep the platforms in mind, though for my applications I think my nugget homeserver will do fine
docker/podman compose can get you pretty far in your home setup
Ah, docker. I'll touch Docker a bit later
it's a great tool to learn
Been wanting to touch it for a while, but I keep getting sidetracked
I would prioritize it over aws/gcp/azure
please don't ping random people for help
Hello user. Recommending to read dontasktoask.com and nohello.net and https://pythondiscord.com/pages/resources/guides/asking-good-questions/. You are making a common mistake in asking to ask instead of asking a question itself and therefore u will not get help. Also better to ask it in tools-and-devops
Already told you before. We can't help you because u don't ask your question with provided code examples, expected results, what u wished to achieve.
sorry
so i was trying to use the git-hub actions workflow to merge 2 branches when some changes is done to one branch it should auto merge it to the other branch i tried it and it triggers the event but it doesn't merge it
it sounds like a bad idea to me. rethink if it should be done in the first place.
github workflows aren't meant for git commit pushing
exception, in special situations when using repository as an infrastructure like in upptime application
its a part of assignment i have to submit it in 24 hours
hey serverless devs !
Which is better, Serverless Framework or AWS CDK ?
Why?
Hi
Any ideea how to add an external theme in vscode linux?
Like, i found the ~/.vscode-oss/extensions path
But where to put the theme here
?
is there a way to customize the wheel filename created when using poetry build or pip wheel?
god I hope not
No and why? The wheel filename follows a specific format because it encodes important information about the wheel.
Ask in #editors-ides
hello. This is my scenario in a kubernetes cluster:
- I have a Django application where most of pods have one replica
- Only the actual application (WSGI) has multiple replicas
- I have two nodes
- I want any pod to be evenly spread, not just matching pods
I'm already checking "Pod Topology Spread Constraints". Is there any trick for this?
as far as i remember i launched in the past and yeah it worked with topologySpreadConstraints stuff.
I just used maxSkew 1, topologyKey found in my node info as hostname unique per node and that's it basically 
and what did you use to select pods? I see labelSelector and matchLabelKeys, but I don´t see the difference and also I don´t see an example that applies to all user-created pods
labelSelector. i had this topology written inside of my Deployment/Replica stuff
you are supposed to apply it per Deployment/Replica/Pod object
technically nothing prevents you applying it... almost globally through the usage of helm/templating stuff. U would be needing just to insert reusable stuff
ok. I think I'm on the right path, just missing that selector trick to ensure any non-system pod is spread without manually specifying labels
though I could, perhaps is easier to tag all of them
Hey everyone,
I am looking for a tool for performance/requests tracing of API backend. I've done messy poc with opentelemetry and jaeger, but not sure if it has functionality I need.
My short term use case:
- I want spin up backend with tracing enabled, send some requests (basically happy path user flow) - then I want to dig into details and see eg external http requests aggregated by their url. This way I can easily spot that external request A is made 10 times instead of expected
Jaeger so far provides me with nice overview of each call to API, but I failed to see any kind of aggregation of repeating requests to external services (eg, show me all /external_resource requests, and which part of app called them). Also, it seems that opentelemetry does not capture body of http requests
so looking for something relatively easy to set up (elastic stack would be an overkill), that can be set up locally and that has possibility to aggregate all outgoing requests from the app
If anyone knows if it is possible to configure opentelemetry&jaeger to achieve that, I would also be greatful
Maybe sentry would do 🤔
I created a docker container for dev purposes, and I am using PIL within it, however when I do img.show(), no image is shown. This isn't really a surprise. I assume that in order to get to see the image I would need to map a port to the host. Anyone know what port, or how else I could do this?
at what port img.show() works outside of docker?
(which url is opened)
not sure what you mean which url is opened?
when you run img.show(), where it is opened
how
in which program
It simply runs in the shell, I connected to the shell with docker exec -it container sh
I'm very early in my project, I'm just setting things.
Not sure how that gif is helpful?
(i give up trying to understand what you have at the moment)
you aren't able to explain what is your current output format. To where picture is exported / rendered / saved / from where you expect it to see
If I were to work directly on the host in python using PIL, and I call img.show() it would open the image in whatever image software was available to the OS.
okay, it does next things
- saves somewhere image to filesystem
- then sends signal to your GUI for opening (may be runs script or something)
Docker can easily... have.. shared volume(folder) between running container and host
just a matter of simplle argument. So the first thing is easy to have
the second, forwarding signal from container to host GUI for automated picture showing? i have honestly no idea how, except knowing it is probably possible. But it is advance shit beyond my understanding. (and beyond average docker usage too)
I can offer you only -> remake your code rendering picture at simple URL adress (respond with Flask endpoint for example), then forwarding port for seeing picture in browser is simple
or just become satisfied with receiving picture to the folder where you activated container
Docker is for CLI/web applications, not for Desktop/GUI applications essentially. It is possible to hack it for Desktop application usage, but it is very advance shit beyond its intended usage.
What you write is pretty much what I thought, I was hoping that that there was a simple solution to show the image on the host. I'll save the files to the host and open from there.
yeah, it is simple. just forward Docker volume for this
docker run -v $(pwd)/folder:/path_to_docker container
or do same at the level docker-compose
That is already the case. In order to save your code when your developing you kinda need to do that anyways.
Been trying to connect https://vscode.dev to my vps either through vscodes tunnel feature or with ssh, the latter is not possible due to terminal and extension limitations on the web client (which is exactly why i want to connect to my vps, so i can use a terminal and run code through the web client without having to pay for github codespaces). A tunnel was my last option, but I've been running into an error when running code tunnel on my vps cli about snap for ubuntu, did some research and I only found one person that had the same error as me, it was an open issue at vscodes repo, it was unanswered.....
So if anyone here that might know how I can go about this, then I would really appreciate some suggestions!
(i've posted in #editors-ides too because it's quite a mix between that and this topic)
Haven't been able to find a single solution to this... pretty weird, I might actually create a project on this in the future for the sake of being able to stay in the web and connect to your vps and develop with vscode
oddly enough, that's not possible as of today based on my 3-4 hours of research lol
I am about to board a plane so I can't help further, but I suggest you Google "X11 forwarding docker" to make any GUI software work even when ran behind docker. @mild hinge
I have made it work correctly before so it's definitely possible.
Off-topic channels
There are three off-topic channels:
• #ot0-psvm’s-eternal-disapproval
• #ot1-perplexing-regexing
• #ot2-never-nester’s-nightmare
The channel names change every night at midnight UTC and are often fun meta references to jokes or conversations that happened on the server.
See our off-topic etiquette page for more guidance on how the channels should be used.
sry
Anyone aware of any tools similar to twine which lets you upload distributions to multiple pypi indices in a single command ?
twine only uploads to a single index
I'm looking for tools that uploads dists to multiple pypi indices
Can anyone here help me linking my modules on windows to an Odoo container? I've tried mounting the first folder on a second on the container, but it doesn't recognize the first
does anyone know if there's a python module with a ton of different TTS voices? the ones I can find only have around two or three
In theory I should be able to drop pylint and isort altogether if I switch to ruff, right?
Ah. ruff is not supporting match-case just yet...https://github.com/charliermarsh/ruff/issues/282
Eh, I suppose can I refactor the thing to elif
AndyFluffing — Idag 19:16
Hello. Can someone tell me how I can send an email with python-code on a rpi? I used to do it with a gmail-account, but google changed something that closed that door.
Hi,
Does anyone ever build a slack bot using python?
Hello, do you might know why i can t install using this method " pip install -r requirements.txt "
you may need to use one of the following:
py -m pip install ...
python -m pip install ...
python3 -m pip install ...
ok i will try
has anyone tried replit for coding, now we can also perform coding on chromebook through replit
Scan the number plate and get all the details of the vehicle! 🚘, https://github.com/YashIndane/platefetcher , I have tried to use as much as devops tools in this project along with the amazing app.
hi everyone, i need your help, i'm using python 3.11 and i want to use pyserial but it sends me back this error , although pyserial 3.5 is installed on my computer
Traceback (most recent call last):
File "c:\Users\HP USER\Downloads\Monty-Python\import serial.py", line 1, in <module>
import serial
ModuleNotFoundError: No module named 'serial'
!dashmpip
When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.
Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.
Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.
hi! I have a list of swear words to use on my website. But I need the words in this format >>
swear_words = ["d@mn", "h@ll", "cr@p", "d@rn", "p@ss"]
Are there any tools to convert those 1 word per line text into something like this?
Regex, regular expressions will make fuzzy match to find them in most combinations
used a csv converter and worked like a charm
Failed to understand your question then, I thought u meant finding them already at target
ahh...
why not just download remote ssh extension
Yes, they do. A web search will show you lots of tutorials and examples.
it's not available on the web version
read the second sentence in my message
i didn't see that
So I'm trying to set up an Azure pipeline with Poetry but it can't recognize it at the next script
I want poetry to be at least available for testing + coverage + code quality in separate steps
you'll have to write a command to install it
you can expect to have python and pip available, but not 3rd-party stuff like poetry
is anyone familiar with the numerical shooting method for higher order boundary value problems?
i understand its essentially a guess and check method but im fuzzy on the details for python implementation
Does anyone know a tool or code that runs a command through CMD as administrator?
Instead of just doing it myself
can someone help me figure out whats causing this error?
python: can't open file '/app/main.py': [Errno 2] No such file or directory
I can run my docker container from the dev machine but once I pull the image into unraid Im getting that error in the logs.
I am able to confirm main.py is included in the image at that directory
anyone know of a scheduler other than apscheduler ? I'm struggling to get it installed on an ARM device, but do not want a cron job ( a system dependency )
Celery Beat
https://github.com/darklab8/darklab_examples/tree/master/python/celerylite
Most minimalistic example that uses pip celery
@rapid sparrow thanks, looked at celery beats... we are currently using it somewhere else, but I thought I will write my own scheduler... as to avoid dependencies on an ARM edge device
when using tkinter ive been using the insert function on text blocks, but problem is when i use the insert function the text inserted into the text box isnt visible.
what i mean by this is
theres this text box im using
i enter text inside of it and click enter, ive made it so when i click enter some text gets inserted into it, the text is correctly inserted but its not visible
i have to click left arrow key in order to see it
any idea how i can make it so when i use the insert function the text i insert in the text box is directly visible ?
heres my code https://paste.pythondiscord.com/uhibokudur
hey i have no clue if this is the right place but im currently trying to make a programs that you can run via the right click menu in windows explore.
i have added it to the right click menu using regedit but im getting this error from windows and its not running the script. and here the key thing im using to run the script
I think there is a setting in windows to stop you from running unsigned executables.
That may be enabled
I've seen it enabled by default on some laptops
Hey, I'm not sure if this is the right channel (let me know). But I wanted to share my first repository and I'm really excited to keep going. If someone has tips please let me know.
I am using GitHub and I am in a team with a repository that has the main and develop branch protected. I have merged several changes to the develop branch. I now want to merge the develop branch into the master branch, however, there is a merge conflict between develop and master. How would I resolve this issue?
git fetch origin master:master (pulling latest commits from master to master)
and while standing in this developed branch
git merge master
resolve conflicts (i usually do it with vscode
push commits, problem solved
I've tried that in pycharm, but for some reason that has not fixed the issue because when I submit the commits to develop branch via a PR, I still get that there is a conflict between develop and master
feel free to @ me
git checkout developed_branch_name // changing to developed branch
git fetch origin master:master // pulling latest master commits to master
git merge master // merging master to developed branch
solve merging conflicts (using pycharm tools / or kdiff3 / or vscode, whatever) / probably will require to finish it with git commit -m "merge: solved" once you finished. check with git status to verify it is resolved
git push // push developed branch commits with resolved commits to conclude it
okie dokes, I think that helped a lot!
I submitted a PR to be submitted to develop branch and I will try to merge develop into master after and see if its fixed!
I'm really happy about this!
hello hello, not sure it's the right channel, but I was wondering:
when I do
pip install numpy==1.23.4
for example, how does pip detects, among all the available wheels in the pypi index, what is the correct one for 1.23.4 ? is it a naming convention or does it perform a kind of operation, or does the wheel can be queried to get the version?
ah, feels like there is a PEP https://peps.python.org/pep-0427/#file-format
Python Enhancement Proposals (PEPs)
How is flet for Android dev?
hi i need help
Hello, I need some ideas for pentesting features or tasks I will implement in my mutlipurpose cybersecrurity tool please
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
you know what pentesting is right?
yes
unfortunately many pentesting tools can be used for malicious purposes whether intended or not
should I use setuptools for a tool made for linux? Or there is a better way to make an installation for my tool on linux?
I want it to be fully integrated with the linux system, like when I type in the terminal:
myToolName
it should turn blue and be accessible from anywhere in the system
can't say for python ecosystem regarding different ways for installing.
But i can say, that if you want it globally accessable you have at least two ways
- using pip to install it globally
- compile to binary and add application binary to any Linux folder with binaries mentioned in $PATH (installing process can be just
ln -s source_path folder_wtih_binaries_paththrough soft symlinks, or throughwget/curlto users then)
both versions are kind of reliable, with second way more reliable to have accessability for linux than first one
using pip will make it only usable through
python3 ./myTollName
right ?
And is there a better way like :
git clone from github rep
pip install -r reqs.txt
cp -r . usr/local/bin/toolName
will this work ?
ergh... i know that pip/python contains a way to hook up entry scripts into its installable packages
so pip install docker-compose
and it becomes available as docker-compose --arguments globally without python3 writing in its invocation
or ansible-playbook contains the same
i remember briefly somewhere reading about it
django for that matters has the same too. django-admin command gets hooked into user interface
i think i remember it is setup somewhere at the level of some kind of setup file
together with using argparse or click for interface, you can make nice hooked interface
thanks this is helpful
and installation wise, pipx allows installing package as "global" but wont cause issues with other python tools that might have conflicting dependencies ..
execute binaries from Python packages in isolated environments
A simple project - new in python -
https://github.com/AbodShah/DownloaderTool-YouTube-Instagram
Is it better for a cybersecurity tool to be menu based or like this:
myTool --option1 xyz
myTool --option2 xyz
etc ?
no
check out shebangs
setuptools entry_points -> console_scripts should do this for you
Okay so I saw this thing on github and figured looking on discord would be a good place to go
And it says using python you can get cou s for yourself
And I'm not sure how to get it to work
hey, in git merging from develop branch do main branch, would you rather opt for feat(develop): merge branch or feat: merge develop branch ?
taking into account conventional commits
https://github.com/darklab8/darklab_autogit
I made a tool capable to enforce those rules automatically btw
I think better merge(develop): branch or merge: develop branch no difference
Because merge is not a feature according to conventional commits
whoah, that's amazing. i'll check it out
makes total sense, thank you!
for future merges, should i end the commit message like v2, v3... ?
since i'm not using release tags
Uh-huh. Semantics versioning of the tool works on git tags, not release tags
Just on regular git tool capabilities
I mean... The tool above already provides calculating next release version based on your submitted commits 🙂
With also generating changelog of changes of new features and bug fixes in markdown
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
I'm probably missing something obvious but I've run into one last stumbling block in migrating my project over to a proper pyproject.toml rather than setup.py/requirements.txt, in my toml for my dynamic version (I'm using Hatchling) I'm not sure what kind of path its expecting for [tool.hatch.version], I'm running py -m build from my project directory, my __init__.py which contains my __version__ is in my topmost module directory so:
my_project
┗╸__init__.py
pyproject.toml
Yet a simple:
[tool.hatch.version]
path = "my_project/__init__.py"
Isn't enough, if I want it to work I have to give it the entire absolute path for some reason.
We are excited to be working on the open-source project,
https://github.com/promptslab/Promptify, which has been trending on GitHub and provides solutions to NLP problems using LLMs such as GPT, PaLM, etc.
We'd love to have like-minded contributors join us to discuss new features and core structures. If that sounds like you, please do reach out to us to get involved! 🙂
I'm wondering if someone is available to have a convo with me about packaging a project. I have a few sequential questions. I'm more used to node things these days, and getting a little dizzy reading the python packaging docs with how many different tools and ways there are to make a package.
Usually it's better to start with a question. That way everyone can help you as they have time and ability.
It's been forever since I made a python package. The official docs recommended using hatch, but hatch is kind of huge and there's no real tutorial, just reference docs.
-
How do you set up a pypi package that has importable as well as CLI-executable functionality? Like, after a pip install, somebody could do
$ myproject --some=argfor example, as well asfrom myproject import thinginside an app? -
What are best practices to define dependencies and install them? I'm using
pipenv, which is kind of awesome, but I’m not sure if that's stepping on the toes of hatch. It’s kind of confusing to have to manage aPipfileor even just arequirements.txtseparately from thetomldeps. I'm more used to node-style these days, where everything is defined in one place (thepackage*files). Like, the build system looks to that for people installing your package, but during dev, you also justnpm ito install them in your local “env” (node_modules, not a venv) and usenpxto run files using your env. Is there ahatchcommand to install the defined toml deps in a venv or local dir? Or do you just have to manage your requirements yourself during local dev, however you see fit, and then make sure you also include them in the toml when building and releasing? -
What’s the recommended loop for local dev in terms of running your app? Just have your venv set up and
$ python path/to/my/script.py? Or is there a better suite of commands to run your project using the defined deps, likenpx?
Sorry for the wall, and thanks in advance.
just a tiny bit above answered question number 1: #tools-and-devops message
- pipenv is very broken tool, definitely recommending to work with poetry.
- What’s the recommended loop for local dev in terms of running your app? Just have your venv set up and $ python path/to/my/script.py? Or is there a better suite of commands to run your project using the defined deps, like npx?
in general poetry and... pyenv will cover all possible needs to run your application
pyenv = switches global python between versions quickly
poetry = will work like npm, and automatically create correct venv version and install stuff into it. poetry shell, poetry install. For running application it is still better using python3 path_to_your_script for dev env of course. But your should really get how works python packaging system in order to be good
@rapid sparrow I went with poetry and it is WAY easier to learn and use than hatch, IMO. Thank you!
for third thing:
recommending launching any scripts like
python3 -m package.subpackage.script_file
or python3 filename_in_current_folder.py
don't run scripts with writing address in sub folders through regular means, if you need to launch script in subfolder, use -m argument to do it via python packing system
this ensures that your scripts will have access to same absolute import package_name.libs as any other files
no problems will be with importing during script runs, or during test runs then
python3 -m package_name, will launch code from __main__.py file btw in package_name
Basically, your python files should not need to have hacks in PYTHONPATH for their working 😆
isnt it usually preferable to test against the installed version of your package rather than relying on sys.path? in that case you already have the freedom to run your script in any way, minus the pitfall of a flat-layout project
or perhaps im not aware of a situation where you need to test the working tree directly?
no no no.
usually we test application before it is packaged
because from package we have often excluded tests
package is compiled/packaged result. it can be even not tested at all. preferably tested though, to ensure that during packaging important files did not went missing
yes the tests might not be in the wheel itself, but that doesnt mean you can't run tests on it - afaik thats what tox does, installing your package into a virtual environment then running whatever commands in the project root
Hello guys, moved from conda and pip to poetry few months ago and now my task is to create a simple package - before I was doing so with setup.py and stuff around it but now I'm like... wait, how should I create a package with poetry? Can you guys please help me out? ❤️ Thanks!
what a good question 😁 i will need to find out that too. As i do poetry package too.
i planned to use setuptools if i will not find it is possible in pure poetry though, https://pypi.org/project/setuptools/
https://python-poetry.org/docs/libraries/#packaging oh wait, there are commands to build and publish in poetry itself
https://python-poetry.org/docs/libraries/#publishing-to-pypi
Libraries This chapter will tell you how to make your library installable through Poetry.
Versioning Poetry requires PEP 440-compliant versions for all projects.
While Poetry does not enforce any release convention, it does encourage the use of semantic versioning within the scope of PEP 440. This has many advantages for the end users and allows...
in general recommending to read official documentation btw 🙂 https://youtube.com/shorts/-yWiHsGdFKQ?feature=share
I'm actually trying to build and package a I'm getting errors all over my screen lol, but yeah, it's probably not that hard I hope 😆
i just tried building, mine builds pretty fine 🙂
read errors/ or provide errors to identify problem further
yeah yeah ofc.. I just made a repo with all the code I needed, made setup.py and be like... oh wait... I use poetry now.. something is not right 😂
well I think I'll make a clean repo, try to build it, add some stuff and try again, chillz, have a good one mate!
Has anyone used ReadTheDocs? I have some general questions that can't be answered by their documentation.
ask the question and someone who knows can answer
ive used it for one project and the main struggles i had was learning sphinx and realizing that the builddir had to be changed to _build for rtd to find it
@willow pagoda Thanks. I played around with their tutorial repo and am confused.
My questions assume I am in one Github repo with both project source code files and Sphinx/MkDocs documentation.
- RTD is just a builder/hoster for docs you've already created in Sphinx/MkDocs, correct? I.e., you work on both source code and documentation separately?
- If I change some source code file, maybe just add a comment, RTD rebuilds the entire documentation. Why? RTD can't read anything from the source code files, just the documentation, so why does it rebuild?
- Why does RTD talk about 'continuous CI/CD', like its somehow linked directly to your source code? If I change my source code drastically (method names, constructors, etc.), the documentation doesn't reflect any of that, right? I have to manually update the Sphinx/MkDocs files. The way the RTD guides are written, it seems like RTD does some automatic detection of code changes to update the corresponding documentation pieces, which I know it can't possibly do. Maybe I'm just overestimating it.
And lastly... can I have RTD documentation in a separate repo while having source code in its own? This is just cleaner to me. I am assuming the only reason RTD docs are kept in the same repo as source code is to automatically trigger build updates, but again, as source code and documentation are totally separate... why does it matter? You change code and then update the docs after... does RTD have some special ability I'm missing?
I can answer some of this: Sphinx has the ability to automatically generate documentation from the docstrings of a class or a function. This means that changes to your source code may result in changes to your documentation.
@empty rover I see... so this is more of a Sphinx problem than an RTD problem for me. Because I was so confused by RTD's requirement to have your code open-source on a repo for the free version. I figured, if documentation is separate from code, why bother hosting code, just write the docs and host on RTD... but if Sphinx can do what you say... hmm.
yup what hofmann said, sphinx has two built-in extensions for this
https://www.sphinx-doc.org/en/master/usage/quickstart.html#autodoc
https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html
sphinx.ext.autodocprovides directives that can expand themselves using docstrings from your codesphinx.ext.autosummaryprovides the.. autosummary::directive to generate .rst files using autodoc directives
enable them in your conf.py and write an .rst file with the appropriate directives to use them, for example:
https://github.com/thegamecracks/berconpy/blame/main/docs/source/conf.py
https://github.com/thegamecracks/berconpy/blob/main/docs/source/api.rst
iirc rtd starts you with two documentation versions, latest and stable, the first one updates according to the branch its configured for, but you can deactivate it in the versions tab
https://docs.readthedocs.io/en/stable/versions.html#version-states
and for stable you manually trigger a build whenever you want
Thank you very much. This helps a lot.
oh wait, stable also updates itself when you tag a commit with a semantic version that isnt a prerelease (as described in the last link)
Honestly for a documentation software, the documentation for RTD sucks 
I feel like all my questions could be answered by an explicative diagram showing the workflow of an RTD project.
for me i just had to read the bare minimum to get my docs hosted, but setting up the sphinx documentation beforehand took the most time
their tutorial's a decent start, and i'd summarize the workflow as bootstrap docs/, type some reST, run make html in docs/, view build/html/index.html, and repeat until it looks ready to push
thanks a lot. you've been a great help.
hey guys
i'm trying to clear my repo history on github cause it shows error while deploying it and it caused by the deleted file
Create a new branch with git checkout --orphan branch_name (the --orphan will make it have no parents and the root of the history, like the git init state).
Then delete your main branch, and rename your branch to main or master or whatever. Commit your code and push.
do u have a youtube video shows me how to do it loks a bit complicated xd
I do not have a youtube video (and I also personally do not recommend learning from videos), this is all just a short list of commands.
Do you know how to delete a branch?
alright can u guide me then
it is
a file that i added then i deleted
but it stuck in history and when i'm trying to deploy it just shows
error and it fail to deploy
Oh wait, do you want to delete all your history?
yeah
check it shows (Delete _redirects)
So first you should create a new orphan branch just git checkout --orphan branch_name
Then delete the main branch git branch -D main
rename your branch to main git branch -m main
and then you're set, you just have to commit and push
alr
You should you the cli for this
Are you on Windows?
i'm on ubuntu
Ok so open the terminal in the repository's directory
alr
i'm in
Open a new terminal in that directory pls
i did
Where is it?
it's in the hidden bar don't worry about it xd
Sure lol, so just execute the commands that I explained about earlier in the terminal, commit and push and then you're done.
alr let me try it sec
Sure
brench name is the name of the project right ?
Branch name is the name of the branch
xd
It's just a random name, you can pick any name (assuming you are talking about the name I picked branch_name)
ah got it
and what about branch main
That's just the default name for the main branch (master can be used as well) but since that's your default main branch of github there is no need to really change that
so now i just need to push it
Did you commit?
i did all commands u sent me
git checkout --orphan branch_name
git branch -D main
git branch -m main
I didn't send the commit command, but I guess you can use Github Desktop if it shows you the branch
Did they all work? Because some projects use master instead of main for the main branch.
i used master
and it worked
Didn't git branch -D main give you an error if you used master?
it gave me noth i guess
Deleted branch master (was e7bdfae).
this what it shows me
Oh okay, so just commit and push this
git commit -m "initial commit"
git push origin master
only !
forgot git add .
so i do it before commit !
Yes
alr
it shows an error
Send the error please
o https://github.com/dimensionthug/prewebsite.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/dimensionthug/prewebsite.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[8:48: command not found
Oh interesting... Give me a second pls
alr
Just force it using -f
That worked for me
can u send me the full command
git push -uf origin master
i guess it's done
numerating objects: 21, done.
Counting objects: 100% (21/21), done.
Delta compression using up to 4 threads
Compressing objects: 100% (19/19), done.
Writing objects: 100% (21/21), 9.68 KiB | 9.68 MiB/s, done.
Total 21 (delta 1), reused 16 (delta 1), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/dimensionthug/prewebsite.git
- e7bdfae...068305a master -> master (forced update)
Branch 'master' set up to track remote branch 'master' from 'origin'.
That means it worked, check it
here you're done
i guess it works
let me check
it still failed to deploy
idk why
Very interesting, why did it fail?
i have no idea
Maybe you have an error there or smth, check the logs
==============
Using Nixpacks
context: e1a981e64bc431acdf3663a2b7f2ae7b
Nixpacks build failed
Using subdirectory "wordcount"
Nixpacks was unable to generate a build plan for this app.
Please check the documentation for supported languages: https://nixpacks.com
The contents of the app directory are:
pycache/
wsgi.py
templates/
urls.py
settings.py
views.py
init.py
asgi.py
Showing 23 logs
App source + Nix packages + Docker = Image
this is the build logs
i guess i'll try to upload it in dif website
host
@heavy knot btw do u have any free host dynamic web
so i can test on
i guess fly.io
is good example
to try on
Heh, running GUI programs in docker for windows works. https://stackoverflow.com/a/75392952 | happy python docker noises
btw i believe the error message is explaining to you that your project structure isnt correctly organized, and that you should click the link they gave you and follow the guide for your language, i.e. python
https://nixpacks.com/docs/providers/python
probably a relevant part:
Python is detected if a
main.pyORrequirements.txtORpyproject.tomlfile is found.
their message also seems to suggest it was looking inside wordcount/ rather than using manage.py
i guess i don't have any of that in my files i can show you my files and guide me through it if u can cause i'm really new to python and django and i'm trying my best to learn and i felt frustrated last night and quit learning and today and started over trying to solve the problem again and it will be super helpful if u do so 😄
this is all files i have inside wordcount
well a requirements.txt file is what you most likely want, otherwise nixpacks wouldnt know what dependencies your project has
if its just django and gunicorn (the webserver that nixpacks prefers apparently), your requirements.txt could be as simple as: Django gunicorn or if you want them locked to a specific version: Django==4.1.7 gunicorn==20.1.0
@vocal pewter so the question is about why these tests fail or what it actually means. https://github.com/autokey/autokey/pull/785
TOTAL 9298 6260 2370 139 30.0%
report run-test: commands[2] | coverage html
/home/runner/work/autokey/autokey/.tox/report/lib/python3.7/site-packages/coverage/html.py:111: CoverageWarning: No contexts were measured
self.coverage._warn("No contexts were measured")
Wrote HTML report to test_coverage_report_html/index.html
___________________________________ summary ____________________________________
clean: commands succeeded
ERROR: coverage: commands failed
report: commands succeeded
Error: Process completed with exit code 1.
i was wondering if someone could explain if it can be ignored or what it means
Your failure isn't with tox or coverage. You have a failing test.
=================================== FAILURES ===================================
_____________________ test_application_runs_without_errors _____________________
caplog = <_pytest.logging.LogCaptureFixture object at 0x7f39e6722090>
@patch('autokey.dbus_service.AppService' , unittest.mock.MagicMock())
@patch('sys.argv', ['autokey-app-testing'])
def test_application_runs_without_errors(caplog):
> subprocess.call(["xhost", "+SI:localuser:{}".format(os.environ.get('USER'))])
tests/UIs/test_headless.py:41:
what i don't understand is why it fails if i fork with only master but works if fork with all branches
the first error was on their dev branch so that might be on them
but this fork one makes no sense to me
oh wait i think i see why now
> assert_that(git_tag_version, is_(equal_to("v"+autokey.common.VERSION)),
"Ensure the most recent git tag version matches the version number in lib/autokey/common.py")
E AssertionError: Ensure the most recent git tag version matches the version number in lib/autokey/common.py
E Expected: 'v0.96.0'
E but: was ''
tests/test_common.py:38: AssertionError
@vocal pewter ok thanks, i'll focus on that first error. I mistakenly assumed they failed for the same reason.
Good luck.
I have no idea. :) I just looked at the CI output for a coverage error and found a pytest failure.
i clearly did not look well enough since it's right there to see. oh well. thanks gain
@vocal pewter apt install x11-xserver-utils fixed it.
can you link me a video explain that so i can learn from it in details
a video on listing dependencies...? its a pretty simple process, you're just listing the packages you installed through pip
https://pip.pypa.io/en/latest/user_guide/#requirements-files
https://packaging.python.org/en/latest/tutorials/installing-packages/#use-pip-for-installing
if you mean deploying a django website, i cant help you with that beyond linking their documentation https://docs.djangoproject.com/en/4.1/howto/deployment/
hey, simple git question
in the description of merge commits, should i list the merged commits from oldest to most recent or the other way around? (top to bottom)
Just make generic deception what feature it brings in sum of its commits
i did, but i felt it was clearer for me to describe what actual commits are contained in that merge
i guess it just comes to personal preference, i feel i prefer it most recent to oldest but wondered if there was some common practice or anything
if you want to list commits anyway, you could do it like a changelog, use chronological order
I want to make an Instagram auto mail collector I wonder how I can collect the e-mail of the account from the recommended ones of the account?
might not be the correct channel, but in matplotlib I am trying to plot a line graph but if there is no point next to it I want to plot it to 0.
How can I authenticate for a mirror using devpi? I'm trying to create a cache for a private index, but can't find how to authenticate into that index using devpi
You're looking for #user-interfaces
Depending on whether you're using numpy of pandas for the data, they have functions to create intermediate values between existing data points
Hi guys can I get some help on how to build pc
Hi Guys
Is there an official way to install dependencies from pyproject.toml (setuptools backend) without installing the package itself? It'll be for docker to cache my dependencies before installing the source code itself. Although in reality it's a pure-python application organized as a package, so perhaps I should get rid of the installation metadata entirely and use a requirements.txt file...
My current workaround is using a short script to extract and install the dependencies manually.
toml is a pretty known file format....
python has even inbuilt library for this https://docs.python.org/3/library/tomllib.html
just.. read file, parse, and install like it is a regular requirements.txt?
thats the workaround im doing
may be there is better way though
mhm
somewhere in setuptools or smth
actually you know, poetry uses pyproject.toml for dependency management 🙂
you can just install stuff with poetry
i have an instruction how to install it for docker easily
FROM base as dep-poetry
ENV POETRY_HOME /opt/poetry
RUN python3 -m venv $POETRY_HOME
RUN $POETRY_HOME/bin/pip install poetry==1.2.2
ENV POETRY_BIN $POETRY_HOME/bin/poetry
COPY pyproject.toml poetry.lock ./
RUN $POETRY_BIN config --local virtualenvs.create false
RUN $POETRY_BIN install --no-root
COPY src src
ergh. feel free to skip venv stuff i guess
poetry can specify which dependency groups to install, with --with --without smth arguments
poetry's what i used in my first dockerfile, except i went with two separate venvs and copying the project to my second stage
but i just want to use setuptools this time
FROM base as dev
RUN pip install poetry==1.2.2
COPY pyproject.toml poetry.lock ./
# RUN $POETRY_BIN config --local virtualenvs.create false # do we need it?
# RUN $POETRY_BIN install --no-root
FROM dev as pre-prod
RUN poetry export --without-hashes --format=requirements.txt > requirements.txt
FROM python:3.10.5-slim-buster as prod
WORKDIR /code
COPY --from=pre-prod /code/requirements.txt ./
RUN pip install -r requirements.txt
original file from here https://github.com/darklab8/darklab_article_docker_python/blob/master/example_frm_django/Dockerfile
oh yeah, u can use poetry to extract to requirements.txt file
huh
Sorry about the long message, TL;DR I'm having trouble learning to use Hatch beyond what's in the documentation, does anyone have good resources or repos that use Hatch that I can look at?
Does anyone have much experience with Hatch (https://hatch.pypa.io/)? I'm using Poetry for my projects now, but I'd really like to try Hatch for a few projects. I specifically want to try it for building in a container with devops; I already use a Poetry Dockerfile very similar to the one @rapid sparrow posted a few messages up (actually, you helped me trim my version down a bit! 😄), but I'm having trouble wrapping my head around actually using Hatch.
I can't seem to grasp how Hatch handles dependencies and environments. With Poetry, I can install dev dependencies like Black so VSCode can autoformat on save; I created a "dev" env in Hatch, and it seems like it creates it successfully, but I'm wondering if I can use a combination of Hatch for environment management, and another tool for dependencies. Am I meant to install new dependencies by using Pip inside of Hatch?
Resources for learning are pretty sparse for Hatch, I've only found a couple of blog articles that were helpful, but I just feel like I don't fully understand the tool. I've read through the docs, which don't have many examples, or link to sections I feel are underdeveloped (like editing Hatch's config at ~/.config/hatch/config.toml), and it feels like there is a lot I should "just know" that I don't when I'm reading through the docs.
Any good learning resources, or repos where you've used Hatch that I can take a look to see how things are structured? 🙂
There's the #hatch channel in discord.gg/pypa where you could probably get some quality help. Black is actually packaged using hatchling now, but we don't use any of Hatch's features ATM.
Awesome! Thank you for this 🙂
Hello everyone! I wonder what the best practice for release a Python project with GitHub workflow is. I'm trying not to push to main branch directly, so maybe creating a published release manually is the way to go? Normally after merging a pull request.
name: Build and distribute
on:
release:
types: [published]
jobs:
ci-run:
name: Run the Test suite
uses: obfuscated/obfuscated/.github/workflows/ci.yml@master
build-and-release:
runs-on: ubuntu-latest
needs: ci-run
steps:
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/checkout@v2
- run: pip install wheel
- run: |
ref = "${{ github.ref }}"
tag = ref.split('/').pop()
print(f'::set-output name=tag::{tag}')
shell: python
id: tag
- run: >
python setup.py
bdist_wheel
--build-number ${{ github.run_number }}
env:
TRAVIS_TAG: ${{ steps.tag.outputs.tag }}
- name: Get package name
run: echo "::set-output name=package-name::$(python setup.py --name)"
id: name
- name: Copy to s3
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
source: 'dist/'
dest: 's3://obfuscated/${{ steps.name.outputs.package-name }}'
flags: --recursive
aws_region: eu-west-1
Ideally, you create only Release of product in Github, then automatically runs github workflow and deploys it
Thanks! I appreciate this process myself, but I wonder if there's a way to automate versioning for the project itself as well, which seems a bit redundant to do every time.
hehehehe
i made a tool for this
i mean u can use just something like auto generated version matching Github Action workflow run, but i made tool that automates following Semantic Versioning for product releases
https://github.com/darklab8/darklab_autogit
scans git tags, and suggests next version based on present feat:, fix: commits
also generates changelog of new features and fixes
i usually make releases with running command autogit version --tag --push, it automatically generates next version, and pushes as git tag to remote
this tool also helps following git conventional commit standard to have better descriptions to git commits
friendly one file binary format for any OS and architecture 🙂 written in golang.
Very dedicated tool! The Semver flow seems pretty interesting, although what I'm trying to achieve is combine the Python & Git versioning together.
And I just discovered this tool, which seems to do the job, I guess
I'm building a web crawler with selenium and I want to deploy it with selenium. Crawler is composed of two part, a chromedriver instance running in one container and my code who connect to running instance to process data. After trying to find a way to pass args to my code container via docker compose, I finally choose to just put var in .env file at build statement and use they are env vars in my program. So my python command to run crawler in dev is python -m mcrawler --use-env-vars. But when I use it in docker file, it seems --use-env-vars does not havec effect. This is my code in __main__.py and in Dockerfile. Thanks in advance if someone can help me.
Might be a weird question, but anyone here knows how to put a custom SPS and PPS value on python library PYAV to decode an h264 stream? If I am wrong, what is the correct channel to ask the question?
I think this is the right channel but; I’m currently building a prototype game engine in python. It’s a side project, nothing special, just to learn game engine and game design. My issue is that I have working code but the speed/frame rate of the code overall isn’t the best. I’m aware that python isn’t great for speed but I know most of the lag comes from the graphics library I’m using, I’ve already started the process of switching to a diff graphics library. But my main question is there a way I can compile or convert the python code directly to C or another language that will be faster?
Primarily without having to add a bunch of none python code? Also if I desire to ship this demo to my discord server is there a way I can freeze this compilation using let’s say a compiler such as pypy?
Technically u can if using different python compiler like Cython
My concern with cython is that do you have to add a bunch of extra code to make cython run?
Such as writing code to specify certain thing for each individual definition?
As far as I see in tutorial, yeah https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html
U need to use Cython variables for its magic to work
As far as I remember, in limited amount it will speed up your performance even without Cython variables usage. Effect of speed up will be just way worse (2x at max)
Thank you, I’ll look into compiling with cython without having to use those variables.
Also if I freeze the code into a single exe. Will that allow me to use the cython library?
Cython stuff I think works only if compiled to binary.
Cython = compiler of Python to more C like level code
It should not work without compiling may be
So once it compiles does it create a standalone c code that I can run on its own? I know I should just read the documentation. Im just trying to see if this is worth the effort vs switching to another language
Static compiled code can be only compiled and only then run in theory.
I think u a supposed to be always compiling... Which means its translation to C and then to assemble / binary stuff.
Kind of questioning how Cython runs unit tests though then
This post is about using pytest for testing cdef functions in Cython.
Ok so I think I’ll take a moment to look at how much further I want to prototype this engine. If I continue prototyping then switching to another language will be harder. So im thinking I should instead figure out what language I should be switching too instead and if switching is worth it. Thank you @rapid sparrow! I appreciate your insight!
Consider switching to Rust or Golang 🙂
Or may be even going c# or Java way
You can't improve what you can't measure. Before switching language and throwing the baby with the bath water, it's worth exploring where it is being slow and why
How to write a python program to analyse the first captured frame of a PCAP file which is a DHCP protocol?
Quick question, if I declare the same env variable in dockerfile and as a docker run flag, which one takes precedence?
https://docs.docker.com/engine/reference/commandline/run/#env
Use the -e, --env, and --env-file flags to set simple (non-array) environment variables in the container you’re running, or overwrite variables that are defined in the Dockerfile of the image you’re running.
Thanks, I missed that part
Hey there! I'm am in a real bind at work. We develop some python applications that are deployed on an aarch64 embedded computer and we are really needing to implement CI/CD build pipelines for gitlab. Unfortunately, our infrastructure at my company is terribly unhelpful. We only have access to x86 servers for building and tools like docker buildx or docker in docker are just not viable options for cross compiling.
I need to do the following:
Create virtualenv
pip install -r requirements.txt
cd library-written-by-us
python3 setup.py install
pyinstaller myapp.py
And get a native aarch64 binary out of the project. This is very easy when done on a local aarch64 dev machine, but I need to do something like this on an x86 server in gitlab. What is the best approach for cross building our python application to aarch64 while making sure that all the dependencies in our requirements.txt match the platform as well? PLEASE any help or advice or experience would be supremely appreciated. I've tried many solutions but nothing is working in our cloud. Docker in Docker with buildx is a nonstarter because the infrastructure is such crap. I believe that doing the cross build in just a regular Ubuntu18.04 container is our best bet to make sure the pipeline works but I'm just stuck. Not a lot of discourse exists online surounding this topic that is particularly helpful. I've even consulted with chatGPT which suggests cross compiling python3.6 (our target version) and using qemu to run the aarch64 version of python and install all the deps. Is this the right approach or is there something better that I should be aware of. THANK YOU in advance
It buildx is not an option, perhaps to explore if docker WASM is applicable?
From my experience... Python cross platformness sucks and we could say not existent.
Best option going buildx
Perhaps to try WASM Docker.
And if both aren't available, then may be even using vagrant xD
AWS has arm64 instances, easier probably making runner already with arm64 onboard
Ergh, assuming u target arm64 of course
Aarch64 is not CPU architecture. It is only distro
If your CPU architecture match, u can just build on x86, resolving distro details at level of regilar containers
Using arch image as base or smth
Okay. This is what I feared. I'm probably going to have to go through the arduous and painful task of onboarding our native arm64 machine as a gitlab runner. Thank you for your input. If anyone else has any nuggets of hidden wisdom, please let me know.
I feel a bit betrayed that python doesn't have infrastructure in place for easier cross compilation. But maybe I'm just an asshole with expectations that are too damn high 🙃
As far as I searched this is decision made consciously by CPython developers.
If u wish cross platform run, then don't compile in CPython
Or use alternative python implementation like Cython. It should be having cross platform features perhaps. (Or Jython and etc)
In any way I just gave up and used Golang, it is cross compiled natively with single flag change to any OS/CPU architecture without any problems as long as u don't use CGO(even with CGO cross compiled though)
You should be able to use cibuildwheel for this.
you can utilize one of the configuration settings here: https://cibuildwheel.readthedocs.io/en/stable/options/#repair-wheel-command to go from just making the internal dep into per-platform wheels to also handling pyinstaller.
docs on this provide the default as 'auditwheel repair -w {dest_dir} {wheel}' and point out that it is treated as a shell command, and explicitly note you can extend it with && whatever_else, or in your case, pyinstaller use.
Long shot but has anyone built any sort of slack scraper?
Thanks for the responses @rapid sparrow and @fallow storm. I'll check those out. I successfully compiled python3.6.9 for aarch64 earlier today. Weird thing though is that pyinstaller fails to install through pip because python3.7 or higher is required. This is weird, because the system we're targeting, the Nvidia Jetson Xavier NX, has python3.6.9 and install pyinstaller no problem. Even if I copy the wheels from the NX computer and try to install them, python rejects it because the package says python is out of date. Does anyone know how this can be if I am using literally the same version of python and it works on one machine and not the other?
whats the best way to handle docker and python libraries togethor
do you use venv and docker togethor?
cause both virtualize so are both of them needed? or can i just use docker?
but if i use docker how do i get the requirements file do i manually create it?
or is the docker container created first then everything is installed in there?
but then if i kill the container everything dies
im assuming this is the way but i have the dooubt about creating the requirements file
cause if i use venv i can easily track the packages but is it necessary since we are using docker?
i just learnt docker and im trying to host an application so im trying to figure out the best way to do it 😅
I don't see any point to making a virtualenv inside a docker container
of course
sso i will make a requirements.txt file manually right?
also i just found out poetry is it the same as venv?
that's the simplest way, sure
if I were you, I'd use as few fancy libraries as you can get away with, until you understand what you're doing
poetry is nice but it's sort of like trying to drive a semi-trailer, when you have never even driven a car
python and pip
In 99% cases when u use docker, u don't need venv.
How u track dependencies normally?
venv
Venv is not dependency tracker
U can't do it with it
U can track dependencies with
requirements.txt, constraints.txt, pipenv and poetry
yes i use venv then pip freeze the results to a requirements.txt file
but i get what you are saying also i used to use venv because i use wsl and alot of packages do not install properly until i use venv
That is better answer, but essentially u do the most primitive dependency tracking, because u don't know what u need, and what are your main dependencies
Recommending as next step doing next thing
pip freeze > constraints.txt
Write into requirements.txt by hand main deps without version lock
Install as
pip install -r requirements.txt -c constraints.txt
Constraints file deps aren't installed, they lock stuff installed by requirements
u are not using WSL2 with fully fledged Linux virtualization?
im using wsl2
Then I don't get your problem. Docker image should be having easy time installing your deps without venv
What do u use as image basis?
yes i just learnt docker today
Docker Deep Dive book is good one to learn it
so i will try it wth itt today
thank you i will try too look into it
the python alpine one
or just python:3.8
alright
Due to different C compiler and stuff
Also alpine has bug for some python version to compile/install stuff 50 times slower
Does anyone have experience setting up visual studio's c/c++ python debugger?
https://learn.microsoft.com/en-us/visualstudio/python/debugging-mixed-mode-c-cpp-python-in-visual-studio?view=vs-2022#enable-mixed-mode-debugging-in-a-cc-project
I got as far getting a python file to load and execute in my c++ but when I add the file to my project and set a breakpoint it gives me a symbol not loaded error.
Development, QA, Operations, Business. Long ago, the four business positions worked in silos, but everything changed when DevOps appeared.
Only the DevOps Avatar, master of all four positions, could unite them. But when the businesses needed it most, DevOps was just emerging.
Years passed, and DevOps became the bridge between the business positions of marketing, sales, finance, and operations. With the help of this modern practice, we could integrate these positions, create efficient workflows, and deliver business value quickly.
As DevOps practitioners, we are the catalyst for change, breaking down the barriers between the different business positions to ensure seamless collaboration and efficient delivery of high-quality products or services.
In reality, DevOps person usually deals with infrastructure as a code for web infra. Which speeds up development, makes faster getting feedback, documented as a code stuff, gets development approach to getting reliability, observability and etc in infrastructure
Basically DevOps people are software web devs which care about maintenance of a product usage in the most automated way, automating toil as much as possible
Common to adhere to those principles
https://12factor.net/
A methodology for building modern, scalable, maintainable software-as-a-service apps.
On a more philosophical side in entirely different termin meaning, DevOps is actually about making everyone care about other side of product development in order to receive better, faster product.
Ergh... There are two different things named DevOps, which happen to have same word by accident and HR fault
One of them means which stuff does DevOps engineer, second one describes DevOps as a culture in a company/team
Guys is it possible regarding verson control to share without using git & github between 3 people
version controlling is possible with using Git + smth else (Gitlab / Gitea / self hosted CLI Git server and etc)
When you work in a company you get github account from that company right?
And it could be gitlab or github or self hosted CLI git as you said
it depends on company policies. Usually it is good practice to create separate account regardless of existing policies
Have you ever worked with junit or mockit testing tools
Quite briefly got started on junit, already used it very minimally. Only started learning Java
Familiar with unit testing in two other languages
I am only familiar with python unit testing
How is it different
Is it tough to learn?
Java is considerably different from Python in general 😁
static typed world is different one (python has typing too, but rarely who uses it)
otherwise, principles are you know, mostly same
Is it necessary to learn i mean can i do the same job with python unit testing?
using python unit testing in Java? no of course you can't (partially can, but you should never do it)
Actually i am applying for a job and required skill is junit or mockit
Ok thanks
Java unit testing can be done only in Java testing frameworks
Python unit testing can be done only in Python testing frameworks
End to end testing can be done in any testing framework for any other language (so you can e2e test java web app in python)
Technically possible to do even unit testing in cross language matter, but it is like using assemble language to write web application. Only most craziest people who value no time would do it (which will almost never happen in real life)
Ohhhhhh
Spamming in several channels the same is bad
Some might find https://github.com/pycontribs/mk useful as it does recognize python projects, including tox and pre-commit configurations too.
I prefer https://taskfile.dev/
Yaml for the win
i am trying to connect my mongo db application to the python application
both are one the same network i added a netshoot container and checked just like they did in the docker docs
this is the connection in python
but when i go to this route
it gives me time out error as i does not connect
the error
docker run \
-w /app -p 80:80 \
-v "$(pwd):/app" \
--network todo-app --network-alias todo-py \
python:latest sh -c "pip install -r requirements.txt && uvicorn app.main:app --host 0.0.0.0 --port 80 --reload"
for spining up fastapi app
docker run \
-dp 2717:27017 \
--mount type=volume,src=todo-db,target=/data/db \
--network todo-app --network-alias mdb \
mongo
for spining up mongo container
im trying to do it without the username and password in mongo db
NVM I JUST RESTARTED ALL THE CONTAINERS AGAIN AND IT WORKS NOW
does it require business knowledge
why does python 12 lines of code take more cpu usage than many tabs of google chrome
we have no idea what you wrote in them, you know? 😆
how can you expect receiving help, if you don't provide us with any information what you are really doing?
here from time import sleep
import pyautogui as pt
from pynput.mouse import Controller, Button
mouse = Controller()
class Clicker:
def init(self, target_png, speed):
self.target_png = target_png
self.speed = speed
pt.FAILSAFE = True
def nav_to_image(self):
try:
position = pt.locateOnScreen(self.target_png, confidence=.74) # region=(0, 84, 1277, 793)
pt.moveTo(position[0] + 15, position[1] + 15, duration=self.speed)
pt.leftClick(pt.position())
pt.PAUSE = 20
except:
return 0
if name == 'main':
clicker = Clicker('images/1111.png', speed=.15)
end = 0
while True:
if clicker.nav_to_image() == 0:
end += 1
# End the loop
if end > 20000000:
break
i just want to detect image, thats all
I want to fix this script error someone help me 🙂
instead of “print xyz” do “print(xyz)”
Hey @tulip stump!
It looks like you tried to attach file type(s) that we do not allow (.pak). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
Hello 👋
I have the following nginx manifest
# nginx.yaml
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
spec:
selector:
app: nginx
ports:
- port: 1234
targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx
name: nginx-container
and the ingress manifest
# ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-ingress
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-svc
port:
number: 1234
When I apply these, the service, deployment & ingress both get successfully configured.
kubectl apply -f nginx.yaml -f ingress.yaml
However, I can't seem to figure out how to reach the nginx service through ingress.
Running kubectl get ingress results in
NAME CLASS HOSTS ADDRESS PORTS AGE
hello-ingress <none> * 69.69.69.5 80 51m
Now, running curl http://69.69.69.5:80/ results in a Connection refused
The question is of course: What am I doing wrong ? :D
make diagnostics with kubectl get svc
ingress is supposed to be creating loadbalancer servide object there, which was supposed to be giving access to it over 80/443 ports
---
# Source: ingress-nginx/templates/controller-service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: 'true'
labels:
helm.sh/chart: ingress-nginx-4.0.10
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/version: 1.1.0
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: controller
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
type: LoadBalancer
externalTrafficPolicy: Local
ipFamilyPolicy: SingleStack
ipFamilies:
- IPv4
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
appProtocol: http
- name: https
port: 443
protocol: TCP
targetPort: https
appProtocol: https
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/component: controller
if copying from code of ingress-nginx deployment
if you run self hosted solutions like microk8s/k3s, they don't have working load balancers until you added support to them to cluster
MetalLB is a possible solution
for cloud managed Kubernetes Cluster like Digital Ocean K8s cluster, this is solved at the level of provider, and they initianizlize automatically cloud level load balancer
Of course may be u have a different problem
check any objects named LoadBalancer there
they supposed to be having assigned ip address
It's all ClusterIp
well. that is a problem
I'm running my cluster with minikube
your ingress did not create loadbalancer object at all
therefore nothing is present to grant external access to it
external access is provided only with next methods
- Node Ports services for 30000 ports+
- Load balancers services
- you can personally get access to services by using port forwarding for yourself
So the tutorial I'm following is wrong
Well, I tried running this https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/
This one makes NodePort service
& I still am running into the same issue
Let me have a go at it again
i used Nginx ingress, that was different experience
u a using regular basic ingress
Anyway it has mentioned that
Note: If you are running Minikube locally, use minikube ip to get the external IP. The IP address displayed within the ingress list will be the internal IP.
is supposed to be used for getting access
Note: If you are running Minikube locally, you can visit hello-world.info from your browser.
although during local running, supposed to be accessed too. Or may be previous step is obligatory
I did see that & followed it
Still nothing
I'm rerunning it again
curl: (28) Failed to connect to hello-world.info port 80 after 21056 ms: Timed out
How would I set up a package so that during creation of its wheels, it uses npm to build a subproject and then distributes the artifacts in place of that source code?
For context, the project consists of two python packages, one of which contains the node.js project and an entry point to start up a website using the generated files. I'm looking into switching from hatch to setuptools for this customized build process, but I can't find any structure I should follow for this. Is there a better way than just using subprocess.check_call() at the start of setup.py?
Can anyone point me in the right direction for how to create a connection string for Azure DevOps?
I've tried using azure.devops module, but all documentation points to using azure.devops.connect (or azure.devops.connection) and when I try either of those I get an error:
AttributeError: module 'azure.devops' has no attribute 'connect'
figured out a solution for this by creating a build subcommand that setuptools could automatically invoke
(if i just ran the subprocess commands normally, it would wastefully slow down the sdist creation)
https://github.com/Bubobubobubobubo/sardine/blob/60e7181fdbaba8eacadd53632c7f9e974043271f/setup.py
not familiar with azure but according to their github, it seems you're meant to connect to their API using the Connection class?
https://github.com/microsoft/azure-devops-python-api py from azure.devops.connection import Connection ... connection = Connection(base_url=organization_url, creds=credentials)
Indeed.
However, Connection doesn't exist in azure.devops
from azure.devops.connection import Connection
Still results in azure.devops not having that attribute error.
import azure.devops
print(dir(azure.devops))
['builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'pkg_resources']
seems to work fine for me
azure.devops is a module; it won't have a connection or Connection attribute
which is pretty annoying, now that I think about it
well it could if the maintainers chose to import it for convenience, but their init only contains a legacy namespace package declaration
https://github.com/microsoft/azure-devops-python-api/blob/dev/azure-devops/azure/devops/__init__.py#L1-L6
azure-devops/azure/devops/__init__.py lines 1 to 6
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import pkg_resources
pkg_resources.declare_namespace(__name__)```
I may also be confused in that I'm very new to python. 🙂
My goal is to retrieve a file from an azure dev ops repo.
I at least now have got past the:
client = Connection(adoconnectionstring)
Next is to retrieve the file, but not sure if it's possible with something like this (co-pilot suggested this):
filecontent = client.git.get_item(adoprojectname, adorepositoryname, adorepositorypath + adorepositoryfilename)
Again:
AttributeError: 'Connection' object has no attribute 'git'
client.get_item also doesn't work
Your IDE is supposed to show syntax. I can recommend vscode with installed Python extension
Yeah, intellisense is working, but I'm not seeing anything about get items or files, etc.
I'm using VSCode. 🙂
Is there a way to get a summary/one-liner of what an attribute of a module is suppose to be used for?
Hardest part for me right now is knowing where to look for help/explanations.
https://docs.python.org/3/tutorial/classes.html#python-scopes-and-namespaces
... for example, in the expression
z.real, real is an attribute of the object z. Strictly speaking, references to names in modules are attribute references: in the expressionmodname.funcname, modname is a module object and funcname is an attribute of it.
most dot-notation syntax you see is for accessing an attribute of some object
ideally, help(instance.attribute)
ah you meant just getting info on some specific attribute
documentation site would also be helpful too, but absent that you can try to look through the source code to figure out what you need
All super helpful, thank you!
for example, the github example shows getting a "CoreClient" from the connection before accessing its related API ```py
connection = Connection(base_url=organization_url, creds=credentials)
Get a client (the "core" client provides access to projects, teams, etc)
core_client = connection.clients.get_core_client()
Get the first page of projects
get_projects_response = core_client.get_projects()``` if you start at azure/devops/connection.py you'll find where the Connection object is declared, and in it you see that the .clients attribute is set to a ClientFactory instance:
https://github.com/microsoft/azure-devops-python-api/blob/6.0.0b4/azure-devops/azure/devops/connection.py#L35
azure-devops/azure/devops/connection.py line 35
self.clients = ClientFactory(self)```
if you click on ClientFactory, github can link you to where its defined (azure/devops/released/client_factory.py), and in there you'll see there's a get_git_client() method which is probably for azure's Git API
docs: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/?view=azure-devops-rest-7.1
code: https://github.com/microsoft/azure-devops-python-api/blob/6.0.0b4/azure-devops/azure/devops/released/client_factory.py#L46-L51
azure-devops/azure/devops/released/client_factory.py lines 46 to 51
def get_git_client(self):
"""get_git_client.
Gets the 5.1 version of the GitClient
:rtype: :class:`<GitClient> <azure.devops.released.git.git_client.GitClient>`
"""
return self._connection.get_client('azure.devops.released.git.git_client.GitClient')```
this time github can't resolve it, but if you go one directory outside you'll find a git/ folder containing the GitClient, and in the GitClientBase class it inherits from you'll find a bunch of methods that you can call on it
https://github.com/microsoft/azure-devops-python-api/blob/6.0.0b4/azure-devops/azure/devops/released/git/git_client_base.py
thankfully the devs added docstrings for them so you can figure out what each parameter should take, and the paths they use like azure.devops.v5_1.git.models.GitVersionDescriptor can point you towards the file you should be looking at (azure/devops/v5_1/git/models.py)
i gotta say it sucks that there isnt a documentation page and barely any intellisense compatibility (i.e. type-hinted code)
You are helping me get started in the right direction though, so I appreciate it.
I'll have to circle back on this in a couple hours, need to get home/dinner/etc.
I can’t connect to a docker container running inside WSL2. The container is served via a compose file, port forwarding is 8000:8000, but I can’t access localhost:8000 on the windows host saying the server sent an empty response (it runs fine with a proper Ubuntu vm) anyone developing using WSL2 had this problem?
This could be an IPV4/6 issue where it defaults to IPV6 in some cases
can I make the actual app a kubernetes loadbalancer? (or it must be another service that routes to my app)
Yes to both parts of question
MetalLB project implements kubernetes load balancer for self hosted clusters
It is used by user as service
Okay, thanks!
Are you allowing access to tool immediately after registration?
you will receive it on March 21
!rule 6 delete then
Kind of scam to gather emails and other personal data at this point
no, the first version will be released on March 21 for those who sign up for the waitlist
and is free
<@&831776746206265384>
Because u don't really provide it for free
U just advertise with gathering personal data at this point, which has a cost too. Therefore it is not free, it is payment with personal data for nothing at this point of time
!rule 6
but absolutely not, it’s free, if you want to try it before everyone on March 21 we will deliver it to you, it will be free until we reach 1M of users, we are taking investment in our startup
Darkwind is right
Please don't use our server as an ad board
on discord there is too much mischief, when you all use our AI to create websites and apps we talk about
@clear bronze we can appreciate that you're not being malicious, but you're ultimately still promoting a business venture of yours, and that isn't something that's allowed here.
If you have any questions about our policies, you can ask us over @balmy mulch
okay you’re right, I thought it might help some freelancer or student who creates websites regularly
I've got a game-themed Discord bot (running in a Docker compose) that'll have a command to display the global player history of the game. This can be retrieved through Steam's web API, so I'd just query it every n minutes and add the record to a db for that specific time to graph on-request.
Running this as a microservice is likely the best choice, since it wouldn't be dependant on the bot (and its services) being online. I could have this run directly on the hardware with Postgres and a crontab executing the script every n minutes, just exposing this to the bot's compose would be trivial. Is this the best way of running the microservice?
Hey there. Very similar project i already refactored three times from zero until i achieved level of comfort for development / maintability / and code simiplicity to do it well
What i learned from my experience
-
in attempt number one i quickly coded discord bot functionality fully, it was working... but full of bugs, hard to test because everything depended on Discord.py, including making loop task to query stuff in background. its architecture is not testable and awful, Discord.py was breaking all the time
-
in second attempt i went with proposal similar to yours https://github.com/darklab8/darklab_darkbot/tree/master/OLD_CODE2/architecture i went with many microservices, separating service parts into 4 microservices, one was important for scrapping and providing data as rest API, another one to configure user settings, another one served as simplified rest api to make requests to discord and etc. Not even was able to finish. Too many microservices led to very unpleasant development and hard to finish it. Tried using Postgresql for user settings as well
I tried to mitigate damage from Discord.py and used to redirect its input fully to Argparse, but it did not still work well enough considering amount of microservices
(Later i was recommended https://github.com/hikari-py/hikari btw, as more lightweight better discord alternative)
===
3) And the third attempt was the most succesful one. https://github.com/darklab8/darklab_darkbot
https://discoverygc.com/forums/showthread.php?tid=188040&pid=2282025#pid2282025
I just made it in golang, with having necessary loops in background as a gouroutine (which is multithreading)
And yeah i continuied redirect input to CLI library (this time golang Cobra), and giving output back to user.
Everything works smoothly, simple, as singly binary with 4 of my background multithreaded loops running at the same time.
And with almost zero dependene on any third party discord libs
So... from my experience, i recommend making it as single application. Don't make microservices when you are single dev, you are only overcomplicating stuff and making harder to finish it
Use Celery for background loop tasks in python as most reliable solution of python world, but potentially recommending exploring using just multhreading loop task in background. In golang it works well 🙂 (for python i am unsure how well this idea is) This helped me avoiding need for databases, as i just keep necessary data in memory objects, and other threads can access it in mutex lock fashion to avoid data corruption
In third attempt i went to store user settings just in Sqlite3, it was absolutely enough
end result, is single binary launchanble file, that just keeps its state in single sqlite3. Easy to build, launch, maintain. I was fully satisfied with end result
=====
even if you would split smth to microservices... good idea to have typed input/output of them, with code reusage shared between services. Makes stuff easier., which are tied to Pydantic BaseModel. Mypy/Pyright stuff is necessary for easy development and matainance. In golang and other typed languages this problem is not standing though.
FastAPI and Django Ninja are kind of welcome stuff in this regard
In general i am quite recommending Celery approach to python solution (Celery beat i mean as alternative to cron jobs), because with testing fixtures available, it is easy to test their code, and they out of the box mitigate damage of python problems having runtime unhandled errors crashing app. So yeah, Celery should be better choice in Python world in comparison to just using multhithreading looped tasks in Golang, where it is enough 
TLDR: Recommending https://github.com/hikari-py/hikari
- Celery beat https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html
if u will need smth from rest apis, then FastAPI/Django Ninja
Mypy/Pyright + Pydantic BaseModels to use more often across applications
Avoiding usage of postgres for simple bots, and just using sqlite3
Not making microservices, make a single monolith, launched in different processes (Main one with Discord + Celery beat(puts loop task requests into queue) + Celery worker(executes loop tasks requests))
Celery beat worker is persistent to crashing and will be a good cron job solution, it has its own separate process. It will run your loop requests splendidly
Ergh, due to having different processes not sharing memory, you will be probably needing to glue it with Redis for shared easy memory stuff if necessary. In golang i did not need it, since multhreading background loops (instead of Celery) kept stuff in shared memory. Golang is more resistent to error crashing.
Woah, quite the journey. The approach of having everything as one binary/app won't work for me, since I'd like a degree of resilience. If the bot ever dies, having the microservice(s) running would be ideal. Considering they're relatively small, I don't mind this.
Currently I'll just have the db running in a compose, the bot with pm2 and the microservices as standalone scripts executed by cron which'll fetch the data and add it to the db. With how lightweight they are, calling these microservices is one hell of a stretch lol
up to you, up to you 🙂 Golang made me app heavy resilient just because error handling in golang happens in code almost always (instead of encountering unexpected runtime errors). I offered Celery to complensate this problem in Python, since it will make loop tasks in its own processes, fault tollerant and protected from others. Celery offers quite a bunch of fault tolerant features. Celery code will allow to make it a single shared monolith, just launched in multiple processes.
Celery will allow easily having your cron jobs in python code instead of in cron, kind of better from the point of code maintainability and control
Hi, I have started my npm and code is running successfully
but i'm not able to access the endpoint
I'm using AWS
Not sure if you are around or if someone else reading this can help. I'm new, very likely to misuse terminology, but trying to learn!
Trying to create a connection string for Azure DevOps and then read a file from an Azure DevOps repo, but having trouble accessing the functions (methods?).
I'm using azure.devops:
https://github.com/microsoft/azure-devops-python-api/tree/6.0.0b4/azure-devops/azure/devops
from azure.devops.connection import Connection
I see the functions client_factory class: https://github.com/microsoft/azure-devops-python-api/blob/6.0.0b4/azure-devops/azure/devops/released/client_factory.py#L46-L51
And the functions from get_client_base
https://github.com/microsoft/azure-devops-python-api/blob/6.0.0b4/azure-devops/azure/devops/released/git/git_client_base.py
But don't know how to access those functions.
Specifically I believe I need the get_items() function from git_client_base.py from line 462 in that file.
Not sure how to access that after importing azure.devops though.
If I do:
from azure.devops.connection import Connection
client = Connection(adoconnectionstring) #contains the https/url
filecontent = client.get_item(<with ADO project name, repo name, etc>)
Error: AttributeError: 'Connection' object has no attribute 'get_item'
azure-devops/azure/devops/released/client_factory.py lines 46 to 51
def get_git_client(self):
"""get_git_client.
Gets the 5.1 version of the GitClient
:rtype: :class:`<GitClient> <azure.devops.released.git.git_client.GitClient>`
"""
return self._connection.get_client('azure.devops.released.git.git_client.GitClient')```
Part of my confusion is understand the relationship between the files, classes, objects, etc within a python module.
Example: I can use from azure.devops.connection import Connection
I see the Connection class (object) from the connection.py file from inside the azure.devops module.
I also see GetClientBase class (object) from the git_client_base.py file from within the azure.devops module.
However, when trying:
from azure.devops.gitclientbase import GitClientBase
I get an error:
ModuleNotFoundError: No module named 'azure.devops.getclientbase'
Long story short, we cannot use mkdocs and the github pages feature for our documentation since our current infrastructure has a big issue when we use multiple branches. All our repos are quite small with 5-8 files and max 20 functions in total.
Is there any way to fetch all the DocStrings from every file and create an one page documentation for README.md or I manually post to a Confluence page?
@pine echo I believe sphinx has a singlehtml builder that could work for Markdown. There’s also a confluence builder on pip
I haven’t worked with sphinx before. But will check it asap. Thanks a lot
There should be docstring doc building in mkdocs too somewhere in theory
At least DRF documentation was made with mkdocs and suspiciously looks like it has autodoc used too
https://github.com/tomchristie/mkautodoc
https://mkdocstrings.github.io/usage/
Indeed, mkdocs has different autodoc plugins too
services:
api:
platform: linux/x86_64
build: .
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
container_name: dc-isp-manager-api
restart: always
..
..
command:
- /app/installer
How can I execute the command /app/installer such that the container doesn't close when the command fails?
Anyone using pre-commits for fastapi project?
Wrap it in a shell command, like
command:
- /bin/sh
- -c
- '/app/installer || sleep 666666666'
Yes. Just ask your question
I've tried this, I'm sorry but my question is incomplete. Let me clarify what I'm doing exactly.
Basically I have a fastapi based webservice. Some routes are for executing some executable and getting their output, but inorder to make these executables work, I need to run an installer executable first so that it would install all the dependencies.
I need to mount some devices as well as u can see in my compose file. Installer won't work without them.
So I need some way to run installer once everything is mounted but before the web services run.
Currently as a work around, I'm first starting the container and then executing the installer by docker exec into the container.
Let me know if there could be possible to have a better solution
You can use "subprocess" module to have commands within your python script?
and you can use "subprocess.run()" to run the installer executable?
you can use the "os" module to run system commands, so "os.system()" to run "mount"
you can make sure the installer runs before the web by using an "entrypoint" option in your Docker Compose file?
And then you can use a "time.sleep()" call to wait until the device is mounted before running the installer?
so "os.path.exists()" to check if it exists?
Using entry point seemed like a solution to run the installer before running the web app. But for some reason, it would close the container after installer runs instead of running the web app.
I'm already using subprocess to run those mini exe scripts on api calls, but need to run installer before the web app runs so the mini exe can execute properly when api endpoints are called
when i learned git-commits, i had great fun enough to make entire tool that uses them 😁
https://github.com/darklab8/darklab_autogit
I present you, autogit!
Tool when activated for repository with autogit hook activate, will enforce any git conventional commits rules, specified in its autogit.yml configurational file 🙂
https://www.conventionalcommits.org/en/v1.0.0/
it enforces them by pre-commit hook
based on properly written commits enforced by this tool, it allows to generate changelogs of features/fixes for product release
and also automatically sugests next semantic version release of a product ( https://semver.org/ )
this tool is hopefully quality remake in golang of an old buggy npm tool with awful code and lot of dependencies that break the tool: https://www.npmjs.com/package/git-conventional-commits . I just kind of remade it cleaner in golang with minimal dependencies, CI friendly one binary file to use without any dependencies including git.
And just augmented with some stuff that was missing or broken
I liked that npm tool, but it was just hehe broken in some features, and author just redirected for repairements to his all dependencies authors
Is there any way I can auto configure the hooks upon git clone?
you can insert configurational instructions into https://taskfile.dev of a project. Makefiles are kind of useful for this.
as for fully automatically automatically without even single commands, you would need to have some tool installed / scripts configured that would react to git clone command
it would have been simpler to just use taskfile though, it is not like it is hard to run some kind of task hook:setup command
though you know... in order to ensure that project has its tests/lints running, people just use CI tools like Github Actions / Gitlab Ci, it ensures running lints/tests and etc stuff on every commit server side
I cannot for the life of me figure out how to make a successful connection to Azure DevOps using Python.
#imports go here
import pandas as pd
import os
import azure.kusto.data
from azure.kusto.data import KustoClient, KustoConnectionStringBuilder
from azure.kusto.data.helpers import dataframe_from_result_table
from azure.identity import ManagedIdentityCredential
from azure.identity import DefaultAzureCredential
from azure.kusto.data.exceptions import KustoServiceError
from automationassets import get_automation_variable
from http.client import HTTPConnection
import http.client
import socket
from azure.devops.connection import Connection
Get the managed identity token
credential = DefaultAzureCredential()
Set the Azure DevOps organization URL
org_url = get_automation_variable('ORG_URL')
Create a connection to Azure DevOps using the managed identity
connection = Connection(base_url=org_url, creds=credential)
Get the organization name, project name, and repository name
org_name = connection.get_client("core").get_current_connection_data().location.lower()
get_automation_variable('PROJECT')
get_automation_variable('REPO')
Get the organization name, project name, and repository name
org_name = connection.get_client(get_automation_variable('ORG_NAME')).get_current_connection_data()
project_name = get_automation_variable('PROJECT')
repo_name = get_automation_variable('REPO')
Print the results
print(f"Organization name: {org_name}")
print(f"Project name: {project_name}")
print(f"Repository name: {repo_name}")
Error:
Failed
Traceback (most recent call last): File "C:\Temp\jbq50cn4.bwh\737851cb-2b18-433f-ac16-690a5541ed1b", line 75, in <module> org_name = connection.get_client(get_automation_variable('ORG_NAME')).get_current_connection_data().location.lower() File "C:\WPy64-3800\python-3.8.0.amd64\lib\site-packages\azure\devops\connection.py", line 44, in get_client client_class = self._get_class(client_type) File "C:\WPy64-3800\python-3.8.0.amd64\lib\site-packages\azure\devops\connection.py", line 52, in _get_class imported = import(module_name)ValueError: Empty module name
Doesn't seem to matter what I use in get_client("<here>"), always ends in the same error.
Can anyone show me how can I write a python script setup.py that will install dependencies from requirements.txt and setup git hooks for my repo? I am new to python and am struggling a bit to understand this.
dunno why you'd need a script for that
to install dependencies from requirements.txt, you type python3 -m pip install -r requirements.txt
to set up the git hooks, I think you just add them to your git repo, and commit them, like any other files
also, if you do choose to write a script to do this stuff, don't name it "setup.py"; that name is effectively reserved for a special purpose
What I need to do is after clone install dependencies from requirements.txt and run pre-commit install
Wanted to do this by running one single file
And the development environment will only be windows.
No linux or mac
Maybe I can write a setup-hooks.bat or setup-hooks.ps1
i dont think it would make sense for a setup.py to install git hooks given that it only runs when your package gets built from source, which doesn't imply the presence of version control
but i guess having it define dependencies from a requirements.txt is fine, you simply need to parse the file into a list and use the install_requires= parameter to tell setuptools about the dependencies
e.g. ```py
from setuptools import setup
with open("requirements.txt") as f:
requirements = f.read().splitlines()
setup(
...,
install_requires=requirements
)```
any xonsh user here?
Auto install of hooks would be a huge security flaw. Clone my repo would equal to pawn me.
hmm, actually it would be not. if having done it with open source software with strictly defined code that just installs hooks of repository you clone, then why not
hooks are applied only to repository git operations anyway
unless persons uses git operations to this repository he would not see it
and considering that person needs concocious effort to clone with hooks installed after that... i guess he is already reviewed code to approve those hooks
there is very small difference from regular program installation process. (or pretty much no difference)
from setuptools import setup
from codecs import open
from pathlib import Path
import os
here = Path(__file__).parent.absolute()
print(os.listdir(here))
with open(str(here / "README.md"), encoding="utf-8") as f:
long_description = f.read()
with open(str(here / "requirements.txt"), encoding="utf-8") as f:
requirements = [line.strip() for line in f if not line.startswith("#")]
setup(
name="package",
version="0.0.1",
install_requires=requirements,
long_description=long_description,
url="https://github.com/package/package",
author="author",
license="UNLICENSED",
keywords=["django", "django rest framework", "celery"],
python_requires=">=3.8",
packages=["package"],
include_package_data=True,
)
trying to build package, but during building, it excludes all files, but i need requirements.txt 😆 how to add requirements.txt temporally for setup.py script during build?
* Getting build dependencies for wheel...
['setup.py', 'README.md', 'package.egg-info', 'PKG-INFO', 'setup.cfg', 'pyproject.toml', 'package']
i get error
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build-via-sdist-3fmq3qog/package-0.0.1/requirements.txt
oh wait, with python3 -m build --sdist --wheel it built for some reason sucesfully
magic 🙂
reminds me of a build issue i recently had where files werent being included/excluded according to my configuration (e.g. __pycache__ directories), and deleting the build/ directory happened to fix it
iirc it was specifically py -m build -w which caused build/ artifacts to linger, while py -m build automatically removed it (i assume they're not meant to stay there?)
I'm doing some tinkering with dokku, and will eventually try to integrate it with my current kubernetes cluster. I got dokku to run and deploy an app on a rhel 7 vm with docker, but unfortunately I'm having troubles configuring it with minikube running on the same host.
Any ideas how I can let my dokku container know about the minikube container?
After adding kubectl, kubeconfig and minikube certs manually to the container, I just get this error.
dokku@d6bb5291d1b9:/tmp$ kubectl get pods
E0316 18:40:21.428437 99124 memcache.go:238] couldn't get current server API group list: Get "https://192.168.49.2:8443/api?timeout=32s": dial tcp 192.168.49.2:8443: i/o timeout
should I switch to k3s instead of minikube so I can access it from the network? Maybe I can configure dokku to run inside minikube
Screw it, I'll use my live instance of k8s
I've got one with barely any pods on it
Hey guys. Need some piece of advice from devops guys. Currently choosing between GitHub and gitlab to host our project and I’m honestly struggling to find the big difference between platforms.
I’ve read on the internet that gitlab provides "GitLab has Continuous Integration/Continuous Delivery (CI/CD) and DevOps workflows built-in"...but github has that too, no? I've used github actions before in one of my projects... and so far it's been great. So what's the "core difference" between these two? Github has ci\ci with gihub actions.. and gitlab has it too..
Thanks for helping!
there is no big difference, they are very closely matching each other in capabilities
major difference will be only that in Github Actions u can use Actions Marketplace, while in Gitlab CI i think it does not exist, and u would have to use stuff like Ansible to achieve some cases similar capabilities, while for other stuff only using workarounds from ecosystem of public docker images, but that would be still i think less than what offers Github Actions
Less proprietary ties will be though
Also you can self-host gitlab if you choose to
I doubt there's a "core difference". github is part of Microsoft, and is presumably well funded; I'd expect them to have groovy features before gitlab.
in the past if you wanted a private repository, you would go for gitlab or bitbucket. Though github has private repos and enterprise plans now with custom domains.
github smells more "enterprise-y" to me, fwiw
got it guys. thanks for sharing your experience 👍
Pls Help Me To Export Videos File in this pak file, i upload in Pak file in this drive link, so pls help me to someone extract videos file
https://drive.google.com/file/d/103myBlbQVMHiEmnzuOxQqxDApmQfZQLS/view?usp=drivesdk
but bitbucket can link to jira
Can I have a single RST file which compiles to 2 separate pages with sphinx?
Its kinda boring to manage 3-4 line files
Hi folks. Quick question. What actually is observability? Everyone I ask gives me a different answer.
your eyes and ears to monitor behaviour of your application, seeing metrics / logging / tracing and etc of your application, that gives full undestanding that application works correctly, and giving you enough information to predict that it will be in a close future still working correctly or warning in advance about some bad events tha twill happen soon (Your server runs out of storage disk free space) 🙂
Observability exists at least of two forms
- Technical observability / where we monitor there are no errors/ enough storage / ram and etc to run app / http requests go as they were supposed to go / logging and tracing information about requests to application shows no errors
- Business Observability, where we gather intel about user actions, and give it to salesman in order to optimize business strategy
Observability for technical side gets often automated, as we set certain precise metrics we wish to see, like database requests are completed in less than N time, requests to app in less than X time and etc
if our monitored situation gets worse, we get automated alerts
Observability is necessary to control risk for our application
if everything goes smoothly, or at least within certain amount of... level of acceptability, we more rapidly go forward without fear
if we encounter troubles for more time of downtime they we promised to uphold -> we work more on getting more stability / obserability and etc of our application
without observability we can't know if we uphold application working to the promised percentage of uptime correctness like 99%
because users aren't obligated to tell about happened errors, monitoring system should tell us before users tell us
For more information regarding observability, and everything else related to maintenance of an application, recommending just reading google sre books https://sre.google/books/
Goals and practices are told there in a more precise manner
Discover Site Reliability Engineering, learn about building and maintaining reliable engineering systems, and read books online to learn more about SRE and other reliable engineering organizations
why does docker-compose up get stuck at run start?```
74.2s => CANCELED [vibeo-backend 7/7] RUN npm run start
60.2s => CANCELED [vibeo-frontend 7/7] RUN npm run start
Both ``vibeo-backend`` and ``vibeo-frontend`` share a similar dockerfile:```dockerfile
FROM node:19.8.1
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE xxxx # port is different on both
RUN npm run build
RUN npm run start
frontend/package.json scripts:```json
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
``backend/package.json`` scripts:```json
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npx tsc",
"start": "node dist/index.js"
},
I’ve begun using a tool called CodeScene to analyze Python code, and it is free for Open Source projects (as mine is). I haven't any experience using it in in-house projects (only Open Source), but really like the perspectives on tech in the analysis and reporting. I haven't really seen that kind of view on tech before in similar tools. If you are a CodeScene user at work, do you have any feedback to share about it? Have a look here: https://codescene.com/
RUN command is run during build, if you start server during build it will never stop
You need to use ENTRYPOINT or CMD
What information have you found valuable specifically?
Any concrete example of actionable information for your project?
I’ve just begun using it, but my expectations are to quickly find out when/if things like tech debt is becoming an issue, but so far all looks “green” and nice.
Besides one thing, probably important to do something about: “knowledge distribution” - makes total sense, since I’m the only maintainer, with few contributions so far.
Another thing that I just realized I forgot to add (was planning to do that this weekend) is the Pull Request quality gate of the tool. This is probably extra important in projects like mine, when the one creating a pull request and the one merging/approving it is the same person 😆
anyone???
\
you're runnin it on jupyter notebook maybe that's the issue
where should i run it ??
vs code ?
my suspicion is now miniforge's distribution of python3.10 is somehow broken
a regular python script?
also not really the right channel for this, try #async-and-concurrency or create your own help channel #❓|how-to-get-help
okay thank you
Maybe I have misunderstood your question, but would it be possible to activate it just as you would with a virtual environment you have created? More details here on the basics of venvs: https://realpython.com/python-virtual-environments-a-primer/#activate-it
Hi, we have released an Open source tool Pair (https://github.com/jiggy-ai/pair), An iterative, stateful chat-like interface for programmers to pair programming with GPT-4, might be useful to some of you. Github Copilot is a great tool for leveraging GPTs while coding, but it is too “open loop” for more complex tasks that require Q&A, feedback to guide it in a particular direction, iteration on code execution errors, etc. There is a large class of tasks that are better accomplished in an iterative, stateful chat-like interface, thus we built Pair. You are welcome to use it and also to contribute to it.
I am pushing releases to PyPI from my CI, every release I push is successful and the workflow is too. However the GitHub action publish badge always says failing
I'm looking to automated some workflows that involve running a bunch of commands locally then copying a bunch of files to some remote host then executing a fairly large workflow on the remote host involing monitoring an application that runs, maybe using something similar to pytest to run a bunch of tests and producing a report then cleaning everything up. This is all on linux. So far I can think of pytest, fabric, dask, luigi, (airflow but its probably overkill). Ansible came up but I think I'd prefer something purely pythonic if possible.
Ansible is good idea, and it is written in python, very compatible with it, and syntax involves sometimes python stuff
Does ansible support resuming say if the workflow was killed in the middle of it?
It was made exactly for this 💯
All syntax and libraries encourage u with support and tools to do that
Small effort knowing Ansible at just average level is needed
hmm
is there any way to have a python script call into ansible so I don't need to invoke ansible directly?
Yes, sure
U can integrate python scripts.. or any other language scripts
I'll have to look into ansible a bit more closely then
It is called, Ansible has idempotency property (if u will search in articles/docs/books)
Recommending a book 🙂
Good enough book to learn it from zero to average+ level
thank you!
https://www.pubgmobile.com/pictures/M21/LV50.png
This type of lots of png link have in this webpage but, i get this links only from some .dat files in game folder,, so i need ur help, how can I get all png file in this webpage, without unknown png links
Someone help me
Help to web scrap
https://dev.37signals.com/bringing-our-apps-back-home/ interesting article
Hi, I have joined an internship in a startup and in the interview I told that my goal to learn from this internship is to learn how applications work in production.
so after I got selected we had a meeting discussing the high level architecture of the backend system.
OpenRemote
All Devops, Security & Monitoring components (Signoz, Jenkins, Nagios & Snyk)
RabbitMQ
Docker swarm, Nginx config etc.
I have been assigned to learn the above technologies and I'm only familiar with docker here, also the backend framework is using fast-api and mongo which I am comfortable with. and hosted on GCP never used it but I wanna learn but all of it is behind a paywall.
The first tool is an IOT tool something, the startup is a parking management system so it has to take data from sensors and stuff we can ignore that for now cause this might not be the right channel for it.
but if I had to go about learning the rest of the tech stack, what would be the best way to go about it?
I would assume it is to get some cloud platform and actually publish a working project and slowly integrate the different tools I have to learn but I don't have a credit card and ones that accept debit cards just don't seem to work for me. they always get declined or give me some hundred other errors.
the best way to learn about Nagios and Jenkins is to use them. Nagios is relatively straightforward: it's a monitoring system that works around "checker scripts" : programs that exit with code 0 if all is good, and 1-3 for critical / warning / unknown. In Nagios you configure your servers and services to check (checked with these check_commands that are configured in Nagios) and it will take care to check those regularly. Lots of functionality in Nagios is built around alerting like silencing alerts, scheduled downtime etc.
I would probably ask for read-only access to their Nagios instance to get some first-hand experience with it. The way I started learning it was by writing some checkers my old boss asked me for.
Docker Swarm is deprecated as far as I remember so I wouldn't recommend to pour too much time into learning it.
As for nginx configuration, I recommend getting some server somewhere (raspberry pi, or a VM on some cloud provider) and just setting up nginx to serve something: for example, make your website serve a copy of the Django docs, or a homepage for yourself. Learn about how to get nginx to forward requests to another service (called "reverse proxy"). Learn how the include system works and how nginx utilizes it in installations on modern distributions (e.g. /etc/nginx/conf.d, ...). Learn how to provision certificates automatically with certbot (use your previous knowledge from serving static HTML files and use the webroot authenticator). And one more fun exercise: set up an nginx instance to act as a caching proxy to pypi.org: that is, you can point your pip clients to it and it will cache packages locally for a while to speed up downloads and reduce load on pypi
snyk is some security scanning tool. I don't think there's too much to learn about it, as fixing the vulnerabilities of it is more important
I have no idea what OpenRemote and Signoz are. As for RabbitMQ using the setup they have there as a learning point is probably best. Hope that helps
Thank you ✨
Regarding the cloud provider, which do you think is good for a beginner to get into.
The place where I'm working said they will be using GCP but I'm having trouble creating an account there cause I don't have a credit card I might have to ask my father to give his credit card to experiment with the platform for the time being. 😅
Any provider is not free.
Although GCP gives first customers 300$ expirable free credits for half of year
U need some payment card for this though
I love digital Ocean for comfortable simplicity
But if u need GCP then it is GCP
It is entirely different beast
It is not supposed to be usable without infrastructure as a code like Terraform though. Its GUI is heavily overbloated
Hello guys, i'm having issues with having network connectivity in docker containers
Have tried adding the dns for systemd-resolved to the "execstart" of the .service file for docker and that didn't work, i also added the --network=host arguments to the command to run the container and that still didn't work. I currently have my firewall to allow outgoing rules. How can i fix this issue
i recommend netcup because they're cheap, work well, and are german (they are also our sponsor). For 3.25 € / month you get a server with decent specs to do quite some testing: https://www.netcup.eu/vserver/vps.php
hetzner is another provider you could check out, they are also cheap and have good servers
for netcup I can give you coupon codes, unfortunately for the smallest tier they don't have any. here's a 5€ voucher you can use if you want 36nc16796559900
not really, you could mess around with jq to extract data if it's structured omehow
what's the exact issue you are seeing? are requests timing out, being refused, or getting another error? you shouldn't need systemd-resolved in your docker container
check your kernel log for any ufw blocks (sudo dmesg -T) that appear when you're running your container (assuming you're running ufw)
i already checked ufw, plus i already allowed outgoing requests in the firewall and when i run requests like apt-get update or run a dockerfile, it times out and took a while for me to notice the container wasn't able to connect to the network
normally docker is kind enough to punch holes in your firewall
what's in /etc/docker/config.json?
when i run requests like apt-get update or run a dockerfile,
are you having connectivity issue when building a docker image from dockerfile?
or are you having connectivity issue when trying to connect to the outside world from within a running docker container?
just thought that might be an important distinction to clarify.
Hello guys i explain to you my github problem
On gitlab i got a project of class
Than i want to push on my personal github for gived the link to people who want to recruit me for a work
But the problem is i got like a empty folder unclickable and i saw is a "submodule"
But me i just want degit
The folder because its now only for desmonstration purpose 😦
so you have a new repo, which contains submodule of another repo that you want to demo?
is the other repo that you want to demo private?
its a repo of my school session so yes
i just want to copy the folder and pushing it on my public git basically
but i think someone in mp gived to me a good solution
i see.
you probably copied .git over as well, which shouldn't be there if you just want the content of the repo to be demo to be in this new public repo.
the presence of .git probably made git think that's a submodule
yes
for that i got problem
a guy said to me to do git clone --bare
and after git push -- mirror new link
and that just worked
git is painfull
cool, that's a little bit more advanced yeah
i prefer control c control v
@modern robin Hey man, I hope you remembered me, I need some help with aws, could you help me out?
What’s up?
Does deleted ebs volumes also count towards the 30gb per month aws in free tier?
If it’s deleted. It doesn’t count anymore
rn it's showing me, so what does it mean
That’s what you’ve used when running instances
so how do I know how much I've left for this month?
I have multiple repos in Github where at the moment, I create one separated mkdoc github page with their docstrings individually. Is there any way I can create one single github page which will generate and combine the mkdocs for all of the defined repos instead?
30-24.829
i havent done this before but i can point to the mkdocs-monorepo-plugin which appears to be made for this purpose
https://github.com/backstage/mkdocs-monorepo-plugin
alternatively if you're using the readthedocs hosting provider, their subprojects feature apparently lets you combine multiple projects under a single domain
https://docs.readthedocs.io/en/stable/subprojects.html
Hey People,
Just got an Azure DevOps account, and I have a codebase (PyQt6-based Desktop Application) that I will be pushing soon.
I will have 4 branches. main, release, develop, and Hotfix/Update. 2 of us will be working on that.
At the start, I will push my current base to the main, and create a branch Develop out of it.
Once, we are at a good stage to deploy, we create a release branch and create a pipeline trigger based on tag name and branch name release in Azure DevOps.
We tag and push the code to the release branch, and it will generate the build. Once that is done.
We then merge the release branch with Main and remove it from local+remote, and check out to develop.
Can someone check if this strategy is correct, if not, what changes i should make?
yeah but I'm confused as to how that works, cause all the volumes are deleted now so why 30-24... ? and not 30gb as a whole
You used 24GB before they were deleted
so does that mean I only have around 6 gb left for this month?
Yes. What are you doing that’s consuming so much?
I left 3-4 ec2 instance running that's all, but now I've terminated all of them
Ok you’re good then.
but if I create a new ec2 instance now and I think by default a 8gb ebs is attached, so will I be charged for that?
When you create a new EC2 instance in AWS, by default an Elastic Block Store (EBS) volume is attached to it for the root device. The cost of the EBS volume is based on the storage capacity and the I/O operations used.
If you create an 8GB EBS volume, you will be charged for the storage capacity of the volume as well as any additional charges for data transfer, snapshots, and other EBS features that you use. The pricing for EBS varies by region and depends on the type of volume you use.
To get the most up-to-date pricing information for EBS, you can check the AWS website. You can also estimate your EBS costs using the AWS Simple Monthly Calculator or the AWS Cost Explorer.
I understood this, but then what is the difference between active and deleted volumes if both are counted towards your 30 gb storage?
My active volume is 0 gb
where as my deleted volume is ~24 gb
Where do you see this. Active and deleted
I don't, I'm just assuming this cause
you said
Showmeyourdds(DueDiligence) — Yesterday at 9:29 PM
If it’s deleted. It doesn’t count anymore
What kind of scenarios do you see for the branches? It looks like an advanced setup and maybe that’s what you need. In most teams I’ve been part of, a main with tags and short-lived feature branches have been good enough. In some, we have had a “develop” in between because our team had less control over the build process.
Delete was once active.
bro I'm confused af regarding this, so by that logic I can only create 3 ec2 instances per month? Cause by default 8gb * 4 = 32 gb which will be beyond free tier
Active means the ec2 is running
No. It only counts for what is used
used as in? not reserved?
Used while the instance is running.
It doesn’t charge 8GB just because the instance is created. That’s just the capacity
hmm by that logic i don't recall doing something which will use 24 gigs
Are you making snapshots?
I don't exactly remember but I've none atm.
I can’t say. Record your initial. Make an ec2 instance and calculate how much it takes
as far as I recall it was taking about 2 gig per AMI
Ok. I’ve never tracked mine as I’ve never gone over the free limit.
I did use auto scaling groups so theoretically if one AMI uses ~2 gigs then I've created 12 ec2 instances in this month right?
I’ve created more an still didn’t hit the limit. So I don’t know 🤷🏽♂️
interesting, how do I check what actually ate so much gbs? is there a way to do that?
Dunno bro
I wanted to make a small PR to fix something, so I created a branch off master, made my change, and committed it, then realized master was out of date, so I did a merge from origin/master, and now my PR contains my change plus the merge. Is that okay, or is it messy? Should I delete the branch and start over from an up to date master?
it is okay 🙂 (technically it depends on their commit policy)
your merged commits from master will share at maximum only one extra merging commit, not all of them
if u are worried about having too many commits = just squash them
git rebase -i master
change pick for all of them except most top one to squash
and save/save
it will join all your possible commits into one
way less noise if desired, without branch recreations
I did the rebase, changed everything except the latest one (my change) to squash, and it added two more commits. Seems like I did something wrong, should I have squashed all but the oldest instead (including my own commit)?
Ended up deleting it and publishing again. Feels bad that it didn't work out, but feels good that it's clean.
Hey @velvet hedge!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Hey @velvet hedge!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Hey, not sure this is the appropriate channel but i'll give it a go.
I have a code, lets say A1B2C3. I wanna email this to someone, and then have them enter it to a form to verify their email. Is there any tool out there to send this verification code in an email for me? Instead of me having to send it
the only ones I know of are insanely complicated 😦
Sending email used to be easy, 20 years ago; now it's a pain in the butt
overall? or using some sorta library
overall
thats tough
library isn't enough; you need a server to send it from
i thought it'd be fairly easy
I don't think it is. I could be wrong but I'd bet on it
i'd imagined there was some sort of api or library that would send the email for you
it's possible you can do it easily if you don't mind your mail getting flagged as spam
would i need a server
dunno
when we say server, we're talking about a whole server to send the email, or just a personal email like xxx@gmail.com for the email to b sent from?
https://realpython.com/python-send-email/#yagmail might help; never heard of it until now
sendgrid 🙂 Service for sending emails
the former, I guess; I don't really understand what you mean
"server" means "computer", not "string of letters and digits with an @ sign"
gotcha, thats what i meant yes
ill have a look, thanks!
It's showing what lines were added, and what lines were removed
yes
you can also get this in commandline by running git diff
He meant to say in a terminal
bash in linux
command prompt in windows
Bash on windows 😃
under WSL, why not?)
there's also git bash, cygwin
Good afternoon everyone, what better video content or article talking about linter for Python which do you recommend? I use it every day, but I never got around to putting one in my hand. It had already automated at work.
Let's say you are responsible for the release and distribution channels and there was a need for many cloud related skills since most of it would happen in a cloud.
What titles would you use to describe such person?
Cloud Release Engineer 
Great! That's what I had in mind too, but wanted to make sure there wasn't something more popular
thanks!
Hello everyone,
I have created a little python program with which you can create a beautiful readable chapters txt file (of the format "h:mm:ss YOUR_CHAPTER_TITLE") .
Then you can use the txt file to add your chapter titles and afterwards use the script to attach it to the video.
Keep in mind though that this program only works in Unix systems like macOS and you need FFmpeg installed on your machine.
The github repo of the project is here: https://github.com/amireza007/ChapterForVideos
There are some TODO things, available in the code such as a UI and exception handling.
I would really appreciate if you take time to test and even more if you have any comments regarding it or improvements or edits to the project.
Thanks for your attention
is there a package-lock.json equivalent in python?
depends on what package manager you use
pip-tools can create a lock file in the form of requirements.txt
poetry creates a poetry.lock
pdm creates a pdm.lock
pipenv creates a Pipfile.lock
node_modules is created manually if using regular pip by running python3 -m venv venv and source venv/bin/activate
default one package-lock.json created by pip freeze > constraints.txt
npm i is pip install -r requirements.txt -c constraints.txt
requirements.txt should be having your top level dependencies, constraints locks only to which version to install them and secondary deps
everything is automated and most comfortable in poetry (choice number 1 today)
it automatically creates node_modules as .venv
when you run poetry shell or poetry install (npm i)
and locks to poetry.lock your package-lock.json (which is fully managed automatically when you just install deps as poetry add package_name)
i don't know if docker questions should go here but how could i create a docker image that is just python run python ... and pg_ctl start (for postgresql)
given my tiny bit of familiarity with docker, you probably dont want to create an image running two services and instead use docker-compose.yml to declare multiple containers to run for your application
https://docs.docker.com/compose/features-uses/
that way you can just use the postgres image without any modifications, configure that image correctly,then pass the credentials to your python image using env/secrets
https://github.com/docker-library/docs/blob/master/postgres/README.md
oh, so i don't need to set up an image at all
i have a personal repo i can show as an example, although i never actually finished it after i figured out how to connect the services 😔
sure
drop example what u made, we will figure out 🙂 my company and me in pet projects too overuse for dev envs compose everywhere ^_^
in fact, i have even written article with repository of code example how to have in docker compose 🙂
https://github.com/darklab8/darklab_article_docker_python/blob/master/example_frm_fastapi/docker-compose.prod.yml
https://github.com/darklab8/darklab_article_docker_python/blob/master/example_frm_django/docker-compose.prod.yml
docker-compose examples for FastAPi, Django and Flask made
We just override launching command: for particular containers
docker-compose.yml
https://github.com/thegamecracks/python-todo-list/blob/main/docker-compose.yml
- credentials are defined in a separate .env file (i think i chose this over secrets for convenience)
Dockerfile
https://github.com/thegamecracks/python-todo-list/blob/main/Dockerfile
- dependencies are installed and cached in the
main-depslayer, and there are three more layers fordev-deps,tests, andprod
app.py
https://github.com/thegamecracks/python-todo-list/blob/main/src/todo_list/app.py
- sqlalchemy connection is defined here
i'll give it a check a bit later 👍
Hey guys, I initially posted this in the general channel and later realized there are more dedicated channels for this kind of topics. So I'm moving it here.
I have a side project I have been working on for ~2+ years. It is a Python library for PDF form processing. In a nutshell it allows filling a PDF form with annotated fields (text fields, checkboxes, etc) by simply feeding a dictionary, along with some miscellaneous functionalities. I built this for the purpose of an easier way of generating PDFs without having to write long and unmaintainable reportlab code.
Right now I have had some users using it and got some feedback from them. However I could really appreciate more users/developers looking into it so that there are more inputs on potentially unveiled bugs, inspirations on new features, ways to improve/optimize the code, or just in general more exposures to this library. If your workflow, whether personal or full-time work project, involves PDF generation, I will appreciate a lot if you could spend some time and take look at this library.
Thank you very much for your time.
https://github.com/chinapandaman/PyPDFForm
neat! love the RUN --mount=type=cache...
btw, docker-compose support (i.e. v1) is getting dropped in june, you can start using docker compose (i.e. v2) now to avoid getting caught out by the deprecation
so thats what they meant by v1 being deprecated... i thought they were aliases when i unintentionally used them interchangeably
How to make something like this?
Pls I want to know how to make colour gradient like tht
I know how to make the ASCII art
Guys if i am on a good level of knowing bash script and automation, i make a couple of projects, can i have a part time job using this skill, and where i can find it
Currently i am a chip designer, but I need to make side hustle from bash
No 😂 bash is only pretty much augmentary (and in my mind opinion heavily overrated part of other skills needed to be known)
Can u become hired as mathematician with only knowing how to summate 2+2? Answer is comparable
Use the python module "pystyle"
"import pystyle"
"from pystyle import *"
You know, your nickname is kind of very strongly inappropriate. Perhaps u may wish to change it
It was an alternate account, with a different name due to being targeted in mass report attacks
Change nickname please. I find your nickname harmful.
Is this better?
Much better ☺️ 😎 thanks 👍
Welcome.
Nice explanation, its seems very long way even for just a part time job😅
I find its relevancy very low at least.
If u aim for getting hired as infrastructure guy
Learn stuff like
AWS, docker, Terraform, GitHub actions,
Deploying containerised applications and managing managed AWS RDS dateless.
Feel free to add Ansible to this.
Best to know networking at level capable to operate AWA VPC stuff.
Small project with learning how to deploy applications and setting up monitoring and logging will be a good start
Bash is used somewhere in between from time to time there
If u aim getting hired as backend Dev, learn SQL, some engine like Postgresql, building rest apis
Besides that bash is sometimes needed for Dev env and managing GitHub actions CI workflow / Gitlab Ci and etc
In each case bash is small augmentary stuff sometimes needed, but main dishes are different (Rest API+Databases) / (or AWS, infrastructure code stuff)
Instead of AWS, GCP, Azure stuff can work as well, some people deploy to bare metal.
AWA is just most used and in demand
There are system administrator... They know Linux(or Windows servers) how to operate and manage self hosted databases
Bash comes to them as augmentary tool again, but not most important one.
Knowing Linux ecosystem, repairing and maintains dB and apps comes first
If they go for Windows Servers, bash is kind of not that applicable though. I heard in newest Windows versions u can run bash in Windows though
System administrators are pre-historic role that was before infrastructure as a code and cloud came to play though
that doesn‘t mean they‘re irrelevant
Hi, I was trying to create a script to read my outlook emails and I found out about imaplib. I just wanted to know that what if my office365 has another layer of security to it which needs an organisation login from a service like okta verify or authenticator? Will I be able to access my emails using imaplib?
what's the easiest way to do http requests in jenkins? for some reason we're not using groovy.
never used jenkins except one time, but i can bet it is curl
Do you have curl?
Good question.
I noticed that there is an API that logs each request to AWS Cloud watch, and there is at least one log each millisecond, and I think the logs are slowing it down a lot,
is there a way to save the logs in memory and print everything each N logs instead of printing each logger.info() immediately?
The docs about logging handlers might give you some ideas, the one about queues look interesting but I haven’t used that one myself: https://docs.python.org/3/howto/logging-cookbook.html#dealing-with-handlers-that-block
How do your Python logs get to cloud watch? Are you using a plugin for the logging module? Are they collected from stderr by something else, eg Docker?
thanks, I'll have a look at this
the stuff just gets printed to stdout, and cloudwatch just displays all the output as is
or just… CW agent
logging.TRACE = 5
class BeeLogger(logging.Logger):
def __init__(self, name, level=logging.NOTSET):
super().__init__(name, level)
logging.addLevelName(logging.TRACE, 'TRACE')
def trace(self, msg, *args, **kwargs):
self.log(logging.TRACE, msg, *args, **kwargs)
logging.setLoggerClass(BeeLogger(level=logging.DEBUG)) # error
how do i pass the logging level here?
aren't you missing pass the name before the level? Also, what does "error" mean?
setLoggerClass only takes class
I mean here BeeLogger(level=logging.DEBUG)
your __init__ has name and level
shouldn't it be something like BeeLogger("bee_logger", level=logging.DEBUG) ?
also, paste the error please
yeah if i use the level i also need to supply a name
but the original code goes like logging.setLoggerClass(BeeLogger)
set the logger class and then use logging.getLogger().setLevel() to set the level for the root logger, which propagates to all other logger objects
see also how the python bot does it: https://github.com/python-discord/bot/blob/main/bot/log.py
does it propagate when i have several files with their own getLogger(__name__)?
depends on which logger you set it to
if you set it in a logger called myapp then myapp.mymodule will use that yes
Why does Python Docker SDK list a few images but not visible in Docker Desktop or Terminal (docker image ls)
import docker
client = docker.from_env()
print(client.images.list(all=True))
[<Image: 'helloworld:latest'>, <Image: ''>, <Image: 'python:slim'>, <Image: 'hello-world:latest'>]
But in the terminal it's not shown:
scripts> docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
scripts>
client.images.list(all=True) seems to correspond to docker image ls --all instead of docker image ls, could you give the former a try and compare?
Same result
I wonder if its running on different instances
potentially, could you describe your setup a little bit?
try running docker image ls -a you will see intermediate hidden images as well too
in python you run with all=True argument, it is -a in CLI
if u will remove in python all=True, it will match as without -a in CLI
Planning to automate installing some Docker containers using Python. Docker's Python SDK looked simple and when I ran some basic scripts this was the result
consider using configuration management tool like Ansible instead ^_^ (or for that matter, there are also Salt, Chef, Puppet)
or better just use already Container scheduling system and deploy containers directly to AWS ECS or AWS EKS for example
hmm okay let me rephrase, are you pointing to the same docker daemon in both cases?
Same result. I've removed all=True, it's still showing some images that are not visible to Docker Desktop or the terminal
you have several docker daemons i think may be. Docker Desktop creates VM with docker in it
This is what I'm thinking the issue could be, how do I check the list of daemons
In the old SDK examples we had to set it, now I'm not sure
it is not really checkable information to get list of all daemons except requesting current one
docker version
you will see to which Server Daemon your current CLI client is getting attched
also daemon is overridable by DOCKER_HOST env var, so if something sets it, that means it got changed to smth else from deafult
how to check same in Docker Desktop or Python CDK, is a different issue ^_^
docker context ls lists 2 endpoints. As you said Docker Desktop has it's own endpoint with a *. I'm guessing Python is using the default endpoint
client = docker.from_env()
Something should be done here
this is not really source of information which can list all docker daemons
(chances that context is configured to show all of them is extremely low usually)
Oh
Docker daemons are often existing at different servers / VMs
the only answer is checking running servers/VMs if u want to gather all working docker daemons
I'm working on an Ubuntu VM locally. Not connecting to the outside network
anyway, just check Server Docker Daemon for Python CDK configured
and compare with Server Docker Daemon in CLI (docker version command / docker context ls)
then u will see if they are running with different daemons
hmm? what ensures virtualization
Yeah, looks different. Python mentions containerd, docker-init details. But terminal mentions only docker-desktop's details. Also API version is different, Python: 1.42, Terminal: 1.41
Just a Boxes VM to completely separate my PC's setup. Basically I want to use Python to setup several docker containers on low power SBCs for an IoT project. So, I'm using VMs to just simulate a new OS install
^_^ wait, you try to compare checking Docker in Boxes VM and Docker Desktop/WSL?
Nope, everything I've mentioned is from the Ubuntu VM
you mention Docker Desktop, where it appears
Ubuntu VM
so, you have Docker Desktop and some VM (presumably Ubuntu too) in Boxes virtualizer?
Yes, I have installed Docker desktop on a Ubuntu VM
so, you have two VMs
Docker Desktop running on Ubuntu VM
and Boxes VM running Ubuntu VM 2
each VM is obviously having separate docker daemons ^_^
No. Gnome Boxes has an Ubuntu VM, this Ubuntu VM has docker desktop and python docker sdk running on it
I'll just create another VM without docker desktop and see it it works properly
ah, u installed Docker Desktop inside Ubuntu VM that is running inside Gnome Boxes?