Skip to content
Open
Show file tree
Hide file tree
Changes from 10 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ odmltables/gui/graphics/*.dvi
odmltables/gui/graphics/*.ps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All lines from 67-76 should have src/odmltables/gui/...

odmltables/gui/graphics/*.txt
odmltables/gui/graphics/*.tex.backup
odmltables/gui/testfiles/*
src/odmltables/gui/testfiles/*
doc/build/*
doc/_build/*
doc/requirements*.rst
Expand Down
31 changes: 15 additions & 16 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@
# serve to show the default.

import sys
import glob
import subprocess
import os

import tomllib

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath('../../python-odml/'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if this is needed? Seems like a hack of some sort....?

sys.path.insert(0, os.path.abspath('../odmltables'))
sys.path.insert(0, os.path.abspath('../src/odmltables'))
sys.path.insert(0, os.path.abspath('..'))

# installing current odMLtables version
Expand All @@ -33,25 +32,25 @@
output, error = process.communicate()

import odmltables

VERSION = odmltables.VERSION
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe:

Suggested change
VERSION = odmltables.VERSION
VERSION = odmltables.__version__


# reformatting requirements files to be automatically included in docu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still something necessary, putting deps into the documentation?

requirement_files = glob.glob('../requirements*.txt')
for requirement_file in requirement_files:
with open(requirement_file, 'r') as f:
lines = f.readlines()
# listify and increase readability
for line_id in range(len(lines)):
lines[line_id] = '* ' + lines[line_id]
lines[line_id] = lines[line_id].replace(';', ' in case of ')
new_filename = f'{os.path.splitext(os.path.basename(requirement_file))[0]}.rst'
with open(new_filename, 'w+') as f:
f.writelines(lines)


with open("../pyproject.toml", "rb") as f:
data = tomllib.load(f)

def format_dependencies(dependency_list):
# format a list of dependencies into a block text list
formatted_dependencies = '\n* '.join(dependency_list).replace(';', ' in case of ')
return formatted_dependencies

dependencies = data["project"]["dependencies"]
with open('requirements.rst', 'w+') as f:
f.write(format_dependencies(dependencies))

for option, optional_dependencies in data["project"]["optional-dependencies"].items():
with open(f'requirements_{option}.rst', 'w+') as f:
f.write(format_dependencies(optional_dependencies))


# -- General configuration ------------------------------------------------
Expand Down
21 changes: 12 additions & 9 deletions doc/environment.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: odmltables
channels:
- conda-forge
- free
- anaconda
dependencies:
- python=3.7
- setuptools
- snowballstemmer
- sphinx
- sphinx_rtd_theme
- pip
- pip:
- odml
- sphinx-rtd-theme
- python ==3.11
- setuptools
- snowballstemmer
- sphinx
- sphinx_rtd_theme
- pip
- pip:
- odml
3 changes: 2 additions & 1 deletion doc/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ version `1.0 <https://github.com/G-Node/odml-terminologies/blob/master/v1.0/odml
the `G-Node <http://www.g-node.org/projects/odml>`_.


In addition to the detailed step-by-step instructions presented here, there are also two **interactive tutorials** available as `jupyter notebooks`_. Both tutorials can be directly executed using binder_ or run locally from the odmltables sources (:any:`tutorials/tutorial-1_scenarios/demo_scenarios.ipynb`) folder. The first notebook (|notebook1|) is giving a quick overview on how odMLtables can be used in a metadata workflow by presenting a number of small application scenarios. The second notebook (|notebook2|) shows the usage of odMLtables for handling large metadata collections and is based on two published experimental datasets.
In addition to the detailed step-by-step instructions presented here, there are also two **interactive tutorials** available as `jupyter notebooks`_. Both tutorials can be directly executed using binder_ or run locally from the odmltables `tutorial folder`_. The first notebook (|notebook1|) is giving a quick overview on how odMLtables can be used in a metadata workflow by presenting a number of small application scenarios. The second notebook (|notebook2|) shows the usage of odMLtables for handling large metadata collections and is based on two published experimental datasets.

.. _binder: https://mybinder.org/
.. _jupyter notebooks: http://jupyter.org/
.. _tutorial folder: https://github.com/INM-6/python-odmltables/tree/master/tutorials

.. |notebook1| image:: https://mybinder.org/badge.svg
:target: https://mybinder.org/v2/gh/inm-6/python-odmltables/master?filepath=tutorials%2Ftutorial-1_scenarios%2Fdemo_scenarios.ipynb
Expand Down
42 changes: 23 additions & 19 deletions examples/example1/example1-2.odml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/example1/example1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def run_example():

def setup_example():
# We are using the same csv table as used in the tutorial
filename = '../../doc/source/csv/example1-2.csv'
filename = 'example1-2.csv'

xlstable = odml_xls_table.OdmlXlsTable()
xlstable.load_from_csv_table(filename)
Expand Down
1 change: 0 additions & 1 deletion examples/example2/example2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import datetime
import odml.base
import odmltables.odml_xls_table as odml_xls_table
from odmltables.xls_style import XlsStyle

pre_enriched_file = 'example2-1.odml'

Expand Down
1 change: 0 additions & 1 deletion examples/example3/example3.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import datetime

import odml
from odml import DType
import odmltables.odml_xls_table as odml_xls_table


Expand Down
1 change: 0 additions & 1 deletion odmltables/VERSION.txt

This file was deleted.

78 changes: 78 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[project]
name = "odmltables"
version = "1.0.1dev"
authors = [
{name = "odMLtables authors and contributors"},
{email = "[email protected]"}
]
description = "Interface to convert odML structures to and from table-like representations"
readme = "README.rst"
requires-python = ">=3.6"
license = {text = "BSD 3-Clause License"}
keywords = ["odml", "excel", "metadata management"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: BSD License",
"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",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
]

dependencies = [
"xlrd >= 0.9.4",
"xlwt >= 1.0.0",
"numpy >= 1.8.2",
"quantities >= 0.10.1",
"odml >= 1.4.2",
"future >= 0.16.0",
"argparse >= 1.0.0",
]

[project.urls]
documentation = "http://odmltables.readthedocs.io/"
repository = "https://github.com/INM-6/python-odmltables"
download = "http://pypi.python.org/pypi/odmltables"


[build-system]
requires = ["setuptools>=62.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = true

[tool.setuptools.package-data]
odmltables = ["gui/graphics/*", "logo/*"]

[tool.pytest.ini_options]
minversion = "7.0"
addopts = "-ra -q"
testpaths = [
"tests",
]
pythonpath = [
"src"
]

[project.gui-scripts]
odmltables = "odmltables.gui.main:parse_args"

[project.optional-dependencies]

doc = [
"numpydoc>=0.5.0",
"sphinx>=1.2.2",
]

gui = ["PyQt5>=5.0.0"]

test = ["pytest>=3.0.0"]
8 changes: 0 additions & 8 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements_doc.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements_gui.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements_test.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

69 changes: 0 additions & 69 deletions setup.py

This file was deleted.

File renamed without changes.
14 changes: 4 additions & 10 deletions odmltables/__init__.py → src/odmltables/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os.path

with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'VERSION.txt')) as version_file:
VERSION = version_file.read().strip()

import importlib.metadata
# this need to be at the begining because some sub module will need the version
__version__ = importlib.metadata.version("odmltables")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this actually also work for non-installed packages?

VERSION = __version__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems VERSION is only used in two instances (to print the --version info for the CLI, and as a title for the GUI window). Maybe one could substitute a odmltables.__version__ in those instances and remove the VERSION variable alltogether?


# -*- coding: utf-8 -*-
"""
Expand All @@ -15,9 +14,4 @@
.. autoclass:: odmltables.compare_section_csv_table.CompareSectionCsvTable
"""


from odmltables.odml_table import OdmlTable
from odmltables.odml_csv_table import OdmlCsvTable
from odmltables.odml_xls_table import OdmlXlsTable
from odmltables.compare_section_csv_table import CompareSectionCsvTable
from odmltables.compare_section_xls_table import CompareSectionXlsTable
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
import subprocess

from PyQt5.QtWidgets import (QVBoxLayout, QHBoxLayout, QMessageBox,
QLineEdit, QPushButton, QLabel, QGroupBox,
QGridLayout, QTreeWidget, QTreeWidgetItem,
QToolButton, QFileDialog, QCheckBox, QComboBox,
QFrame, QSizePolicy, QRadioButton)
QLineEdit, QPushButton, QLabel, QGroupBox,
QGridLayout, QTreeWidget, QTreeWidgetItem,
QToolButton, QFileDialog, QCheckBox, QRadioButton)

from PyQt5.QtCore import Qt

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import PyQt5.QtGui as Qtg

from .pageutils import QIWizardPage, clearLayout, get_property, get_rgb, shorten_path
from odmltables import odml_table, odml_xls_table, odml_csv_table, xls_style
from .. import odml_csv_table, odml_xls_table, xls_style, odml_table


class LoadFilePage(QIWizardPage):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from PyQt5.QtCore import Qt
import PyQt5.QtWidgets as Qtw

from odmltables import odml_table
from .. import odml_table
from .pageutils import QIWizardPage, clearLayout, shorten_path


Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from PyQt5.QtCore import Qt

import odml
from odmltables import odml_table, odml_xls_table, odml_csv_table, xls_style
from .. import odml_xls_table, odml_table
from .pageutils import QIWizardPage, clearLayout, shorten_path

mandatory_headers = ['Path to Section',
Expand Down
File renamed without changes.
Loading