#smooth-operator 2020-06-29
<Chipaca> good morning peeps!
<jam> morning Chipaca
<facubatista> Muy buenos dÃ­as a todos!
<Chipaca> facubatista: I just lied to stub!
<Chipaca> facubatista: src is *not* in our dispatch's pythonpatgh
<Chipaca> facubatista: i thought we'd agreed to that :-|
<jam> Chipaca, i think we should if we don't right now
<facubatista> mmm
<jam> unless python always includes siblings.
<facubatista> we talked about mod, and then we said that all charms were symlinking from lib to that anyway
<facubatista> about 'mod' dir, I mean
<facubatista> don't remember about 'src'
<jam> I wouldn't include mod, because you generally want a subdir of that anyway
<mup> Issue operator#339 opened: debug-code silently fails if src/charm.py is not executable <Created by stub42> <https://github.com/canonical/operator/issues/339>
<jam> Chipaca, you already set my pr as non draft? Or it just accepted our earlier attempts
<Chipaca> jam: i did it
<mup> Issue operator#339 closed: debug-code silently fails if src/charm.py is not executable <Created by stub42> <https://github.com/canonical/operator/issues/339>
<mup> Issue operator#339 opened: debug-code silently fails if src/charm.py is not executable <Created by stub42> <https://github.com/canonical/operator/issues/339>
<mup> Issue operator#339 closed: debug-code silently fails if src/charm.py is not executable <Created by stub42> <https://github.com/canonical/operator/issues/339>
<mup> Issue operator#339 opened: debug-code silently fails if src/charm.py is not executable <Created by stub42> <https://github.com/canonical/operator/issues/339>
<facubatista> Chipaca, jam, added 'src' to PYTHONPATH - https://github.com/canonical/charmcraft/pull/63
<mup> PR charmcraft#63: Added 'src' to PYTHONPATH <Created by facundobatista> <https://github.com/canonical/charmcraft/pull/63>
<jam> facubatista, Chipaca : isn't it automatically part of PYTHONPATH if you exec src/charm.py ?
<facubatista> ah, wait, we don't want 'src' hardcoded
<facubatista> that PR is wrong
<Chipaca> jam: not part of pythonpath, but effectively the same thing
<Chipaca> but i thought it wouldn't work when going via the symlinks
<Chipaca> maybe i was wrong?
<Chipaca> trying to get it to break here :)
<Chipaca> so, there's something the site thing is doing
<Chipaca> if you run it in isolated mode, it fails
<facubatista> Chipaca, what do you mean?
<Chipaca> facubatista: I mean: if you have src/charm.py importing potato, and you have src/potato.py
<Chipaca> facubatista: and you do 'python3 src/charm.py'
<facubatista> it works
<Chipaca> it will find potato, at least on ubuntu focal
<Chipaca> but now try with python3 -I src/charm.py
<Chipaca> and it no longer finds potato.py
<Chipaca> so the site configuration is doing something
<Chipaca> i'd have to dig to figure it out
<Chipaca> this means we probably want src/ on the pythonpath so it works in pythons weirder than just plain ubuntu
<stub> https://bugs.launchpad.net/juju/+bug/1885555
<Chipaca> but i need more data to be confident :)
<facubatista> Chipaca, -I: "In isolated mode sys.path contains neither the scriptâs directory..."
<facubatista> Chipaca, so, the -I is removing the script dir
<facubatista> not that something else is adding it
<facubatista> "All PYTHON* environment variables are ignored, too. "
<facubatista> Chipaca, so, if you run it isolated, it would not respect our path fixings either, so...
<Chipaca> facubatista: ah :-) thanks
<Chipaca> facubatista: yeah i knew it ignored pythonpath, i wasn't suggesting to run it with that
<Chipaca> facubatista: I just wanted -S, i guess
<Chipaca> facubatista: jam: https://discourse.juju.is/t/charmcraft-bi-weekly-dev-summary-2020w25-26/3289
<Chipaca> facubatista: jam: can you give it a quick read in case i forgot anything, before sending it out to the non-editable things?
<facubatista> yes
<jam> Chipaca, I just remembered we need to confirm whether collect-metrics is going to cause problems. I'll start working on that tomorrow after all my meetings.
<facubatista> Chipaca, the "snap" part looks too detailed, I wonder if we should have a tl;dr part
<mup> PR operator#323 closed: 317 state get <Created by jameinel> <Merged by jameinel> <https://github.com/canonical/operator/pull/323>
<jam> (meetings today)
<Chipaca> jam: congrats on landing that
<jam> Chipaca, is it worth holding the summary for tomorrow and be able to just announce 0.7 ?
<Chipaca> jam: i'm happy to do a smaller we-got-0.7-up one on wednesday
<facubatista> can't we release 0.7 today?
<jam> It seems like we could
<Chipaca> should I do those changes to ops.lib.use before that?
<jam> Chipaca, autoimport ?
<jam> I'd happily review it for you
<jam> Chipaca, meeting?
<Chipaca> omw
<jam> Chipaca, I noted that it did include PyYAML but no .so extensions
<Chipaca> i think it including pyyaml is a bug :) but that's just me
<jam> Chipaca, I'd rather not, but that is a side effect if people prefer "include system packages = false"
<Chipaca> i wonder which yaml you get when you import it tho
<jam> all of them simultaneously
<Chipaca> jam: maybe then it'll be fastest!
<facubatista> Chipaca, jam, as a conclusion from the debugging some minutes ago... shall we fix dispatch execution bits or not?
<Chipaca> facubatista: i think we should, but not zomg-release-this
<facubatista> Chipaca, https://github.com/canonical/charmcraft/issues/64
 * facubatista -> lunch
