ChatExchange
ChatExchange copied to clipboard
Make developer dependencies optional
As discussed in chat here, pytest
eventually shouldn't be a strict dependency for this project. It should still be defined in setup.py
, but as optional, either as an extra
or through some other mechanism.
It doesn't look like there's any specific way of indicating dev dependencies as with Node, so a [dev]
extra as implemented in fc8d339 seems like the appropriate approach.
It might be nice if we could have a second, distinct, Travis test build, which tries installing the non-dev dependencies and running a simple example script, but I worry that that's a slippery slope to lots of disorganized testing so I probably won't pursue it.
(Although if we did want to go down that road, I think it might just take something like this (docs):)
matrix:
include:
- install: 'pip install .'
- script: 'python examples/something.py'
include:
- install: 'pip install .[dev]'
- script: 'python -m pytest'
The build of fc8d339 failed on Travis. I am guessing there might be an issue with using extras with a non-editable installation of a local path:
(from .travis.yml, doesn't work, it thinks I want a packaged name ".[dev]")
pip install .[dev]
as opposed to calling
(works locally, as make install-dev-dependencies
)
pip install -e .[dev]
or
(well-documented usage)
pip install ChatExchange[dev]
I've filed a ticket about this behaviour at https://github.com/pypa/pip/issues/1780, which should clear up whether this is a bug or expected.
Is this still relevant? I don't understand the distinction between "extra" and "optional" here. It should be easy to build a Github Action which tests without the dev dependencies (other than pytest, but how would you avoid importing that?)