Fork me on GitHub
#boot
<
2016-01-13
>
jethroksy05:01:25

I'm getting a very peculiar boot-environ problem

jethroksy05:01:16

(env :foo) initially returns nil which breaks my program

jethroksy05:01:50

But after trying to evaluate that same expression in the repl, it returns the correct result and my program works again

jethroksy05:01:07

I can only assume my clojure src was compiled before the environ task executed, but environ is my first task

martinklepsch08:01:43

@jethroksy: are you using the serve task? Environ only sets things in the current pod and serve uses a fresh one

jethroksy08:01:39

I'm running stuff from my -main task

jethroksy08:01:52

I'm using aleph with system so that might be what causes the issue

jethroksy08:01:02

I havent pushed the db code up yet, although it's very much like the yesql example code

martinklepsch08:01:19

Hm, not seeing anything obviously wrong @jethroksy

jaen08:01:28

Hmm, I remember an issue like that, but I'm not sure what I did about it; if I remember I'll let you know.

jaen08:01:21

I think I know what this is.

jaen08:01:49

You're creating your system as toplevel defs.

jaen08:01:09

Environ information is not yet available at compile time IIRC.

jaen08:01:27

If you change that to functions that return system maps it should be okay.

jaen08:01:43

As you can see the environment values are only queried

jaen08:01:49

When the function is called at runtime.

jaen08:01:59

In your case the env is queried at compile time

jaen08:01:07

And that's probably why it lacks information.

jaen09:01:05

At least I think that's what my issue was when I had it.

jethroksy09:01:00

@jaen Yeah I thought about that

jethroksy09:01:09

But I really want my queries to be in my db namespace

jaen09:01:28

Ah, yesql?

jaen09:01:22

Well, I don't think it plays well with component, I don't remember there being a way to specify connection at query time.

jethroksy09:01:40

Would honeysql work?

jaen09:01:23

