Skip to content

Added (back) tox.ini file#8202

Closed
astrofrog wants to merge 1 commit intoastropy:masterfrom
astrofrog:tox
Closed

Added (back) tox.ini file#8202
astrofrog wants to merge 1 commit intoastropy:masterfrom
astrofrog:tox

Conversation

@astrofrog
Copy link
Member

I'm putting this up for discussion at the coordination meeting this week

After several people mentioned tox as a potential way to simplify our infrastructure, I decided to look into it to see if it could serve our purposes. Just for background, the way tox works is that you can specify any number of configurations for different virtual environments containing different sets of dependencies. When you run one of the configurations, it will set up the environment (if not already existing), install the developer version of astropy into it, then run any custom commands.

Compare this to how we run tests - we install astropy to a temporary directory and then run pytest in that directory - and how we run docs: we build astropy then patch the sphinx build to point to the built version of astropy. What we are trying to achieve is similar to what tox does, except we have developed our own (in places complex and hacky) infrastructure.

With this PR, you can do e.g.:

tox -e py37-build-docs

and this will set up a virtual environment with the build requirements then run Sphinx, and it does not use the custom sphinx docs runner in astropy-helpers. Likewise, you can do e.g.:

tox -e py36-test

and it will run the tests on Python 3.6 after building astropy.

This opens up several possibilities:

  • If we were to use this, we could possibly consider getting rid in the long term of our custom test runner infrastructure and custom sphinx build infrastructure, meaning less code to maintain.

  • For continuous integration purposes, we could define different combinations of dependencies in tox.ini and then simply refer to those environments in the various CI configurations, rather than having to e.g. repeat dependencies in each CI config. The CI config would be a lot simpler, and as a bonus it would be a lot easier to replicate those environments locally with tox

In terms of downsides/issues, I've found that for ccache to work well I had to do:

tox -e py36-test --develop

and I'm not sure why it misses the cache otherwise, so something to investigate but not really a roadblock.

Finally, one thing to consider is how to deal with the fact that people will have muscle memory for e.g. python setup.py build_docs. For now I'm not suggesting we actually get rid of this, though we could imagine making it so that the setup commands become aliases for tox, or recommend the tox command to run. In the long run, we do have to recognize that the Python community is moving away from setup.py commands, so tox is a way to solve that problem.

@codecov
Copy link

codecov bot commented Dec 2, 2018

Codecov Report

Merging #8202 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8202      +/-   ##
==========================================
- Coverage   86.91%   86.91%   -0.01%     
==========================================
  Files         383      383              
  Lines       57866    57866              
  Branches     1056     1056              
==========================================
- Hits        50294    50293       -1     
- Misses       6958     6959       +1     
  Partials      614      614
Impacted Files Coverage Δ
astropy/samp/hub.py 77.38% <0%> (-0.14%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 708dc60...38a91ae. Read the comment docs.

@pllim pllim added the testing label Dec 4, 2018
@astrofrog
Copy link
Member Author

Closing in favor of #8248

@astrofrog astrofrog closed this Dec 7, 2018
@saimn saimn mentioned this pull request Dec 7, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants