Conversation
- make for tasks (no deps, simple, works) - pylint - let users manage their own venv - make info.json available inside package so can be used, for example, in __version__ - follow common practice of not having requirements.txt for libs - changes to various CLI config files - prep travis for automating package deployment
@amercader @brew @vitorbaptista @akariv @roll The above setup is based on various efforts around standardizing how we do this, that includes input from pretty much all of us. I'm integrating this setup into our coding standards. The goals are:
Feel free to comment here, or, after I add to https://github.com/okfn/coding-standards contest via PRs :). |
My feedback:
It looks like the best way for now. Weak place in python ecosystem =(
Don't have enough knowledge on the topic. Pylint looks like a standard.
When packages will be widely public facing it's a good idea to not have helpers for env activation (could be used in internal packages with git hooks to ensure no broken builds pushed).
The essential one to have version at runtime. Just didn't have time to do it)
Don't like the idea having different Our standard by default list could include:
That way a actual data could be in:
Many files to do not maintain for every project) |
Also:
|
deps= | ||
-rrequirements.dev.txt | ||
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH | ||
deps= -rtests_require |
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.
Instead of having a separate file for tests requirements, why not simply add the requirements here? Any advantages on having tests_require
in setup.py?
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.
I think it is good to be able to pip install the test reqs (see make install
). As for having it in setup.py, it is friendly for anyone who uses python setup.py test
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.
to give contributor do pip install -r requirements.txt
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.
As we're using tox, we should never need to install the test dependencies. python setup.py test
simply calls tox
, which handles that for us.
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 would you recommend adding an explicit pip install tox
to make install
, or, just telling the dev that they need to install tox? I don't mind changing pip install tests_require
to pip install tox
and letting tox handle test deps actually... it just still looks a bit foreign to me. In general, I think you are right that we just let tox handle it.
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.
make install
will bring deps + tox. But yes, you'd then have to run tox at least once in order to be able to run the linter or coverage, as they'd only be declared in tox with the suggested change. Probably not so good, to change, then.
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.
deps declared where?
I mean if remove extenal file.
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.
in setup.py. pip install -e .
uses setup.py
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.
But it also installs the package by itself to development environment?
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.
I'm asking because if we have installed our package (python setup.py install) to dev venv it could lead to magical bugs because of 2 copies of package in PYTHONPATH.
Again - i never did it that way - correct me if i wrong.
Another suggestion:
https://github.com/okfn/datapackage-storage-py (section |
I think moving to a Installing a Python package should work the same: With these few changes, the only thing the user needs to know is that we use |
Adding to my last comment, if we configure the |
@@ -0,0 +1,22 @@ | |||
.PHONY: all list install test review coverage | |||
|
|||
PKG := tabulator |
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.
We should probably get the name from the info.json file instead of repeating.
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.
I guess, good idea.
@pwalsh But taking another look on external files soultion:
what is technical objections against it? It's:
Now we have many tech problems to substitute it but initial problem was like it's bad naming? May be rename it to |
To give a better example on what I think is the best approach, check https://github.com/datapackages/datapackage-py. Everything related to the metadata about the package is in setup.py, except for the README. This keeps that file quite straightforward. The If you want to run tests, you'd have to have I'm not linting the code, but to do so I would just add a new environment to my The main advantage of this structure is that we're not adding any extra abstractions on top of what Python already offers. There's no extra Makefile or JSON files to maintain. The user can simply clone the code and call |
@vitorbaptista of course, a lot of this is based on that package. But the problem I see there is that you are turning tox into a task runner, which may or may not be ok, but I don't think it is as transparent as you make out. Definitely, I think it is important to be able to run lint and coverage reports as distinct from a normal test run (especially lint). |
@vitorbaptista |
Although I think that linting should be part of the default test suite, we can easily set lint to run only when calling [testenv:lint]
deps=
{[testenv]deps}
pytest-pylint
commands=
py.test \
--pylint If we don't specify |
@roll I'm not that familiar with All in all, I think |
@vitorbaptista I agree tox solves a ton of issues, but that example above of trying to use tox as a runner for a linter is a vastly different experience to just running |
I checked Paul's Now I almost don't see blockers to make it |
About version. It's a small thing but a real important thing. It's a real trap. I thinks we have to avoid to have it in 2 places - even we may be have to add test before release to check declared version matches git tag version (just check current tabulator git tag and declared version =( ). Solution 1Parse it in setup.py. Solution 2 (?)Have someone experience of getting version at runtime?
I suppose it's a bad idea because some collisions could be introduced etc? But I haven't tried it. |
|
Considering that we keep our test dependencies into To be clear, I'm not saying that we should follow this pattern just because others are using it. There're plenty of ways to do the same thing. I'm just giving these examples as indications that we're not overusing Tox for something it was not intended to. |
This is great @vitorbaptista keep it coming. I guess I'm seeing two distinct use cases here: running on CI, and some helper tools during development. |
Ohh.. but it looks like So I think this https://github.com/datapackages/datapackage-py/blob/master/setup.py + version extraction + Than on getting started to contributors we just need to write:
All others (test, review) will be tox calls. |
@pwalsh One of the specific goals for
@roll In Tox's FAQ, there's a suggestion on how to integrate tox with setuptools test commands, so I think it's a bit overkill, though. If there're issues with |
@vitorbaptista
Then contributor needs to install |
Yes, I get that. The whole point of the Makefile is an interface to run tasks, not only tests. |
@amercader @brew @vitorbaptista @akariv @pwalsh Please take a look - #41 |
__version__
as well assetup
@roll this is not for merging right at this moment: it is for your feedback. Sorry I'm using your codebase to test this out, but, you know why we are doing this :).