Skip to content

Commit

Permalink
Basic package structure (#2)
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
Teschl authored Mar 26, 2024
1 parent 602dd43 commit a7df97c
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 1 deletion.
Empty file added LICENSE
Empty file.
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# pytopotoolbox
Python interface to TopoToolbox

Python interface to TopoToolbox.

## Guide

Temporary guide for the functionality of the package. For Windows replace "python3" with "py".

### Generate distribution archives

Generates a .whl and .tar.gz which then can be used to install package with pip.
These Files can be distributed with PyPi or downloaded directly.

```bash
cd path/to/pytopotoolbox
python3 -m pip install --upgrade build
python3 -m build
```

### Installing distribution archives

Use "--force-reinstall" to overwrite previous install.

```bash
pip install dist_name.whl
```

### Installing from repository

If want to install the package directly from the repository without first generating a ".whl" file.

```bash
cd path/to/pytopotoolbox
pip install .
```

### Unittest

How to run a single unittest:

```bash
cd path/to/pytopotoolbox
python3 -m tests.filename
```
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "topotoolbox"
version = "3.0.1"
authors = [
{name="Wolfgang Schwanghart", email="w.schwanghart@geo.uni-potsdam.de"},
{name="Dirk Scherler", email="scherler@fz-potsdam.de"},
{name="Will Kearney", email="william.kearney@uni-potsdam.de"},
{name="Theo Bringezu", email="theophil.bringezu@uni-potsdam.de"}
]
description = "Python interface to TopoToolbox."
readme = "README.md"
license = { file = "LICENSE" }
dependencies = [
"numpy",
"matplotlib"
]
requires-python = ">=3.8"
keywords = ["TopoToolbox"]
classifiers = []

[project.urls]
Homepage = "https://topotoolbox.github.io"
Repository = "https://github.com/TopoToolbox/pytopotoolbox"
Issues = "https://github.com/TopoToolbox/pytopotoolbox/issues"
1 change: 1 addition & 0 deletions src/topotoolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .placeholder import example
2 changes: 2 additions & 0 deletions src/topotoolbox/placeholder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def example(input):
return str(input) + " example"
Empty file added tests/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import topotoolbox

print(dir(topotoolbox))
print(topotoolbox.example("test"))
12 changes: 12 additions & 0 deletions tests/unittest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import unittest
from src.topotoolbox.placeholder import example

class TestPlaceholder(unittest.TestCase):
def test_example1(self):
self.assertEqual(example("test"), "test example", "failed unittest")

def test_example2(self):
self.assertEqual(example(""), " example", "failed unittest")

if __name__ == '__main__':
unittest.main()

0 comments on commit a7df97c

Please sign in to comment.