<Chipaca> jam, facubatista, if you're still around jay responded
<Chipaca> jam, facubatista, never mind then :)
 * facubatista is back
<Chipaca> and I'm EOD :-)
<Chipaca> facubatista: ð ttfn
<mup> PR operator#340 opened: make ops.lib.autoimport use optional <Created by chipaca> <https://github.com/canonical/operator/pull/340>
<facubatista> Chipaca, bye
 * facubatista eods
#smooth-operator 2020-06-30
<mup> Issue operator#341 opened: ops.lib fails to import packages with '-' in their metadata <Created by stub42> <https://github.com/canonical/operator/issues/341>
<mup> Issue operator#342 opened: ops.lib.autoload does not log what it is doing <Created by stub42> <https://github.com/canonical/operator/issues/342>
<mup> PR operator#343 opened: Allow library metadata to include hyphens <Created by stub42> <https://github.com/canonical/operator/pull/343>
<mup> Issue operator#344 opened: Cleaner error message when use_juju_for_storage is True wrt Juju 2.6 <Created by jameinel> <https://github.com/canonical/operator/issues/344>
<mup> Issue operator#345 opened: Harness could start with config initialized from config.yaml <Created by jameinel> <https://github.com/canonical/operator/issues/345>
<mup> PR operator#343 closed: Allow library metadata to include hyphens <Created by stub42> <Closed by stub42> <https://github.com/canonical/operator/pull/343>
<mup> PR operator#346 opened: Improve ops.lib line matching regexp <Created by stub42> <https://github.com/canonical/operator/pull/346>
<mup> Issue operator#347 opened: use_juju_for_storage=True breaks if metrics are in use <Created by jameinel> <https://github.com/canonical/operator/issues/347>
<mup> Issue operator#348 opened: Support collect-metrics normally once Juju runs it as a normal hook <Created by jameinel> <https://github.com/canonical/operator/issues/348>
<mup> PR operator#349 opened: 347 juju storage and collect metrics <Created by jameinel> <https://github.com/canonical/operator/pull/349>
<jam> morning Chipaca
<Chipaca> jam: hiya
<Chipaca> jam: how's things?
<jam> Chipaca, relatively ok. personal stuff is progressing.
<jam> https://github.com/canonical/operator/pull/349 is up
<mup> PR #349: 347 juju storage and collect metrics <Created by jameinel> <https://github.com/canonical/operator/pull/349>
<jam> though I'd like to understand scope of testing it
<jam> I did put it in a real charm and test it
<jam> and also figured out why my previous charm *didn't* fail
<jam> Chipaca, it seems Juju doesn't call 'collect-metrics' if you don't have 'metrics.yaml' defined.
<jam> see also #347 for the context of why I implemented it the way I did.
<mup> Issue #347: use_juju_for_storage=True breaks if collect-metrics is in use <Created by jameinel> <https://github.com/canonical/operator/issues/347>
<facubatista> Muy buenos dÃ­as a todos!
<Chipaca> facubatista: (null)
<Chipaca> hmmh
<Chipaca> facubatista: ð !
<Chipaca> hexchat is dumb sometimes
<facubatista> Chipaca, storm of Nones!
<stub> So yeah, thought I had a problem with relative imports. But I just can't get ops.lib to import my package if __init__.py tries to import something else in the same package directory, relative or legacy syntax. And absolute won't work since I don't have an absolute module path.
<Chipaca> stub: giving it a try here
<Chipaca> stub: indeed it falls over
<Chipaca> stub: the spec does have 'submodule_search_locations' set to the right thing so i need to dig further into why it isn't working
<mup> PR operator#350 opened: Improve ops.lib line matching regexp <Created by jameinel> <https://github.com/canonical/operator/pull/350>
<jam> Chipaca, facubatista https://github.com/canonical/operator/pull/350/files# tests added
<mup> PR #350: Improve ops.lib line matching regexp <Created by jameinel> <https://github.com/canonical/operator/pull/350>
<jam> which tells me we probably still need to tweak the regex
<jam> it allows: LIBFOO='something'and some more stuff
<jam> and treats the 'and some more stuff' as a comment
<karimsye> I have been hitting this error: ops.model.ModelError: b'ERROR file set "data" requires volume source\n'
<karimsye> https://www.irccloud.com/pastebin/7dXXTOnd/
<jam> Chipaca, facubatista : operator#349
<mup> PR #349: 347 juju storage and collect metrics <Created by jameinel> <https://github.com/canonical/operator/pull/349>
<jam> is updated, just waiting on tests
<Chipaca> jam: nice
<jam> Chipaca, I also have #350, though I don't know if we want to land it.
<mup> PR #350: Improve ops.lib line matching regexp <Created by jameinel> <https://github.com/canonical/operator/pull/350>
<Chipaca> #346 is also updated fwiw
<mup> PR #346: Improve ops.lib line matching regexp <Created by stub42> <https://github.com/canonical/operator/pull/346>
<Chipaca> er
<jam> Chipaca, and approved by me
<Chipaca> not that one, t'other one, but yanno
<jam> (your pr was approved by me, I knew what you meant :)
<jam> I'm EOD, you can land whatever you feel relevant for 0.7
<jam> karimsye, is that metadata.yaml or the pod spec?
<jam> I'm not positive, but quick reading of the validation code seems to say you'd want to be updating the pod spec with a source
<jam> karimsye, probably more of a question for #juju
<karimsye> jam: that is the metadata.yaml
<karimsye> jam: thanks I will check with them
<Chipaca> aha!
<Chipaca> oho!
 * Chipaca saw the gruffalo
