-
Notifications
You must be signed in to change notification settings - Fork 16
[WIP] Use tox and npm scripts #272
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vitorbaptista tox is fine (seems overkill for just a python version but you are the expert in bootstrapping python packages :) ).
Regarding scripts in package.json
, we used to have them there and then moved them back to Makefile
to have a single point of truth. I personally don't mind your new approach, so unless @roll has any comments I'm happy to merge this.
If tests pass of course |
I'm +1 to get back to PS. |
Great! I'll check why the tests aren't passing and update the PR.
I mostly agree regarding It's much easier (for a newcomer) to run the tests, being sure the environment is correctly set. It's also useful to run linting. It can even be (ab)used to write something similar to npm scripts, where a command is executed with all the dependencies installed, so you could have It's even more useful in our case, where we have many different Python repositories, so we can be sure that wherever we run |
It's required to run `setup.py`, so we need to explicitly add it to the `MANIFEST.in`, otherwise it won't be added to the python package.
dae00e8
to
2f04764
Compare
The Makefile then is simply a dumb wrapper that calls commands defined in the `package.json` or `tox.ini`, depending if it's JavaScript or Python. This allows us to rely on their respective package manager to run the correct version of each executable (avoiding having to mess with $PATH). I also changed the testing NODE_ENV to "test", as it's the most common name.
This fixes a bug where psycopg2 is unable to determine postgresql versions >10.x (see psycopg/psycopg2#489).
16c6cd2
to
018d831
Compare
018d831
to
f618fdd
Compare
The fixes were mainly adding missing `__init__.py` files to folders that should've been modules but weren't. I also changed to use `pkg_resources` to find the resource files path, as it's more reliable than relying on the __file__ location.
f618fdd
to
124e584
Compare
This PR:
package.json
(from the Makefile)There's not much advantage in using
tox
instead of the Makefiles, considering we just have a single Python version. I did it because I find it useful to understand the testing configuration, and I think it makes it easier for newcomers to just run the tests. With tox, they just have to:cp .env.example .env # Modify the TEST_DATABASE_URL with the test DB to use tox
I also changed all example values in
.env.example
to be valid (and commented out SENTRY_DSN, otherwise it'll be used even with an invalid value), to make as easy as possible for new users.Then I moved the NodeJS scripts from the Makefile to the
package.json
. This is important to guarantee that we're using the binaries that were installed by npm, not something that we happen to have in our path. By doing this, I fixed a tricky bug. We were using the binaries installed by npm by modifying thePATH
in the Makefile, as:goodtables.io/Makefile
Line 5 in 60b9f26
However, this appends
./node_modules/.bin
to the end of thePATH
variable. Binaries are searched in the folders insidePATH
in the order that they appear, so if (say) you had thekarma
binary installed in your system, it would be used instead of the one installed in./node_modules
.