Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ ignore =
F405,
# line break before binary operator
W503,
exclude =
versioneer.py,
src/sorunlib/_version.py,
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- name: install wheel
run: |
python3 -m pip install ${{ steps.find.outputs.wheel }}[tests]
python3 -m pip install ${{ steps.find.outputs.wheel }}[dev]

- name: Run unit tests
working-directory: ./tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Install sorunlib
run: |
pip3 install -e .[tests]
pip3 install -e .[dev]

# Unit Tests
- name: Run unit tests
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# dynamic package version
src/sorunlib/_version.py

# tmp files
*.swp

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ is left to the reader)::

$ git clone https://github.com/simonsobs/sorunlib.git
$ cd sorunlib
$ pip install -e .[tests,docs]
$ pip install -e .[dev,docs]

This will install an editable version with the optional dependencies for
testing and building the docs.
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Install and update using pip::

Install optional dependencies with::

$ pip install -U sorunlib[tests]
$ pip install -U sorunlib[dev]
$ pip install -U sorunlib[docs]
$ pip install -U sorunlib[tests,docs]
$ pip install -U sorunlib[dev,docs]

Documentation
-------------
Expand Down
63 changes: 59 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,62 @@
[build-system]
requires = [
"setuptools>=42",
"wheel",
"versioneer-518",
"hatch-vcs",
"hatchling",
]
build-backend = "hatchling.build"

[project]
name = "sorunlib"
dynamic = ["version"]
description = "OCS Control Programs for running the observatory."
readme = "README.rst"
license = "BSD-2-Clause"
requires-python = ">=3.9"
classifiers = [
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Astronomy",
]
dependencies = [
"ocs==0.11.3",
"pyyaml",
]

[project.optional-dependencies]
docs = [
"sphinx>=5.3.0",
"sphinx_rtd_theme>=1.1.1",
]
dev = [
"pytest-cov>=3.0.0",
"pytest-mock>=3.12.0",
"pytest>=7.0.0",
"setuptools-scm",
]

[project.urls]
"Bug Tracker" = "https://github.com/simonsobs/sorunlib/issues"
Documentation = "https://sorunlib.readthedocs.io"
Homepage = "https://github.com/simonsobs/sorunlib"
"Source Code" = "https://github.com/simonsobs/sorunlib"

[tool.hatch.version]
source = "vcs"

# closest scheme to versioneer behavior, avoids auto-incremented version number
# https://setuptools-scm.readthedocs.io/en/latest/usage/#default-versioning-scheme
[tool.hatch.version.raw-options]
version_scheme = "no-guess-dev"

[tool.hatch.build.hooks.vcs]
version-file = "src/sorunlib/_version.py"

[tool.hatch.build.targets.sdist]
include = [
"/src",
]
build-backend = "setuptools.build_meta"
7 changes: 0 additions & 7 deletions setup.cfg

This file was deleted.

43 changes: 0 additions & 43 deletions setup.py

This file was deleted.

24 changes: 22 additions & 2 deletions src/sorunlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,25 @@ def initialize(test_mode=False):
"wait_until",
"initialize"]

from . import _version
__version__ = _version.get_versions()['version']
# Define the variable '__version__':
# This has the closest behavior to versioneer that I could find
# https://github.com/maresb/hatch-vcs-footgun-example
try:
# If setuptools_scm is installed (e.g. in a development environment with
# an editable install), then use it to determine the version dynamically.
from setuptools_scm import get_version

# This will fail with LookupError if the package is not installed in
# editable mode or if Git is not installed.
__version__ = get_version(root="..", relative_to=__file__, version_scheme="no-guess-dev")
except (ImportError, LookupError):
# As a fallback, use the version that is hard-coded in the file.
try:
from sorunlib._version import __version__ # noqa: F401
except ModuleNotFoundError:
# The user is probably trying to run this without having installed
# the package, so complain.
raise RuntimeError(
"sorunlib is not correctly installed. "
"Please install it with pip."
)
Loading