Skip to content

Commit

Permalink
Modernize project setup (#164)
Browse files Browse the repository at this point in the history
* Change to more modern project setup

* Move notebooks to docs, automatically render

* Update GH actions to use hatch

* Remove cli.py (unused). Update readme

* Add klapo as contributor. Update changelog

* Update bumpversion cfg

* Bump version: 1.1.2 → 1.2.0

* Add version, date to changelog

* Remove cli/main from tests

* Pin pandas to <2
  • Loading branch information
BSchilperoort authored May 4, 2023
1 parent 84c817e commit 38ef30b
Show file tree
Hide file tree
Showing 106 changed files with 3,859 additions and 11,048 deletions.
6 changes: 1 addition & 5 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
[bumpversion]
current_version = 1.1.2
current_version = 1.2.0
commit = True
tag = True

[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'

[bumpversion:file:README.rst]
search = v{current_version}.
replace = v{new_version}.
Expand Down
53 changes: 0 additions & 53 deletions .cookiecutterrc

This file was deleted.

18 changes: 8 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ jobs:
python3 --version
- name: Upgrade pip and install dependencies
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install .[dev,publishing]
- name: Check style against standards using flake8
run: flake8 src tests setup.py
- name: Check import order
run: isort --check-only src/dtscalibration --diff
python3 -m pip install --upgrade pip hatch
python3 -m pip install .[dev]
- name: Check style with Ruff and isort
run: hatch run lint

build:
name: Build for (${{ matrix.python-version }}, ${{ matrix.os }})
Expand All @@ -55,9 +53,9 @@ jobs:
python3 --version
- name: Upgrade pip and install dependencies
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install .[dev,publishing]
python3 -m pip install --upgrade pip hatch
python3 -m pip install .[dev]
- name: Run unit tests
run: pytest -v
run: hatch run test
- name: Verify that we can build the package
run: python3 setup.py sdist bdist_wheel
run: hatch build
6 changes: 2 additions & 4 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ jobs:
python3 --version
- name: Upgrade pip and install dependencies
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install --upgrade pip hatch
python3 -m pip install .[docs]
- name: Install pandoc using apt
run: sudo apt install pandoc
- name: Convert the notebook examples to docs
run: python docs/nb_examples_to_docs.py
- name: Build documentation
run: sphinx-build -b html docs dist/docs
run: hatch run docs:build
41 changes: 0 additions & 41 deletions .prospector.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .pylintrc

This file was deleted.

8 changes: 5 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ build:
sphinx:
configuration: docs/conf.py

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
install:
- method: pip
path: .
extra_requirements:
- docs
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Authors

* Bas des Tombe - https://github.com/bdestombe
* Bart Schilperoort - https://github.com/BSchilperoort
* Karl Lapo - https://github.com/klapo
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@

Changelog
=========
[1.2.0] (13-03-2023)

Bugfixes

* Fixed deprecated np.float and np.int

Other

* Moved project build system & scripts to hatch.
* Project is now fully configured using pyproject.toml
* Linting is handled by Ruff.
* Notebooks are now rendered as part of the documentation.

Removed

* cli.py script (unused) has been removed.

New contributors:
* Karl Lapo (@klapo)

1.1.2 (2022-09-25)
------------------

Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ doi: "10.5281/zenodo.1410097"
license: "BSD-3-Clause"
repository-code: "https://github.com/dtscalibration/python-dts-calibration"
title: "Python distributed temperature sensing calibration"
version: "v1.1.2"
version: "v1.2.0"
url: "https://python-dts-calibration.readthedocs.io"
32 changes: 17 additions & 15 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ little bit helps, and credit will always be given.
Bug reports
===========

When `reporting a bug <https://github.com/bdestombe/python-dts-calibration/issues>`_ please include:
When `reporting a bug <https://github.com/dtscalibration/python-dts-calibration/issues>`_ please include:

* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
Expand All @@ -24,7 +24,7 @@ articles, and such.
Feature requests and feedback
=============================

The best way to send feedback is to file an issue at https://github.com/bdestombe/python-dts-calibration/issues.
The best way to send feedback is to file an issue at https://github.com/dtscalibration/python-dts-calibration/issues.

If you are proposing a feature:

Expand All @@ -37,7 +37,7 @@ Development

To set up `python-dts-calibration` for local development:

1. Fork `python-dts-calibration <https://github.com/bdestombe/python-dts-calibration>`_
1. Fork `python-dts-calibration <https://github.com/dtscalibration/python-dts-calibration>`_
(look for the "Fork" button).
2. Clone your fork locally::

Expand All @@ -49,9 +49,15 @@ To set up `python-dts-calibration` for local development:

Now you can make your changes locally.

4. When you're done making changes, run all the checks, doc builder and spell checker with `tox <http://tox.readthedocs.io/en/latest/install.html>`_ one command::
4. Activate your desired development environment (e.g., a python venv or conda environment), and install the package in editable mode, with the dev dependencies::

tox
pip install -e .[dev]

4. When you're done making changes, make sure the code follows the right style, that all tests pass, and that the docs build with the following commands::

hatch run format
hatch run test
hatch run docs:build

5. Commit your changes and push your branch to GitHub::

Expand All @@ -68,23 +74,19 @@ If you need some code review or feedback while you're developing the code just m

For merging, you should:

1. Include passing tests (run ``tox``) [1]_.
1. Include passing tests (do ``hatch run test``) [1]_.
2. Update documentation when there's new API, functionality etc.
3. Add a note to ``CHANGELOG.rst`` about the changes.
4. Add yourself to ``AUTHORS.rst``.

.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will
`run the tests <https://travis-ci.org/bdestombe/python-dts-calibration/pull_requests>`_ for each change you add in the pull request.
It will be slower though ...
.. [1] Sometimes there are issues with different python versions. For this you can do
``hatch run test_matrix:test``. Generally, on Github tests will be run using Github Actions,
where all versions, as well as the documentation, are tested.
This will be slower though ...
Tips
----

To run a subset of tests::

tox -e envname -- pytest -k test_myfeature

To run all the test environments in *parallel* (you need to ``pip install detox``)::

detox
hatch run pytest -k test_myfeature
12 changes: 3 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Overview
:alt: PyPI Package latest release
:target: https://pypi.python.org/pypi/dtscalibration

.. |commits-since| image:: https://img.shields.io/github/commits-since/dtscalibration/python-dts-calibration/v1.1.2.svg
.. |commits-since| image:: https://img.shields.io/github/commits-since/dtscalibration/python-dts-calibration/v1.2.0.svg
:alt: Commits since latest release
:target: https://github.com/dtscalibration/python-dts-calibration/compare/v1.1.1...main

Expand All @@ -45,10 +45,6 @@ Overview
:alt: It would be greatly appreciated if you could cite this package in eg articles presentations
:target: https://zenodo.org/badge/latestdoi/143077491

.. |example-notebooks| image:: https://mybinder.org/badge.svg
:alt: Interactively run the example notebooks online
:target: https://mybinder.org/v2/gh/dtscalibration/python-dts-calibration/main?filepath=examples%2Fnotebooks

.. end-badges
A Python package to load Distributed Temperature Sensing files, perform a calibration, and plot the result. A detailed description of the calibration procedure can be found at https://doi.org/10.3390/s20082235 .
Expand Down Expand Up @@ -90,14 +86,12 @@ Devices currently supported
* AP Sensing: **CP320** .xml files *(single ended only)*
* SensorTran: **SensorTran 5100** .dat binary files *(single ended only)*

Learn by examples
=================
Interactively run the example notebooks online by clicking `here <https://mybinder.org/v2/gh/dtscalibration/python-dts-calibration/main?filepath=examples%2Fnotebooks>`_.

Documentation
=============

https://python-dts-calibration.readthedocs.io/
Example notebooks can be viewed [here](https://python-dts-calibration.readthedocs.io/en/latest/learn_by_examples.html).


How to cite
===========
Expand Down
10 changes: 7 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinx.ext.autosectionlabel',
# 'nbsphinx',
'nbsphinx',
'sphinx.ext.mathjax',
'sphinx.ext.intersphinx',
'sphinx_automodapi.automodapi',
Expand All @@ -30,7 +30,7 @@
]

if os.getenv('SPELLCHECK'):
extensions += 'sphinxcontrib.spelling',
extensions += 'sphinxcontrib.spelling'
spelling_show_suggestions = True
spelling_lang = 'en_US'

Expand All @@ -41,7 +41,7 @@
year = str(date.today().year)
author = 'Bas des Tombe and Bart Schilperoort'
copyright = '{0}, {1}'.format(year, author)
version = release = '1.1.2'
version = release = '1.2.0'

pygments_style = 'trac'
templates_path = ['.']
Expand Down Expand Up @@ -69,3 +69,7 @@

# sphinx_automodapi.automodapi
numpydoc_show_class_members = False

# -- nbsphinx configuration --
nbsphinx_allow_errors = False
nbsphinx_execute = "always"
23 changes: 0 additions & 23 deletions docs/examples/index.rst

This file was deleted.

Loading

0 comments on commit 38ef30b

Please sign in to comment.