Skip to content

Commit

Permalink
maint: add test to extras_require, remove dev-requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Nov 22, 2022
1 parent 08ed844 commit 1ac9c44
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install --upgrade . -r dev-requirements.txt
pip install ".[test]"
if [ "${{ matrix.oldest_dependencies }}" != "" ]; then
# take any dependencies in requirements.txt such as tornado>=5.0
Expand Down
49 changes: 27 additions & 22 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
# How to make a release

`jupyterhub` is a package [available on
PyPI](https://pypi.org/project/jupyterhub/) and
[conda-forge](https://conda-forge.org/).
These are instructions on how to make a release on PyPI.
The PyPI release is done automatically by CI when a tag is pushed.
`jupyterhub` is a package available on [PyPI][] and [conda-forge][].
These are instructions on how to make a release.

For you to follow along according to these instructions, you need:
## Pre-requisites

- To have push rights to the [jupyterhub GitHub
repository](https://github.com/jupyterhub/jupyterhub).
- Push rights to [jupyterhub/jupyterhub][]
- Push rights to [conda-forge/jupyterhub-feedstock][]

## Steps to make a release

1. Create a PR updating `docs/source/changelog.md` with [github-activity][] and
continue only when its merged.

```shell
pip install github-activity

github-activity --heading-level=3 jupyterhub/jupyterhub
```

1. Checkout main and make sure it is up to date.

```shell
ORIGIN=${ORIGIN:-origin} # set to the canonical remote, e.g. 'upstream' if 'origin' is not the official repo
git checkout main
git fetch $ORIGIN main
git reset --hard $ORIGIN/main
git fetch origin main
git reset --hard origin/main
```

1. Make sure `docs/source/changelog.md` is up-to-date.
[github-activity][] can help with this.

1. Update the version with `tbump`.
You can see what will happen without making any changes with `tbump --dry-run ${VERSION}`
1. Update the version, make commits, and push a git tag with `tbump`.

```shell
pip install tbump
tbump --dry-run ${VERSION}
tbump ${VERSION}
```

This will tag and publish a release,
which will be finished on CI.
Following this, the [CI system][] will build and publish a release.

1. Reset the version back to dev, e.g. `2.1.0.dev` after releasing `2.0.0`

Expand All @@ -42,9 +45,11 @@ For you to follow along according to these instructions, you need:
```

1. Following the release to PyPI, an automated PR should arrive to
[conda-forge/jupyterhub-feedstock][],
check for the tests to succeed on this PR and then merge it to successfully
update the package for `conda` on the conda-forge channel.
[conda-forge/jupyterhub-feedstock][] with instructions.

[github-activity]: https://github.com/choldgraf/github-activity
[pypi]: https://pypi.org/project/jupyterhub/
[conda-forge]: https://anaconda.org/conda-forge/jupyterhub
[jupyterhub/jupyterhub]: https://github.com/jupyterhub/jupyterhub
[conda-forge/jupyterhub-feedstock]: https://github.com/conda-forge/jupyterhub-feedstock
[github-activity]: https://github.com/executablebooks/github-activity
[ci system]: https://github.com/jupyterhub/jupyterhub/actions/workflows/release.yml
18 changes: 0 additions & 18 deletions dev-requirements.txt

This file was deleted.

19 changes: 6 additions & 13 deletions docs/source/contributing/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ When developing JupyterHub, you would need to make changes and be able to instan
conda install configurable-http-proxy yarn
4. Install the python packages required for JupyterHub development.
4. Install an editable version of JupyterHub and its requirements for
development and testing. This lets you edit JupyterHub code in a text editor
& restart the JupyterHub process to see your code changes immediately.

.. code:: bash
python3 -m pip install -r dev-requirements.txt
python3 -m pip install -r requirements.txt
python3 -m pip install --editable ".[test]"
5. Set up a database.

Expand All @@ -108,21 +109,13 @@ When developing JupyterHub, you would need to make changes and be able to instan
available via `Python <https://docs.python.org/3.5/library/sqlite3.html>`__.
See :doc:`/reference/database` for details on other supported databases.

6. Install the development version of JupyterHub. This lets you edit
JupyterHub code in a text editor & restart the JupyterHub process to
see your code changes immediately.

.. code:: bash
python3 -m pip install --editable .
7. You are now ready to start JupyterHub!
6. You are now ready to start JupyterHub!

.. code:: bash
jupyterhub
8. You can access JupyterHub from your browser at
7. You can access JupyterHub from your browser at
``http://localhost:8000`` now.

Happy developing!
Expand Down
26 changes: 16 additions & 10 deletions docs/source/contributing/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,28 @@ Make sure you have completed all the steps in :ref:`contributing/setup` successf
Code formatting and linting
===========================

JupyterHub has adopted automatic code formatting and linting.
As long as your code is valid, the pre-commit hook should take care of how it should look.
You can invoke the pre-commit hook manually at any time with:
JupyterHub automatically enforces code formatting. This means that pull requests
with changes breaking this formatting will receive a commit from pre-commit.ci
automatically.

.. code:: bash
To automatically format code locally, you can install pre-commit and register a
_git hook_ to automatically check with pre-commit before you make a commit if
the formatting is okay.

pre-commit run
.. code:: bash
This should run any auto formatting on your code and tell you about any errors it couldn't fix automatically.
You may also install `black integration <https://github.com/psf/black#editor-integration>`_
into your text editor to format code automatically.
pip install pre-commit
pre-commit install --install-hooks
If you have already committed files before running pre-commit you can fix everything using:
To run pre-commit manually you would do:

.. code:: bash
# check for changes to code not yet committed
pre-commit run
# check for changes also in already committed code
pre-commit run --all-files
And committing the changes.
You may also install `black integration <https://github.com/psf/black#editor-integration>`_
into your text editor to format code automatically.
21 changes: 21 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,27 @@ def get_package_data():
'Source': 'https://github.com/jupyterhub/jupyterhub/',
'Tracker': 'https://github.com/jupyterhub/jupyterhub/issues',
},
extras_require={
"test": [
"beautifulsoup4[html5lib]",
"coverage",
# cryptography is an optional dependency for jupyterhub that we test
# against by default
"cryptography",
"jsonschema",
"jupyterlab>=3",
"mock",
# nbclassic provides the '/tree/' handler that we tests against in
# the test test_nbclassic_control_panel.
"nbclassic",
"pytest>=3.3",
"pytest-asyncio>=0.17",
"pytest-cov",
"requests-mock",
"selenium",
"virtualenv",
],
}
)


Expand Down

0 comments on commit 1ac9c44

Please sign in to comment.