Skip to content

Commit

Permalink
Merge pull request #109 from antarcticrainforest/use-tox
Browse files Browse the repository at this point in the history
Use tox
  • Loading branch information
antarcticrainforest authored Aug 28, 2024
2 parents 447d5d0 + e43912a commit d706ff8
Show file tree
Hide file tree
Showing 26 changed files with 260 additions and 236 deletions.
36 changes: 34 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
# .coveragerc to control coverage.py
[run]
omit = */test/*
branch = False
omit = .converage*
*/tests/*
*/__main__.py
concurrency = multiprocessing

[report]
fail_under = 97
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug
def _post_url(self)

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
except KeyboardInterrupt:
except ImportError:
except RuntimeError
raise SystemExit

# Don't complain about the Completer class
class Completer

# Don't complain if non-runnable code isn't run:
if 0:
if perf_file *:
p_col = *
f_col = *
q_col = *
if __name__ == .__main__.:

ignore_errors = False
25 changes: 13 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ jobs:
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Creating conda environment for python 3.11
- name: Creating conda environment
run: |
conda create -n test -c conda-forge -y python=3.11 pip cartopy make
- name: Install dependencies
conda create -n test -c conda-forge -y ipykernel bash_kernel ffmpeg cartopy make pandoc tox
- name: Setup jupyter kernel
run: |
conda run -n test python3 -m pip install -U -e .[tests]
conda run -n test python3 -m ipykernel install --name tintx --display-name "tintX kernel" --env DATA_FILES ${PWD}/docs/source/_static/data --user
conda run -n test python3 -m bash_kernel.install
- name: Linting the code
env:
DATA_FILES: ./docs/source/_static/data
run: |
conda run -n test make lint
conda run -n test tox --parallel-no-spinner -p -e lint,docs
tests:
name: tintX tests
runs-on: ubuntu-latest
Expand All @@ -46,7 +49,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- name: Checkout
Expand All @@ -59,10 +62,7 @@ jobs:
echo $CONDA/bin >> $GITHUB_PATH
- name: Creating conda environment for python ${{ matrix.python-version }}
run: |
conda create -n test -c conda-forge -y python=${{matrix.python-version}} ffmpeg pip cartopy make hdf5
- name: Install dependencies
run: |
conda run -n test python3 -m pip install -U -e .[tests,docs]
conda create -n test -c conda-forge -y python=${{matrix.python-version}} ipykernel bash_kernel ffmpeg cartopy make pandoc tox
- name: Setup jupyter kernel
run: |
conda run -n test python3 -m ipykernel install --name tintx --display-name "tintX kernel" --env DATA_FILES ${PWD}/docs/source/_static/data --user
Expand All @@ -71,11 +71,12 @@ jobs:
env:
DATA_FILES: ./docs/source/_static/data
run: |
conda run -n test make all
conda run -n test tox -e tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./report.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
dependabot:
name: Merge PR by dependabot
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build/*
coverage_report.xml
*.egg-info
*.ipynb_checkpoints/*
.tox/*
docs/source/.ipynb_checkpoints/
docs/source/_build/
report.xml
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
include LICENSE
include README.md
include .coveragerc
include pytest.ini
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ install:
python3 -m bash_kernel.install

test:
python3 -m pytest -vv $(PWD)/src/tintx/test
python3 -m pytest -vv $(PWD)/tests
rm -rf '='

test_notebooks:
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ possible to tintX:

- [ ] Create a fork of [this repository](https://github.com/antarcticrainforest/tintX)
and clone this fork (not the original code)
- [ ] Install the code in development mode: `python3 -m pip install -e .[dev]`
- [ ] Create a new branch in the forked repository `git checkout -b my-new-branch`
- [ ] Add your changes
- [ ] Make sure all tests are sill running. To do so run the following commands
- make lint
- make test
- make docs
- tox
- [ ] Create a new pull request to the `main` branch of the
[original repository](https://github.com/antarcticrainforest/tintX).
### Adding new Jupyter examples
Expand Down
3 changes: 2 additions & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: tintx
channels:
- conda-forge
dependencies:
- python=3.11
- python=3.12
- ipython
- tintx
- geopandas
- hdf5
- pandoc
- pip
- pip:
- furo
Expand Down
2 changes: 1 addition & 1 deletion docs/source/III_Using_the_command_line_interface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"\n",
" Arguments:\n",
"\n",
" input_files: Filename of the HDF5 file contaning the tracking data.\n",
" input_files: Filename of the HDF5 file containing the tracking data.\n",
"\n",
"Options:\n",
" -o, --output FILE Path to a visualisation of the tracking. If `None`\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/source/II_Tracking_already_loaded_datasets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We can now simply create a `RunDicrectory` object by directly initialising the class. Since the `time`, `lon` and `lat` dimensions already have the default names we don't have to pass the `x_coord`, `y_coord` or `time_coord` keywords:"
"We can now simply create a `RunDirectory` object by directly initialising the class. Since the `time`, `lon` and `lat` dimensions already have the default names we don't have to pass the `x_coord`, `y_coord` or `time_coord` keywords:"
]
},
{
Expand Down
Loading

0 comments on commit d706ff8

Please sign in to comment.