Skip to main content

OMS Utilities

Project description

OMS Utility Library

Common tools that are used across OMS.

Description

A collection of fileio, gridding, ...

Getting Started

Dependencies

  • pytest, wheel, setuptools

Installing

  • omsutils is not yet available on PyPI, so the suggested method to install is as follows:
$ git clone git@github.com:OrbitalMicro/omsutils.git
$ cd omsutils

It is recommended to install the package in a virtual environment to avoid conflicts with system packages.

# create your virtual environment
$ python3.8 -m venv py38

# activate your virtual environment
$ source py38/bin/activate

If you install outside of the virtual environment you will get the message:

Defaulting to user installation because normal site-packages is not writeable

We can install the package only, package in editable mode, and package with tests.

# Package Only
$ pip install .
# Package Only in editable mode
$ pip install -e .
# Packages and testing
$ python setup.py install

Creating a Package

The generic package structure is

omsutils
├── LICENSE                    ┐
├── setup.cfg                  │
├── setup.py                   │
├── docs                       │ Package documentation
│   └── ...                    │
├── LICENSE                    │
├── README.md                  ┘
├── pyproject.toml             ┐
├── src                        │
│   └── omsutils               │ Package source code, metadata,
│       ├── __init__.py        │ and build instructions
│       ├── moduleA.py         │
│       ├── moduleB.py         │
│       └── submodule          │
│           ├── __init__.py    │
│           ├── moduleA.py     │
│           └── moduleB.py     ┘
└── tests                      ┐
    └── ...                    ┘ Package tests
  • To add a new module

Add module file to omsutils that contains function definitions for example gridding.py.

To call the package

from omsutils import gridding

Testing

Install pytest

pip install -U pytest
  • Tests go in the tests folder
# content of test_sample.py
def func(x):
    return x + 1


def test_answer():
    assert func(3) == 5

Run Tests

To execute the test function:

$ pytest
=========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-1.x.y
cachedir: $PYTHON_PREFIX/.pytest_cache
rootdir: $REGENDOC_TMPDIR
collected 1 item

test_sample.py F                                                     [100%]

================================= FAILURES =================================
_______________________________ test_answer ________________________________

    def test_answer():
>       assert func(3) == 5
E       assert 4 == 5
E        +  where 4 = func(3)

test_sample.py:6: AssertionError
========================= short test summary info ==========================
FAILED test_sample.py::test_answer - assert 4 == 5
============================ 1 failed in 0.12s =============================

this will run all files of the form test_*.py or *_test.py in the current directory and its subdirectoruies

Group multiple tests in a class

# content of test_class.py
class TestClass:
    def test_one(self):
        x = "this"
        assert "h" in x

    def test_two(self):
        x = "hello"
        assert hasattr(x, "check")

Help

Any advise for common problems or issues.

command to run if program contains helper info

Authors

Contributors names and contact info

ex. Dominique Pizzie ex. @DomPizzie

Version History

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omsutils-0.0.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omsutils-0.0.1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file omsutils-0.0.1.tar.gz.

File metadata

  • Download URL: omsutils-0.0.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for omsutils-0.0.1.tar.gz
Algorithm Hash digest
SHA256 93966637acf08cf40390bcc14edd857eee0d65cabb0769e9029d29a30c11fba6
MD5 ff33d7f51457fc5bfae4c21c757801a6
BLAKE2b-256 d88487e8921324d41c77415daa56c8d2f411869be5178ef21f01a8fe1059a7a0

See more details on using hashes here.

File details

Details for the file omsutils-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: omsutils-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for omsutils-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e0503c6e192db5aa7f5d4cc983fd20f5118c8b7fcea5e5e7713aee9e4c96a08
MD5 29b228c7e3288e66318fd38a99b08a24
BLAKE2b-256 ec15dbacb78ae68a4cc43a3fe49cf9afd6d8b043820b5b131dc38ca2043f5b3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page