Skip to content

Run "make lint" and "make reformat" inside docker container #4961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

shevelevs
Copy link

This is so that it's not necessary to install python3.6 on the host machine. See #4948 for details.
This is not yet finished, but just to get feedback before I try to do more

Couple of implementation notes:

  • static container doesn't have python3.6 installed, so it looks like it's easier to just use python3.6 image from docker registry
  • technically the python3.6 "build" cointainer doesn't need to be in docker-compose (it can be just used from Makefile via docker run directly)
  • "docs" target is the thing that currently won't work, it needs some modifications because of recursive make calls

it's not necessary to install python3.6 on the host machine
@shevelevs shevelevs changed the title WIP: Run "make lint" and "make reformat" inside docker container Run "make lint" and "make reformat" inside docker container Nov 3, 2018
@shevelevs
Copy link
Author

shevelevs commented Nov 3, 2018

@di, let me know what you think. Works for me locally:

docker-compose run --rm build /opt/warehouse/src/.state/env/bin/flake8 .
docker-compose run --rm build /opt/warehouse/src/.state/env/bin/black --check warehouse/ tests/
All done! ✨ 🍰 ✨
340 files would be left unchanged.
docker-compose run --rm build /opt/warehouse/src/.state/env/bin/doc8 --allow-long-titles README.rst CONTRIBUTING.rst docs/ --ignore-path docs/_build/
Scanning...
Validating...
========
Total files scanned = 23
Total files ignored = 21
Total accumulated errors = 0
Detailed error counts:
    - CheckCarriageReturn = 0
    - CheckIndentationNoTab = 0
    - CheckMaxLineLength = 0
    - CheckNewlineEndOfFile = 0
    - CheckTrailingWhitespace = 0
    - CheckValidity = 0
# TODO: Figure out a solution to https://github.com/deezer/template-remover/issues/1
#       so we can remove extra_whitespace from below.
docker-compose run --rm build /opt/warehouse/src/.state/env/bin/html_lint.py --printfilename --disable=optional_tag,names,protocol,extra_whitespace,concerns_separation `find ./warehouse/templates -path ./warehouse/templates/legacy -prune -o -name '*.html' -print`
# We're not on Travis, so we should lint static files inside the static container
docker-compose run --rm static ./node_modules/.bin/eslint 'warehouse/static/js/**' '**.js' --ignore-pattern 'warehouse/static/js/vendor/**'
docker-compose run --rm static ./node_modules/.bin/sass-lint --verbose
✔ ~/workspace/pypa/warehouse [Issue4948_RunReformatInDocker|✚ 1⚑ 1] 
20:50 $ make reformat
docker-compose run --rm build /opt/warehouse/src/.state/env/bin/black warehouse/ tests/
All done! ✨ 🍰 ✨
340 files left unchanged.
✔ ~/workspace/pypa/warehouse [Issue4948_RunReformatInDocker|✚ 1⚑ 1] 
20:50 $ make docs
/Library/Developer/CommandLineTools/usr/bin/make -C docs/ doctest SPHINXOPTS="-W" RUN_IN_DOCKER="docker-compose run --rm build" SUBDIR=docs BINDIR=/opt/warehouse/src/.state/env/bin
docker-compose run --rm build  sphinx-build -b doctest -d _build/doctrees  -W docs _build/doctest
Running Sphinx v1.8.1
making output directory...
building [mo]: targets for 0 po files that are out of date
building [doctest]: targets for 20 source files that are out of date
updating environment: 20 added, 0 changed, 0 removed
reading sources... [100%] ui-principles                                                                           
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
running tests...

Doctest summary
===============
    0 tests
    0 failures in tests
    0 failures in setup code
    0 failures in cleanup code
build succeeded.

Testing of doctests in the sources finished, look at the results in _build/doctest/output.txt.
Testing of doctests in the sources finished, look at the  results in _build/doctest/output.txt.
/Library/Developer/CommandLineTools/usr/bin/make -C docs/ html SPHINXOPTS="-W" RUN_IN_DOCKER="docker-compose run --rm build" SUBDIR=docs BINDIR=/opt/warehouse/src/.state/env/bin
docker-compose run --rm build  sphinx-build -b html -d _build/doctrees  -W docs _build/html
Running Sphinx v1.8.1
making output directory...
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 20 source files that are out of date
updating environment: 20 added, 0 changed, 0 removed
reading sources... [100%] ui-principles                                                                           
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] ui-principles                                                                            
generating indices... genindex http-routingtable
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build/html.

Build finished. The HTML pages are in _build/html.

@brainwane brainwane added the developer experience Anything that improves the experience for Warehouse devs label Mar 22, 2019
@brainwane
Copy link
Contributor

@shevelevs I'm so sorry for the delay in response!

Could I ask you to resolve the conflict with the Makefile, and then I'll nudge a reviewer?

Also, is there a chance we'll see you at PyCon North America in May, during the sprints?

Thanks and sorry again.

@brainwane
Copy link
Contributor

@shevelevs Hi! Could you resolve the Makefile conflict, so I can get this reviewed? Thanks!

@sayanarijit
Copy link
Contributor

@brainwane I resolved the conflicts here: #6205

Base automatically changed from master to main January 21, 2021 18:39
@di di mentioned this pull request Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer experience Anything that improves the experience for Warehouse devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants