Skip to content

Commit

Permalink
Update dependencies and Python version>=3.10 (#57)
Browse files Browse the repository at this point in the history
* Update dependencies and Python version>=3.10

* Add GH workflows

* remove travis configuration

* Remove unused badges and bump up version

* add RTD config

* Populate yml

* Update rtd yaml path

* UPdate .readthedocs

* another try

* Update makefile

* correct conf.py path

* Use RTD theme
  • Loading branch information
alejoe91 authored Jan 24, 2024
1 parent ad2a60d commit 25646a9
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 60 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/full_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test on Ubuntu

on:
pull_request:
branches: [master]
types: [synchronize, opened, reopened]


jobs:
build-and-test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest
- name: Pytest
run: |
pytest -v
29 changes: 29 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release to PyPI

on:
push:
tags:
- '*'
jobs:
release:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Tools
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build
- name: Package and Upload
env:
STACKMANAGER_VERSION: ${{ github.event.release.tag_name }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m build --sdist --wheel
twine upload dist/*
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: ubuntu-20.04
tools:
python: "3.10"

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
[![Build Status](https://travis-ci.org/CINPLA/expipe.svg?branch=dev)](https://travis-ci.org/CINPLA/expipe)
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](http://www.repostatus.org/badges/latest/wip.svg)](http://www.repostatus.org/#wip)
[![Build Status](https://github.com/CINPLA/expipe/actions/workflows/full_tests.yml/badge.svg)](https://github.com/CINPLA/expipe/actions/workflows/full_tests.yml/badge.svg)[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](http://www.repostatus.org/badges/latest/wip.svg)](http://www.repostatus.org/#wip)
[![PyPI version](https://badge.fury.io/py/expipe.svg)](https://badge.fury.io/py/expipe)
[![Anaconda-Server Badge](https://anaconda.org/cinpla/expipe/badges/installer/conda.svg)](https://conda.anaconda.org/cinpla/expipe)
[![codecov](https://codecov.io/gh/CINPLA/expipe/branch/dev/graph/badge.svg)](https://codecov.io/gh/CINPLA/expipe)

# Expipe

Expand Down
8 changes: 4 additions & 4 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = expipe
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

Expand Down
17 changes: 7 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import os
import re
import expipe

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
except ImportError:
print("RTD theme not installed, using default")
pass
try:
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
except ImportError:
print("RTD theme not installed, using default")
pass

# -- General configuration ------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx
sphinx_rtd_theme
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: expipe
name: expipe-test
dependencies:
- python=3.5
- python=3.10
- numpy
- matplotlib
- scipy
Expand Down
11 changes: 5 additions & 6 deletions expipe/backends/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def convert_quantities(value):
result = value.tolist()
elif isinstance(value, np.integer):
result = int(value)
elif isinstance(value, np.float):
elif isinstance(value, float):
result = float(value)
else:
# try if dictionary like objects can be converted if not return the
Expand All @@ -76,17 +76,16 @@ def convert_quantities(value):
def yaml_dump(f, data):
assert f.suffix == '.yaml'
with f.open("w", encoding="utf-8") as fh:
yaml.dump(
yaml_ = yaml.YAML(typ='safe', pure=True)
yaml_.dump(
convert_quantities(data), fh,
default_flow_style=False,
allow_unicode=True,
Dumper=yaml.RoundTripDumper
)


def yaml_load(path):
with path.open('r', encoding='utf-8') as f:
result = yaml.load(f, Loader=yaml.Loader)
yaml_ = yaml.YAML(typ='safe', pure=True)
result = yaml_.load(f)
return convert_back_quantities(result)


Expand Down
10 changes: 5 additions & 5 deletions expipe/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ def _load_config(path):
result = {}
else:
with path.open('r') as f:
result = yaml.safe_load(f)
yaml_ = yaml.YAML(typ='safe', pure=True)
result = yaml_.load(f)
return result


def _dump_config(path, contents):
assert path.suffix == '.yaml'
path.parent.mkdir(exist_ok=True, parents=True)
with path.open("w", encoding="utf-8") as f:
yaml.dump(
yaml_ = yaml.YAML(typ='safe', pure=True)
yaml_.dump(
contents, f,
default_flow_style=False,
allow_unicode=True,
Dumper=yaml.RoundTripDumper)
)


def _load_config_by_name(config=None):
Expand Down
11 changes: 9 additions & 2 deletions expipe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ def type(self, value):
raise TypeError('Expected "str" got "' + str(type(value)) + '"')
self._backend.attributes.set('type', value)


@property
def datetime(self):
dtime = self._backend.attributes.get('datetime')
Expand Down Expand Up @@ -671,11 +672,13 @@ def delete_project(self, name, remove_all_children=None):
# Entry API
def get_project(path, name=None):
import expipe.backends.filesystem
from expipe.config import settings

path = pathlib.Path(path).absolute()

name = name or path.stem

global_config = config.settings.copy()
global_config = settings.copy()

local_config_path = path / "expipe.yaml"
if not local_config_path.exists():
Expand Down Expand Up @@ -723,9 +726,13 @@ def create_project(path, name=None, init=False):
"type": "project",
"project": name
}
print(local_config)

with local_config_path.open('w') as f:
yaml.dump(local_config, f)
yaml_ = yaml.YAML(typ='safe', pure=True)
yaml_.dump(
local_config, f,
)

return get_project(path)

Expand Down
2 changes: 1 addition & 1 deletion expipe/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '0.5.1'
version = '0.6.0'
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numpy
ruamel.yaml
quantities
pandas
ipywidgets
click
numpy>=1.25
ruamel.yaml>=0.18.5
quantities>=0.14.1
pandas>=2.1.2
ipywidgets>=8.1.1
click>=8.1.7
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering'],
python_requires='>=3.9',
)

0 comments on commit 25646a9

Please sign in to comment.