<mup> Issue operator#351 opened: ops.lib.use does not support submodules <Created by chipaca> <https://github.com/canonical/operator/issues/351>
<mup> PR operator#352 opened: make ops.lib.use support relative submodules <Created by chipaca> <https://github.com/canonical/operator/pull/352>
<Chipaca> stub: ^
 * facubatista is back
<mup> Issue operator#347 closed: use_juju_for_storage=True breaks if collect-metrics is in use <Created by jameinel> <Closed by jameinel> <https://github.com/canonical/operator/issues/347>
<mup> PR operator#349 closed: 347 juju storage and collect metrics <Created by jameinel> <Merged by jameinel> <https://github.com/canonical/operator/pull/349>
<mup> PR operator#340 closed: make ops.lib.autoimport use optional <Created by chipaca> <Merged by chipaca> <https://github.com/canonical/operator/pull/340>
<mup> PR operator#350 closed: Improve ops.lib line matching regexp <Created by jameinel> <Merged by chipaca> <https://github.com/canonical/operator/pull/350>
<mup> Issue operator#341 closed: ops.lib fails to import packages with '-' in their metadata <Created by stub42> <Closed by chipaca> <https://github.com/canonical/operator/issues/341>
<mup> PR operator#346 closed: Improve ops.lib line matching regexp <Created by stub42> <Closed by chipaca> <https://github.com/canonical/operator/pull/346>
<Chipaca> facubatista: 'm afraid i need your eyes on #353
<mup> PR #353: don't use --long in "get describe" for version <Created by chipaca> <https://github.com/canonical/operator/pull/353>
<mup> PR operator#353 opened: don't use --long in "get describe" for version <Created by chipaca> <https://github.com/canonical/operator/pull/353>
<facubatista> Chipaca, let's see
<facubatista> Chipaca, +1ed
<facubatista> Chipaca, and I'm here for an hour or so, if you need something else
<Chipaca> facubatista: ack, thanks
<mup> PR operator#353 closed: don't use --long in "get describe" for version <Created by chipaca> <Merged by chipaca> <https://github.com/canonical/operator/pull/353>
* ChanServ changed the topic of #smooth-operator to: general discussion of the operator framework || github.com/canonical/operator || ops 0.7.0 || charmcraft 0.2.0
<Chipaca> facubatista: done :-D
<facubatista> Chipaca, great!!
<Chipaca> two more PRs coming up
<mup> PR operator#354 opened: post-release fallback version bump <Created by chipaca> <https://github.com/canonical/operator/pull/354>
<mup> PR operator#355 opened: readme tweaks (including link to the api docs) <Created by chipaca> <https://github.com/canonical/operator/pull/355>
<Chipaca> facubatista: where's the handling/catching of the store sending the wrong data? ie in whoami we just do e.g. name=response['display-name'], which will throw a KeyError in our code rather than telling the user what the problem was. I _think_ you said you were abstracting that handling somewhere but i don't see it
<facubatista> Chipaca, I still don't have it
<facubatista> Chipaca, but I have this XXX in current branch, that will turn out in a filed issue before landing:
<facubatista>             # XXX Facundo 2020-06-30: Every time we consume data from the Store (after a succesful
<facubatista>             # call) we need to wrap it with a context manager that will raise UnknownError (after
<facubatista>             # logging in debug the received response). This would catch API changes, for example,
<facubatista>             # without making charmcraft to badly crash.
<Chipaca> facubatista: ð
<Chipaca> facubatista: did a first pass on your current pr
<Chipaca> and now i am going to ð¤
<facubatista> Chipaca, see you tomorrow
<Chipaca> facubatista: anything more i can do for you before disappearing in a clod of <deleted>?
<facubatista> Chipaca, nop, relax, thanks!
<Chipaca> ð :-)
 * facubatista eods
