These are chat archives for coala/coala-bears

7th
Jun 2018
John Vandenberg
@jayvdb
Jun 07 2018 03:10
python3.6 -m pip install -r test-requirements.txt ?
John Vandenberg
@jayvdb
Jun 07 2018 03:28
@makman2 @binore @bekicot @li-boxuan @blazeu we have a "dispute" wrt package-lock.json , c.f. coala/coala-bears#2508
IMO , there is no value in storing this file as people do not use npm to install our package.json , and maybe we should even just remove package.json
Yana Agun Siswanto
@bekicot
Jun 07 2018 03:38
Probably remove package.json as some bear doesn’t adhere local package anyaway (like ESLint) :smile: . Removing it means, we will have a hard time to know what npm dependency are required by coala-bears right?.
John Vandenberg
@jayvdb
Jun 07 2018 04:02
we now have bear-requirements.yaml which includes them
Manan Kalra
@manankalra
Jun 07 2018 05:59

python3.6 -m pip install -r test-requirements.txt ?

Nah, same problem.

Vaibhav Rai
@RaiVaibhav
Jun 07 2018 06:08

With 18.04, Python doesn't come pre-installed, right?

I think some internal problem is there, reinstall OS if you can, please consider using it from the generic source, last time when I tried to do something creative it hit me hard.

Consider it as a last option :sweat_smile:
John Vandenberg
@jayvdb
Jun 07 2018 07:09
@manankalra run python3 and try 'import ..' manually
If that works, something is wrong with pytest
If it doesnt work, something is wrong with pip / python env
Manan Kalra
@manankalra
Jun 07 2018 07:14
Doesn't work; I recreated the virtual env, still no luck
Then Python has issues, maybe! Idk
John Vandenberg
@jayvdb
Jun 07 2018 07:59
try a verbose pip install to see where it is installing things
then use PYTHONPATH to ensure that directory is seen by python
Palash Nigam
@palash25
Jun 07 2018 10:03
@manankalra did you try installing these modules? I was getting a Module Not Found error last night and I did a pip install, now pytest is working fine for me
John Vandenberg
@jayvdb
Jun 07 2018 10:21
he has already said he did
Mischa Krüger
@Makman2
Jun 07 2018 21:16
@jayvdb tbh I'm not totally 100%ly aware of how we want to handle non-python dependencies in future from within our bears with the REQUIREMENTS field. But for now, I rather like to have some package.json so users knowing npm can immediately install dependencies, so it just works. That's usually the faster and better understood way.
John Vandenberg
@jayvdb
Jun 07 2018 21:35
but it doesnt just work
it doesnt work at all
because each dependency needs to be installed with -g to be global
and npm doesnt support that from a package.json
we would need to publish the coala-bears package, and dependency_manager would need to load the dependencies from within it
iirc, some serious tomfoolery is needed to get the dependencies bin files to be exposed in our package
Surya Widi
@blazeu
Jun 07 2018 21:47
if you run npm bin (add -g for global package) it'll point to the directory where the installed executable is located
for local package this should be $PWD/node_modules/.bin
and it's better to prefer the local package because the dependency is explicitly set in the project's package.json
Surya Widi
@blazeu
Jun 07 2018 21:52
another interesting command is npx https://www.npmjs.com/package/npx , comes preinstalled with npm 5 iirc.
it'll run the local executable from the current directory/project, if it's doesn't find it, it tries to find it globally and run it, finally if it's not intalled, it'll install it globally and then run it.
John Vandenberg
@jayvdb
Jun 07 2018 22:09
@blazeu , but a coala user isnt the coala-bears directory. they are in their own project directory
we need some way to make npm install listed dependencies globally
and then we still have the problem that most users dont want to install them all, so we need a cib tool anyway
Surya Widi
@blazeu
Jun 07 2018 22:12
I don't suggest we keep the package, I suggest that coala look for the executable somewhere else using npm bin or npx or make similar logic in Python based on both.
John Vandenberg
@jayvdb
Jun 07 2018 22:12
npx sounds interesting
Surya Widi
@blazeu
Jun 07 2018 22:12
*package.json
John Vandenberg
@jayvdb
Jun 07 2018 22:12
nod
but how do we communicate version restrictions to npx ?
Surya Widi
@blazeu
Jun 07 2018 22:13
same as npm install
npx eslint@4
John Vandenberg
@jayvdb
Jun 07 2018 22:14
can it be given a package.json to get all that data from ?
Surya Widi
@blazeu
Jun 07 2018 22:15
no, but if we can read the user package.json in the current working directory, the version is there.
John Vandenberg
@jayvdb
Jun 07 2018 22:16
I did have a sed script which converted package.json version to cmd line version syntax ; it wasnt pretty .. ;-)
Surya Widi
@blazeu
Jun 07 2018 22:18
parse the json? there should be a npm command to do this.
Mischa Krüger
@Makman2
Jun 07 2018 22:31
You have plenty of rope to solve that from my side, like you say @jayvdb , we need some cib sooner or later so people can install just the things they need ;)
Wasn't aware that package.lock doesn't work, especially that it's not globally installable. npm is just a weird package manager...
John Vandenberg
@jayvdb
Jun 07 2018 22:37
We can make it work by setting NODE_ env vars, and those tricks would need to be in package_manager and the linter runner.
Or @blazeu will find a better way.. ;)