#tools-and-devops

1 messages Ā· Page 4 of 1

short peak
loud bear
sly snow
#

looks like you're still in conflict. how did you resolve the conflict?

loud bear
#

and saved the conflict file

sly snow
#

on your terminal, type git status

loud bear
#

i think i pressed merge staged files or something like that afterwards

mental steppe
#

Try rebasing your changes onto the incoming ones

loud bear
#

wait hang on

#

i opened github desktop

#

and it showed me an option to continue merge or skip

#

i pressed continue, and done

#

šŸŽ‰

sly snow
#

ok, glad that worked

loud bear
#

ok but i got an extra unneeded commit

#

and i can't squash it

loud bear
#

also why doesn't gitlens show the merge commit?

north rock
#

At #GoogleCloudNext let’s modernize, build, model, analyze, operate, secure, collaborate, and
innovate—together. Join experts, October 11-13, to learn and grow together to meet tomorrow head on.

Register today, https://goo.gle/3xnxi2q

wooden ibex
rain cloak
#

Hello!

I am uploading files to github, but I can't add hidden files for some reason. I keep getting this message when I try to add a hidden file:
"This file is hidden."
Does that mean it is not possible to upload hidden files, or is there something I must do?

rapid sparrow
#

Files and folders starting from dot are considered hidden in Linux though. But it does not matter for git

rain cloak
heavy knot
#

How do I fix this problem?

graceful light
#

Does running the commands they tell you to not work

heavy knot
#

Especially the second one

graceful light
#

do wsl --list to see what distros are registered in WSL, and use that info to properly unregister from it

heavy knot
#

Oh thank God you're saving me

#

I have this problem since yesterday

graceful light
#

I mean this is standard debugging steps, typically run whatever command line tool you're using with either -h or --help to see the available commands and go from there

heavy knot
#

Weird it says that it doesn't have any distros downloaded

#

While it has

graceful light
#

Install the ubuntu one from the link they have there
or open the MS Store app and search for Ubuntu made by Canonical Group Limited
IF you already have that app then uninstall and reinstall it

heavy knot
#

I already have it then, I'll uninstall and reinstall it again

#

Nope. The same thing

#

@graceful light What do you think?

graceful light
#

might be better to ask somewhere more involved with WSL than this Python server

heavy knot
loud bear
#

why do certain tox testenv's recreate while certain don't?

cerulean seal
loud bear
rapid sparrow
#

Pleasantly surprised. Started to read book Expert Python Programming 4th edition
instead of stuff i expected, it started to explain me in Chapter 2, how to set dev environments with venv/poetry, and then jumped into vagrant, docker/docker-compose and explained througly its usages and code examples with python specificsšŸ™‚

#

Really nice of them doing that. Indeed book with modern approach.

#

Omg. it explained throughly all stuff how to use it for dev environment. All the different tricks... which i already use though
And even much more than that šŸ‘€ Really useful

rapid sparrow
#
abc = [1,2,3]
print(123)

raise Exception("123")
$ python3 -m pdb -c continue test46.py 
123
Traceback (most recent call last):
  File "/usr/lib/python3.10/pdb.py", line 1726, in main
    pdb._runscript(mainpyfile)
  File "/usr/lib/python3.10/pdb.py", line 1586, in _runscript
    self.run(statement)
  File "/usr/lib/python3.10/bdb.py", line 597, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/home/naa/repos/pet_projects/experiments/test46.py", line 4, in <module>
    raise Exception("123")
Exception: 123
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/naa/repos/pet_projects/experiments/test46.py(4)<module>()
-> raise Exception("123")
(Pdb) abc
[1, 2, 3]
(Pdb) 
(Pdb) list
  1     abc = [1,2,3]
  2     print(123)
  3  
  4  -> raise Exception("123")
[EOF]
#

This alone trick is amazing.

#

getting into pdb debugger Right before Code Crash automatically! with capturing that environment before crash

#

Although the most i like this trick with watchmedo

#

watchmedo auto-restart --patterns "*.py" --recursive -- command [...] into docker-compose and we have hot reloaded program in container even if it did not have hot reloader

pseudo kiln
#

Hey does anyone have experience with salt/sls files and the configuration of it? idk if this is a good place to ask or if u can lead me to a place where i can ask this
plz tag me or dm me

tawdry needle
tawdry needle
pseudo kiln
#

Yep the deployment/automation tool

#

oh oke then i will post my problem here thxc

#
install_network_packages:
  cmd.run:
    - name: |
       subscription-manager register --username blank --password blank --auto-attach
       dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
  pkg.installed:
    - pkgs:
      - epel-release
      - yum-utils
      - unzip
      - curl
      - wget
      - bash-completion
      - policycoreutils-python-utils
      - mlocate
      - bzip2
      - httpd
      - redis
      - mariadb
      - mariadb-server
      - redis
      - dhcp-server

/etc/dhcp/:
  file.directory:
    - user: dhcpd
    - group: dhcpd
    - recurse:
      - user
      - group

/etc/dhcp/dhcpd.conf:
  file.managed:
    - source:
      - salt://dhcpd.conf
    - user: root
    - group: root
    - mode: 644

/var/www/html/:
  file.directory:
    - user: apache
    - group: apache
    - recurse:
      - user
      - group

/etc/httpd/conf.d/nextcloud.conf:
  file.managed:
    - source:
      - salt://nextcloud.conf
    - user: root
    - group: root
    - mode: 644

# dhcpd:
#   pkg.installed: []
#   service.running:
#     - enable: True

httpd:
  pkg.installed: []
  service.running:
    - enable: True
    - require:
      - pkg: httpd
  cmd.run:
    -  name: |
        systemctl start httpd.service
        systemctl enable httpd.service
        firewall-cmd --add-service=http
        firewall-cmd --add-service=http --permanent

mariadb:
  pkg.installed: []
  service.running:
    - enable: True
    - require:
      - pkg: mariadb
  cmd.run:
    -  name: |
        mysql --silent -u root -e "create database NextCloud_db; grant all on NextCloud_db.* to 'test'@'localhost' identified by 'testpass'; FLUSH PRIVILEGES; "

php:
  cmd.run:
    -  name: |
        yum install -y php php-mysqlnd php-common php-json php-xml php-gd php-mbstring php-process php-pecl-zip php-pdo php-intl php-ldap
#

atm i have this salt script sry for the eyesore. my problem atm is with the dhcpd giving me an error that the service can not be found. I have tried it with dhcp-server, dhcpd.service and dhcp.service. I am running this script on my Rhel 8 linux vm. I mostly want to fix the turning on and displaying dhcp is installed. If you got the time an patience to give me any tips on the rest of the script i will appreciate it. I know its a mess with those cmd.runs i started 2 days ago.

#

thx for the time if anyone decides to read it šŸ™‚

#

also any advice on where to edit those scripts would be appreciated because copying from my vm is a pain since i mostly use nano as my editor

rapid sparrow
#

I did not understand fully walrus usage cases, now I see

#

Besides obvious usage for regular expressions, I really liked trick of its usage for dictionaries

#

I really missed this stuff to declare better classmethod attributes. I needed to have global values before that like in example with dictionaries in order to have them dry. With walrus it will be all a bit nicer

#

Though in reality I wished to read that book for Parallelism chapter

#

It explained thoroughly and in examples difference and applications of Multithreading, multiprocessing and concurrency

#

Plus it will show how to integrate C++ into Python, which is cool too xD

