Skip to content

Commit

Permalink
test pypi action
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnsonDylan committed Aug 2, 2021
1 parent 933784a commit ee5cd79
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 139 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ jobs:
pip install coverage
bash <(curl -s https://codecov.io/bash)
- name: Build Python package and Upload to TestPyPi
shell: bash -l {0}
env:
TEST_PYPI_TOKEN_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
poetry build
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish -r testpypi --username "__token__" --password $TEST_PYPI_TOKEN_PASSWORD
- name: Build Python package and Upload to PyPi
shell: bash -l {0}
if: startsWith( github.ref, 'refs/tags/v') && matrix.python-version == env.PYTHON_MAIN_VERSION
Expand Down
12 changes: 6 additions & 6 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

# context parameters
example.context(
['https://stuchalk.github.io/scidata/contexts/scidata.jsonld']
)
['https://stuchalk.github.io/scidata/contexts/scidata.jsonld']
)
example.context(
'https://stuchalk.github.io/scidata/contexts/scidata2.jsonld', True)
base = 'https://scidata.unf.edu/' + uid + '/'
Expand Down Expand Up @@ -127,13 +127,13 @@
'@id': 'constituent',
'source': 'compound/1/',
'role': 'chm:analyte',
'properties': [prp1,prp2]
'properties': [prp1, prp2]
}
con2 = {
'@id': 'constituent',
'source': 'compound/2/',
'role': 'chm:reagent',
'properties': [prp1,prp2]}
'properties': [prp1, prp2]}
con3 = {
'@id': 'constituent',
'source': 'compound/3/',
Expand Down Expand Up @@ -284,7 +284,7 @@
for k, v in ser1_dict.items():
dataser1.update({str(k): str(v)})
for k, v in ser1_dict_str.items():
dataser1.update({str('str_'+k): v})
dataser1.update({str('str_' + k): v})

ser2_input = {'colA': [10, 20, 30]}
ser2_dataframe = pd.DataFrame(ser2_input)
Expand All @@ -310,7 +310,7 @@
for k, v in ser2_dict.items():
dataser2.update({str(k): str(v)})
for k, v in ser2_dict_str.items():
dataser2.update({str('str_'+k): v})
dataser2.update({str('str_' + k): v})

example.dataseries([dataser1, dataser2])

Expand Down
42 changes: 25 additions & 17 deletions example2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
from scidatalib.scidata import SciData
import json
import pandas as pd
import re


p_name = '/Users/n01448636/Documents/GoogleDrive/PycharmProjects/SciDataLib/test.rruff'

uid = 'example'
example = SciData(uid)

# context parameters
example.context(
['https://stuchalk.github.io/scidata/contexts/scidata.jsonld']
)
['https://stuchalk.github.io/scidata/contexts/scidata.jsonld']
)
example.context(
'https://stuchalk.github.io/scidata/contexts/scidata2.jsonld', True)
base = 'https://scidata.unf.edu/' + uid + '/'
Expand Down Expand Up @@ -261,17 +257,27 @@
dps = [dp1, dp2]
example.datapoint(dps)

# with open(p_name) as openfile:
# openfileread = openfile.readlines()
# spectrax = []
# spectray = []
# for x in openfileread:
# if re.search('(\d{1,}\.\d{1,}), (\d{1,}\.\d{1,})',x):
# spectrax.append(re.match('(\d{1,}\.\d{1,}), (\d{1,}\.\d{1,})',x).group(1))
# spectray.append(re.match('(\d{1,}\.\d{1,}), (\d{1,}\.\d{1,})',x).group(2))

spectrax = ['107.9252', '108.4073', '108.8894', '109.3715', '109.8536', '110.3358', '110.8179', '111.3000', '111.7821']
spectray = ['831.4121', '833.1594', '839.9602', '848.9200', '855.5815', '860.6728', '862.4740', '859.3690', '851.6688']
spectrax = [
'107.9252',
'108.4073',
'108.8894',
'109.3715',
'109.8536',
'110.3358',
'110.8179',
'111.3000',
'111.7821']
spectray = [
'831.4121',
'833.1594',
'839.9602',
'848.9200',
'855.5815',
'860.6728',
'862.4740',
'859.3690',
'851.6688']
ser1_input = {'spectra_x': spectrax, 'spectra_y': spectray}
ser1_dataframe = pd.DataFrame(ser1_input)
ser1_dataframe_str = pd.DataFrame(ser1_input).applymap(str)
Expand All @@ -288,7 +294,9 @@

example.dataseries([dataser1])

example.datagroup([{"@id": "datagroup", "@type": "sdo:datagroup", "datapoints": ["datapoint"]}])
example.datagroup(
[{"@id": "datagroup", "@type": "sdo:datagroup",
"datapoints": ["datapoint"]}])

# add source
src = {'citation': 'Chalk Research Group',
Expand Down
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
[tool.poetry]
name = "SciDataLib"
version = "0.0.1"
version = "0.2.2"
description = "Python library for development of SciData JSON-LD files"
authors = [
"Stuart Chalk <schalk@unf.edu>",
"Dylan Johnson <n01448636@unf.edu>",
"Marshall McDonnell <mcdonnellmt@ornl.gov>,
]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/ChalkLab/SciDataLib"
repository = "https://github.com/ChalkLab/SciDataLib"
keywords = ["scidata", "scidatalib"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"
]

[tool.poetry.scripts]
Expand Down
6 changes: 3 additions & 3 deletions scidatalib/scidata.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ def author(self, authors: list, replace=False) -> list:
for au in authors:
auth = {'@id': ('author/' + str(len(a) + 1) + '/')}
auth.update({'@type': 'dc:creator'})
if type(au) is dict:
if isinstance(au, dict):
if 'name' in au:
auth.update(au)
elif type(au) is str:
elif isinstance(au, str):
auth.update({'name': au})
a.append(auth)
self.meta['@graph']['authors'] = a
Expand Down Expand Up @@ -780,7 +780,7 @@ def __iterate_function(self, it, level, cnt_index, cat_index):
if isinstance(value, list):
level += 1
for i, y in enumerate(value):
if type(y) is str:
if isinstance(y, str):
pass
else:
value[i], category, count, new_cat_index = \
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
# replace with your username:
name = SciDataLib
version = 0.2
version = 0.2.2
url = https://github.com/ChalkLab/SciDataLib
author = 'Dylan Johnson, Marshall McDonnell, Stuart Chalk'
author_email = 'n01448636@unf.edu, mcdonnellmt@ornl.gov, schalk@unf.edu'
Expand Down
14 changes: 0 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,7 @@
long_description = fh.read()

setuptools.setup(
name="SciDataLib",
version="0.2",
author="Dylan Johnson, Marshall McDonnell, Stuart Chalk",
author_email="n01448636@unf.edu, mcdonnellmt@ornl.gov, schalk@unf.edu",
description="Python library for development of SciData JSON-LD files",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/ChalkLab/SciDataLib",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
entry_points={
'console_scripts': [
"scidatalib = scidatalib.cli:cli",
Expand Down

0 comments on commit ee5cd79

Please sign in to comment.