Skip to content
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

👌 IMPROVE: Nicer Development Experience #172

Merged
merged 15 commits into from
Aug 11, 2020

Conversation

pradyunsg
Copy link
Member

Closes #151 in my opinion. :)

Following @choldgraf's nudge, I ended up writing the entire noxfile for this project and rewrote a part of the contributing guide to reflect what the various commands needed during development look like with nox.

Oh, and I added the nox -s docs-live thing, with live-reload through sphinx-autobuild as well. :)

@pradyunsg pradyunsg changed the title 👌 IMPROVE: Nicer Development Experience 👌 IMPROVE: Nicer Development Experience Aug 10, 2020
@pradyunsg
Copy link
Member Author

Oh. Oh. CI improvements!

Copy link
Member

@chrisjsewell chrisjsewell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heya I'll have a proper look later ta. But I note from a first glance that you haven't altered the pre-commit, to ensure the css is up to date with the sass. IMO This is also the way the project should be linted, not via nox

@chrisjsewell
Copy link
Member

The live compiling is good though 👍

@chrisjsewell
Copy link
Member

You might also want to add: https://github.com/pre-commit/mirrors-scss-lint

@pradyunsg
Copy link
Member Author

I note from a first glance that you haven't altered the pre-commit, to ensure the css is up to date with the sass.

I don't see why that would be necessary -- I've not re-added the compiled file into version control. It is still generated by compiling the SCSS file. The difference is that it's not compiled as part of the sphinx-build run, but separately (through boussole watch/compile).

IMO This is also the way the project should be linted, not via nox

nox is not a linter, but being used to run the linters (nox -s lint installs and runs pre-commit).

@chrisjsewell
Copy link
Member

The other question that came to mind is using this in a conda environment, where I do all my development. There's some notes on this here: https://nox.thea.codes/en/stable/tutorial.html#testing-with-conda

@pradyunsg
Copy link
Member Author

The other question that came to mind is using this in a conda environment

Hmm... I don't think using conda is necessary here. All the packages in our dependency tree have wheels on all major platforms and the specific case of testing this theme doesn't need any performance optimized variants of those packages IMO.

@pradyunsg
Copy link
Member Author

You might also want to add: pre-commit/mirrors-scss-lint

I'd prefer we do this separately, because I already feel like I'm changing a lot of things in this one. :)

@pradyunsg
Copy link
Member Author

pradyunsg commented Aug 10, 2020

I don't think using conda is necessary here.

To be clear, this will still work in a conda environment that has a Python in it. It'll create the isolated environments for each of the sessions using the conda environment's Python, in a .nox directory and the exact same commands will do the right thing.

@chrisjsewell
Copy link
Member

I've not re-added the compiled file into version control

Yes but I think they should be in the version control, otherwise people can only use the package directly when installing from pypi (because you run the compile in the publish workflow), and for example the RTD PR builds are now broken: https://sphinx-book-theme--172.org.readthedocs.build/en/172/

@pradyunsg
Copy link
Member Author

pradyunsg commented Aug 10, 2020

people can only use the package directly when installing from pypi (because you run the compile in the publish workflow)

That's something I didn't realize. :)

for example the RTD PR builds are now broken

Oooooo.

@pradyunsg
Copy link
Member Author

That should do it. :)

@pradyunsg pradyunsg requested a review from chrisjsewell August 10, 2020 14:37
@pradyunsg pradyunsg force-pushed the nicer-devex branch 2 times, most recently from aecddc6 to dc216a7 Compare August 10, 2020 14:44
@pradyunsg
Copy link
Member Author

Okay, this should be good to go. realizes he didn't mark this PR as a draft earlier Oh nvm. 😅

@chrisjsewell
Copy link
Member

nearly there! I'll also just have a play around with using it locally before merging

@pradyunsg pradyunsg force-pushed the nicer-devex branch 2 times, most recently from 92bddc8 to a5ecb33 Compare August 10, 2020 15:28
@pradyunsg
Copy link
Member Author

Note to self: don't dev on pre-commit while also working on other projects. It can result in bad things happening.

@chrisjsewell
Copy link
Member

chrisjsewell commented Aug 10, 2020

Unless I'm missing something; with live-build, if you update the scss, it will compile the css in docs/_static, but sphinx won't pick up on this and so it doesn't get re-copied to docs/_build/html and thus update in the browser.
I think this was mentioned before, but is there any way we can rectify this: via sphinx or just separately adding a copy command to nox?

@chrisjsewell
Copy link
Member

chrisjsewell commented Aug 10, 2020

This is brought up in sphinx-doc/sphinx-autobuild#34, but as also previously discussed, sphinx-autobuild is an "abandoned" package which is not ideal, although if/while it works thats not necessarily a problem for a dev dependency

@chrisjsewell
Copy link
Member

This is also the upstream issue: sphinx-doc/sphinx#2090

@pradyunsg
Copy link
Member Author

Looks like changing conf.py is an option, based on sphinx issue's last comment.

@pradyunsg
Copy link
Member Author

All done! Ready to go!

@pradyunsg pradyunsg closed this Aug 11, 2020
@pradyunsg pradyunsg reopened this Aug 11, 2020
@pradyunsg
Copy link
Member Author

Closed-reopened to retrigger CI for the failed codecov upload.

@chrisjsewell chrisjsewell self-requested a review August 11, 2020 12:45
@chrisjsewell chrisjsewell merged commit af8a28c into executablebooks:master Aug 11, 2020
@chrisjsewell
Copy link
Member

🎉 🥳

@pradyunsg pradyunsg deleted the nicer-devex branch August 11, 2020 12:58
Copy link
Member

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments from me - I guess @chrisjsewell already merged but it'd be great to hear @pradyunsg 's responses nonetheless!


* Install `pre-commit` and activate it for this repository
```bash
nox -s tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this work with arguments passed to pytest? E.g. I often do pytest -k aspecifictest or pytest -s so that I can start an IPython kernel from within the test.

Copy link
Member

@chrisjsewell chrisjsewell Aug 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nox just calls pytest within a particular virtualenv (which it builds) that gets created in a folder in the repository folder. But you can still run pytest normally if you don't want to use nox

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if I should mention it here. The form is nox -s tests-3.8 -- (pytest-args).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to document this? If so, please file an issue referencing the above comment.

@pradyunsg
Copy link
Member Author

Happy to respond. :)

Dinner time right now - ill try to resolve those concerns before sleeping today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how to work on this project
3 participants