#smooth-operator 2020-07-01
<jam> morning all
<Chipaca> good morning all :)
<Chipaca> stub: dunno if you saw #352 but that should do the trick
<mup> PR #352: make ops.lib.use support relative submodules <Created by chipaca> <https://github.com/canonical/operator/pull/352>
<stub> Chipaca: Yup. Was going to test it, but a DB deploy exploded.
<Chipaca> stub: that totally sounds like a lot more fun than testing
<stub> Chipaca: I need to confirm it works with a path like lib/interface-pgsql/opslib/pgsql containing a hyphen :)
<Chipaca> stub: interface-pgsql is not a legal python package name is it?
<stub> Nope, not at all. But it is my repo name.
<Chipaca> stub: let me know how that goes :)
<Chipaca> actually, i might as well test it myself
 * Chipaca tests it
<stub> Yup. Probably best to just say 'don't do that silly' if it doesn't work
<Chipaca> stub: it works :)
<Chipaca> import ops.lib; meh = ops.lib.use("foo", 2, "jlenton@gmail.com")
<stub> Now unicode!
<Chipaca> In [2]: meh
<Chipaca> Out[2]: <module 'foo-bar.opslib.meh' from '/tmp/xyzzy/foo-bar/opslib/meh/__init__.py'>
<Chipaca> and that __init__.py does 'from . import foo', so submodules work also
<Chipaca> In [1]: import ops.lib; meh = ops.lib.use("foo", 2, "jlenton@gmail.com"); meh
<Chipaca> Out[1]: <module 'ð©.opslib.meh' from '/tmp/xyzzy/ð©/opslib/meh/__init__.py'>
<Chipaca> stub: ^
<stub> invalid UTF-8 sequences?
<stub> ;)
<Chipaca> NO.
<Chipaca> :)
<Chipaca> OTOH you can call it ð­ð¤ð°ð®ð© for that extra bit of gravitas
<jam> Chipaca, you're having too much fun :)
<Chipaca> jam: non-stop partying, that's me
<jam> Chipaca, you and the unicode library, cosying on up
<Chipaca> ð ð¬ðªð· ð·ð®ð²ð½ð±ð®ð» ð¬ð¸ð·ð¯ð²ð»ð¶ ð·ð¸ð» ð­ð®ð·ð
 * Chipaca brb
