#tools-and-devops
1 messages ยท Page 69 of 1
and then you actually get a real inbox, tech support, etc
depends on your needs i guess
for just sending alerts to yourself i do think it'd be nice to be able to run an smtp server in a container
But why?
excuse not valid, business have shit to do
yeah if i was running a business w/ employees i'd probably want something "industrial" like MS
SSO and stuff
and fastmail isn't a mail sending service, it's email server
I'm talking about Applications sending emails like reminders, password resets and like
for that, use Sendgrid OR Amazon SES OR whatever
oh yeah for sure
Mail protocols are so friendly, that they are not really different from rest apis
SMTP is PITA to deal with
The only real requirement, having turned off protection from bots
but Sendgrid and SES have RestAPI for email
Nice I guess. Rest makes life easier
I already was told by other devops that
Alertmanager integrates with sendgrid easily
So, that is my choice then
if I use docker-compose with --scale flag, does docker load balance it automatically?
is there a way to just get FresyshbTF2 out of this link https://steamcommunity.com/id/FresyshbTF2 ?
hmm, why do I have a feeling, that it is another web scrapping steam bot? ๐ค
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
it's not malicious in any way
it's simply for a usernames list of names for my program
no cracking or any sort involved
do you parse the steam web site for that?
I was gonna use discord for names but I don't want to use selfbots for obvious reasons
yes, solely for getting realistic usernames though
shrugs whatever
i'm making a site to display the most commonly used names
sup guys
kinda stuck on whether i should buy a raspberry pico, im trying to dev something like a rubber ducky but not as dangerous
import os
os.system("taskkill /f /im explorer.exe")
if input == "chrome":
os.system("start chrome.exe")
Im working on a sorta like optimizer
for using programs that need more resources
actually it won't
depending
but killing applications won't make performance better in most cases
true, and sometimes running explorer.exe shows the taskbar and sometimes just opens File Explorer
The only times I've had to kill explorer.exe were if the UI got locked up
Which was rare but did happen
lmao
what version of windows
I have to kill explorer.exe a little more often
7 was the last version i used so probably 7
ah
Wait no i have win 10 at home but never used it much
Literally only for gaming ๐
Didn't know 11 existed
10 was surprisingly usable, i still feel comfortable in windows after growing up with 95/98 and later xp
The first programs i ever wrote were batch scripts meant to look like a scary hacker had taken over the PC
yes, its in beta rn
and now you probably could write batch scripts to actually be a scary hacker taking over the pc ๐
uhhhh
i'm now slightly worried about poetry
1 thousand open issues on the repo; 635 of those have the triage label
@velvet spire which poetry
!pypi poetry
That one
is there a way to specify how a python object should be converted to a jupyter display?
wdym
It's probably fine but I personally don't use it
I've been happy with pip-compile, a venv, and a Makefile
Some of my colleagues use Pipenv which seems ok (better than when it first came out) but doesn't handle package building so you still need setuptools
I think display is an ipython-ism, not a jupyter-ism... maybe that helps with search terms at least
Looks like these _repr_* methods are the way
I meant what I said
you have a local repo and a remote, right
the remote is on github
in your local, make a folder called folder, and move your file into it
then do git add .
git commit -m "your commit message"
git push
and you're done
oh so git add .?
im using visual studio code to push and commit tho
The principle is the same
move your file to your folder, locally
stage and commit everything
push
Alternatively, if you prefer, you can make your changes on github
and then pull to your local
@tawdry needle thanks
Hey guys just joined today, I was always fascinated by DevOps but couldn't find much specific to python. Is DevOps in python mainly aimed just running the tests and auto deployment ?
look up "pexpect"
devops "in" python might have 2 different meanings:
- using python for devops tasks
- doing devops for applications written in python
I'm more interested for the second one 
learning about packaging and distribution of python applications is a good place to start i think
The Python Packaging User Guide (PyPUG) is a collection of tutorials and guides for packaging Python software.
if you will be still interested in the first one, using CLI interface in python is quite cool https://click.palletsprojects.com/en/8.0.x/
plus sometimes I use jinja2 templating to make configs https://jinja.palletsprojects.com/en/3.0.x/
and then I discovered that literally the same does ansible (with literally the same libraries), I reinvented the wheel for things it already does.
if you could help me out a bit more I would heavilly appreciate that
https://pexpect.readthedocs.io/en/stable/ this is a tool that lets you work with interactive command line applications
noice
yes I read all that
but I do not think it can help me
frankly, I do not know much about coding, please keep that in mind
not to mention, this is NOT an interactive console
it is purely output
no input
I want to read text from a console
basically use it in py
be able to slap it into a string or something
the only thing I can do in the console is clear it and copy things
and frankly, for starters, I have no clue how to access the raw data from the console
I only have the window.
that's the proble
problem*
I have no clue
hence "probably java"
that's what I am trying to figure out
it's literally a minecraft launcher (don't laugh at me) I figured it would be easy enough to do a project with it
that's fine, how do you run it?
opening the launcher
like, double clicking it?
opening the EXE for it.
it automatically launches the launcher and the console
in the command prompt?
I don't think it is a CMD
as i can't input anything
and it doesn't look like windows cmd at all
so you go double-click on a .exe file in explorer, and a prompt pops up?
yes.
well, let me just show you
okay
I got a bit further
I found the text file it dumps the output to
realtime
hope that helps?
@tawdry needle
Okay I think I have it from here, thanks anyways
I will make the python file in the same folder as the logs
And then read it from there
Hi,
I want to find distance between different object, from an arial view (captured by drone). Can anyone tell me where I can start my research? How can I achieve this?
Go to #algos-and-data-structs maybe, out of topic here
Why does github pages only allow you a choice of two directories?
"You can publish your site from any branch in the repository, either from the root of the repository on that branch, /, or from the /docs folder on that branch"
It seems they just don't currently support it
I understand that they don't support it. I'm asking why
it's always been that way
probably just simplicity
one thing you can do is set up your files like this
src/
python/
docs/
and then send the "built" sphinx docs to /docs
it'd be an interesting paid feature if you could open that up somewhat
the alternative is to host docs in a separate repo with automated pushes
that way you can also include multiple versions of the docs instead of keeping it pegged to the current main branch
Maybe there are security and/or performance considerations
Not really answer to why, but I think there is a second deployment method from CI artifacts
It should be not restricting which folder to use then
you mean via github actions?
I haven't gotten around to learning them, but that's good to know
I'm actually fine with pushing to a different branch, mkdocs makes it easy
yeah
can anyone explain what sys.stdin does?
i'm not sure if this is the appropriate channel
I came across it in a coding assessment
it represents the "standard input" to your python application
In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), standard output (stdout) and standard error (stderr). Originally I/O happened via a physically co...
hey guys
i have a question that how can i use storage account
on my vs code editor?
I was trying out conda run -n myenv to run commands inside of a makefile script and noticed that if I call conda run -n myenv somescript.py inside of make when myenv is already active, then the call fails:
EnvironmentLocationNotFound: Not a conda environment: PATH_TO_ANACONDA3/envs/myenv/envs/myenv
Anyone here who can share some things to try out at this point?
Clearly, the path to the environment has appended an extra envs/myenv
for all i know this is a bug in conda ๐คทโโ๏ธ
i wouldn't be surprised honestly
if you can reproduce this in a "clean" env, file a bug report
does it only happen inside the Makefile?
I did notice that the base env is set to whatever environment is active when running make
because it might also have to do with the shell configuration & what variables are/aren't exposed to the subshell that runs the commands under Make
ok, that's where i was heading
i would say that this is still a conda bug, but a subtle one
Make itself spawns a shell when executing commands
that shell inherits its environment from the Make process, which of course inherits its environment from your shell process
somehow, conda managed to fuck things up such that conda invocations in the child process think they are the base conda environment even when they're in an active environment
possibly because PATH is updated and exported, but some other conda-related env vars are not
if you can reproduce this in a clean env with a trivial makefile, definitely report this as a bug
that's my hypothesis, anyway
Thanks for sharing, I'll see if I can condense it to a minimum make script to reproduce.
i'd be curious if Mamba has the same problem
Mamba is new to me. Looks awesome!
Pretty new to python dev, seems like 2 options for managing dependencies and local dev is either venv/virtualenv or docker containers. I like containers bc it makes managing dependencies and behavior cross-platform more consistent and makes productionizing seem simpler. But with venv, you get a lot more local tooling, e.g. static code analysis and intellisense in vscode against dependencies, and debugging is cleaner. Is there any way to marry the 2? or am I missing something in configuring my dev experience?
venv for developing locally and docker for deployment. you can (should?) create a venv inside the docker container too, so your setups will be very similar
!pypi pip-tools
you might also want to use that for pinning runtime app dependencies
note that the dependencies for your application should usually be pinned, while the dependencies for libraries usually should not be pinned
hmmm thanks. Can you explain the usage of pip-tools? I've been handwriting requirements.txt, confused on the different options, and what's best practice.
Oh, is it similar to package-lock.json for npm?
I think developing in a local container is starting to become popular (VS Code supposedly has really nice support for it)
maybe that would interest you, though I prefer to just have a local venv for development
but yes, you can marry the 2 for example with the tool that salt rock has linked
it allows you to create a so-called lockfile which declares all dependencies and their versions, so that the virtual environment that you're using locally can be reproduced elsewhere (that's what's meant with a predictable and deterministic build)
e.g. in a container that you ship to production
or on another developer's machine
the problem with handwriting requirements.txt is that it becomes a huge burden to frequently bump versions for bugfix releases and to keep track of all transitive dependencies
if you e.g. declare that your application uses django in reqs.txt, and run pip install on it, it will install the latest django, so this could be a different version on your machine, on your colleague's, and on the production server
if you say that you're developing for django==1.6.9, thats a lot better, because now the version of django will be the same everywhere, but django itself has dependencies, and django may say that it uses e.g. some-library>=3.0.0, so this may again resolve to another version elsewhere
therefore to get an entirely predictable build everywhere, even the versions of these transitive dependencies should be locked, and that's really difficult to do for a human, because there will be a lot of them, and you generally want to be using latest bugfix releases so you'd have to constantly manually maintain your reqs.txt
to solve this problem, we use tools like pip-tools, pipenv, poetry & others, which allow you to have a file where you say "I want to use django 3.0.x" where x is the latest micro release, and the tool itself compiles a lockfile with the latest compatible django, and all of its dependencies
"pinning" is declaring the immediate dependencies of your app and their versions (you can pin a specific version, or something like the 3.0.x above, which according to semver should be compatible)
yes, it's like package.lock. the python ecosystem never really settled on a convention for "lockfiles". Pipenv has their own solution, but Pipenv explicitly does not handle building and distribution of packages, it's only for "projects", and you need pipenv-setup to inject the dependencies from your Pipfile into the setuptools metadata https://pypi.org/project/pipenv-setup/
note also the conspicuous lack of a node_modules equivalent and the resulting need for venvs
one possible workflow is to let pip-compile generate a constraints file:
cat > requirements.txt <<EOF
click>=8.0
httpx>=0.19.0
EOF
# Use --strip-extras to make it valid for `pip install -c`
pip-compile \
--generate-hashes \
--strip-extras \
--upgrade \
--output-file=contraints.txt \
requirements.txt
pip install -r requirements.txt -c constraints.txt
this prevents pip from installing unnecessary deps that might be listed in the compiled "lockfile", while still using the locked versions
:incoming_envelope: :ok_hand: applied mute to @ionic fractal until <t:1631683933:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
Hello everyone,
I have a web api container to debug using debugpy and vs code python remote debugger.
the debugger failed to attached and displayed ECONNREFUSED. This is the launch.json code:
"configurations": [
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"connect": {
"host": "0.0.0.0",
"port": 5678
},
"justMyCode": false,
"logToFile": true,
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
}
]
I also tried this but it's not working.
Is anyone familiar with debugpy and vs code python remote debugger ?
i've had a hell of a time getting debugpy working with neovim too
Hey All! I am just getting into CICD/Testing where I am looking to understand whether I have the correct understanding of a concept before proceeding. I have currently built out my first docker-compose collection of docker containers on a remote linux box inside of my lab environment where one of the containers is the application I built in python stored in github. What I would like to do is have something like github actions or gitlab perform the following actions once a pull request is made:
- Connect to a self-hosted runner (linux box) inside my lab network
- Test some of the API calls to the servers in my lab environment directly (using pytest I'm assuming) to verify all of the API calls are working once expected return data comes back from lab servers
- Build new docker image of custom application
- Remove the existing docker container for my application running from docker-compose and build new container based on the newly tested image created above
- All containers are up and functional with the new code
Is this the correct architecture and process one would use to run automated testing in a remote lab environment where a github/gitlab runner can connect to local servers that are not cloud accessible?
Going a little nuts, trying to do a git merge --strategy-option theirs but no matter how I swing it, I just can't get the "other" branch's changes to take precedence over my current branch
whew
this is tough
I need merge my main branch into a feature branch and rebase that merge behind just one commit
this feature branch has like, 70 commits or so
I need to merge the main branch into this feature branch behind the most recent commit on this branch
Good luck
Hey guys <3 I need some help with docker haha. I'm using oraclelinux8-instantclient image and i'm trying to install python on it. Since it's based on red hat I think I need to use yum to install it? But I cant get it to work. This is my DockerFile:
FROM ghcr.io/oracle/oraclelinux8-instantclient:19
WORKDIR /test
COPY . .
CMD [ "yum", "install", "python3"]
I get the installation message but it ends with "Is this ok [y/N]: Operation aborted."
Can anyone help me find what's wrong? Thanks!
Why CMD instead of RUN?
Hey @heavy knot!
It looks like you tried to attach file type(s) that we do not allow (.rar). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.
Feel free to ask in #community-meta if you think this is a mistake.
Hey, I was trying RUN too and it wasn't working. I figured it out though, I needed to add the -y option on the yum command to automatically input the yes.
I am trying to install pygame on android for personal reasons and i am getting a setup file missing error. How can i dix tht
Hey @shell fossil!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
โข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
โข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Can anyone help me with pyinstaller -
https://paste.pythondiscord.com/raw/odiqejiyot
I'm not able to run the application due to hidden import issue in tensorflow2.6.0
That's an interesting one, how did you end up doing it?
There is a pyinstaller command to manually include hidden imports.
I believe it is --hidden-import packagename
Yes I tried that with --hidden-import tensorflow but didn't work
usually no, but you can upload the tarball and wheels as "assets" on github - or make a project on pypi and upload them there
Haven't done it yet
well if you're asking about github then you're mostly asking about source code - normally you distribute the package through other channels like pypi, although pip nicely lets you install from a git repository
and in that case, you usually don't include "compiled" assets in a git repository
partly for technical reasons (git doesn't do well with binary files), and partly because it's just not necessary in a lot of cases
what you do want in the source code is some kind of reproducible process for building the distribution package
a script, a makefile, a set of instructions, etc.
that would be interesting, but no. i'm not aware of any package repository that does such a thing
recommended reading: https://packaging.python.org/tutorials/packaging-projects/
I'm using MkDocs Material with mkdocstrings and I'm trying to document a dataclass.
This is my code:
# `core`
The `lanim.core` module provides a rendering frontend-agnostic core
for creating and transforming general animations.
::: lanim.core.Animation
The methods render fine, but I get this out-of-place string with the class and its __init__ parameters. Any ideas on how to fix it?
Hm, weird, when I add a docstring to the class, it renders correctly (also added show_root_heading)
Should I run poetry config virtualenvs.create false in Dockerfile after pip install poetry? 
i would, or put the config file in there manually
however i do recommend still installing stuff in a venv even in a docker container
until we have pep-582, at any rate https://www.python.org/dev/peps/pep-0582/
I noticed that I need to run poetry run python -m ... instead of just python -m ... when venv is enabled 
I just started with Poetry so I don't know which way is better
yeah, that's how it works. it makes a venv for you and hides it somewhere that you don't see it, so you don't have to manually mess with it, but the tradeoff is you use poetry run
generally in a dockerfile i don't "activate" the venv anyway, i just do ./venv/bin/python -m ...
you could just let poetry manage the venv for you
nothing wrong with poetry run imo
Hmm, okay... Firstly when I tried to run python -m ... and I got error that module is not installed I was surprised ๐
Thx for reply ๐
@desert dove
Hi guys. @Leopard said you could help me a little bit with a docker issue I'm having. Thing is: i'm building a postgres service and the service is creating 2 databases instead of 1... I'm sharing my docker-compose content next
You should keep your secrets in env variables ๐
What do you mean by is creating 2 databases instead of 1? 
You should have cart-test database next to system database
When I access the container postgres server from outside the container with PGAdmin, I see 2 databases: the one I specified called "cart-test" and another one called "postgres"... is this done by default or am I doing something wrong?
Are you sure that you flushed volume properly?
I will try to run Postgres container on my own, give me a second
What is this and how can I do it?
Hmm... I got this table too
Meaning you also get the second database called "postgres"?
Yep. I am not an expert in Postgres but it looks that there is need to have empty database during init
https://github.com/docker-library/postgres/blob/7f5f6da5a1976bfd2c6d989e20cef080d0d9c68f/13/buster/docker-entrypoint.sh#L193-L197
13/buster/docker-entrypoint.sh lines 193 to 197
dbAlreadyExists="$(
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
SELECT 1 FROM pg_database WHERE datname = :'db' ;
EOSQL
)"```
@desert dove 
So this basically means that the service creates the postgres DB by default?
Strange... I have an env variable named POSTGRES_DB... so it should just select it instead of create it
Hey guys, I am using nvidia/cuda:10.0-devel-ubuntu16.04 docker container with python 2.7 and tensorflow==1.4
The code is supposed to run on GPU, but it displays I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
This is the running command: docker run -it --gpus=all --runtime=nvidia -p 5678:5678 -p 5000:5000 --name studia_ner_api_hand studia_ner_api_hand python -m debugpy --listen 0.0.0.0:5678 --wait-for-client OCR/API_OCR.py
The code works perfectly on local without any issue.
Any solution for that please ?
I think you can run poetry shell to enter the venv
But I'm not completely sure
hm?
i am using mkdocs right now, and wanted to automatically document my project
ah
it seems fine, although I have encountered a few difficulties
Documenting dataclasses and generic classes is a bit wonky, and you can't make it document 0 fields (which is useful for protocols that are made as an intersection of other protocols)
fwiw i still wouldn't do that in docker, i'd use poetry run
class Thing(A,B,C):
"Hello"
it won't document this?
Same, that's just another option
It will include the default methods of protocol like __init__ and __init_subclass__
oh yuck
that ought to be configurable
hmm... actually sphinx probably has that same problem too right?
is there a way to tell sphinx not to include parent class stuff in the generated doc?
There has to be
<@&831776746206265384>
just checked on discordpy, apparently it does show everything on client on bot
hey git asks me for .NETframework,Version=4.7.2
do i need to install it?
This is the error it is giving without .NETframework
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date
is there any way to work with git without installing .NET
git doesnt depend on .net at all?
this is downloaded from https://git-scm.com/ right
not some gui client
hey guys, I'm trying to learn some shell scripting, and i want to ask si there any good resource on documentation about the syntax ? like the most recent one or smth like that.
shell is pretty mature software, so there have not been too many interesting syntax additions as of recently, and i can't think of any deprecations or breakages at all. imo the best way to learn shell scripting is to write scripts yourself for common things to do. for example, i have a backup script which calls out to borg and has some nice hooks for completion / failure. you could try building something similar
I see, thank you
Even in Docker?
Let me check
Nah
(25, 'Inappropriate ioctl for device')
FROM python:3-slim
WORKDIR /tmp/xyz
RUN pip install poetry
COPY pyproject.toml pyproject.toml
COPY poetry.lock poetry.lock
RUN poetry install
RUN poetry shell
CMD ["poetry", "run", "python"]
can I ask here about IDE? mainly vscode?
Yes, or in #editors-ides
# Bash Resources
---
http://redsymbol.net/articles/unofficial-bash-strict-mode
https://github.com/dylanaraps/pure-bash-bible
https://www.shellcheck.net
https://betterdev.blog/minimal-safe-bash-script-template
http://www.shelldorado.com/goodcoding/cmdargs.html
https://gist.github.com/hfossli/4368aa5a577742c3c9f9266ed214aa58>
https://wiki.bash-hackers.org/howto/getopts_tutorial
https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
https://www.baeldung.com/linux/use-command-line-arguments-in-bash-script
https://stackoverflow.com/questions/669452/is-double-square-brackets-preferable-over-single-square-brackets-in-ba
https://www.gnu.org/software/bash/manual/html_node/Process-Substitution.html
https://github.com/itspriddle/things-cli
https://github.com/bats-core/bats-core/
vscode
https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck
https://github.com/dylanaraps/neofetch
https://argbash.io
https://explainshell.com/
https://github.com/matejak/argbash
sudo apt install autoconf
---
Tagged:
#bash #resources
Might want to update your private items
also here, a little announcement: we released https://pypi.org/project/justuse/0.5.0/ just now, please report any bugs so that they shall be made into testcases ๐
i still wouldn't recommend using it in production yet, although most things should be auto-installable now
i need help resizing volume in k8s 
https://kubernetes.io/blog/2018/07/12/resizing-persistent-volumes-using-kubernetes/ this doesnโt work?
Author: Hemant Kumar (Red Hat)
Editorโs note: this post is part of a series of in-depth articles on whatโs new in Kubernetes 1.11
In Kubernetes v1.11 the persistent volume expansion feature is being promoted to beta. This feature allows users to easily resize an existing volume by editing the PersistentVolumeClaim (PVC) object. Users no longer h...
i had the volume size set to 11, then i changed it to 60 
it got updated updated in linode
but 
Not sure.
yes i restarted the pod multiple times 
You can ask their support
but also 
Is that for nodes?
i am inside the pod rn 
I donโt do PVC so ๐คท
i saw it being used in the k8s repo so i thought anyone here might have an idea ๐
Maybe someone with more experience will wonder by
Well, Iโd work on transitioning away from PVC
@glad wren did you try resize2fs
i spawned a node shell & ran that pointed to the device (can't be mounted at this stage afaik)
what the fuck
apparently
git rebase -i HEAD~X where x is a commit number. This apparently allows changing previous commit messages. While this does change the hashes, this is perfect for when you decide to change a commit name or something before pushing 
git commit --amend ?
if you want to change the message of a commit that was 6 commits away, this allows you to do that
anything more than the last commit
๐
just did and worked, thank you 
Cool!!
yeah, just don't rewrite after pushing
i want to solve a problem
2280.5 * [1+8.3528 %( 7/365)] - 0
How can i solve this
Any hint?
Problem? I don't see any unknown there 
Also - probably wrong channel and #algos-and-data-structs will be more suitable
is this the right channel for a mypy question?
Minor detail: it doesn't change the commits. It makes new commits that are copies of the old ones
Actually a major detail 
I knew that when sending, but should have made it more clear
having trouble with pip trying to install pynacl. using debian 11 stable
i have cffi backend system package 1.14.5 installed, cffi 1.14.5 installed in my venv, everything here is working correctly as far as i can tell
when i attempt to install pynacl, it seems to also upgrade cffi to 1.14.6, which is incompatible with the backend, despite the required version only being >=1.4.1
yes
it's only major if you are collaborating with other people ๐
how did you install it? Maybe pip install -U is the culprit? Try pip install pynacl 'cffi<=1.14.5' or some equivalent?
just pip install pynacl, tried with --no-deps as well, i'll try that
no luck...
Collecting pynacl
Using cached PyNaCl-1.4.0.tar.gz (3.4 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /home/mike/srv/docker-venv/bin/python3 /tmp/tmpkzt8sv73_in_process.py prepare_metadata_for_build_wheel /tmp/tmp8rsryt_l
cwd: /tmp/pip-install-1mgvgpnq/pynacl_53c29fa6f83c49afb9d5606dde28920a
Complete output (36 lines):
Traceback (most recent call last):
File "/tmp/tmpkzt8sv73_in_process.py", line 280, in <module>
main()
... # nothing particularly interesting in the traceback, just standard setuptools stuff
Exception: Version mismatch: this is the 'cffi' package version 1.14.6, located in '/tmp/pip-build-env-256k8u5r/overlay/lib/python3.9/site-packages/cffi/api.py'. When we import the top-level '_cffi_backend' extension module, we get version 1.14.5, located in '/usr/lib/python3/dist-packages/_cffi_backend.cpython-39-arm-linux-gnueabihf.so'. The two versions should be equal; check your installation.
purged pip cache just in case it was trying to upgrade just because it was convenient and tried again, no dice
do you mean the cffi pip package i have in the venv? because i can open the repl and instantiate cffi.FFI() with no issue, despite this being the line that leads to the error in the setup script
the cffi i have installed is 1.14.5, matching the backend from the system package manager. there is no issue using it outside the pynacl setup script, which inexplicably tries to upgrade to 1.14.6
despite already having 1.14.5 installed through pip just fine, i uninstalled it and installed the system python3-cffi package and it's now working
i missed that one last night because for some reason, apt list *cffi* resulted in only python3-cffi-backend, didn't give python3-cffi or python3-cffi-backend-dbg
Do you really need this installed systemwide?
I hope you're not doing sudo pip install!
@tawdry needle yo, ```py
loaded_config_dict = ConfigurationSchema().load(data=loaded_config_dict, unknown=marshmallow.EXCLUDE)
For some reason any additional fields on the `loaded_config_dict` are not ignored by marshmallow at this moment
gimme a few minutes to get source together
thanks
my code isn't commited right now since I was fixing another bug
while I don't have a full sample, I have tested that it appears in this commit:
https://github.com/discord-modmail/modmail/commit/a83a7d25071aefb10825302fec11a58d0807f28e
I think I found it
I did not find it.
ah....
I wonder if that unknown=marshmallow.EXCLUDE is even doing anything even in the commit before
Okay, so I think it has to do with actually loading the bot configuration from the toml file
rather than loading the .env file and then the .toml file, it loads the .toml file and overlays the .env file on it
which means this should be reproduciable by providing a variable named MODMAIL_BOT_ANYTHiNG
Except its NOT because of how the env parser is written
....
there are some uh
problems
@tawdry needle the short of the matter is there's actually a lot more to it than this
previously it was not even loading the configuration files and only loading the .env file and the defaults
yesno. There is an unexplainable bug here now. I'm gonna take a break and come back to it in a bit
Tldr top level extra keys are ignored just fine
Any nested keys within keys that are wanted are not ignored and throw an error
My solution for that is likely just gone be fuck it and recurse the fields and remove any extra keys, before loading it I guess
Legally, does it matter if I distribute a PyInstaller app which includes licenses for code not actually included in the binary? Because I'm not sure that I can guarantee that every license included actually corresponds to something used since:
a) I am using a license auto-collector
b) I don't need all dependencies which pip installs for some packages so I exclude them
@tawdry needle to give an update: I fixed that bug and now I'm rewriting that .env parser like we talked about previously ๐
quite late response, sorry.
no, i wasn't using the global env with pip. i was using a venv with --system-site-packages
python3-cffi-backend was already installed with system package manager (debian, apt) as dependency of some other package, but python3-cffi wasn't
despite explicitly installing cffi 1.14.5 in the venv (matching system-installed version of the backend), it kept wanting to update that package, still no clue what was going on there
i installed the system/apt package python3-cffi to go with the already installed python3-cffi-backend and the pynacl install went fine
what's the best way to get a representation of all callable objects with signatures in a python module?
a way to iterate recursively through all callable objects would do the trick, too
i'm trying to come up with a good way to realise "signature-equivalence" for auto-reloading and auto-upgrading
while i realize that real signature-compatibility would require checking whether the pre/post conditions are ~~narrower ~~ broader than before
complicated subject. maybe it should end with signature-equivalence
maybe i could make it work with icontract
as a combined signature of sorts
!d ast @urban pecan
Source code: Lib/ast.py
The ast module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each Python release; this module helps to find out programmatically what the current grammar looks like.
An abstract syntax tree can be generated by passing ast.PyCF_ONLY_AST as a flag to the compile() built-in function, or using the parse() helper provided in this module. The result will be a tree of objects whose classes all inherit from ast.AST. An abstract syntax tree can be compiled into a Python code object using the built-in compile() function.
That seems to be what you want
not really, i only need the signatures
inspect.signature(callable, *, follow_wrapped=True, globals=None, locals=None, eval_str=False)```
Return a [`Signature`](https://docs.python.org/3.10/library/inspect.html#inspect.Signature "inspect.Signature") object for the given `callable`...
and now, how to combine both? ^^
But I don't see how you could get the items to get the signatures without using the ast
i already thought of both, but i have little experience working with the AST, so i'm not sure how to combine both
I suppose it depends.
IMO trying to use the ast seems more stable
however, you could... Uh. Import the file, call dir on it. Iterate through the result and use getattr to get each result then callable() every result. Then inspect.signature
However, knowing your intentions, and which project this is for, I must add that parsing the ast seems most resound.
ah, maybe i need to take different routes for auto-reload and auto-upgrade
Hello everyone, I am using nvidia/cuda:10.0-devel-ubuntu16.04 docker image to run an API that uses tensorflow 1.4 and python 2.7. (an OCR that works on GPU). The code works perfect locally, but on docker,
it shows me this warning while loading the network on GPU
tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
and the code returns empty result.
Docker launch command: docker run -it --gpus 'all,capabilities=compute' --runtime=nvidia -p 5678:5678 -p 5000:5000 --name api api python -m debugpy --listen 0.0.0.0:5678 --wait-for-client OCR/API_OCR.py
Any idea how to solve this ?
@urban pecan why did you need the ast?
i didn't, i just asked about a good approach to recursively compare callable object's signatures
while recursing dir with getattr should be feasible with auto-reloading a module, it's probably not a good idea to import (and thus execute) a package just to check signatures
which suggests an AST-approach
Wdym recursively?
Oh, you need to step through the entire module and compare signatures of items within
Yeah, use the AST. It's not that hard to work with, just a little verbose and the documentation is a bit dense
Figuring out what types of nose can't be children of a particular node was not easy, I've ended up just experimenting with trial and error instead of relying on the reference doc
maybe i need to read the source of AST then first?
It's in the docs, it's just a little hard to read
Probably not as hard to read as the source
i guess it's as good a time as any to start fiddling with the AST, rather sooner than later ^^
black magic, here i come
the nice thing about ast (rather than bytecode) is that it should be portable across implementations
although with new syntax being added it won't be portable across 3.x versions
I'm not sure, but I don't think that message is an error. It looks more like a warning saying that the binary is not as optimized as it could be.
what does this / / do?
Dockerfile line 8
COPY --from=py3 / /```
it's weird syntax because it's using multi-image builds, but it just copies the root file system of the initial image to the one of the next
what that means is because it pulls both a Python and Java image it copies the Python build to the Java image, so you end up with both Python and Java installation
i think i'll push for a "package:module" syntax in justuse, i always get confused when python complains about missing attributes on packages etc.
what'cha think?
like use('scikit-learn:sklearn')?
yeah
i think it's a good idea, but i also think it would be nice to support them as separate kwargs
use('scikti-learn:sklearn')
use(('scikit-learn', 'sklearn'))
use(distribution='scikit-learn', module='sklearn')
i like it
although, the middle one is bad
uh
no, actually tuple could work
i didn't see the additional ()
second and third could be aliases via methdispatch
the last one gets my vote but it won't work as we currently only allow one positional argument ๐
it's a tuple!!
you mean this? https://pypi.org/project/multipledispatch/
there's also pattern matching ๐
no, i mean
# singledispatch for methods
def methdispatch(func) -> Callable:
dispatcher = singledispatch(func)
def wrapper(*args, **kw):
return dispatcher.dispatch(args[1].__class__)(*args, **kw)
wrapper.register = dispatcher.register
update_wrapper(wrapper, func)
return wrapper
remember when python used to allow tuples in signatures?
we dispatch on the first argument, which works quite well
(and only positional argument)
...did it?
destructuring in function signatures would be super cool
def foo((a,b), c):
...
built-in runtime checking
would be a nice accompaniment to pattern matching
yeah you could declare like
def func((x, y), z):
also i wish you could destructure mappings with =
{'x': x} = {'x': 1, 'y': 2}
jinx
I used it in 2.x
thanks for nothing, PEP 3113
https://www.python.org/dev/peps/pep-3113/#no-loss-of-abilities-if-removed this is... moronic
ok that's a rude word
this is "ill considered"
no, it's pretty much what i'd call it, too
all of these issues are either non-issues in 2021 or could have been fixed
where to send the hate mail?
hehe
propose re-adding them on a mailing list i guess
i also want mapping destructuring now
especially w/ pattern matching
hell, i want all the pattern matching syntax on the LHS of =
the reply will be "meh, we just removed it!!!1 and lumbdus suxxx!11!"
forget lambdas
no loss of functionality
there actually was loss of functionality too
the PEP is not objective
Why They Should (Supposedly) Stay
I used it for points which is one of the "supposed" use cases that worked very nicely
we should be going the other direction, to full destructuring IMO
last complaint
Annotations provide great flexibility for documenting what an argument is expected to be for a parameter, including being a sequence of a certain length
I vehemently disagree
help() does not show annotations, does it?
they only add new types to 'ast' and don't remove anything, I guess, so compatibility probably shouldn't be an issue
does โgo to testโ work for you all in
?
any specific test file naming convention you use to support it?
with the new parser you mean?
never actually tried it tbh. normally i write TestFoo for unittest, and test_foo for unittest/pytest
which doesnโt work for me
itโs quite irritating to have to go find the corresponding test
like okay itโs a few more seconds but itโs just not as ergonomic
compared to a language plugin which supports it
i think three's a way to configure the test function naming pattern
i remember seeing something like that in the settings
@tawdry needle as I alluded to, the requirements haven't been super well defined quite yet. The reason I've already asked is that I'm generally interested to know how one can make a portable Python environment with a frozen set of dependencies, but which exposes a regular Python executable.
could you define portable?
(also is this part of a previous conversation that I'm missing?)
you can change the location of the python executable (even if that requires moving associated files) to anywhere on that machine's file system, and you can move it between two machines (even if those two machines must share the same OS)
The real-world application is that I'm developing something that will eventually be deployed on a computer that does not have internet access, but for the sake of argument, we can assume that there are no restrictions on what I can put on the flash drive.
ah
So er, what's the question?
are you asking how to install the python files in a self contained environment?
You know, I'm not entirely sure
because I think for that you could actually use venv, or virtualenv
I've never tried it personally, but there's a flag which can be flipped on to copy everything instead of symlinking it
afaik, venv environments can't be moved at all, even within the same machine
I haven't, so maybe you're right
what's the difference between somefolder/** and somefolder/ in a .gitignore 
iirc not much?
no, there is a difference
and it has something to do with reincluding
i can't remember what it is, but I do remember one of these will work and the other wont:
# a
somefolder/**
!somefolder/readme.md
# b
somefolder/
!somefolder/readme.md
@heavy knot
Based on the docs I found it sound like the first with ** will ignore the readme
but not certain 
Ye
And git ignore don't always matter either
Like
You can still add a file past a git ignore
between flask, django and FastAPI
which would you ship an API (say with future extensibility of some frontend framework) to production
probably fastapi, assuming i already had some kind of database set up
if i needed to start from scratch with a database i would probably go with django
TBH aren't django and flask not really apis?
they're general-purpose web frameworks. you can definitely use both to build APIs, and there are add-on library/frameworks that help you do it too
e.g. django rest framework
note: my preference for django is partly a matter of familiarity
maybe sqlalchemy + fastapi is a better "stack", or the new library sqlmodel
!pypi sqlmodel
also tbf starlette is nice too
fastapi is built on top of starlette, so yes
Question more about licensing - can I use pylint in commercial software? 
Or maybe should I use different linter?
should be fine if you're not distributing or importing ("linking") it
is this where i ask questions about installers?
Yeah, I think that this channel will be accurate
How do I turn an exe directory (build/dist) etc from pyinstaller into just a single MSI installer that I can distribute to people?
What are some great third-party tools/APIs that should be used be in production? I'm thinking like Sentry for error logging, Grafana for monitoring, etc.
Docker for deployment?
Yep already done
Some CI pipelines?
In progress
I'm looking for a list of stuff that are used in py scripts in general not for deployment specifically, just not sure where ask it (thought this was about tools in general at first)
I.e. Sentry
I don't quite understand... Basically when I have a problem then I am trying to find a solution. I am not taking a product and trying to find, where can I use it in my app ๐
Do you want to speedup your app? Use some cache
Do you want to implement queue? Use some already existing implementations
And so on...
That's why I'm asking for common third-party stuff that should be used in every script no matter what it does, like Sentry for error logging. I don't have a specific problem I'm trying to solve just trying to find more cool tools that makes your life easier. Sentry is the only great example I have as it really should be used in every script
But I bet there are a lot of cool stuff I'm missing that makes a lot of sense to use
Well Sentry fits that perfectly imo
i was more thinking of pytest
Yeah I know, I meant it fits my example
in very rare cases there's a single project that fits the niche
in most cases there are different ways to accomplish what you want
I'm asking for very common general stuff... for example every website ever should use Google Analytics, a CDN, etc.
Same question but for python scripts
that question doesn't even make sense
Every script should use x and y in production no matter what it does, but Sentry is the only one I got so far and I bet there are plenty
Bruh
I am not using Google Analytics (or any analytics service at all) because of security and tracking reasons lol
Well you're part of the 0.01% then, my bad, then I'm looking for something that 99.9% of the scripts should use
For my personal website ofc
But I'm talking about production not personal
python scripts can range from media production pipelines over desktop or mobile applications to super computing scientific applications
There is no production website without GA (at least I'd hope so)
I am not sure that it's even possible to do that list. You have different requirements for desktop app and server app for example 
the requirements are very diverse
Then the list is empty ๐
It should be used in EVERY script
Why would you use sentry for a local desktop app
i never used sentry
I don't need sentry when I am developing simple automating script which has about 100 lines
My question was for production app
what kind of production?
Anything that runs in production ffs
It doesn't matter
Because once again I'm looking for general tools
Give us a more details then it would be easier to make a list that better fits for you
Why isn't a desktop app a "production" app?
are you talking about hosting websites or pharmaceutical production?
Why shouldn't a desktop app use sentry?
Because it may not even be able to connect to the internet
There's little overlap for tools between libraries, web hosted and desktop stuff
I have like 20 different projects that are completely unrelated and I'm using sentry in all of them, hence why I asked in general...
like lab equipment
Yeah idk how to ask it in an even more straight forward way
I have 3 different projects rn and I can tell you that the only thing which is common for all of them is just a packaging tool
the only overlap in all bigger python projects may be the project management and IDE
Don't they all use logging?
However I am still learning devops and tools
I cannot do it for offline application for example (one of them)
If you don't use logging in every single script then you are probably already doing it wrong
For other two the security requirements don't allow me to do that
I couldn't imagine myself not using logging even in a single script wtf
I'm talking local logging with logging
Local logging is okay
there are different approaches to logging and debugging
me neither
Well if you guys don't even use Sentry then I'm asking a wall pretty much lol
I haven't met a single developer that isn't using Sentry yet
My mind is blown lol
now you have
Maybe your working area is much different that ours
I've hired I think 7 coders so far for completely unrelated projects and all of them used Sentry, which is why I asked for tools in general
Because it just makes sense
Have you ever make a app for gov or military?
... no
I cannot imagine that military will connect with external service to store logs
So here you are
Right, the vast majority here probably is developing for the gov and military right?
Different requirements requires different tools and services
I don't know what others do
Maybe 1 person on this entire server
Maybe it's offline rn ๐
as mentioned, there are many usecases where internet connection is not even an option
and you don't need to look for government or military for that
@smoky stratus you can for example use lambdas (or other cloud functions, name depends on the cloud provider)
That's a good one, I already am
I'm just looking for tech/tools in general that could (well, should but not required) be used in every app ever
Git, Docker, serverless functions, etc.
For deployment
Sentry for logging
CloudFlare etc. for CDN
... for python scripts
You are focusing on server-side applications, right?
Not always but let's just say yes
Most of my projects are SaaS apps
Involving Django, Django REST, MongoDB, RabbitMQ, etc.
But those are specific ones, i.e. you shouldn't use django in every script
But you should use Sentry in every script
I'm looking for general all-purpose tools
I cannot agree
Like databses
You can think about all-purpose database system
There is no such solution
Yeah that's not what I'm after
You have relational databases, document databases, graph databases...
I give up
That's exactly why I said those are not great examples
But for example Lambda is a better one because you could use it somehow in any SaaS whatever the hell its doing. Not saying you should but you could to make some aspects easier
Same goes for Git, Docker
But those are all for deployment, I got that down already
You can use git in every project but you don't need Docker
Anyway, I think that you need to wait for some expert in that area
which git? ๐
github? gitlab?
Git itself
not too long ago, git wasn't even the first choice in that niche
That's why I asked my question the way I asked it, you can run a production app without git... but you shouldn't. You can run a production SaaS app without Sentry... but you shouldn't
If you don't know/use Sentry then I assume you don't have production apps?
Desktop application can also be a production app
And it should also use Sentry in that case. How do you log errors remotely from your users?
Again, all depends on the requirements. How do you log errors remotely without Internet connection on the machine?
I am making offline tool which doesn't require internet connection and probably won't work in environment with Internet
It's not even possible to collect logs remotely
Tell me an app you use that doesn't have online logging functionality
I'm genuinely curious
Do you use scientific lab equipment personally?
yup
I am building such app which will work potentially with malware so machines will work in isolated environment
But it's not a production app yet then
Lol
Okay, nvm. You are trying to find tools to cloud apps, not apps in general
I assume because of which will
Both
It doesn't have to be internet connected
I literally don't care
Just looking for tools ffs
You already have programs like this, I am creating something new ๐
Right, but you are creating it and it's not yet in production I'd assume?
But that's completely besides the question anyway
Under development
Right, I'm looking for tools for stuff that is already in production and could be used to make x and y easier
Browserstack
I don't have a specific problem, when I had a problem with lack of logging I've looked into the logging module which works like a charm. But Sentry is a million times better than logging
And btw you can run Sentry locally, it doesn't have to be connected to the internet
Haven't heard of that let me check
Which in essence is a simpler logging module
I already have all my logging needs solved with Sentry, I'm looking for the rest of the aspects
(other than deployment, I already have git/docker etc. for that)
This is a great example of what I'm looking for but it's not python related
Why not Python related? You can use most of those tools with Python
Not in python
With a python app, sure
I.e. you don't use GA in python, but you use it with your python app
I really can't come up with a better example than Sentry
This discussion looks pointless - you have your vision of "general software tools" which are not general at all because fits only for chosen type of products (cloud-like)
But I imagine there are more things that are just as beautiful
I.e. 1 line of code to implement and makes your life a million times easier
I've narrowed to general SaaS apps
i used pyinstaller to make a standalone executable for my program that's just like 5 files and like maybe 50 kb
and the exe is 50 MB
is this unavoidable or maybe caused by importing way too many unnecessary libraries?
sometimes it picks up more binary dependencies than it should, but if you have bigger deps it's mostly unavoidable
pytest, icontract, typeguard?
hypothesis
general software dev tools that make life much easier in a few lines of code
sourcery
github copilot
That's a good example
sourcery is really useful actually
Still haven't got my invite
How does it differ from what PyCharm already has built in? The example that's how on their homepage PyCharm can do by itself already
Kite is a nice one too
copilot is nifty, tabnine isn't bad either
Installing now to check it out
i dislike kite for various reasons
Such as?
sourcery is a vscode extension as well as a commit bot on github
both are well worth it
yes
PyCharm can do this by itself
Nvm it doesn't play gif here
I think PyCharm does a lot of this by default
I barely use VSC so can't talk for that
But anyway, github copilot was a great example of what I'm after
it does auto-refactoring on PRs and analysis
can be quite motivating
Oh damn that looks sweet
i use draft PRs now mainly for that reason
which has a number of benefits besides that
I'm looking at your other PRs and damn that is impressive
Exactly what I was looking for, tools like this
ty
how can i minimize imports for pyinstaller
like say im only using 2 methods from win32gui i dont want to import the whole thing
but the entry file i'm running pyinstaller on doesn't use win32gui at all it's a different file in the project
but in the hidden_imports=[] section of the spec file it seems u just specify outermost libraries not library functions
like my 50 MB exe takes 20 seconds to run
that is just simply not acceptable
i guess sizewize of the exe doesn't matter but it needs to open in 1 second not 20
i gues the issue is prbably mainly the one-file option ?
it suggests parts of identifiers and expressions that don't really make sense, was my problem with it
plus required a resource-hungry background process on Windowd
Isn't pywin pure python? I'd build it without onefile and look at what binaries are taking up most space
if pyinstaller included them erroneously you may want to consider a clean environment, for some others you can safely delete them as they're part of your dep that it included because it can't detect what you use from it
the "embeddable python" distribution doesn't include the stdlib, does it ?
It wouldn't be very usable without it, I'd guess only modules like tkinter or sqlite aren't included
if there was such a thing as a "single-file executable" that didn't have to fully unpack itself into Temp on every run, that would be more compelling I think
pyinstaller's folders could be a bit nicer if it didn't dump everything into the root dir
What benefits do those have?
I use em, but what other benefits?
afaik there will be shared libraries, and on Windows its (virtually) impossible to load shared libraries from memory on Windows, so I would think a statically-linked python might work better as a foundation for single-file.
then maybe customize ZipImporter to load from the sys.executable itself, or at some offset into it?
i really like the workflow encouraged by gitlive: pick an issue, which auto-creates a feature branch with #issue-name schema, empty commit, make draft PR to get sourcery in the loop, do all the changes, have greyblue commit to the same PR for details and when everything is done and tests pass, merge the PR with main
i guess gitlive is another tool i could recommend
it still got some quirks and bugs, but i mostly like it
i could find no tool that does a better job, the rest of what's out there are basically linters and formatters
it refactors your PR and makes a pull request you can merge into your original PR
Huh
here they've listed out what it will do:
https://sourcery.ai/blog/explaining-refactorings-1/
doing pyinstaller -D made the exe run real fast and is down to 4 MB
so i guess thats mainly what it was
now i need to turn this cluttered folder into a single installer
Avoiding the unpacking helps a lot, but I'd look into cutting down the size for distribution if you don't have deps that are that large
i can imagine some of these turning into real ugly code if the tool isn't careful to keep line lengths under a certain amount (and maybe limit some other heuristics like number of parentheses on the line)
deps what do u mean by this
Your code's dependencies
oh right
Is it possible to set up GitLab running without a domain and using self-signed cert? It's for local dev work only (no intention to open it up to the public). I'm not on any VPS services too, just me and an old laptop-as-a-server that runs Ubuntu
I found a blog post at https://futurestud.io/tutorials/how-to-run-gitlab-with-self-signed-ssl-certificate but not sure if that's good enough
they do a pretty good job at that, but i also use black, which plays quite well with sourcery and tabnine/copilot
oh yeah, they don't do anything really advanced or do too many things in one statement, maybe there's some internal limit
Hey I am trying to chase down a memory leak using PyCharm involving tkinter/pil is there a better application to pick through memory snapshots?
anyone familar with pipenv and setup.py? trying to do a monorepoish type setup.
my question is in #help-chestnut
guys , can anyone help me about how to install pyspark docker image from here
https://hub.docker.com/r/jupyter/pyspark-notebook
i need specifically to setup spark version 3.0.1 , i'm new to docker and installed image which apeared to be a newer version , how can i change it
anyone know a good guide for innosetup use
I have long question in #๐คกhelp-banana message, gist is:
Does it make sense to harvest .so libraries from the manylinux docker image to put in a wheel?
Hopefully basic git question. I'm not using branching or anything currently, just tracking changes in a simple repo where I'm the only developer. I have an unused function that I want to remove for now but may want to come back to later. What's the easiest way to track something like this?
You can add tag to current version, like v1.0.0
When you want to check file for that version later use
$ git show v1.0.0:path/to/file
Cool, thanks!
how should i clone a repo and then make a new repo with that other one?
like how do i clone repo A into a new repo B that im making?
Umm, hello
I remember installing git, but when I try to use this I get this error. Could someone help me sort this out, please ping me if so.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
this happens when I run the command git
You can use Fork feature on GitHub for example
Or clone repo and replace remote to another repo
Hello, I have a tiring problem with git
(I use pycharm)
I have a file with .db format
I commited and pull my folder
all files changed with the thing where you can choose for each change in the code which version you keep
but the .db file also changed
I choose for each files but not in the db because it's unreadable
hii
so to fix it, how can I remove the files from git, I don't need to pull it
or how I can get back to the last commit, now it write this when I try
Has anyone used GitHub Actions to build and deploy to IIS?
I used to use Team City and Octopus Deploy to build and deploy. I would love some advice on best practices.
Is there any significance of the | I keep seeing after run in github actions other than to tell it to read the next lines?
Like ... run: | somecommand1 somecommand2
That just means the input spans multiple lines rather than one. It's part of the yaml standard iirc
I see, so run: somecommand1 somecommand2 would fail?
Umm, I'm not sure. Here's what I see in the yaml spec though (first code block)
Not sure if that's related though
I have a github action that runs a python script to generate a file then pushes it back to the repo ... - name: Run syntax maker run: | python src/syntax_maker.py git config --global user.name 'GitHub Publish Action' git add syntaxes/many.tmLanguage.json git commit -m "Automatically made many.tmLanguage.json syntax." git push
Problem is sometimes the file is already there unchanged so the commit complains nothing to commit, working tree clean and the action fails
Is there a way I can have the action still succeed if no changes are needed 
like if there is new stuff, commit and push it, else, do nothing
this seemed to do the trick
if [[ `git status --porcelain` ]]; then git commit -m "Automatically made many.tmLanguage.json syntax." git push fi
For a dotenv file holding defaults or required variables, what would you name it? Does not have to be on this list.
.env.example
.env.sample
.env.template
Would anyone mind helping me setup a DigitalOcean VPS for a discord bot? I'm super confused as this is my first time working with VPS' thank you! :)
I've got a python codebase that runs on production and development (local). I have some scripts that people on my team (which are technical but not developers) are sometimes running and they need to be with production env.
I have python-dotenv and a prod.env file with the redis connection details for example.
The thing is, when running from your own dev machine, you need to tunnel the prod redis connection to localhost in order to connect to it.
How do you usually handle these scenarios?
DM me if u still have a problem
I used digital ocean recently to get VPS for myself too
I did not get the question
Do u wish using prod redis for dev?
@rapid sparrow I have some scripts that should run with production creds (for example, connecting to the redis production server), but they're running from a developer's laptop.
To get network access to the production instance, SSH tunnelling is used. Hence, the redis hostname (and maybe port) is now localhost and no the actual internal production hostname
so I can have another env file like production-local.env that works on a dev machine (after setting up the SSH tunnels), but I just wanted to know what others are doing/thinking regarding this
Ah, so u wish to know alternative to ssh tunneling to prod redis, or alternative to .env files, right?
I use linux for dev. I just raise docker container with redis in my dev PC
I heard some Windows 10/macOSes versions can do it too now
yeah that's not exactly what I'm asking
hello guys, anyone knows if there is a fullnode implementation in python? like a library that I can install with pip
how can i push a branch with git without checking it out?
should be able to use the refspec arg https://git-scm.com/docs/git-push#Documentation/git-push.txt-ltrefspecgt82308203
I don't know if this part of devops or software-design. Forgive me if I'm in the wrong channel for this. I want to run a python script on a cron job but I want all of this handled in docker containers. A bit of research leads me to this approach:
1 docker container for the python app script with the python slim image
1 docker container specifically to run docker run --rm app script installed with ubuntu image
Then put them together with a docker-compose.yml.
Is this the right way? Or should I merge the 2 docker images into 1?
Is anyone else using Sublime Text as their editor and have a fairly comprehensive Python setup (e.g. linters/mypy/lsp)?
i had a former colleague who used it.
eventually we came up with vscode having sublime text theme, and that's basically it.
Haha. I have never gelled with anything heavier and I like my setup, I was just wondering if anyone else used it so I could see if I was missing anything cool
Hi guys Ive encountered a weird problem using gitlab: I have a group with projects but the problem is that my group ci variables are only inherited by projects present before I added them but news project dont inheritate them I dont understand why
anyone familiar with pipenv and setuptools?
That should be done in Dockerfile where you CMD it with that as ARGS
Thanks solved it
I used docker-compose
lol yeah same, used it when using scripts. when getting more advanced used vscode. missed the older sublime theme, but that's just a preference setting
@wet parcel following up:
โโโ app
โ โโโ main.py
โ โโโ Pipfile
โโโ somelib
โโโ __init__.py
โโโ lib.py
โโโ setup.py
can you post the contents of app/Pipfile? note that pipenv has weak support for "local" packages and editable installs, see https://github.com/pypa/pipfile/issues/90
also, @wet parcel i just noticed that somelib is structured incorrectly. it should be like this:
.
โโโ app/
โ โโโ main.py
โ โโโ Pipfile
โโโ somelib/
โโโ somelib/
โ โโโ __init__.py
โ โโโ lib.py
โโโ setup.py
and setup.py should be like this:
from setuptools import find_packages, setup
setup(
...,
packages=find_packages(),
...,
)
there is a difference between an "import package" (a module that can contain other modules) and a "distribution package" (something you distribute e.g. via pypi). the naming choices are unfortunate here, so it's sometimes easier to refer to a "distribution package" as a "distribution"
setup.py defines a distribution, which can contain one or more modules/packages
with the setup above, you should be able to write from somelib import lib in app/main.py
@tawdry needle thanks so much! I was structuring it incorrectly. clearing up the meaning distribution from other packages helped greatly.
For further reading: https://packaging.python.org
The Python Packaging User Guide (PyPUG) is a collection of tutorials and guides for packaging Python software.
@tawdry needle do you if I can change that second dir to somethign else?
โโโ somelib/
โโโ somelib/ <---- this one?
in the setup i showed, if you change that name, you change the name of the python module that you import. so if you have ./somelib/foo then you write import foo.
holy
this is excellent, i don't have to do the work for it now
nearly half of the commits to the linux kernel have been since 2015.
Can I ask you a question about ffmpeg?
hello guys,
hope you are all well.
I faced output clipped, log limit 1MiB reached error while building a container.
I added to /etc/docker/daemon.json these 2 lines:
"log-driver": "json-file",
"log-opts": {"max-size": "100m", "max-file": "2"}
I ran systemctl reload docker. The error persists when rebuilding.
any advice about how to handle properly this issue ?
PS: I don't want to use buildx since I am in production.
of the 33 respositories of this guy and it seems like all of them depend on a different project of theirs
sounds like me. lol
I think instead of pushing everything directly to app.domain.io we push it to something like dev.domain.io for testing and if everything seems fine we push it to app
Can someone tell me if this is even possible? It's a nestjs app. Are there any courses available to help me with this? Any help will be appreciated.
We are using AWS EC2 for the server
how can i make a github action step of a larger workflow work only if in the event a specific path was edited?
I think you can echo from one step
echo ::set-output name=was_edited::$value
then get it in another
${{ steps.previous_step_id.outputs.was_edited }}
but like, how do I know if it was edited in the pushed commits?
setting value...
run: |
value=???
not sure. some fancy bash 1 liner... that git diffs, pipes that to grep etc or use find. or checks last modified date of the file?
What is the easiest way to debug memory consumption? I have numpy arrays as attributes to classes
ฤฐt goes upwards of 20gbs for views of 40 2500x1500 images :(
There is sys.getsizeof but itโs not always accurate
it is also returning tiny sizes of references and eztremely hard to trace to the object itself
I guess that's whay you mean
i think numpy arrays have their own "sizeof" method
note that an 'object' dtype array probably will be considered an array of references and will therefore underestimate the true size. but for things like numbers it should work well
A memory profiler ought to help
Does anyone know where to fix this issue? I am running GitHub actions, and I'm receiving "Error: Process completed with exit code 1."
Anyone used buildbot? Is it worth to learn?
Define worth? If you want to use it, then go ahead.
Worth == it's useful and still maintained ๐
Looks like itโs still used by people. Doubt itโs a popular CI.
Hello, I have a question.
I sometimes work on a project at my school from a school computer.
I would like to use github pull and push, possibly without login.
I don't want to enter ssh keys on the school computer, because i don't always get the same computer, and typing in the ssh key every time would be a hassle
can i pull with https clone, but then i can't push.
can i push without login, or with some kind of login that doesn't save my password?
You can set the remote URL as follows https://{USERNAME}:{PASSWORD}@github.com/username/reponame.git iirc 
Make sure to remove repo (or change remote) when you leave this computer
thx
it says remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead
Oh, lol. I used it few years ago
Read this docs then https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
Hey @civic grove!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
โข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
โข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
https://paste.pythondiscord.com/efikaparal.sql can someone help me with this pls? im trying to learn docker by using it together with an existing flask app and it seems to be erroring on installing greenlet via pip
# syntax=docker/dockerfile:1
FROM python:3.8-alpine
WORKDIR /code
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
RUN apk add --no-cache gcc musl-dev linux-headers libressl-dev libffi-dev make
COPY requirements.txt requirements.txt
RUN python -m pip install -r requirements.txt
EXPOSE 5000
COPY . .
CMD ["flask", "run"]
this is my entire dockerfile
!pypi cryptography
^ this i believe uses greenlet
i think i have to install a dependency to the docker instance(?alpine) directly but i can't figurefind out which one
i added build-base to RUN and now it's working
How would I go about getting GitHub Actions to log the output of an ongoing step in real time instead of having to wait for the step to finish?
Also, if I have a Google Cloud VM and I initialise it as a self-hosted GitHub Actions runner using the browser console, then will jobs still run if I close that browser console window/computer dies?
someone knows shell command ?
just ask the question ๐
a lot if different ones ;b
I just need to know is shell is the english name ๐ ?
I need to translate my courses in english
In computing, a shell is a computer program which exposes an operating system's services to a human user or other program. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer's role and particular operation. It is named a shell because it is the outermost layer...
Thanks, have a nice day y'all
Hello everyone
I'm trying to get performance data into a python script and then process line by line and output elsewhere
It's a typeperf command for windows I'm currently using to get performance stats
Are there any pointers to how I can extract said stats using python?
Thanks
it depends on the format of the data, but usually you can process data line-by-line by looping over a "stream" such as stdin or a file object. for example:
import sys
from collections.abc import Iterable
from typing import TextIO
def process_line(line: str) -> str:
"""Perform some meaningless data processing for demonstration."""
return f'<< {line} >>'
def process_stream(stream: TextIO) -> Iterable[str]:
"""Process an entire stream, line-by-line."""
for line in stream:
yield process_line(line.strip())
def sink_to_stdout(lines: Iterable[str]) -> None:
"""Do something with the processed data."""
for line in lines:
print(line)
def main():
if len(sys.argv) == 1:
# If no args, read from stdin
sink_to_stdout(process_stream(sys.stdin))
else:
# Process each input file one at a time
for input_path in sys.argv[1:]:
print(f'=== Processing: {input_path} ===')
with open(input_path) as input_file:
sink_to_stdout(process_stream(input_file))
if __name__ == '__main__':
main()
@tawdry needle Thanks. I'll like to ask. I am currently working with a typeperf command in windows. I would first execute the command in main and then process each line right?
i'm not sure what you mean by that, nor do i know what typeperf is
if you run that script as python3 <scriptname>.py, the stuff inside if __name__ == '__main__': will be executed. so in this case, that would execute the main() function, which checks cli args, reads from stdin, etc.
yes, you could also import <scriptname> (without .py) in a python console, but main() relies on checking the original cli args so that probably wouldn't work. you'd have to write a different function that takes a filename as input, for example
this is just a demonstration of how you might structure a "stream processing" application in python
more generally you can just do
with open(filename) as filehandle:
for line in filehandle:
...
Thanks. I appreciate it
noting that sys.stdin does not need to be "opened"
So for my GitHub Workflows I run black, isort, flake8, and pyright for formatting / error checking the code, but what do you guys use aside from that? Do you have any spell checkers for things including comments?
Does anyone know of a good programming software?
Define "programming software" - do you mean a code editor?
I use the codespell utility a fair bit. Very convenient when installed via pipx.
hello guys, I have a container that must have a program called kaldi (https://github.com/kaldi-asr/kaldi).
I have to run this command for configuration purposes: cd /opt/kaldi/tools && extras/install_srilm.sh.
When I put it in RUN, it always raises an error, but if I build the image without it and run it inside the container, it works perfectly.
I thought maybe the displayed message after installation is seen as an "error". I tried to redirect it to /dev/null in vain.
any Idea about how to solve this ?
no, the "error" has to do with the exit status of the script. if it's non-0, it's considered an error.
the text emitted to stderr is not relevant for determining if there was an error
that said, show the output you got
Is using pyenv on a server that doesn't have a modern version of python 3 best practice or is there a better alternative these days?
docker perhaps
Not a good option for this client ๐ฆ
i don't see anything wrong with pyenv then
i'd use pyenv-virtualenv as well
better than building it from source, although i guess there's always the risk that the pyenv maintainer is compromised and slips in a crypto miner or secrets logger
building python from source isn't that bad, but you do need some deps and like all things it might take some fiddling to get it working on the client's specific environment
thanks for you helpful answer โค๏ธ this is the output:
make[2]: Nothing to be done for 'install-exec-am'. test -z "/opt/kaldi/tools/liblbfgs-1.10/share/doc/liblbfgs" || mkdir -p -- "/opt/kaldi/tools/liblbfgs-1.10/share/doc/liblbfgs" /usr/bin/install -c -m 644 'README' '/opt/kaldi/tools/liblbfgs-1.10/share/doc/liblbfgs/README' /usr/bin/install -c -m 644 'INSTALL' '/opt/kaldi/tools/liblbfgs-1.10/share/doc/liblbfgs/INSTALL' /usr/bin/install -c -m 644 'COPYING' '/opt/kaldi/tools/liblbfgs-1.10/share/doc/liblbfgs/COPYING' /usr/bin/install -c -m 644 'AUTHORS' '/opt/kaldi/tools/liblbfgs-1.10/share/doc/liblbfgs/AUTHORS' /usr/bin/install -c -m 644 'ChangeLog' '/opt/kaldi/tools/liblbfgs-1.10/share/doc/liblbfgs/ChangeLog' /usr/bin/install -c -m 644 'NEWS' '/opt/kaldi/tools/liblbfgs-1.10/share/doc/liblbfgs/NEWS' make[2]: Leaving directory '/opt/kaldi/tools/liblbfgs-1.10' make[1]: Leaving directory '/opt/kaldi/tools/liblbfgs-1.10' This script cannot install SRILM in a completely automatic way because you need to put your address in a download form. Please download SRILM from http://www.speech.sri.com/projects/srilm/download.html put it in ./srilm.tar.gz , then run this script. Note: You may have to rename the downloaded file to remove version name from filename eg: mv srilm-1.7.3.tar.gz srilm.tar.gz
it sounds like you are expected to download the script from a specific location that requires you to put in your address, presumably so they can add you to a mailing list
This script cannot install SRILM in a completely automatic way because you need to put your address in a download form. Please download SRILM from http://www.speech.sri.com/projects/srilm/download.html put it in
./srilm.tar.gz, then run this script.
so you need to obtain that tarball file first as per the instructions, and COPY it into the container before that RUN command
it seems that they updated the script to make it auto download.
Thank you
Hey @valid mulch!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com