Skip to content

Commit

Permalink
Merge pull request #116 from eragooon/pyproject-migration
Browse files Browse the repository at this point in the history
Build Backend replacement using a `pyproject.toml` file instead of a `setup.py` file.
  • Loading branch information
Mayitzin committed Jun 27, 2024
2 parents ea5d2d6 + dfc37b8 commit b179ad0
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 82 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.0] - 2024-06-18
### Added
- Added pyproject.toml file to replace the deprecated setup.py
- Added __version__ to main package __init__.py file

### Changed
- Moved from the setuptools to hatchling build backend
- Docutils version will now be installed by Sphinx
- Changed the docs/conf.py to get its version from the package import
- Updated documentation for the new hatch workflow

### Removed
- Removed old requirements.txt
- Removed requirements.txt from docs
- Removed tools folder for version management. Check pyproject.toml

## [0.3.1] - 2021-09-29
### Added
- Error raise if geomagnetic field is invalid in class `EKF`.
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The most recommended method is to install AHRS directly from this repository to
```shell
git clone https://github.com/Mayitzin/ahrs.git
cd ahrs
python setup.py install
python pip install .
```

Or using [pip](https://pip.pypa.io) for the stable releases:
Expand All @@ -34,6 +34,13 @@ pip install ahrs

AHRS depends merely on [NumPy](https://numpy.org/). More packages are avoided, to reduce its third-party dependency.

## Versioning
In order to update the version, use hatch and adjust it automatically

```shell
hatch version <major, minor, patch>
```

## Important novelties in 0.3

(Click on each topic to see more details.)
Expand Down
2 changes: 2 additions & 0 deletions ahrs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
from .common.quaternion import Quaternion
from .common.quaternion import QuaternionArray
from .common.dcm import DCM

__version__ = "0.4.0"
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import sys
from datetime import datetime
sys.path.insert(0, os.path.abspath('../../ahrs' if sys.platform.startswith('win') else '../..'))
from tools.versioning import get_version
from ahrs import __version__

# -- Project information -----------------------------------------------------
project = 'AHRS'
author = 'Mario Garcia'
copyright = f"2019-{datetime.now().year}, {author}"
release = get_version()
release = __version__

# -- General configuration ---------------------------------------------------
extensions = [
Expand Down
20 changes: 17 additions & 3 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,20 @@ version in the git repository and install it manually:
git clone https://github.com/Mayitzin/ahrs.git
cd ahrs/
python setup.py install
python pip install .
To install as editable do this:

.. code-block:: console
git clone https://github.com/Mayitzin/ahrs.git
cd ahrs/
python pip install -e .
To install specific requirements, do this:

.. code-block:: console
python pip install .[dev]
python pip install .[docs]
This will get you the latest changes of the package, so you can get an updated
version.
Expand All @@ -34,9 +47,10 @@ To build this documentation you first need to have `Sphinx
<https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html>`_.

.. code-block:: console
python pip install .[docs]
cd docs/
pip install -r requirements.txt
make html
You can then build the documentation by running ``make html`` from the
``docs/`` folder to build the HTML documentation in the current folder. Run
Expand Down
65 changes: 65 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[build-system]
requires = [
"hatchling",
]
build-backend = "hatchling.build"

[project]
name = "AHRS"
dynamic = ["version"]
description = "Attitude and Heading Reference Systems."
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.6"
license = {text = "MIT"}
authors = [
{name = "Mario Garcia", email = "mariogc@protonmail.com"}
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Education",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Scientific/Engineering :: GIS",
"Topic :: Software Development :: Embedded Systems",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"numpy>=1.17",
"docutils<=0.18.1",
]

[tool.hatch.version]
path = "ahrs/__init__.py"
pattern = "^__version__ = ['\"](?P<version>[^'\"]*)['\"]"

[project.urls]
"Homepage" = "https://github.com/Mayitzin/ahrs/"
"Source Code" = "https://github.com/Mayitzin/ahrs/"
"Bug Tracker" = "https://github.com/Mayitzin/ahrs/issues"

[project.optional-dependencies]
dev = [
"pytest",
"flake8",
"black",
]
docs = [
"sphinx>=6.0",
"pydata_sphinx_theme>=0.13"
]
build = [
"hatch",
"hatchling",
]
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

74 changes: 0 additions & 74 deletions setup.py

This file was deleted.

0 comments on commit b179ad0

Please sign in to comment.