<facubatista> Muy buenos dÃ­as a todos!
<Chipaca> facubatista: hiya :)
<Chipaca> jam: you coming to the revue?
<mup> Issue operator#180 closed: A way to easily drop the developer inside their running Python code <Created by facundobatista> <Closed by facundobatista> <https://github.com/canonical/operator/issues/180>
<mup> Issue operator#66 closed: Packaging of charm and layer code <Created by knkski> <https://github.com/canonical/operator/issues/66>
<mup> Issue operator#282 closed: Harness: Unable to assert if framework was called correctly by charm <Created by relaxdiego> <Closed by jameinel> <https://github.com/canonical/operator/issues/282>
<mup> Issue operator#317 closed: use charm state for Juju 2.8 <Created by jetpackdanger> <Closed by jameinel> <https://github.com/canonical/operator/issues/317>
<mup> Issue operator#303 closed: ints in pod spec somehow become scientific notation <Created by jetpackdanger> <Closed by chipaca> <https://github.com/canonical/operator/issues/303>
<mup> Issue operator#316 closed: unit state lost following upgrade-charm <Created by jetpackdanger> <Closed by chipaca> <https://github.com/canonical/operator/issues/316>
<Chipaca> facubatista: meeting?
<Chipaca> facubatista: there you were :-)
<jam> Chipaca, facubatista : https://kubernetes.io/blog/2019/01/15/container-storage-interface-ga/
<Chipaca> ack
<jam> (I'm assuming :)
 * facubatista -> lunch
<facubatista> Chipaca, what do you think about, in error, trim the message presented to the user to something sane (150chars), while still dumping the full message in the log?
<Chipaca> gr, not sure how much of that got to the channel :-/
<Chipaca> stub: FYI:
<Chipaca> >> import ops.lib; meh = ops.lib.use("foo", 2, "jlenton@gmail.com"); meh
<Chipaca> <module '\udce1rbol.opslib.meh' from '/tmp/xyzzy/\udce1rbol/opslib/meh/__init__.py'>
 * Chipaca goes have dinner
 * facubatista eods
#smooth-operator 2020-07-02
<mup> PR operator#354 closed: post-release fallback version bump <Created by chipaca> <Merged by jameinel> <https://github.com/canonical/operator/pull/354>
<jam> morning Chipaca, just in time for me to go to lunch :)
<jam> I put up 2 posts on Discourse, feedback/edits welcome
<Chipaca> moin moin moin
<Chipaca> jam: reading
<Chipaca> jam: the 'reusable components' one, maybe needs tweaking because ops.lib.use is a thing now?
<jam> Chipaca, we could. Right now the component thing is mostly about what a component looks like. We can add ops.lib.use to it, or we can make that a separate topic
<Chipaca> k
<facubatista> Muy buenos dÃ­as a todos!
<Chipaca> facubatista: a shame tabulate can't be told to print to a file
<facubatista> Chipaca, I don't want to print to a file! unless a logger can be handled as a file?
<Chipaca> facubatista: well, that would be my next 'shame' :-)
<Chipaca> print(..., file=logger.info) :-)
<facubatista> don't like that
<facubatista> you're not pushing bytes/chars to it; it's a complex object which builds messages, etc
<facubatista> Chipaca, what I *do* miss is: instead of doing `print("foo {} bar {}".format(a, b))`, being able to do `print("foo {} bar {}", a, b)` (and that it doesn't fail if var replacement is wrong)
<facubatista> printl()
<facubatista> printf!
<Chipaca> printf, clearly
<facubatista> oh
<Chipaca> facubatista: ?
<facubatista> now I'm trying to hack it into builtins :p
<Chipaca> facubatista: it also needs a flogger module that lets you do flogger.debug('the {} is all up the {}', thing, where)
<facubatista> Chipaca, I want to do that using logger, it's in my project list
<facubatista> Chipaca, jam, this is the refactor I promised to simplify reviews: https://github.com/canonical/charmcraft/pull/67
<mup> PR charmcraft#67: A small refactor creating a "store api" layer between commands and the client <Created by facundobatista> <https://github.com/canonical/charmcraft/pull/67>
<facubatista> Chipaca, jam, and the refactor about paths in build that I also commented to you: https://github.com/canonical/charmcraft/pull/68
<mup> PR charmcraft#68: Totally avoid dealing with paths as strings <Created by facundobatista> <https://github.com/canonical/charmcraft/pull/68>
<Chipaca> facubatista: so productive ð²
<facubatista> :)
<Chipaca> jam: you coming?
<jam> yep
<facubatista> Chipaca, I don't "see" the benefit of using NamedTuple from typing in a not-typed project
<Chipaca> facubatista: yeah, not that big. I started out with "how to add docstrings" and in 3.6+ you subclass NamedTuple and write a regular docstring there, but in 3.5 you still need to set __doc__ by hand
<Chipaca> so it's a bit of a wash. Maybe just make a note to switch to NamedTuple once we drop 3.5, such that adding a docstring is nicer? (and â¦ what i should have started with: add a docstring :-) )
<facubatista> Chipaca, you mean, adding a docstring to User?
<Chipaca> facubatista: PosixPath('/tmp/pytest-of-travis/pytest-0/test_validator_requirement_mul0/testfile1') != PosixPath('/tmp/pytest-of-travis/pytest-0/test_validator_requirement_mul0/testfile1')
<Chipaca> facubatista: a.k.a. 3.5 hates you
<Chipaca> facubatista: yes i meant adding a docstring to User
 * Chipaca adds __head__ to all his classes