barren rapids
#
  1. I have a problem with pyqt, actually with a timer there. My code includes timer (it's updating every 100 ml seconds) and a button. It's is one thread. However when I try to press the button , I have a delay and it freezes. A code which is connected to the button starts working in a second. As far i understand i need to make two threads i made test-class for this but i don’t understand how do this right.
  2. https://paste.pythondiscord.com/sulaqimari - My code
    2.1. my "test-class"
    def __init__(self, *args, **kwargs):
        QThread.__init__(self, *args, **kwargs)```
3.I want everything to work quickly. No delays and no lags
loud bear
rapid sparrow
#

and that answer linked u official docs

#

syntax slightly changed itself to 2022 year, while still remained though

loud bear
#

ok wait hang on

#

i use tbump

rapid sparrow
#
on:
  pull_request:
    types:
      - opened
jobs:
  run_if:
    if:  startsWith(github.head_ref, 'releases/')
    runs-on: ubuntu-latest
    steps:
      - run: echo "The head of this PR starts with 'releases/'"
#

official docs

#

latest syntax

loud bear
#

and it does tagged annotation

rapid sparrow
#

oh wait, it is name of job xD

#

okay,.

loud bear
rapid sparrow
#

they used head_ref instead of ref for some reason

#

u need to check which variables are available

loud bear
#

won't head_ref work?

rapid sparrow
#

šŸ¤·ā€ā™‚ļø

#

being developer is about being more persistent than your computer errors xD

loud bear
#

no

#

fuck github actions

rapid sparrow
#

that's a good option too

#

Why don't u try Gitlab CI, it is better and way more modern ;b

loud bear
#

I am debating whether to switch over to poetry first

#

poetry is s l i c k af

rapid sparrow
#

i am tempted to do that too, but i tried it and really disgusted with 1 minutes of dependency resolvings to wait

loud bear
#

i dont have many dependencies

rapid sparrow
#

using pip install -r requirements.txt with -c constraints.txt / requirements.dev.txt

loud bear
#

i am tired of outsourcing everything to a different thing

rapid sparrow
#

top level deps rules to requirements.txt
pip freeze > constraints.txt

loud bear
#

there's build to build wheels, twine to upload to PyPi, tbump to bump version, venv for virtual environment, pip to install stuff

#

i am sure i still forgot something

rapid sparrow
#

i use docker-compose instead of venv ;b

loud bear
#

docker takes a lot of RAM

rapid sparrow
#

not really. u can use docker even in small ram PC pithink

loud bear
#

what is a "small ram PC"

rapid sparrow
#

less than half of GB will be taken for your python application

#

postgresql is a bit fatter though

#

well, within 1 GB u can fit your whole dev env

loud bear
#

IDK running VSCode + Chrome (2-3 tabs) + DIscord alone takes like 70% of my 8GB ram

rapid sparrow
#

anyway, that's why my dev machine has 16 GB RAM, first. Though i bought them for google chome xD
256 SSD + i5 CPU + No videocard except inbuilt one -> Kubuntu OS

loud bear
#

docker takes 2GB

rapid sparrow
#

Chrome + Discord + Skype + several VSCode and yeah, your ram is gone

loud bear
#

and ik it does, task manager is too lame to show it

rapid sparrow
#

U can....

#

try adding ram through Zram (compresses RAM usage twice through CPU usage for compression and storing back in RAM)

#

and Swap (works well if u have SSD)

loud bear
#

I better get a working publish step first

#

its been literally a whole year i couldnt find out why for fucks sake it didn't run

heavy knot
#

should you squash and merge a feature branch that's a major rework or just leave it?

rapid sparrow
#

it describes how to configure it further

loud bear
#

"Ubuntu"

rapid sparrow
#

šŸŽ‰

loud bear
#

no

#

i just can't get the fluidity on ubuntu

#

its just always that something is glitchy

#

never smooth

rapid sparrow
#

I like my faithful Kubuntu. All defaults are right, and everything is easy to install

loud bear
#

i dont even touch anything else than vanilla ubuntu in linux distros

rapid sparrow
#

Ubuntu/Debian is often used for Docker images ;b Choice number one, besides Alpine images for Docker

loud bear
#

i do have ubuntu on wsl

#

never use it tho

rapid sparrow
# loud bear docker takes **a lot of RAM**

Anyway, i did not complain about it even when had much weaker PC
My complain about docker is only in need to have extra 50-100 GB of a hard drive for quickly getting filled memory with cached containers and images

loud bear
#

docker is a huge white elephant

rapid sparrow
#

often needing to go for docker system prune -a šŸ™‚

loud bear
#

with probably no advantages for simple use cases

rapid sparrow
rapid sparrow
loud bear
#

i mean just do everything in a venv instead

rapid sparrow
#

it does not make sense to use venv instead

loud bear
#

or use tox, its enough isolation

rapid sparrow
#

docker ensures... your system binaries are recorded too. It is just not always just pip packages u know, some binaries are needed often being installed too

#

and easy networking by container_name usage as hostnames to postgresql/redis and other stuff in other containers

#

those dependencies are basically recorded too at docker level, which postresql version u need to have it working

#

Docker is fully encompassing environment to record your whole stuff needed for web application

loud bear
#

woah

#

wait

rapid sparrow
#

@shadow crow Btw, Vultr is more or less semi acceptable cloud provider. It can be paid in cryptocurrency

#

although cryptocurrency soon could be becoming more difficult option too

#

besides that i use DigitalOcean. It has option to be paid in advance by any acceptable visa card even from third party service. I just paid my stuff for year in advance

wooden ibex
barren rapids
#

Can someone help me with pyqt? there #help-lemon PLS!!!!

edgy basin
#

that's kind of like saying *insert editor with extensions here* is an ide

mystic void
#

that's true. There seems to also be an impression that not being an ide is bad. That can actually be great as it means it's lighter. All these fancy features in IDEs aren't free and will contribute to making it slower and heavier

glacial sand
#

Should a sdist include gitignores/github workflows ? How about requirements.txt ?

tawdry needle
#

maybe it could also include your test suite

glacial sand
#

Nice, thanks ! Setuptools already includes my tests/ by default.
I also include my package data in the MANIFEST.in instead of using package_data in pyproject.toml. I don't know if it's bad form

tawdry needle
loud bear
tawdry needle
#

there's nothing strictly problematic about including the gh actions stuff, but what's the point? none of that is necessary to "distribute" the software

loud bear
#

Docs make my probably 50kb tar.gz to a 1.2mb

glacial sand
loud bear
loud bear
tawdry needle
tawdry needle
loud bear
tawdry needle
#

i don't know if that's possible, manifest.in is part of setuptools. it's likely that poetry doesn't support it

loud bear
#

So does poetry not support sdist at all

#

I mean what's even the point of an sdist in 2022? Somebody can just clone the repo, why would anyone bother about a sdist

mystic void
tawdry needle
loud bear
#

If the repository itself gets deleted then it was probably not meant for use anyways

#

And it won't definitely be maintained

tawdry needle
#

there are some projects with complicated dependencies where the git source repo is very different from the sdist

loud bear
#

I agree for complicated projects sdist might make sense

tawdry needle
#

i see it the other way, end users should not have to figure things out from a developer source repository

#

but there are plenty of situations when you can't download a compile binary package, so an sdist is the perfect choice

loud bear
#

That's what bdist is for

tawdry needle
#

likewise an sdist can be distributed alongside other packages in a central repository like pypi

tawdry needle
#

you aren't supposed to distribute a wheel that has unbuilt stuff in it, that completely defeats the purpose of a binary package

loud bear
#

Why can't that be just left over to the end user to just clone the repo and do it themselves, add a BUILDING.md or something to show how its done

tawdry needle
#

or because your source repository might have extra files in it that you don't want to distribute, or because you don't even want to host a source repository, etc

loud bear
#

Why would you need to redistribute something already hosted on Github or something to an another place? Seems like a chore maintaining both

tawdry needle
#

it was certainly less rare at a relatively recent time in the past

loud bear
#

Git has submodules and stuff so you can pretty much divide stuff like C extensions if they are too big

tawdry needle
#

i also gave several other reasons why you might want such a thing

#

i work with a lot of packages that require compiled extensions and other such set up, i much prefer having access to an sdist instead of whatever manual inconsistent bullshit i would have to do otherwise

#

of course it's best to have a compiled binary package, but that's not always possible

loud bear
#

Just use less C extensions ig

tawdry needle
#

that's not really an option

midnight nimbus
#

what is devops TuT i still don't understand

tawdry needle
#

also what is your complaint about sdist to begin with? i don't see much value in wondering why something exists, and then rejecting the various good reasons why the thing should exist

loud bear
#

Its an excess for most pure python projects

tawdry needle
loud bear
#

With nicely maintained repos being a nice plus

tawdry needle
#

other people will continue to use them for any of the valid reasons i gave

loud bear
#

I think I will when I switch over to poetry

#

poetry for one is insanely better than setuptools

#

Everything is nicely added to pyproject.toml

pseudo kiln
obsidian marsh
#

hatch is also a good choice

tawny temple
#

Of course Poetry existed before the standard for metadata, but it doesn't seem like they plan on switching soon the last time I looked into it

obsidian marsh
#

my pre-commit is working differently on my ci?

#

isort runs just fine locally but changes things on gh actions

warped charm
#

My best guess is it isn't using the same configuration options. What does your environment look like

wet dune
true vapor
wet dune
#

As i said i was asking which one to use. Click is more of a shell like prompt based cli app

brazen forge
#

you can do prompts with click too

red locust
#

i had ubuntu, i instlled linux mint, dont know if it can be the reason but ubuntu and wsl stopped working, i uninstalled them and tried reinstalling, now this comes up

delicate girder
#

What plugins/configurations do you have on Pycharm to ensure all code is clean and upto standards?

rapid sparrow
# delicate girder What plugins/configurations do you have on Pycharm to ensure all code is clean a...

from vscode experience i can say that it is not really concern of IDE to do that. Those are CLI separated tools inserted into CI pipeline
IDE can do only next things regarding this:

  1. Have Black format files on save to ensure auto applied code formatting
  2. Install plugins to see errors from your tests/linters/static type checkers inside IDE for quicker discovery and visual approach (mypy, pylint, pytest integrations and etc)
loud bear
tawny temple
#

But it does at least sound like Poetry wants to support 621 now

lean pewter
#

hi! i hope this is okay to post here. looking for feedback from python devs. im building a package manager for python and thinking about adding a feature for project types. right now it'd mainly just help with bootstrapping project structure, but i think it could have a lot of other great use cases later on. I'm wondering if devs would find this useful. Link in thread.

#

oh no threads 😦

graceful light
wooden ibex
tawdry needle
#

cute logo though

#

i don't think there's anything wrong with exploring the design space of package managers, but i also would not expect people to start using it

#

it also depends a lot on what exactly it is

#

if it's just another tool that wraps pip, then yeah forget it

#

if it's a completely new reimplementation from the ground up that doesn't use pip at all, you have my serious attention

#

not that pip is bad per se, but that's a design space that has not really been explored at all, and imo is a good opportunity for "disruption"

wooden ibex
rapid sparrow
#

I would say for that matter, all modern python packaging tools kind of suck

#

Bad resolving or really long resolving time of deps

wooden ibex
#

Also, packages manager are a problem because PyCharm. Run time has long been solved with Docker, though it sucks that Docker is pretty much mandatory with Python.

#

Development has been solved with VSCode and Remote Containers, everyone but PyCharm and VSCode can be ignored, though they won't take that well.

tawdry needle
#

also good point about pycharm being a major obstacle to adopting any new tooling

wooden ibex
tawdry needle
velvet spire
tawdry needle
#

the psf is also doing a pretty good job at picking up the pieces, i think. they have/had a lot of hard problems on their plate to solve. i think it's for the better that they're spending the effort to define standards, instead of ramming through one preferred solution and creating serious fragmentation.

#

imagine if there was no pep 517, and they just NIH'ed their own thing and declared poetry and flit and hatch as nonstandard and unsupported?

#

things would be 100x worse than they are

#

we have editable pep 517 installs, we have pip-compile

#

imo the psf should adopt pip-tools in the same way they adopted pipenv, and they should focus on making a stable python api for pip, and a stable web api for pypi that doesn't require downloading and unpacking wheels to get metadata. otherwise i think things are headed in a good direction.

#

and pretty fast i might add, given how relatively few people and man-hours are available to work full time on pypa-related efforts compared to the untold billions of compute-hours and dollars of revenue that makes use of python packaging tools

#

if you want to assert that this never should have been a problem in the first place, then yes i agree with you.

obtuse shale
#

tooling in this space is building on decades of architectural decisions that cannot be undone without inventing a parallel incompatible* world like conda

*semi-incompatible, certainly interoperable with work but not entirely seamless

graceful light
#

To this day you still can't use pip search because the XMLRPC endpoints have been taken down due to some attack-like stuff going on in those endpoints
PSF needs people who are interested and qualified to fix that kind of issue

obtuse shale
# loud bear 1. Its in beta. 2. What standard are you talking about <:pithink:652247559909277...

Poetry does not yet implement PEP 621, but we have a core maintainer interested in developing support. In general, it just hasn't been a high priority as we have plenty to work on and limited voulenteers.

Most people clamoring for PEP 621 so far seem to want to see it supported simply because "it's the standard" but it has substantial drawbacks/quality of life changes from Poetry's custom format (e.g. Poetry encourages use of markers heavily, and PEP 508 syntax is overwhelming with no editor support for new users), as well as being less expressive in general.

It definitely seems worth supporting given the main goal of 621, which was to allow different tools to introspect sdists without having to discover and run their build-system if the metadata they seek is defined declaratively (and likewise, to know which fields are declarative and interpreterable in an interoperable way, and which ones require executing the build system to return an interoperable answer).

However, outside hatch no one is really doing that yet, and it will take years and years to realize that benefit.

#

Basically there's not a direct benefit to users now, and it's very beneficial to tooling authors, but only in a future where everyone is using 621 as much as they can and it's had years to mature. It's very much on the road map for Poetry to support and an implementation is cooking, but it's a big change with little immediate benefit (and I predict a massive spike in support requests due to PEP 508 syntax being much less accessible to new users).

#

Most of the people doing work on tooling are voulenteers, and the PSF does support development of the very difficult/critical features the community identifies in PyPA projects (+ warehouse, aka PyPI) with transparent, paid professional development sprints.

graceful light
#

I'm not saying that the PSF is directly to blame - they themselves pointed out that a lot of issues with pip and some security vulnerabilities are things that they want addressed, but they can't find people who are interested in those things

obtuse shale
#

There is simply a limited number of voulenteers, funding, bandwidth to plan sprints using that funding, and generally experts in this space, as Python packaging is a very specialized space with very different considerations from other ecosystems.

graceful light
#

A lot of the intrigue is with the Python core and not so much the related tools used in relation to Python, which is a shame, but there isn't much they can do except try to drum up support or start doing paid bounties

obtuse shale
#

Packaging in Python is something that has evolved over time and hindsight has benefited other ecosystems, but not Python itself obviously, as decisions 'made' (many were unplanned/more a codification of developing practices) decades ago are difficult to revisit now. Many are language-level constraints (e.g. the single sys.path).

#

More experts in this space are always needed -- if you're willing to put the effort in, and be persistent/dogged as you learn the problem space as well as working in large/stability-focused open source projects, basically any project in the packaging space would be happy to have more regular contributors.

wooden ibex
#

I'm just going for it, Poetry is part of the problem along with PEP 621

#

these Domain Specific Tools have set in to fix what is clearly a language fault

obtuse shale
#

Do you propose another breaking change along the lines of Python 3? It's very difficult to make such a transition as the last decade has taught us.

#

There are many things people would like to change about Python if it was started from scratch today, but most have accepted that gradual change is the only path forward for the ecosystem as they are not willing to risk another Python 2 -> Python 3 transition.

wooden ibex
#

I don't want breaking change but just very opinioned. We are consolidating around pip, venv will be autocreated and PIP will start doing pyproject.toml

obtuse shale
#

Keep in mind that Python is also in large part a specification now, with many implementations and gaining consensus among them is required for many changes -- CPython is not the only game in town.

wooden ibex
#

Who else is largely in town?

#

CPython, Stackless?

obtuse shale
#

Ah, I see. I think you might be a bit naive as to the problem space. If it was as simple as getting everyone under one roof to bless/force the one true way of doing things that would meet the needs of everyone, we wouldn't need the PyPA. We wouldn't have any use for Conda, even.

wooden ibex
#

Isn't PyPA around packaging?

#

Also, full disclosure, I'm coming at this from SRE PoV. As SRE, Python as EcoSystem sucks unless it's inside docker. Full stop, don't hand me a Python whatever unless it's inside Docker.

obtuse shale
#

These days the prominent alternate implementations are primarily CPython forks used for both prototyping of new performance-focused features (ala the way PyPy has been used in the past), plus PyPy and MicroPython. IronPython and Stackless Python are around but much less prominent.

velvet spire
#

and cython, jython

obtuse shale
wooden ibex
obtuse shale
# velvet spire and cython, jython

Cython is not a Python implementation -- it is a compiler that turns a restricted subset of Python into compiler IR, which is then turned into native code.

velvet spire
#

but they still are involved in discussions, as far as i can tell

obtuse shale
velvet spire
#

i mean, some bugs have been fixed that happen on cython

obtuse shale
wooden ibex
# obtuse shale I am not sure what you mean -- pip, warehouse, and virtualenv are all packaging ...

I'm approaching it from PoV of SRE, developers I got main.py, I need requests/FastAPI/SQLAcademy, it's using Python 3.8.latest. 🐰 Cool, What do you got to run it? developers Well, I got this Pyproject.toml 🐰 Does PIP understand it? developers No. 🐰 Why not? developers I'm stuck using this Poetry thing because multiple versions of Python and various libraries is nightmare for local developer. 🐰 So I'm going to dockerize this, I have to install Poetry into my Docker container? developers Sure, here is 4 line instructions 🐰 Is it required for Runtime? developers No. 🐰 So multistage build process? developers Yes. 🐰 I hate you

obtuse shale
# wooden ibex I'm approaching it from PoV of SRE, <a:developers:585117015878926336> I got main...

I would ask you to please understand that negative comments do nothing but damage to the ecosystem as you demoralize the volunteers who work tirelessly to try and maintain and improve it. Nobody is selling you Python or a support contract.

Constructive criticism (especially from those without 'ecosystem blinders' on -- a fresh perspective) is always incredibly valuable and useful. However, you've expressed nothing but negativity and frankly used some rather demeaning language -- I suggest you take a step back and consider if your comments add any value, or if they only serve to put down those who you are asking to do more work for you.

#

I don't think anyone uses Python because the packaging story is great. We're still a fair league ahead of C, however.

If people simply wanted to use the best designed ecosystem/tooling, they would pick Rust and Cargo, assuming that everything else was fully equal.

Python is not a commercial project, but instead a community project developed by the employees of some large users (but mostly by volunteers).

tawdry needle
#

this is literally what pep 517 solves and has solved for like 2 years at least

#

could it be a little easier to find info on how to write a pep-517-compliant pyproject file? yes. but the problem is literally solved.

velvet spire
tawdry needle
#

it's fucking amazing if you think about it. what other language's package manager lets you drop in one of like 6 arbitrary build tools that all implements a single unified interface agreed upon by the community (which now even supports editable installs as an optional extension), and does so in a completely isolated fashion from the rest of the system?

wooden ibex
tawdry needle
wooden ibex
#

PIP ships with Python Container, seems pretty much core to me

tawdry needle
#

i have no idea what you're talking about

#

rustup isn't part of rust either

obtuse shale
#

pip is included as a bootstrapping mechanism as it is the only tool that can perform 100% of installation/uninstallation duties of Python packages. It is not part of CPython, but an external project.

tawdry needle
#

arguably cargo isn't part of rust even

wooden ibex
obtuse shale
tawdry needle
#

also i don't even get this complaint because unless you're packaging relatively niche scientific libraries that don't ship wheels (eg. cartopy) you can install a specific python version with pyenv or asdf-vm anyway and that's the only system-level dep you need

#

shit you don't even need zlib if you really don't want it

wooden ibex
obtuse shale
#

You kind of need OpenSSL, but Python's build system will in large part handle that for you.

tawdry needle
#

containerization has a lot of good things going for it w/ respect to sre and dev ops, sure

wooden ibex
#

pip is core tool in same way npm is to node

velvet spire
#

er, how?

tawdry needle
#

pip is core tool in same way npm is to node
that's probably true

wooden ibex
tawdry needle
velvet spire
#

what do you mean sre? site reliability enginerring is all that comes up for me in a google search

lean pewter
#

šŸ“

obtuse shale
#

I use Python outside a container every day -- the tooling is quite different, but much more intuitive and easier than say, Perl. I suspect you are looking at the Python ecosystem with Javascript blinders, which is very common these days.

wooden ibex
#

because it's inside the OSes and I cannot rely on venv to properly handle it, it's docker or bust with Python in same way Node isn't.

tawdry needle
#

i've also worked with several real world applications that were deployed outside of containers, installed the old fashioned way on linux servers w/ nginx, and it worked fine

obtuse shale
#

Poetry itself (and related tools like Pipenv and PDM) were all developed with lessons learned from the Javascript and Ruby ecosystems, translated to Python primitives (with different decisions made along the way).

wooden ibex
velvet spire
tawdry needle
#

are you aware of pyenv?

obtuse shale
#

(also for context, $DAYJOB is maintenance of Docker/Moby -- I work with Linux container runtimes and kernel code daily)

wooden ibex
#

some Python from Data people, it's actually pretty rare, DevOps teams write more Python then anyone else

velvet spire
#

using pyenv solves those issues, however

tawdry needle
#

based on the code i've seen devops people write... i wouldn't want to run any of it outside of a container šŸ˜‰

wooden ibex
tawdry needle
tawdry needle
obtuse shale
#

Also if you dislike virtual environments (not sure why as they are basically a 'container' for Python), maybe helping with the effort to get https://peps.python.org/pep-0582/ out of draft is productive?

tawdry needle
#

pep 582 is pretty cool, been meaning to try pdm

velvet spire
obtuse shale
#

Seems like you have a lot of opinions and energy -- educating yourself on the specifics of the problem space and putting those opinions to use are the best way to help move Python forward.

wooden ibex
velvet spire
tawdry needle
obtuse shale
#

Python operates on the basis of consensus. The role of the SC is to break ties and be the higher power, not to proscribe changes from the top down.

obtuse shale
velvet spire
#

ah, i didn't know you meant making venvs with system python

velvet spire
wooden ibex
#

I saw some of the email traffic on PEP 582, I was pretty dishearten and decided to walk away.

tawdry needle
#

something like ruby gems or npm would have been pretty cool, where pip install into __pypackages__ by default. i suppose that's what pdm does. but backward compatibility and all.

obtuse shale
#

If you were disheartened, imagine what it's like to be the developer of one of the tools trying very hard to improve the very thing you are complaining about, and being told "I hate you" šŸ˜‰

wooden ibex
#

this is one of those, Starting in Python 3.13/3.14 PIP REQUIRE VIRTUALENV will be opt out, not opt in

obtuse shale
# wooden ibex This really should be default

For every person who thinks the breaking change should be made, there will be two more who complain that their workflow was broken and their companies business is put in jeopardy. There is a transition plan to make this the default, but it was hard to get consensus on even a multi-year timeline.

#

One of the things you have to understand about pip is that it has to be all things to all people -- this significantly constraints the amount of experimentation or development of new features that they can do.

#

Likewise, anything they introduced has to be supported for multiple years at a bare minimum, even if they decide it was a mistake and move to deprecate it.

velvet spire
obtuse shale
#

We're still trying to kill it.

velvet spire
#

I don't know how old you are so that doesn't help

obtuse shale
wooden ibex
#

and I spend a fair amount of time in Windows

#

Like Powershell, I'm so glad you exist and WHY ISN'T THIS DEFAULT ALREADY!

obtuse shale
#

Powershell is the default in Windows 10 with developer mode on, or Windows 11.

wooden ibex
#

I know

obtuse shale
#

Anyway, I think I'm going to step away from this conversation. I'd be interested to discuss actionable ways the packaging ecosystem can improve as a whole without breaking it for existing users, but vague "Python sucks and you suck" is not very useful. We know it could be a lot better, and a lot of very smart people are spending their free time working on it, instead of pursing their other hobbies, spending time with their loved ones, or doing something that might make them money.

wooden ibex
wooden ibex
tawdry needle
velvet spire
#

pypi really does need that stable web api, instead of removing features from the json api...

tawdry needle
obtuse shale
#

Basically, 'modular' pip -- this was the approach taken with build and what is happening with installer.

tawdry needle
#

it's a lot of individual loosely-connected pieces of functionality anyway

obtuse shale
#

pip has to maintain so much compatibility that rewriting it is likely much more effort than evolutionary development.

tawdry needle
#

oh i meant in the sense of what you described, rewriting big chunks of the internals and swapping them out

obtuse shale
#

Ah, that makes more sense.

tawdry needle
#

starting from nothing but import argparse i agree is not a good strategy

obtuse shale
#

It's also worth noting that there is a concerted effort in pip to define to scope/goals of the project these days, instead of blinding accepting whatever seems useful. The pip-audit folks were let down by this, and it's also why pip-compile will never be built in as things stand.

velvet spire
#

pip-audit folks were let down by this
what happened?

obtuse shale
#

Certainly it wouldn't hurt to promote pip-compile more over use of pip freeze which has so many compromises it's really only useful for tightly controlled environments (e.g. a single container base image).

tawdry needle
#

i think that's also a good strategy. however pip-audit and pip-compile imo do belong at least somewhat officially under the pypa umbrella, like pipx and pipenv

#

if only in name only, and if only for community visibility and to encourage adoption

obtuse shale
# velvet spire > pip-audit folks were let down by this what happened?

If you want to follow 'mainstream' Python ecosystem developments without having to watch GitHub, DPO, MLs, etc, you should subscribe to LWN. They have excellent Linux ecosystem journalism: https://lwn.net/Articles/904197/

velvet spire
#

lmao you know me by now :^)

tawdry needle
#

i should subscribe to lwn too, i keep putting it off

obtuse shale
#

It's incredibly valuable and a very inexpensive way to support a pillar of the Linux community.

obtuse shale
thorny shell
#

2016 apparently

wooden ibex
#

I always wonder about these auditing tools being well maintained.

obtuse shale
#

In recent years the PyPA has adopted the 'big tent' strategy (as opposed to the prior approach of curating/'blessing' projects) to try to make everyone interested in packaging talk to each other + ensure continuity for widely-adopted projects if the current maintainers can no longer contribute. The PyPA is also an 'authority' now and strives to generate consensus and strongly encourage interoperability of tooling.

tawdry needle
#

one issue with the "big tent" is the possibility of newbie confusion

tawdry needle
#

e.g. people thinking pipenv is "official" and the right tool for all projects, when in reality it's kind of a weird tool that doesn't actually fit a lot of use cases

obtuse shale
#

Indeed, it's one reason Poetry hasn't joined the "big tent" so far šŸ˜†

tawdry needle
#

like pip-compile and pipenv are sorta similar, but they aren't at all like setuptools/poetry/flit/hatch

obtuse shale
#

Pipenv is something of a special case -- if I remember the timeline right it's what started the big tent. It was adopted out of necessity was it was widely used and needed new maintainers, but also precipitated the modern iteration of the PyPA in the fallout.

tawdry needle
#

right

#

i was wondering about pipenv, i remember being very surprised to see it under the pypa github account

obtuse shale
#

Without revisiting old wounds, it's in large part because of the same reasons that lead to requests becoming a psf project.

graceful light
#

I used to love pipenv but they wouldn't let you specify a min/max supported versions of the Python runtime
Admittedly moved on to poetry and loving it so far

loud bear
#

!pep 508

rancid schoonerBOT
#
**PEP 508 - Dependency specification for Python Software Packages**
Status

Final

Created

11-Nov-2015

Type

Standards Track

lament yoke
#

asdf + Poetry is the reliable happy path that I've found

brazen forge
#

asdf directly uses pyenv under the hood (for the Python plugin)
it doesn't manage the versions itself

lament yoke
#

Makes sense

sly sleet
#

well, strictly speaking it's not python that does it, it's pyright šŸ˜›

tawdry needle
#

right, i think that's the distinction that you should be making. you have discovered a very useful feature of pyright!

red oxide
#

Hello community,
I've been learning ansible lately and I got a question.

How do I add my generated ssh key (~/.ssh/id_rsa.pub) to my servers authorized_keys file using ansible?

Adding my keys manually for setting up servers for ansible seems tedious, so is there any way to do this using ansible?

An example play-book would be nice if you already have one, thanks šŸ˜„

indigo zenith
# red oxide Hello community, I've been learning ansible lately and I got a question. How ...

You mean the key that Ansible will use to connect with? Obviously not possible. I think you could use a tool like teraform for that.

If you already have a key for Ansible and just need to add user keys, that's simple, I googled it for you: https://www.cyberciti.biz/faq/how-to-upload-ssh-public-key-to-as-authorized_key-using-ansible/

nixCraft

How do I use Ansible to upload ssh public key to as authorized_key to multiple Linux or Unix servers saved in an inventory file?

red oxide
indigo zenith
indigo zenith
#

So maybe that is actually what you need, I'm not sure

red oxide
#

I'm logging in as root, so yeah, i would need to add my key to authorized_keys file of the root

sturdy tide
#

Hello All, I'm wondering if correct here in this study question or no?

graceful light
red oxide
#

I'm using ansible to clone a private repo to my server.
It works fine when I run the playbook on my VPS but when I try to run it on a machine I have hosted locally, it says I don't have access to the repo.
Same script, same state servers (new) with only one difference, that one is rented on cloud and one is private server exposed on local network.

What could be the issue?

thorny shell
#

presumably the VPS has a credential for the repo host, and your local machine doesn't

#

if the clone is going over ssh, for example, perhaps the VPS has an ssh private key in ~/.ssh/id_rsa

#

or perhaps ansible is picking up a private key, and forwarding it to the VPS, but for some reason isn't doing that when you run it locally

red oxide
#

hmm, I found the issue:
I wasn't accepting new hostkey.
Adding this fixed it
accept_newhostkey: yes

rapid sparrow
#

!rule 5 <@&831776746206265384> scraping web sites is against their terms of service usually. Not really welcome

rancid schoonerBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

amber plaza
#

@copper roost Either way that's not the right channel for that, but do be mindful of a website's ToS, many don't allow scraping

loud bear
#

what is the correct way to check if a tag name starts with a v in github actions?

brazen forge
loud bear
grizzled raptor
#

Is there a way to automatically keep track of the current git revision in a python package installed over a git repository?

#

My goal is to keep track of git revisions in my log files for future reference

indigo zenith
grizzled raptor
tawdry needle
grizzled raptor
sly sleet
#

what's the current recommendation for setting up a pip-installable project?

#

pyproject.toml? manually-created? poetry? something-else?
would this be directly installable via pip install ., etc?

graceful light
#

IMO poetry with a pyproject.toml config

velvet spire
#

there's multiple because they cater to different usages

#

(in no particular order)

  • poetry
  • hatch
  • setuptools
  • pdm
  • pip-tools
  • flit
loud bear
#

What's the difference between a, b, rc, pre, post and dev versions?

#

a,b is alpha beta but if they exist why do dev and pre exist

tawny temple
#

Dev is pre-alpha essentially

#

I believe pre release is just another name for a release candidate, but I'm not sure.

loud bear
#

Release candidate is where no new features are added, only existing bugs are fixed

sly sleet
#

guess i'll take a look at each of them later

tawny temple
soft anchor
#

what do you guys use to show directory trees as text?
something like this but more automated

brazen forge
#

tree

grizzled raptor
granite lark
#

hey can anyone look @ my question in broccoli pls

glacial sand
#

How do you feel about the contributing workflow where you split contributions into proposal and implementation issues ? Does it also make sense for bug reports ? (e.g. you first create a bug report issue, then a bugfix implementation issue + PRs)

tawny temple
glacial sand
# tawny temple It depends on the scope of the issue. It probably would not make sense for bugs ...

My thinking was, because we were planning to have enforced standardized issue templates (no blank issues)

That if you *had *to go through the process of filling out the proposal/bugreport part of the form anyway, why not make it so proposals and implementations were two different templates, so you don't have to fill out the same stuff twice ...

Then you just have to create one issue if you are only posting a bug report / feature request without implementation, and the "second issue" of implementation gets filled out by whoever takes up the task/bug report (even if that other person is you) (also meaning multiple implementations by different people can point to the same proposal/bugreport).

So implementation issues "cancel out" proposal issues in a way

Too convoluted ?

#

thanks for the response by the way

tawny temple
glacial sand
tawny temple
#

Not exactly. I think the proposal template should include optional implementation fields. This will cover the case when the author wants to propose something and already has an implementation in mind - they can just do it all in one issue. If they don't know implementation details, the fields are optional so they can leave them blank.

A separate template should still exist for implementation details only, which will be used when a proposal was created with the optional fields left blank.

#

As a maintainer, you want people creating issues, so it's important to reduce friction in that process. I think it's better to avoid the situation where the same person would have to create two issues back to back.

glacial sand
tawny temple
#

The same can be said for the clutter - they see to many fields and become confused.

#

You should also focus on keeping the amount of fields to the absolute necessities.

#

That being said, I'm not entirely sold on having separate issues for implementations generally. It starts to make sense if a complex and/or vague issue needs to be broken down into smaller pieces. However, there isn't much risk to trying it - it's fairly easy to switch to another system if this doesn't work out.

glacial sand
tawny temple
#

If you can find other projects/teams using a similar system successfuly, that would help validate the idea

#

But I don't recall encountering something like that before

daring sail
#

how to fix this
./prepare_fonts.sh: ./tools/unpack_font.py: /usr/bin/python3: bad interpreter: No such file or directory

is this python problem, or something else?

lyric holly
#

python can't find your interpreter

daring sail
loud bear
daring sail
#

when i run it, its print...

/usr/bin/python3 : The term '/usr/bin/python3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1

  • /usr/bin/python3 "c:\Project OmegaT\tools\unpack_font.py"
  •   + CategoryInfo          : ObjectNotFound: (/usr/bin/python3:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
loud bear
#

its not a problem in the script

#

why are you showing me the script pithink

#

you need to install python in wsl

olive pine
#

Is anyone on line that can answer some Docker related questions with launching a DRF and psql database?

rapid sparrow
#

is anyone remembering a way for pytest to read current active marks? pithink

tawdry needle
grizzled raptor
loud bear
#

GA is so fucking annoying

#

I am thinking off pulling out the entire publish action itself

tawny temple
tawny temple
#

I don't think it is possible

loud bear
#

😦

tawny temple
#

You could have a step in the workflow that checks the branch and fails if it isn't master. Of course it'd be better for the workflow to not trigger at all, but I don't see any other options.

#

And it's probably unlikely that you'd push a tag to a non-master branch anyway

loud bear
#

Yea ig

tawny temple
#

They really should document this behaviour more clearly

loud bear
#

And also why does startsWith(github.ref_name, 'v') not work?

loud bear
tawny temple
#

Same as above?

loud bear
#

Earlier my test and publish steps were in a single workflow

#

And the publish had a needs: test with the if condition

#

But it never got executed since I merged it

tawny temple
#

Well I'm asking because I believe that the value of ref_name depends on what triggered the workflow. So if you had a branch filter, and it matched it, then the ref_name would be the name of the branch, even if it also happened to have a tag.

#

That's my theory

loud bear
#

Now I separated once again and don't care if publish action runs without waiting for tests

tawny temple
#

You could confirm that by checking the value of github.ref_type

loud bear
tawny temple
#

No. It says

The short ref name of the branch or tag that triggered the workflow run.

loud bear
#

What is a ref name

#

I even did startsWith with github.ref and refs/tags/v but it didn't work either

tawny temple
#

Basically it's a branch name or tag name and points to specific commit.

tawny temple
loud bear
#

It was for all pushes to master

#

And needed the test step before to complete

tawny temple
#

Right, so you had a branch filter for the workflow trigger, which means ref_type would be "branch" and ref_name would be the name of the branch.

#

ref_name would be a tag name if ref_type was "tag" which would happen if the workflow was triggered due to a tag filter

#

If you want to trigger on a branch but still get the tag, I'm sure there's some git command you could do to get the current tag you're on.

loud bear
#

How do you make a workflow in a different file wait for a first workflow to finish?

#

I used some wait-on action, it started failing, but I read somewhere that workflow_call or something can do it

tawny temple
#

Yeah, workflow_call or workflow_run depending on what exactly you want

real wedge
#

Is it okay to ask docker related question in this channel?

real wedge
#

ah my bad!, and thank you.

#

Will running a container with multiple processes instead of running multiple containers with individual process, decrease the load on CPU? I want to run a container with django + mysql + nginx + rabbitmq processes instead of separate container for each to save the extra overhead each container causes. Is this the right way to think about docker?

hoary sequoia
#

Hey, I consider to learn about using dvc (https://dvc.org/), but before that I have some questions regarding dvc with cloud:

  1. Does dvc saves all the different versions of the dataset?
  2. Does dvc support all data files format (csv, feather)?
  3. Can the usage of dvc with the could, lead to extra costs from the cloud provider, since it increase the frequency of the communication with the cloud?
  4. Can the usage of dvc with the could, lead to extra costs from the cloud provider, since it saves many versions of the data files?
  5. Is there a limitation or disadvantages of the tool when working with large data files(100GB+)?
thorny shell
#

I never heard of dvc before now, but I am deeply skeptical of any version-control system that isn't git. I've seen too many come and go.

#

ah it sounds something like git with the "large-files" extension or whatever it's called.

thorny shell
heavy knot
hoary sequoia
#

if it saves many versions of the data, then instead of using 1GB for example, it might use 10GB for the same file

thorny shell
#

iirc, the entire history of GNU Emacs -- 30 years or more -- takes up roughly twice the space as just the current snapshot

loud bear
#

A 2.0.0 version will be greater than any alpha release of the same version like 2.0.0a4 right?

rapid sparrow
# loud bear A 2.0.0 version will be greater than any alpha release of the same version like ...

https://semver.org/

A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes. Pre-release versions have a lower precedence than the associated normal version. A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92, 1.0.0-x-y-z.–.
Yes

rancid schoonerBOT
#

Hey @heavy knot!

It looks like you tried to attach file type(s) that we do not allow (.zip). 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.

thick charm
light rock
#

!pypi happy

rancid schoonerBOT
light rock
#

!pypi searchor

rancid schoonerBOT
heavy knot
#

is there github magic that lets me steal all the pull requests/issues from the abandoned repo I forked into mine

tawdry needle
heavy knot
#

pithink laws scary

loud bear
#

Nobody will sue you for an abandoned repo of all things in this world šŸ˜†

wet valve
#

That's not the point though

loud bear
#

Is there any way to include parts of a markdown file in rst? There's m2r2 and myst_parser both of them don't have such option

real wedge
#

Will running a container with multiple processes instead of running multiple containers with individual process, decrease the load on CPU? I want to run a container with django + mysql + nginx + rabbitmq processes instead of separate container for each to save the extra overhead each container causes. Is this the right way to think about docker?

indigo zenith
rapid sparrow
#

there are already made containers for mysql, nginx, rabbitmq and etc. few code lines at most to add it to your composition as side cars

#

one containers is supposed to be one process, exceptions are allowed but very rarely

#

containers reuse so much of your OS, that overhead from having multiple of them is almost nothing in comparison to introduced additional complexity of having everything inside one container. Plus logging / networking whatever other stuff made for containers assumes using multi container setups

tawdry needle
#

the thing about "containers reuse your os" is important. at least on linux, standards-compliant containers are basically not isolated at all from the rest of the system, and are (as far as i understand) basically just groups of processes under a particular kind of process namespace

#

it's like putting up a curtain in a big room and pretending it's a separate room

real wedge
real wedge
olive pine
#

Is there a difference in the configuration settings when you dockerize a normal django project or a DRF backend?

rapid sparrow
#

oh, actually i remembered

#

Normal project requires served static assets via nginx, and DRF backend is usually not requiring that stuff xD so it is easier to dockerize DRF xD

#

U would still wish reversed nginx in front at some point though, for the sake of getting Nginx level server side caching for some of your endpoints, or some other shenanigans

olive pine
#

speaking about static assets, my backend does store a handful of pictures to be used on the front end. Do i need to set up anything specific to be able to render those photos? For example, I have a series of icons stored as a FileField in my model. In development they are being stored in a media folder, but its unclear to me if django will pull from that same media file in production.

rapid sparrow
# olive pine speaking about static assets, my backend does store a handful of pictures to be ...

https://docs.djangoproject.com/en/4.1/howto/deployment/
https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
-> https://docs.djangoproject.com/en/4.1/howto/static-files/deployment/
-> On the server, run collectstatic to copy all the static files into STATIC_ROOT

if u deploy django with unchangable static assets
just collectstatic django-admin command will gather statc assets from different folders into one folder which will be needed served by nginx
if u have dynamic static assets (changable not just by git commits), consider using S3 buckets stuff (at least if u wish to keep your backend application stateless)

olive pine
#

ok, so lets say I add another 5 icons to the database later in production, would that be considered a dynamic static asset?

rapid sparrow
olive pine
#

stored as a filefield.

rapid sparrow
# olive pine stored as a filefield.

Yes. https://docs.djangoproject.com/en/4.1/ref/models/fields/
https://docs.djangoproject.com/en/4.1/ref/files/storage/#django.core.files.storage.FileSystemStorage

if u will care to read how it works under the hood by default
it will upload file onto your filesystem, while only having link/path stored in database
image files are served much faster by Filesystems/S3 Buckets
Within Django philosophy, u are expected eventually to write your own implementation of Storage class that will implement S3 Bucket Storage for you (or finding already ready library for that)
and just replacing for FileField Storage engine from FilesystemStorage to S3Storage

#

initially of course it is enough to use Filesystem, S3 bucket is just for... greater scaling things and keeping app stateless

#

depends on requirements of a project

#

Technically nothing really prevents u from storing it right in database (without filesystem). It is just bad performance advice. But it is great in terms of better data integrity.

#

it depends on project requirements

olive pine
#

ok, I will read through the docs to get a better understanding of file storage for production. This project isnt terribly big, its just a portfolio website for myself and i wanted to have a django backend to easily change data in the future.

rapid sparrow
#

just make sure preferably to serve files in the way that it is possible attaching client side caching headers for served contents (FileSystem Storage is fine for that when used together with nginx)

#

that's all you probably wish to have

#

for the sake of minimizing costs, u will not want to use separate S3 Cloud objects

olive pine
#

Im not familiar with caching header. What does that mean to cache client side headers for served contents?

#

is that at setting i need to configure and if so, where? in the django project or with nginx?

rapid sparrow
olive pine
#

@rapid sparrow Do you ever get this error with installing psycopg2 to the docker image?

rapid sparrow
rapid sparrow
#

provide all available details, i suspect i know what u a talking about but i wish to be sure.

rapid sparrow
#

how is it related to python?

#

is it graphical only tool abstracting interactions with databases? What database u a currently using as driver/under the hood?

modern shoal
#

well that's why i said "hope i'm in correct channel."

sorry

rapid sparrow
#

even if it is not related to python, people still can answer that

rapid sparrow
#

not wishing to dig into this direction

#

because any question answering also asks from person to google around a bit / reading docs

#

especially for tool which is not known for them (such proprietary tool will have no one familiar here highly likely, or may be it will)

rapid sparrow
#

Integer can fit only... integer values. within limited range, usually up to 2,000,000,000 for int32 format
float is having limit which numbers it can fit too, and it really worngly stores... nubmers like 10.00000, they are getting miss-corrupted on intention to stuff like 99.999995646345646
double same, but higher limit due to keeping up to 53 digits after dot
deciamal... i haven't learnt implementation details deeply of this one, except knowing that despite working as double, it can correctly estimate itself into integer values

#

basically for your tool in the end is suggested all its unique data types being equvalient to.. all generic data value types, and same rules should be applied to your app specific value types as to those values

#

besides that values can be kept as a string(array) of character, as a binary and date time

rapid sparrow
#

and 38 is just a limit of precision for decimal u have mentioned in your docs

#

in order to understand fully what is going on, it could help u to learn how generic programming data types works (we had subject in university for that, not remembering name)

#

The real shit begins from the point that your tool uses those generic values and somehow translates as ORM into multiple different database types / and even file/documents as storages.
To be honest, at this point it is impossible to say further what is specifically going on without learning first how those data types work for the chosen specific driver/storage type

modern shoal
#

Thanks!

compact ocean
#

Hi im new here, was wondering if anyone could possibly help me with chrome dev protocols

rapid sparrow
ebon minnow
#

How can i remove my account/remove my name and email from the authors list in pyproject.toml

[tool.poetry]
name = "..."
version = "..."
description = ""
authors = ["Guido"]
brazen forge
#

just… remove it?

#

wdym?

ebon minnow
#

sorry for not being clear enough!

rancid schoonerBOT
#

src/poetry/console/commands/init.py lines 127 to 131

if not author and vcs_config.get("user.name"):
    author = vcs_config["user.name"]
    author_email = vcs_config.get("user.email")
    if author_email:
        author += f" <{author_email}>"```
ebon minnow
brazen forge
#

you can answer n when asked

ebon minnow
brazen forge
#

when doing poetry init

#

it'll ask you to enter/config author

#

hmm, new doesn't have that question

ebon minnow
#

So to change it i have to change what exactly?

brazen forge
#

/shrug instead of using poetry new, use poetry init

ebon minnow
#

-_-

brazen forge
#

or open an issue on GH repo

#

make a feature request

loud bear
#

@ebon minnow try changing git global config?

ebon minnow
#

😭

loud bear
ebon minnow
#

wut

loud bear
#

Why are you even using poetry when you don't have git pithink

ebon minnow
#

dont ask questions 😳

loud bear
#

I mean source control is first, then comes packaging

#

It might be possible that your ide installed git

#

Through an extension or something

ebon minnow
#

I looked at github desktop and i think that was the issue

loud bear
#

Yea github desktop does configure git

ebon minnow
#

yeah it was

#

fixed it kek

loud bear
#

Git config is located somewhere in C:/Users/your_user_name

tawdry needle
#

is there something i'm missing about sphinx toctree?

i have this file:

bigcorp (namespace)
==============

.. py:module:: bigcorp

Packages:

.. toctree::
   :maxdepth: 1

   bigcorp.datascience_api_service
   bigcorp.geo_utils
   bigcorp.testing

where each of the files referenced in the toctree directive contain their own toctrees with the same :maxdepth:, and so on recursively until you hit a file that has no toctree.

when i compile this to html, the resulting top-level document has the entire tree represented in bullet points, but i was only expecting bullet points for the items listed explicitly in the toctree.

what's going on here?

#

sphinx has been driving me up a wall today

tawdry needle
#

oh dear, problem solved... i had one toctree without :maxdepth: set

loud bear
tawdry needle
tawdry needle
loud bear
#

I am considering using a Jinja template for autodoc

tawdry needle
#

i've been torn between "hand crafting" the layout and generating automatically. the former might be a little nicer for readers, but more burden on contributors (who in my case are not likely to be very proficient sphinx users)

tawdry needle
loud bear
#

A template lets you decide how its gonna look without you having to mention class names explicitly

#

If your non-reference docs are good, I think 2nd is a better option. It kinda makes you write better docstrings as well.

#

By non-reference docs I mean like user guides, handbooks, getting started and all that stuff

tawdry needle
loud bear
#

Yea that's the template i am talking about

#

I was confused between apidoc and autodoc

#

I wish VScode came with rST support for docstring previews

tawdry needle
#

it doesn't? that's annoying

#

i feel like a lot of newer python tools try to avoid rst as much as possible

loud bear
#

All docstrings look like shit in rST which is like a standard but somehow vsocde supports a custom variant of markdown

tawdry needle
#

i bet it's mkdoc or something similar

loud bear
#

Which doesn't support italics but supports stuff like tables and images

tawdry needle
#

weird

loud bear
tawdry needle
#

it doesn't currently support docstrings at all right?

#

which is why pydantic and fastapi literally don't have reference docs (which is incredibly annoying)

loud bear
#

Even I felt mkdocs is good but for auto generated reference docs sphinx is hands down the best

tawdry needle
#

one of my coworkers recently tried pdoc and got good results

loud bear
#

!pypi mkdocstrings

rancid schoonerBOT
tawdry needle
#

fastapi also doesn't handle rst properly. it puts docstrings directly into the openapi schema, which means that your openapi docs are littered with ugly rst markup.

loud bear
#

Rst isn't as ugly really

#

After using it for like continuously a month I realised its not meant for too much decoration but its good for long texts with various types of content

#

There's next to no IDE support for complete rST syntax. VScode has like one extension which is quite buggy and complaining. Pycharm strips out all formatting

tawdry needle
tawdry needle
tawdry needle
#

is there a tool like setuptools-scm that produces "calver" versions like 2022.10.14+git{hash}?

#

ideally i'd also be able to embed that version in the source code itself so i could emit it in my log messages

#

actually... i think i might just write a script to do this

graceful light
#

So I'm trying to use the pyperf library to measure some personal benchmark stuff, and I'm running into an annoying issue
doing: ```py
runner = pyperf.Runner()

using some example code from their docs

t = runner.bench_command("python_startup", [sys.executable, "-c", "pass"])
pprint.pprint(dir(t))

But it seems like `t` is being yielded into, where the `pprint` call is being made in a loop as results are coming in. I would've thought that `pyperf` would block until it finished, but it feels like it's calling the entire program multiple times
How should I be using `pyperf` to run measure the runtime of a function so that I can later get the mean & median runtimes and write that to a CSV?
tawdry needle
graceful light
#

Yep that's the guide I'm following, just ordered a little differently```py
import sys
import pyperf
from pprint import pprint

runner = pyperf.Runner()
t = runner.bench_command('python_startup', [sys.executable, '-c', 'pass'])

pprint(t)

And the output:```
<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.<Benchmark 'python_startup' with 1 runs>
.
python_startup: Mean +- std dev: 24.5 ms +- 0.4 ms
<Benchmark 'python_startup' with 21 runs>
#

If I do something like putting print("this is a test") before the pprint statement, I get this:```
this is a test
<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
this is a test
.<Benchmark 'python_startup' with 1 runs>
.
python_startup: Mean +- std dev: 24.5 ms +- 0.4 ms
<Benchmark 'python_startup' with 21 runs>

tawdry needle
#

interesting. i wonder if that's somehow related to using sys.executable

#

try using a different command as a sanity check, like /bin/true or whatever

#

also try guarding all that code behind if __name__ == '__main__'

#

i don't know how any of that would matter, but try it

#

it's hard to say what sort of silliness this library does internally, so maybe guarding behind if-name-main is useful

graceful light
#

Just tried it, as well as moving the actual pyperf code into it's own function that gets called from the if-name-main block, but no change

#

Also strangely enough, I can't use pyperf outside of a virtualenv like poetry's shell

tawdry needle
#

it does seem oddly recursive in a way that it shouldn't be

#

i would consider just filing a bug report at that point

#

the examples in the docs shouldn't be so fragile

graceful light
#

So looking further into the documentation, pyperf runs the function that you want to benchmark on different CPU cores. This is bypassing the if-name-main block that should prevent the non-main processes/threads to run that block by using subprocess.Popen to call python -m pyperf command your_app_here

graceful light
#

My hacky temporary solution is like this:```py
import sys
import pyperf
from pprint import pprint

processes = 20
loops = 5

runner = pyperf.Runner(processes=processes, loops=loops)
t = runner.bench_command('python_startup', [sys.executable, '-c', 'pass'])

if len(t.get_runs()) == processes:
print(t.mean())
t.dump("output.json", compact=False, replace=True)

latent canyon
#

Hey , i want to deploy a 2 websites built with django.Both the apps are dockerized using nginx as the web server , gunicorn as the application server.I want to deploy both the websites on the same virtual machine. Any solutions ?

rapid sparrow
#

how did u make dockerization of nginx, gunicorn of them?

#

are they separated containers or u smashed into one?

latent canyon
#

separate containers

rapid sparrow
#

thanks gods )

rapid sparrow
latent canyon
#

yep , its working on a digitalocean instance with a custom domain .But how would i do the same with 2 websites .

rapid sparrow
latent canyon
rapid sparrow
#

i highly recommend reading. Then u would not have such questions. Especially carefully reading Docker Networking section

rapid sparrow
#

When u deploy Docker-compose, u have written in it different containers/services

#

they are able to communicate with each other by service names if u noticed

#

u can address db as db

#

that's because Docker-compose boilerplates docker networking stuff and created bridge network, which unites those containers

#

they can communicate freely within this bridge network with each other

#

and u expose with ports only the desired stuff outside of this network to host/and outside server

rapid sparrow
#
version: '3.8'

networks:
  default:
    name: darkbot

u can add to your docker-composes that they share same bridge network

#

make sure for each one to have unique service names

#

in order to avoid problems

#

U raise your docker-compose with first application
and u raise your docker-compose with second application

#

they both don't expose their ports. but they will be joined into same network

#

They just output their website through Nginx

#

which service their Static content + forwards requests to Gunicorn

#

now within this darkbot bridge network you can access your websites as
http://nginx_1/ and http://nginx_2

#

u can create third docker-compose containing just Nginx working as reverse proxy (it will be launched within same bridge network named darkbot)
it will listen in one section to requests from domain_a.com and redirect them to nginx_1
another sectoin will be listening to domain_b.com and redirected to nginx_2

rapid sparrow
#

just write one docker-compose that has containers for your both applications

#

and add declared third service nginx that redirects incoming domain requests to different nginx containers of your services

#

and obviously expose with ports only this third nginx

rapid sparrow
# latent canyon Exactly , There are a lot of tutorials online for static websites using nginx.Bu...

https://www.digitalocean.com/community/questions/nginx-with-a-domain-and-subdomain with one error person wrote almost correctly nginx config to redirect requests based on different incoming domains here
Something like that u wish to have as your third nginx

#

just instead ofproxy_pass http://localhost:3000; you will be directing to proxy_pass http://application_nginx_container_name:3000;

#

mm third nginx will be working purely as reverse proxy

#

static assets will be regulated by nginx of specific application

#

so for third nginx u need to declare just proxy_pass http://your_application_container_name:3000; and e.t.c. config twice for different domains

rapid sparrow
# latent canyon Exactly , There are a lot of tutorials online for static websites using nginx.Bu...

for additional reading, recommending free Nginx cookbook https://www.nginx.com/resources/library/complete-nginx-cookbook/

stable dragon
#

!ressources

#

!resources

rancid schoonerBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

tawdry needle
tawdry needle
graceful light
tawdry needle
graceful light
#

I need to look at their code more when I get home tomorrow

heavy knot
#

hi can anyone help me

rapid sparrow
rapid sparrow
#

Python Expert Programming is definitely amazing book

#

in chapter 11 i finally got all answers how to deploy/develop uploadable packages with all details

#

before that i knew only crude approach how to deploy to pypi only in some way

#

and this book finally explained what the hell is magical Meta stuff xD

#

plus explained event driven stuff finally
plus finally got details regarding different strategies of parallism. It explained how it works under the hood

#

multiple other topics i wished to know but never knew where to learn. It explained everything i wished to know. in 13 different chapters

#

quite fresh book, just from 2020 or 2021 year. Well, at least its 4th edition

#

Must have to read for python devs i think xD

deep idol
#

Is anybody here using Poetry and Docker? I tried my first little project with poetry, because I like the clean way to sort dev packages from other packages. But from my feeling and by looking at my Dockerfile, it is way more stuff than simply use requirements.txt and pip. Do I miss a big opportunity from Poetry here?

iron basalt
#

Yes, installing with Poetry will be more steps if only because the base image likely won't have Poetry itself, so you have to install it first

#

Poetry's benefits are mostly useful during development (venv management, generating a lockfile from pins, isolating dev deps)

#

you can use Poetry in your Dockerfile, but a common approach is to export production dependencies into a requirements.txt (Poetry has the export command for this), and installing from it in your Dockerfile, using just pip itself

#

the export step can happen for example in your deployment pipeline before the build step

deep idol
#

ok thanks. didn't look up this export command šŸ™‚

graceful light
south forum
#

is their a way to install chrome from code, and not in terminal?
On Ubuntu server

south forum
# rapid sparrow What do u mean?

digitalocean provides a simple "one click web app"
The downside is, that you can't acces root user.
So I can install anything using the console

#

But forget it, I am trying to deploy on a droplet now..
Anyone done that before?
Trying to host my flask-webapp

rapid sparrow
rapid sparrow
rapid sparrow
#

+Selenium web driver

hazy echo
# rapid sparrow

This is a very solid book... and there have been a number of changes since 2020 that you might want to consider: Moby has changed the licensing a bit AND there are some solid alternatives to Docker host and to the docker CLI.
pythonspeed.com blog has good resources specific to Docker, and they explain why many of the practices that make docker good for statically compiled languages are not optimal for Python.

rapid sparrow
south forum
# rapid sparrow And I placed already Chrome into docker before

hey,
I did do this in docker now,
and I am trying to start my selenium script like this, so that it runs once a day at specific time.

( __init__.py )
from apscheduler.schedulers.background import BackgroundScheduler
sched = BackgroundScheduler(daemon = True)
sched.start()
@sched.scheduled_job(trigger = 'cron', minute = 15, hour = 20)
def get_values():
    get_values_script.main()

But it doesent seems to start.

#

Wen I just run the app ( without docker ) it works fine

indigo zenith
south forum
indigo zenith
sage cradle
#

!warn 244658476909854720 our server is *not an ad board. Don't post unsolicited advertisements

rancid schoonerBOT
#

:incoming_envelope: :ok_hand: applied warning to @orchid cloak.

orchid bough
#

Any idea to pack a python multi process application as an exe

latent canyon
gentle solstice
#

It's mostly templates

#

the actual logic is written in go

latent canyon
#

Is there any other way to deploy multiple containerized apps on a single virtual machine.

gentle solstice
#

kubernetes will do it

#

for something more lightweight, podman and docker both support services.

#

podman actually supports (basic) kubernetes apps

south forum
#

How do I deploy a dockerized flask app on digitalocean ?
has anyone ever done that or can link me some resources ?
Also what is the yaml file for? šŸ˜„

gentle solstice
#

You should be able to use a droplet

#

or App Platform may be a better choice

south forum
gentle solstice
#

idk, I don't actually use do

latent canyon
fallow smelt
#

Anyone else like formatting the self keyword to be very close to background color so your eye can skip over it easier?

gentle solstice
#

but self isn't a keyword

#

it's just a variable that has special meaning by convention

sly sleet
#

but why do you want to skip over it

#

there's a pretty big diff btwn an instance variable and a regular local

gentle solstice
#

There's also nothing stopping you from reassigning self. Your linters won't like it, but they can't force you not to.

tawdry needle
#

as stated above, you would need to be careful to only apply that format inside an instance method definition

fallow smelt
#

I want to keep self. Especially when looking at other peoples code

#

But it was actually not that hard to create a formatting rule in vs code so it's just a bit les contrasty than other code

#

I'm just saying I like this look.

indigo zenith
tropic olive
#

i keep getting this error when i run my docker container off this image SyntaxError: Non-UTF-8 code starting with '\xac' in file /bin/sh on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details ```DOCKER

to build the image run "docker build . --tag website"

FROM python:3.10
LABEL MAINTAINER="HRLO77" LICENSE="MIT"
COPY ./* website/
WORKDIR /website/
ENTRYPOINT [ "python" ]
EXPOSE 8080
RUN python -m pip install -r requirements.txt
CMD ['main.py', 'True']

to run a container on this image, run "docker run <IMAGE_ID>" you can get the IMAGE_ID by running "docker images"``` it doesn't matter what the CMD is, always the same error

gentle solstice
#

Does it work outside the docker container?

tropic olive
#

wait i found it

#

ENTRYPOINT [ "python" ] it runs all commands in the docker container with python for some reason

#

even when not the CMD

#

fucking dam

gentle solstice
#

It really looks like you're trying to read /bin/sh as a text file

tropic olive
#
import os
import socket
import uvicorn
import sys

if sys.argv[1] == 'True':
    os.system(f"echo {socket.gethostbyname(socket.gethostname())} is my ip address")
    uvicorn.run('backend:app', host=socket.gethostbyname(socket.gethostname()), port=8080)
else:
    uvicorn.run('backend:app')```
gentle solstice
#

why are you os.system('echo')?

tropic olive
#

to log the containers ip

#

print doesn't work for some reason

gentle solstice
#

why not print()?

#

you shouldn't need to manually get your container's ip.

tropic olive
#

i could use 0.0.0.0 right

gentle solstice
#

if your networking is configured correctly, the container's name will be dns pointed to its ip

#

and yes, use 0.0.0.0 to bind to all interfaces

#

your container ip is pretty much useless outside of docker-world

tropic olive
#

alr

#

i gtg now

gentle solstice
#

I'd also recommend using uvicorn backend:app with HOST and PORT set as environment variables.

#

I also suggest using gunicorn in prod. ```dockerfile
ENV PORT=8080
RUN [ "gunicorn", "backend:app", "-k", "uvicorn.workers.UvicornWorker" ]

#

The port really doesn't matter in docker anyway.

#

Here's a dockerfile I use for a fastapi project with poetry. ```docker
FROM python:3.9-slim AS python-base

ENV PYTHONUNBUFFERED=1
PYTHONDONTWRITEBYTECODE=1

# pip
PIP_INDEX_URL=https://python.repo.eng.netapp.com/simple
PIP_NO_CACHE_DIR=no
PIP_DISABLE_PIP_VERSION_CHECK=on
PIP_ROOT_USER_ACTION=ignore
PIP_DEFAULT_TIMEOUT=100

# poetry
POETRY_VERSION=1.2.0
POETRY_NO_INTERACTION=1

FROM python-base AS builder-base

RUN pip install poetry==${POETRY_VERSION}

WORKDIR /app
COPY poetry.lock pyproject.toml ./

RUN poetry export -o requirements.txt

FROM python-base as production
WORKDIR /app

COPY --from=builder-base /app/requirements.txt .
RUN pip install -r requirements.txt
COPY ice/ ice/

ENV ENV=production
CMD gunicorn -k uvicorn.workers.UvicornWorker ice:app

glad glade
rapid sparrow
#

it is from 2019 though, u will need preferably checking latest available official documentation to confirm it

glad glade
#

i need includes

rapid sparrow
#

check what is available as variables, try different ones

rapid sparrow
glad glade
#

i mean i could do == || == but stuborn

#

ok idk what issue is it works now thank\

tawdry needle
#

if i want to run multiple linters in github actions, is it better to run each linter in a separate "job"? it seems a little wasteful to clone the repo into an action runner 4 separate times just to run 4 separate linters, but it would be nice to have them all separated in the PR

https://paste.pythondiscord.com/nexideqava.yml this is what i have right now, but i have no idea if this is considered good practice

rapid sparrow
#

Surely, performance wise worse... But u know that is a regular problem with better testing

tawdry needle
#

that makes sense

#

also these are free actions so i'm not paying for the compute šŸ˜Ž

#

plus they will run in parallel

#

it just seems like a big waste of cpu cycles in general

#

there's no way to re-use the "clone" and "install python deps" stages for multiple jobs?

rapid sparrow
rapid sparrow
# tawdry needle there's no way to re-use the "clone" and "install python deps" stages for multip...

U can preserve deps thorough cache syntax of CI
But usually modern pipelines just build docker image at first stage in order to freeze competly what we test between all CI stages, staging and prod envs.

When using public GA, then resort to pushing image to public docker hub, and repulling for each stage.

When using self hosted runner it can become optional if runner uses same docker Daemon for all jobs

#

Docker strategy ensures we test exactly same thing
Deps change

Tested image just retagged under new tag into docker registry

tawdry needle
rapid sparrow
#

AWS ECR

rapid sparrow
tawdry needle
#

i also might not be allowed to connect GH to ECR for security reasons

#

completely separate platform and all

tawny temple
#

I don't like the overhead separate jobs adds to the time (waiting to acquire a new agent, etc) but I agree that organisationally and semantically separate jobs are nicer.

rapid sparrow
tawdry needle
#

i'm basically using GHA as a place to prototype things

tawny temple
rapid sparrow
# tawdry needle wdym? teamcity is running on jetbrains servers and GH is running on microsoft se...
#

GA and gitlab gives it for free

tawdry needle
#

lol different pricing structure

rapid sparrow
#

Plus teamcity is not yaml. Horrible

tawdry needle
#

teamcity is so much better than codefresh at least, which i used at my last job

#

i fucking hated codefresh

tawdry needle
#

don't need pip install for hadolint or shellcheck

#

i guess i'll just live with having a lot of repeated work in the runners

#

this won't be a "high volume" repo with lots of commits

rapid sparrow
#

I want ability to run jobs locally

#

Like Tekton almost gives

#

Wishing to write my own CI tool to satisfy all desires. Writing instrument to define purely workflows runable locally. Let s have some other CI tool handling GUI and runners

tawny temple
tawdry needle
#

I think this is ultimately a UI problem on GH's end. In your case, it doesn't seem like you need separate jobs for anything other than to be able to see all the failures separately easily.
yes, precisely

rapid sparrow
tawny temple
#

Isn't there another way that won't cause the workflow to pass?

#

Maybe it's if: success() || failure()

tawny temple
rapid sparrow
#

Hating problems to migrate

#

Wishing to own my CI code

#

Tekton already allows it

#

Remotely executed local launched pipelines in k8s cluster

tawny temple
#

Never heard of Tekton but I will check it out

rapid sparrow
#

It can be inserted into any CI tool

tawdry needle
tawny temple
#

What is that? Is there a full name?

tawdry needle
#

yeah, that

#

emulator runner thing

tawny temple
#

That sounds very useful. Will definitely try it out next time I make significant CI changes.

#

So it just emulates GH actions?

#

Is there a risk of differences in the official implementation and this emulation?

tawdry needle
#

So it just emulates GH actions?
yep!

Is there a risk of differences in the official implementation and this emulation?
yep! but hopefully none that i'll run into, in my simple case.

tawny temple
#

It's not a big worry anyway. I'd still test it in a PR before I merge any CI changes. It just reduces the churn of pushing commits and waiting for GH Actions

tawdry needle
#

and having a pile of broken/failed workflow runs in the history cluttering things up

tawdry needle
tawny temple
#

Yeah, this is what I was talking about regarding caching. I believe that cache is going to be scoped to the job (but you can access the cache in subsequent workflow runs as long as its in the same job).

#

Still, you would only pay an upfront cost once and it would be cached, so not a big deal if installation gets repeated in different jobs.

#

Well, until your dependencies change

tawdry needle
#

the docs arent really clear about that, there seems to be the ability to use a "shared tool cache"

#

it seems like (at least in theory) you should be able to mount a network filesystem in a self-hosted runner and cache everything in one place

#

i just want to avoid putting more pressure on pypi!

tawny temple
#

Ah yeah, if you have a self hosted runner you can have control over that. But that's beyond anything I've ever attempted

#

If you do figure something out, do share the results

tawdry needle
#

i don't think i will pursue this just to run linters šŸ˜†

tawny temple
#

Fair enough, I probably wouldn't either

stone vine
#

anyone used fastapi with graphql?

urban needle
#

Hello, in docker is it possible to make a developement environment for me for such a situation I needed to change my device so dont need to reinstall every thing?
Like can I do a docker image that contains depndencies, vscode, files, folders without even downliading it? Just running it ftom docker

thorny shell
#

sure

#

it's not particularly easy or convenient, but you can do it

urban needle
#

Thanks!

rapid sparrow
#

I want to share... AWESOME development tools available for you if u are working in Linux at least

#

Soft links = like regular anchors to folders, they imitate path resolution to different folder which is enough for Terraform like tool, but Git will see only one file instead of folder
Hard Links = Making fully fledged mirrored files. U can even delete original. As long as any hard link is left for file, it is still existing. Real time sync. Because link links to memory in hard drive. Disadvantage: For file only.
Mount --bind = The best option when u deal with multiple projects/microservices, u can bind entire projects for real time syncronization (almost same like pip install -e, installing some local package in editing mode essentially) (Very useful to have multiple projects combined into one project temporally) (Even git can see those mounted folders fully, so u can commit those files as long as they are mounted)

#

===
Essentially mount --bind is the most useful option greatly enchancing dev environment. Mind blowing at the level of using Docker-compose stuff for dev env

Soft links are fine for some usage cases too though

loud bear
red oxide
#

Hello everyone, I'm trying to run prometheus and grafana using ansible with docker compose.

Dockerfile

FROM prom/prometheus
ADD prometheus.yml /etc/prometheus/

docker-compose.yml

services:
  prometheus:
    build: .
    image: prometheus-custom
    user: root
    ports:
      - 9090:9090
    networks:
      - monitoring-net
.
.

But I'm getting this error:

TASK [Ensure monitering apps are running with latest image.] ************************************************************************************************************************************************************************************************
fatal: [192.69.0.11]: FAILED! => {"changed": false, "errors": [], "module_stderr": "", "module_stdout": "", "msg": "Error: pull failed with 404 Client Error for http+docker://localhost/v1.41/images/create?tag=latest&fromImage=prometheus-custom: Not Found (\"pull access denied for prometheus-custom, repository does not exist or may require 'docker login': denied: requested access to the resource is denied\")"}

I understand that it's not able to find prometheus image I'm building, and I think it's not even building it in the first place.

So how can I build it?

ansible task

- name: Ensure monitering apps are running with latest image.
  community.docker.docker_compose:
    project_src: "{{ config_dir }}/monitoring"
    pull: yes
    build: no
  become: false
#

I tried with build: yes btw, didn't work

rapid sparrow
sly sleet
#

pretty sure symlinks are gated behind admin on windows lol

rapid sparrow
#

Plus learning windows is in general useless for web dev. Windows sucks (and their Windows Servers suck)

#

anything u learned from Linux -> makes u more efficient to handle servers in addition to having better dev env

rapid sparrow
#

wow

#

Freeze gun can simulate time running as 1 hour per tick

#

very useful for tests

pine fern
#

@rapid sparrow question if you are free

#

if you use aws lambda to call another api

#

where do you put the api token

#

i see that aws lambda has environment variables feature - do you use that?

rapid sparrow
pine fern
#

ah this isnt for production. just poc

rapid sparrow
#

U can query secrets with boto3

pine fern
#

you think i should still use secrets manager service?

#

well i guess it cant hurt

rapid sparrow
#

Probably yeah

pine fern
#

thanks DW

rapid sparrow
# pine fern ohhh ok

We have in current organisation written plugin, that exposes secrets in boto3 AWS secret manager like fallback if they aren't found in environment vars.
Application only sees environ["bla"]

pine fern
tropic olive
#

i got everything setup only a few hiccups with hosting a fastapi server. I made a docker image docker FROM python:latest LABEL MAINTAINER="HRLO77" LICENSE="MIT" COPY ./* website/ WORKDIR /website/ EXPOSE 8000 RUN python -m pip install -r requirements.txt CMD ["python", "__main__.py", "True"] and i want to host it on localhost:8000 so that i can connect to it in my webbrowser, this is __main__.py ```py
import os
import socket
import uvicorn
import sys

if sys.argv[1] == 'True':
uvicorn.run('backend:app', host='localhost', port=8000)
else:
uvicorn.run('backend:app')```

#

im running docker run --privileged --network="host" <IMAGE_ID>

#

i can't connect to localhost:8000 tho

#

the server starts up but i just can't connect to any of the endpoints

tawny temple
tropic olive
#

Then I visited 0.0.0.0:8000 and localhost:8000

#

Neither worked

tawny temple
#

Well connecting to 0.0.0.0 wouldn't work but localhost should. 0.0.0.0 is just a special value that means bind to all interfaces I believe.

Anyway, does it work without --network="host"? And what if you use -p 8000:8000? (should be redundant with EXPOSE but who knows)

#

Oh, and are you using http or https when you try to connect? Should be the former.

tropic olive
#

and http

tawny temple
rapid sparrow
#

image syntax declared image to pull from docker registry (optionally from local thing, where they are already built in local docker)

#

build syntax declared building from dockerfile in current filesystem

#

u need to choose something one

#

(delete image syntax if u want building it locally)

tropic olive
#

Ok

red oxide
# tropic olive Ok

I had fast api working inside docker, let me share my files in a moment

tawdry needle
#

the server can listen on 0.0.0.0 inside the image, it will be mapped to localhost/loopback on the host network