/srv/irclogs.ubuntu.com/2020/05/29/#smooth-operator.txt

mupIssue operator#303 opened: ints in pod spec somehw become scientific notation <Created by jetpackdanger> <https://github.com/canonical/operator/issues/303>03:00
MarkMaglanahi there.03:12
Chipacaanybody with a python 3.7 around?10:44
facubatistaMuy buenos días a todos!11:30
facubatistaChipaca, I can prepare a docker with it, what do you want to test?11:31
Chipacafacubatista: nah, just to be precise in a comment11:31
Chipacafacubatista: good morning to you too!11:31
facubatistaok11:31
facubatista:)11:31
Chipacafacubatista: i started playing with getting an ops version in there11:32
facubatistaI've brought my release day clothes today!11:32
Chipacaand went down a bit of a rabbit hole11:32
Chipacafacubatista: excellent!11:32
Chipacafacubatista: I'm stopping for lunch in 30' but things are looking good11:32
facubatistaChipaca, "getting an ops version in py 3.7"? not sure what that means11:33
Chipacafacubatista: i wrote this thing, that i'm backing out for now but will push for early 0.711:33
Chipacafacubatista: https://paste.ubuntu.com/p/PBS2TQxVrg/11:34
Chipacafacubatista: sorry, the 3.7 was not directly connected to 3.711:34
Chipacafacubatista: just that in 3.5 and 3.6 ast.parse('"42"').body[0].value is ast.Str, and in 3.8 it's ast.Constant11:35
Chipacafacubatista: and so I added if isinstance() with a comment # >= 3.811:35
facubatistaChipaca, ah! I got master(ish), it could be of use11:36
Chipacafacubatista: i wanted to check if that was accurate, or if the change was in 3.7 already11:36
facubatistaah, understand11:36
Chipacafacubatista: the documentation is a tiny bit unclear on this; it's been a transition that happened between 3.5 and 3.8 :)11:36
Chipacafacubatista: in 3.8 ast.Constant was used for 'all constants', and ast.Str is deprecated, but it's been a transition11:37
Chipacafacubatista: it's not super important :-)11:37
Chipacanobody uses 3.7 anyway :-p11:37
facubatistajajaja11:37
facubatistaprobably true11:37
Chipacafacubatista: and all this is because we can't import ops to get ops.__version__ because yaml11:38
Chipaca(boo hiss etc)11:38
facubatistaChipaca, which is what normally happens11:39
Chipacafacubatista: so i wrote some code :-)11:39
Chipacafacubatista: https://paste.ubuntu.com/p/x7kTxBPDwK/11:39
facubatistaChipaca, I get it; my solution (in charcramft early version) was way less elegant, but didn't depend on internals, so it's more robust to be executed later in the wild (it's more fragile in the sense that we may break it changing some code, but that would be catched by the test)11:43
mupIssue operator#304 opened: Use git describe to log version when running from git <Created by chipaca> <https://github.com/canonical/operator/issues/304>11:43
Chipacafacubatista: which internals?11:46
mupPR operator#305 opened: Tweaks to the README, setup.py, etc, for release <Created by chipaca> <https://github.com/canonical/operator/pull/305>11:50
Chipacafacubatista: ^11:50
facubatistaChipaca, "internals" -> ast nodes11:50
facubatistaChipaca, on the PR11:51
facubatistaChipaca, reviewed12:13
Chipacafacubatista: picky, picky12:50
Chipacafacubatista: hmm, with '.' in reqs 'pip install -r reqs' installs ops, which might be surprising; wdyt?12:51
facubatistaChipaca, yes, you do not want that12:52
Chipacaok, i'll revert12:52
Chipacafacubatista: wdyt of making install_requires load requirements.txt?12:52
facubatistaas this is a lib, +112:53
Chipacafacubatista: hm, the internet seems to think we're using reqs wrong :)12:58
facubatistaChipaca, we're stretching it, requirements.txt is normally used to "run" something; this is a pure lib, you don't "run" it12:59
facubatistaChipaca, you normally install it, and with install_requires in setup.py it will bring the needed dependencies13:00
Chipacafacubatista: looks like doing '-e .' instead of '.' does what we want13:00
facubatistathat said, how do you express "if you want to use this lib from this branch, you need also these libs to use it"?13:00
facubatistaChipaca, we don't *really need* the requirements.txt file (we do need the requirements-dev.txt one, though)13:01
Chipacafacubatista: 'python setup.py develop'?13:03
Chipacafacubatista: but the -e . in reqs dtrt so \o/13:03
facubatistaChipaca, I don't trust doing stuff like 'python setup.py develop' for those libraries that you may be using and developing *at the same time*13:04
Chipacafacubatista: ok13:04
Chipacafacubatista: can you check that '-e .' does the right thing in that sense, for you?13:05
Chipacafacubatista: (when install_requires is ["PyYAML"])13:05
facubatistaChipaca, I can check it, I would test it IRL, for that you need to fix first the find_packages thing13:06
Chipacafacubatista: what fix to the find_packages thing?13:07
facubatistaChipaca, https://github.com/canonical/operator/pull/305#discussion_r43244086113:08
mupPR #305: Tweaks to the README, setup.py, etc, for release <Created by chipaca> <https://github.com/canonical/operator/pull/305>13:08
Chipacafacubatista: remind me again, what version of setuptools did you have?13:08
facubatistaChipaca, an old one, which is my exact point: you need to specify somehow that the installation procedure needs a modern setuptools if you want to use that method in setup.py13:10
facubatistaChipaca, otherwise people will not be able to install the lib13:10
facubatistabtw, I'm in Bionic, not that I have really old stuff13:11
Chipacafacubatista: we don't have namespace packages anyway :)13:12
* facubatista brb13:12
Chipacafacubatista: what would you say to recording a video of these things working in concert?13:14
facubatistaChipaca, I'm not sure there's a "history to tell" that is best shown in a video than in a tutorial13:17
Chipacafacubatista: tutorial then :-D :-D13:17
Chipacafacubatista: unrelatedly: you know that 'ops $version up and running' thing? it gets annoying :-|13:19
Chipacafacubatista: WDYT of instead having it add [ops:$version] to each log line? would that be less annoying?13:20
Chipacaie '%(asctime)s %(levelname)-8s %(message)s' → '%(asctime)s %(levelname)-8s [ops:$(version)s] %(message)s'13:21
* Chipaca butchered that line but hopefully the idea survived13:21
facubatistaChipaca, remember I wanted to gain "visibility of log lines from the OF"? maybe this "inline version" a good way13:22
Chipacai remembered :)13:22
Chipacafacubatista: ok i'll do that13:23
Chipacafacubatista: getting my headset13:31
facubatistaoops13:33
mupIssue operator#306 opened: Add [ops:<version>] to operator log lines <Created by chipaca> <https://github.com/canonical/operator/issues/306>13:49
facubatistaChipaca, what do we consider more "basic"? the 'install' hook or the 'start' hook?14:00
Chipacafacubatista: what does 'basic' mean?14:14
Chipacafacubatista: they both have the same Ph :-p14:14
facubatistaJAJAAJ14:14
facubatistaChipaca, "barely first thing you need to see/understand"14:14
facubatistaif we hook on one event, which one is that? start or install?14:15
Chipacafacubatista: i think people not doing k8s will only be dimly aware of the 'start' one, and people doing k8s will know of 'install', so probably install14:15
Chipacafacubatista: but, 'if we hook on one event', that depends on the juju version :-)14:15
Chipacafacubatista: if you can assume 2.8, then 'install' always14:16
facubatistaack14:16
Chipacafacubatista: one thing about 'charmcraft build' that i noticed, that was surprising to me14:16
Chipacafacubatista: is that the .charm is named after the directory you're in, instead of using the name from the model14:16
Chipacafacubatista: ie i think it should use the 'name' from metadata.yaml14:17
facubatistammm, yes14:17
Chipacafacubatista: (not for today)14:17
facubatistaChipaca, good idea14:17
Chipacafacubatista: (issue plz?)14:17
facubatistaox courz14:17
Chipacafacubatista: for the tutorial, make the directory be the same as the model name so we don't lie but also don't surprise people :-D14:17
facubatistaperfect14:20
facubatistaChipaca, we should make a meeting around charmcraft issues, at least for "basic setup" like creating a couple of milestones, prioritizing, etc14:23
facubatistawe have 8 open already! :D14:23
Chipacafacubatista: i was about to create milestones but then realised we hadnt agreed on cadence so i punted14:24
Chipacafacubatista: but yes14:24
Chipacafacubatista: would having the same cadence as ops be reasonable?14:25
facubatistaChipaca, "punted"?14:25
Chipacafacubatista: 'lo patié'14:25
Chipacapunted [it]14:25
Chipacafacubatista: i called defer()14:25
facubatista:)14:25
facubatistaChipaca, one "big number" release per month sounds good; we can have "small number" releases in the middle if we want some urgent fix or whatever14:27
Chipacafacubatista: 👍14:27
* facubatista is not sure about calling those major/minor/patch/etc14:27
Chipacafacubatista: this is charmcraft 0.1.0, right?14:27
facubatistaChipaca, we can go with that, yes14:27
facubatistaChipaca, probably we should define "all that charmcraft needs to support" before getting to 1.0; we need to have this in mind when we review all the commands14:28
Chipacafacubatista: created 0.2.0 and later milestones for charmcraftrmrmr14:29
facubatistathanks14:29
Chipacafacubatista: #305 ready for re-review i think14:31
mupPR #305: Tweaks to the README, setup.py, etc, for release <Created by chipaca> <https://github.com/canonical/operator/pull/305>14:31
facubatistaChipaca, at install level, all is fine: https://paste.ubuntu.com/p/psw4Tpf35g/14:37
facubatistaChipaca, +1ed14:39
Chipacafacubatista: woo14:41
mupIssue operator#290 closed: recommend install hook over start <Created by jetpackdanger> <Closed by chipaca> <https://github.com/canonical/operator/issues/290>15:04
mupPR operator#305 closed: Tweaks to the README, setup.py, etc, for release <Created by chipaca> <Merged by chipaca> <https://github.com/canonical/operator/pull/305>15:04
Chipacafacubatista: https://pypi.org/project/ops/0.6.0/15:09
facubatistaChipaca, rocanrol: https://paste.ubuntu.com/p/SJHGzjdP7m/15:10
Chipacafacubatista: con fritas15:11
facubatistaChipaca, did I comment you about this new feature? see line 8 in the pastebin15:11
Chipacafacubatista: you did not15:11
facubatistafades, the easiest way to try Python libraries since libraries were invented15:12
* Chipaca resurrects 'import pip.<thing>'15:13
* Chipaca does not15:13
Chipacai'm going to get a cuppa tea and come back to write a README15:14
facubatistaChipaca, Houston, we have a etc, etc15:46
Chipacafacubatista: charmcraft#14 if you would15:46
mupPR charmcraft#14: update README.md to be more introductory <Created by chipaca> <https://github.com/canonical/charmcraft/pull/14>15:46
Chipacafacubatista: what did i break? :-|15:46
facubatistaChipaca, let's do a HO, but first let my try something15:46
Chipacafacubatista: is the problem charmcraft-side, or ops-side?15:47
facubatistaChipaca, charmcraft15:47
Chipacafacubatista: ok. what's the problem?15:48
facubatista2020-05-29 12:38:13,904  charmcraft.commands.build DEBUG    :: no such option: --system15:48
facubatistaChipaca, let's HO in the standup url15:49
ChipacaI'm going for a run, will bbiaw15:58
* facubatista is back16:13
facubatistaChipaca, branch: https://github.com/canonical/charmcraft/pull/1516:38
mupPR charmcraft#15: Don't use --system  parameter in pip install <Created by facundobatista> <https://github.com/canonical/charmcraft/pull/15>16:38
facubatistaChipaca, first draft of the tuto: https://gist.github.com/facundobatista/d3b7de7a624915227de051cba079e3d616:38
facubatistareally in alpha16:39
* facubatista brb16:39
* facubatista is back17:03
facubatistaChipaca, now the tutorial is "beta" :p17:10
Chipacafacubatista: --system isn't needed when used with --target, right?17:45
Chipacafacubatista: or are we breaking something else and we'll need to revisit?17:45
Chipaca(not now but eventually i mean)17:45
facubatistaChipaca, I couldn't find anything that should be fixed17:46
Chipacafacubatista: I APPROVE17:47
Chipacafacubatista: next week, can i convince you to not do branches on the project itself?17:47
facubatistaChipaca, you could try17:47
Chipacafacubatista: ok :)17:48
Chipacai'll do my best17:48
Chipacafacubatista: travis is being all travis-y17:48
Chipacafacubatista: did you look at charmcraft#14 ?17:49
mupPR charmcraft#14: update README.md to be more introductory <Created by chipaca> <https://github.com/canonical/charmcraft/pull/14>17:49
facubatistanop, will now17:49
Chipacafacubatista: thankyoup17:49
facubatistaChipaca, approved, with a comment17:52
facubatistaChipaca, my branch is ready to land but has only one approve18:00
Chipacafacubatista: there  is  no  branch18:02
* facubatista checks his spoons18:03
Chipacafacubatista: wait, does this mean we're Done?18:03
facubatistaChipaca, what about the tutorial?18:03
Chipacafacubatista: not needed for release :)18:03
facubatistaChipaca, you should push to PyPI18:03
Chipacafacubatista: yes18:03
Chipacafacubatista: but first I should tag18:04
Chipacafacubatista: wait, we need one more to actually bump the version18:04
Chipacad'oh18:04
Chipacafacubatista: do you want to do the honours?18:04
facubatistaok18:05
Chipacafacubatista: at some point, let's move all our copyright headers to the juju style18:06
facubatistaChipaca, ok18:06
Chipacamuch cleaner18:07
facubatistaChipaca, as long lawyers rest in peace, I'm ok18:07
facubatistaChipaca, https://github.com/canonical/charmcraft/pull/1618:07
mupPR charmcraft#16: Version 0.1.0 <Created by facundobatista> <https://github.com/canonical/charmcraft/pull/16>18:07
Chipacafacubatista: +118:08
vgrevtsevhi all - first of all, congrats with the first release \o18:10
vgrevtsevsecond... I'm writing a test and encountered a little problem, hope someone can help :)18:11
vgrevtsevso, tl;dr I'm trying to access a StoredState from the test, but it fails -> https://paste.ubuntu.com/p/BPkFy8zmjP/18:11
vgrevtsevany ideas or advices are very appreciated :)18:12
Chipacaman, stop breaking our stuff :-p18:15
facubatista:)18:15
vgrevtsev:'(18:15
* facubatista bb~1h18:16
Chipacavgrevtsev: where does the charm in line 13 come from?18:18
vgrevtsevit's a `charm.py` file. and `on_config_changed_handler` is a function nmame18:19
vgrevtsevname*18:19
vgrevtsevhere is it: https://paste.ubuntu.com/p/ty3YtMtCvx/18:20
Chipacavgrevtsev: i mean, what created it?18:21
vgrevtsev`import charm`, that's it18:21
vgrevtsevhttps://paste.ubuntu.com/p/TyXhMSyTXC/ line 9818:21
Chipacavgrevtsev: i have no idea what any of those things are :-(18:22
vgrevtsev:(18:22
vgrevtsevok, let me ask another question then: what's the right way to access the StoredState object or mock it? I tried to initialize it in the test itself (in `setUp`), but sounds like it requires a framework context18:23
Chipacavgrevtsev: there seems to be a whole other framework involved in this18:23
Chipacavgrevtsev: are you asking about the framework-private stored state, or about the stored state of your charm?18:27
vgrevtsevI wish I knew the difference...18:27
Chipacathe framework uses a stored state object for some internal stuff, but i don't think you should care about that18:28
Chipacaso i'm assuming it's for your charm18:28
vgrevtsevI think I'm asking about the latter - I need to store some state during the hook execution and then check it18:28
Chipacavgrevtsev: so the way you do that is by asking for it explicitly, something like18:28
Chipacaclass MyCharm(CharmBase):18:28
Chipaca    _stored = StoredState()18:28
vgrevtsevThat's what I did...18:29
vgrevtsev(except of the `_stored` naming)18:29
Chipacavgrevtsev: so if you need to test that your charm is saving the right thing in that stored state attribute, you can either replace it with a double, or mock it, or query it directly18:30
Chipacait's just a python dict-that-ends-up-in-a-sqlite18:30
vgrevtsevI wonder why Harness instance doesn't have a `charm` object (it returns None) instead of anything18:31
vgrevtsev`Note that the Charm is not instantiated until you have called` ah,.......18:31
vgrevtsevWell.18:31
vgrevtsevGimme a sec. :-D18:31
Chipacavgrevtsev: did you harness.begin()?18:31
vgrevtsevI did (now). And the error is different now: "RuntimeError: unable to define an event with event_kind that overlaps with an existing type <class 'ops.testing.Harness.begin.<locals>.TestEvents'> attribute: http_api_relation_created"18:32
Chipacavgrevtsev: hmm, that's probably a wart we're wanting to fix, that has a workaround that i forget but give me a bit18:33
Chipacavgrevtsev: you have more than one test that's creating a harness on the same charm class, right?18:34
vgrevtsevChipaca: no, that's not correct. I have one test class with one test, creating a Harness object from the inside of the test function18:35
Chipacavgrevtsev: I'm afraid I'm going to ask you to file a bug, and chase jam about it18:36
Chipacai'm pretty sure he knows exactly what to do with that18:36
vgrevtsevSure.18:36
Chipacai might be wrong :)18:37
vgrevtsevI assume jam is already eod?18:37
Chipacavgrevtsev: he's eow18:37
vgrevtsevyeah true, it's friday :D18:37
Chipacaso should i be, but i'm waiting to do a release before disappearing :-)18:37
Chipacavgrevtsev: his week goes sun-thu, to make it more fun18:37
vgrevtsevoh wow18:38
Chipacaand travis is taking ages! and my beer is going cold!18:38
Chipacawell, that last one isn't necessarily bad18:38
Chipacacharmcraft 0.1.0 is out18:59
Chipacafacubatista: have a great weekend! the tutorial is looking good, I'd like to include a link to it in the status email (going out Monday)19:00
=== Chipaca changed the topic of #smooth-operator to: general discussion of the operator framework || github.com/canonical/operator || ops 0.6.0 RELEASED (pip install ops) || charmcraft 0.1.0 RELEASED (pip install charmcraft) || have a great weekend
facubatistaChipaca, mmm... we may have a bug19:04
Chipacafacubatista: lies!19:04
Chipacafacubatista: we only have hard to understand features19:04
Chipaca:-p19:04
facubatistajajaja19:04
Chipacafacubatista: contá contá19:05
facubatistaChipaca, https://is.gd/rxVXTp19:05
Chipacafacubatista: what's that?19:06
facubatistaChipaca, why its setup.py is trying to read requirements.txt?19:06
facubatistathat is not in master19:06
facubatistawhat did you push? :p19:06
Chipacafacubatista: that's also missing commands/19:06
Chipacafacubatista: i pushed 0.1.019:07
Chipacawhat is that19:07
Chipacaok let me fix this19:07
facubatistahttps://pypi.org/project/charmcraft/#history19:07
facubatistaChipaca, something pushed 2 days ago19:07
Chipacafacubatista: try now19:08
facubatistaChipaca, don't yank it, really delete it19:09
facubatistawe don't want anybody try to use it even specifying 0.1.119:09
Chipacayeah19:09
Chipacai don't understand the thinking behind pypi's workflow19:10
Chipacayou can't delete a yanked version19:10
facubatistaChipaca, can you un-yank it?19:10
Chipacayes19:10
Chipacabut then it'll be the tip again19:10
facubatistaand then delete it19:10
facubatistaor just release 0.1.219:11
Chipacafacubatista: actually it looks like i can delete it if i enter the CRUD URL by hand … o\19:11
Chipacadone19:12
vgrevtsevChipaca: so actually `_stored` did the magic for some reason, I don't know why19:13
vgrevtsev`harness.charm._stored.set_default(is_started=False)` & `harness.charm._stored` worked fine19:13
facubatistaweeeeee19:13
facubatista$ fades -d charmcraft -x charmcraft version19:13
facubatistaVersion: 0.1.019:13
vgrevtsevWELL19:13
vgrevtsevno19:13
Chipacavgrevtsev: please file the bug :-)19:13
vgrevtsevthe same code produces the different results19:13
vgrevtsevYeah I was filing the bug19:14
facubatistavgrevtsev, thanks19:14
Chipacavgrevtsev: my brain is way ahead of me WRT this EOW thing19:14
Chipacanot that it was a whole lot better before mind you :-)19:14
vgrevtsevno worries Chipaca - i'm just sending my thoughts to the channel not expecting anyone of you to answer :)19:14
Chipacafacubatista: sorted, then? i can go? :-)19:14
Chipacavgrevtsev: :-) cheers man19:15
facubatistaChipaca, let's get drunk19:15
* facubatista prepares a mate19:15
* vgrevtsev looks at the clock, 22:15...19:15
Chipacafacubatista: actual LOL19:15
vgrevtsevwho said "beer"?19:15
Chipacavgrevtsev: i think i did19:15
facubatistavgrevtsev, \o/19:15
Chipacai've got an IPA for ops, and another for charmcraft19:16
* Chipaca likes the hoppy stuff19:16
* Chipaca goes19:16
Chipacafacubatista: buen fin de semana! and see you Monday. Not too early.19:16
facubatistaChipaca, have a nice weekend, eso19:16
Chipacafacubatista: we still need to review your charm :-) but we got the release out so i'm super happy19:16
Chipacanow i need to tidy my thoughts and write that status email19:17
facubatista:)19:17
Chipacabut first, beer, sleep, weekend19:17
Chipaca👋19:17
mupIssue operator#307 opened: Race condition: RuntimeError: unable to define an event with event_kind that overlaps with an existing type <Created by exceptorr> <https://github.com/canonical/operator/issues/307>19:22
vgrevtsev^ that's me19:22
Chipacavgrevtsev: niiice19:26
* Chipaca sips his beer19:27
Chipaca(no coding after beer is being supped)19:27
Chipacain fact, it might be high time to go play civ19:27
* vgrevtsev counts time down before The Last of Us Part II release19:28
* Chipaca wonders if said counting down is done using some form of liquid timekeeping device19:32
mupIssue operator#308 opened: have a code of conduct <Created by chipaca> <https://github.com/canonical/operator/issues/308>19:35
mupIssue operator#309 opened: KeyError: 'JUJU_MODEL_NAME' while emitting event from Harness <Created by exceptorr> <https://github.com/canonical/operator/issues/309>19:36
vgrevtsev:-(19:37
vgrevtsevit's me again....19:37
vgrevtsevChipaca: oh yes, indeed, liquid time machine...19:38
vgrevtsevyou can activate it being near your laptop at 8pm and then suddenly realise it's Sunday 5am already and you're in the middle of nowhere19:39
vgrevtsevbut it was fun :-D19:39

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!