<facubatista> Chipaca, what do you think? https://paste.ubuntu.com/p/j7QBhKSJtf/
<Chipaca> facubatista: >3.5
<facubatista> Chipaca, why?
<Chipaca> facubatista: foo:int  is a 3.6+ thing
<facubatista> Chipaca, mmm... so how NamedTuple works in 3.5?
 * Chipaca points at the docs
<Chipaca> facubatista: https://docs.python.org/3.5/library/typing.html#typing.NamedTuple
<facubatista> Chipaca, and how that helps with the docstring?
<Chipaca> facubatista:
<facubatista> right
 * facubatista opens an issue and forgets about this :p
 * Chipaca hugs facubatista 
<facubatista> Chipaca, https://github.com/canonical/charmcraft/issues/70
<facubatista> py3.5 super hates me: https://paste.ubuntu.com/p/qXcZ3wCVP3/
<Chipaca> facubatista: You need to upgrade your VESA local bus to a MasterCard local bus.
<facubatista> Chipaca, I configured the screen to 16 colors and the test still fails
 * facubatista tries putting it in 320x200
<Chipaca> facubatista: Don't worry; it's been deprecated. The new one is worse.
<mup> Issue operator#356 opened: Support extra service names <Created by knkski> <https://github.com/canonical/operator/issues/356>
 * Chipaca EODs
#smooth-operator 2020-07-03
 * facubatista is not here today, but...
<Chipaca> facubatista: *bonk*
<facubatista> Chipaca, jam, there I merged master (with all the other branches) into my store-names branch, pushed
<Chipaca> nice
<Chipaca> facubatista: now scram
<facubatista> Chipaca, I updated also de "messages to the user doc", told Lilyana about it
<facubatista> and now, I fade into the weekend
<facubatista> see you on Monday :)
 * Chipaca puts on his kicking boots
 * Chipaca takes the boots off
<__chip__> EOD and EOW for me. See y'all Monday!