Yeah, it would. You generate SQL with honeysql and querying is on you then, using either clojure.java.jdbc or clojure.jdbc (I suggest the latter, it's nicer).

jaen09:01:27

Let me find this

jethroksy09:01:39

Good to know I wasn't missing something stupid

jaen09:01:59

There was a library similar to YeSQL posted here some time ago

jaen09:01:44

I'm not 100% sure why environ map wouldn't be available at read time either, since that's when it is created; maybe it's order of initialisation? But that doesn't sound right. Either way I'm pretty sure creating the system maps at runtime with a function should solve this.

jaen09:01:58

I didn't yet find that other lib

jethroksy09:01:01

Yeah it did solve it

jethroksy09:01:01

I'm out of office now, but I'll report back if that works if you want

jaen09:01:05

Oh, I think it was HugSQL - http://www.hugsql.org/

jaen09:01:23

Also, convenience link to clojure.jdbc - https://github.com/funcool/clojure.jdbc - though I remember I had slight problems when using it with joplin for migrations and had to do a bit of alter-var-root magic.

jethroksy09:01:33

Ah okay thanks a lot!

jaen09:01:38

Sure, no problem. Glad that the environ problem was solved.

jethroksy09:01:49

What's stopping it from being inserted at compile time though?

jethroksy09:01:58

I think that'd be pretty good

jaen09:01:24

Hah, the answer is - I don't know. It seems like something that should be doable at read-time, but since moving it into a function fixed it I never bothered to figure out what's the reason the map comes up empty if you use it at read-time.

jaen09:01:08

Also consider how it would interact with AOT - if value is set at read-time you would have to AOT with proper configuration in place already, which might be less than ideal.

jethroksy09:01:17

Ah AOT isn't something I'm familiar with yet

jethroksy09:01:26

Will do some reading and get a proper answer regarding this case for environ

jaen09:01:59

Well, you are in so far as you're using :gen-class, but maybe that's a non-issue. So far I never needed to AOT more than the main class.

meow13:01:49

good morning, @jaen

meow13:01:14

good morning, boot!

meow13:01:24

#C053K90BR

yenda13:01:22

I have this exception when doing boot show -d

yenda13:01:31

I suspect a library conflict but how can I find out if boot show -d gets the exception as well ?

pandeiro13:01:18

should the target task create the :dir if it doesn't exist?

martinklepsch14:01:20

@pandeiro: I'd expect it to

pandeiro14:01:35

@martinklepsch: ok thanks, i'm debugging something on circle but I just wanted to make sure I understood the expected behavior

alandipert14:01:43

it should, and does

yenda14:01:19

well I just added [org.clojure/core.cache "0.6.4"] to the dependencies

alandipert14:01:38

can you share your build.boot? i would guess you are requiring code that requires core.cache, hitting the conflict while build.boot is running

alandipert14:01:57

to circumvent you could comment out any requires and run boot show -d

yenda14:01:52

it is ring-middleware-format that requires core.cache

meow14:01:15

is it true that boot isn't working on older windows?

meow14:01:28

I'm afraid to upgrade any of my boot stuff.

alandipert14:01:37

@yenda: so in this situation... the normal route is to figure ou twhich version of core.cache works for both your purposes and ring middleware format's

alandipert14:01:44

since clojure libraries are usually backward compatible... especially core ones... i would start with [ring-middleware-format "0.7.0" :exclusions [org.clojure/core.cache]]

alandipert14:01:45

an alternative is to not bring in your own version, and instead rely on the one brought in by ring-middleware-format

alandipert14:01:09

a 3rd option is to do whatever you need to do with your specific core.cache version in a pod

alandipert14:01:33

since you could create a pod with different dependencies as the rest of your app, circumventing the conflict

yenda14:01:47

sorry when I said "well I just added [org.clojure/core.cache "0.6.4"] to the dependencies" I meant that it worked that way

yenda14:01:07

so I suppose ring-middleware-format is missing this library and yet requires it to work

yenda14:01:53

thank you for your help though, I need to learn how to use pods someday it seems interesting

alandipert14:01:42

sure. they're kind of the nuclear option, but it's worth knowing that you can use them beyond build time

alandipert14:01:06

i used them once to manage multiple versions of the AWS SDK in an app at runtime

alandipert14:01:00

and yeah - it looks like middleware-format depends on core.cache transitively via core.memoize

pandeiro14:01:51

is bootlaces not compatible with boot 2.5.5 or was there some other reason for not using it anymore in boot-cljs?

martinklepsch14:01:37

@juhoteperi doesn't like it 😛

juhoteperi14:01:48

@pandeiro: It is compatible but not necessary as Boot can handle clojars credentials easily now

martinklepsch14:01:26

I keep using it because I really like that it handles the readme version thing

alandipert14:01:30

oops, vimperator fail

pandeiro14:01:55

@martinklepsch: i still love that too simple_smile

micha15:01:02

@martinklepsch: feel free to make whatever modifications to bootlaces you want

micha15:01:17

i think it's original form is outdated

micha15:01:24

time for a rewrite

martinklepsch15:01:28

@micha: I'm happy with it as is I think

martinklepsch15:01:38

but yeah, might be time to throw some of it over board

micha15:01:48

it started out as a thing for my own personal sanity

micha15:01:34

@meow: boot windows support should be much better on older windows now than it was before

meow15:01:42

@micha: oh, good. I'm moving to a different system tomorrow but at the moment I'm on Windows Vista - I know, kinda scary, right? And you know I ❤️ boot-clj and can't clj or cljs without it

meow15:01:29

¯\(ツ)

meow15:01:05

works surprisingly well in general for everything I'm doing

micha15:01:56

haha wow i had no idea boot would work on vista

meow15:01:48

haven't upgraded in a while so can't say for sure about the latest and I won't have time to test it for you as I'm super, super, super busy

micha15:01:09

which version are you using?

meow15:01:16

trying to work on some of these for clojars: https://github.com/clojars/clojars-web/labels/ready

meow15:01:39

C:\Users\Patrick\code> boot -v
Acquired [email protected][Permits = 0]...
Released [email protected][Permits = 1]...
Boot App Version: 2.2.0
Boot Lib Version: 2.2.0
Clojure Version:  1.7.0

meow15:01:31

I would be willing to trade the testing of boot on Windows Vista for help with those easy tickets for Clojars

meow15:01:42

seriously?

micha15:01:00

lol full disclosure, i am already doing some stuff for clojars simple_smile

micha15:01:06

but yes seriously

meow15:01:21

I am yours

meow15:01:30

just tell me what to do and I will do it

meow15:01:05

as long as it doesn't concern bdsm (see #C0JBGNVS5 )

meow15:01:12

cuz you don't know my safe word

micha15:01:22

i can guess it, don't worry

micha15:01:49

it's "harder" right?

meow15:01:53

I kinda just made it easy for you

meow15:01:21

it should be :stop: or :harder: or :moar:

meow15:01:45

lets pick a clojar ticket to work on

meow15:01:59

can we get all of these resolved today?

meow15:01:26

I'll go around offering free blowjobs to anyone that completes a ticket

micha15:01:21

a human resources nightmare

meow15:01:40

hrm - that's me!

pandeiro16:01:58

is anyone successfully using :parallel-build true w/ cljs/boot-cljs 228?

jaen16:01:37

1.7.170-3 here and it seems to handle parallel build option no problem.

pandeiro16:01:42

@jaen: thanks; you don't see the Undeclared var... warnings either right?

jaen16:01:01

Not at the moment, but they did happen from time to time. But if so that would be caused by :parallel-build true itself, not boot-cljs if I understand correctly.

pandeiro16:01:06

ah ok; yeah, right... I had heard the parallel-build was thread-safe as of 228 but I'm still seeing those warnings...

pandeiro16:01:22

* sometimes

pandeiro16:01:53

when there are multiple .cljs.edn builds

jaen16:01:27

Well, one thing is whether the parallel build code is thread-safe, another is whether the dependency graph has enough constraints that compilation doesn't get reordered so that you end up with undeclared vars.

jaen16:01:56

It could be either.

oskarth16:01:18

boot turns NSFW

pandeiro16:01:56

@jaen: hmm, wish I understanded the latter better...

micha16:01:37

@oskarth: sorry about that

oskarth16:01:46

Haha, is cool

jaen16:01:49

@pandeiro: what I mean is in order to parallelize the build the compiler needs to find parts of dependency graph that can be compiled separately, right?

pandeiro16:01:10

right, understood

jaen16:01:42

But if the constraints you create through require and such don't adequately describe dependencies between namespaces, it can reorder the compilation such that something a namespaces uses won't be defined yet.

jaen16:01:12

At least that's how I understand the root issue behind Undeclared var with parallel compilation is, as discussed on #C03S1L9DN at some point.

pandeiro16:01:52

@jaen: thanks for the explanation, makes sense

meow17:01:35

I am currently on a Windows Vista machine and can test the latest boot

C:\Users\Patrick\code> boot -V
#
#Wed Jan 13 11:36:50 CST 2016
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.7.0
BOOT_VERSION=2.5.5

meow17:01:15

tell me what to do to help with testing

meow17:01:07

will only have access to this machine today

micha17:01:26

can you build one of your projects?

micha17:01:34

also with watch involved

meow17:01:49

I will try

pandeiro19:01:46

Guessing those are ANSI color codes?

alandipert19:01:05

the -C / --no-colors option should get rid of them

alandipert19:01:16

@meow: i am good, thanks - how you doin?

meow20:01:21

super busy

meow20:01:37

heading off the #C0J5T38VB

meow20:01:40

I guess boot-clj can't autodetect the lack of support for color codes?

micha20:01:47

it should do it

micha20:01:57

it has some checks for os being windows

micha20:01:05

maybe those don't work on vista?

micha20:01:14

(boot.App/isWindows) in the repl

micha20:01:17

should be true

meow20:01:47

boot.user=> (boot.App/isWindows)
true
boot.user=>

meow20:01:03

don't some windows shells support color

meow20:01:00

this is the GitHub Git Shell based on powershell and it does have colors, just not for boot

meow20:01:50

the git coloring is working