Skip to content

Commit

Permalink
Pckg stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sstucker committed Dec 1, 2021
1 parent 2e2f278 commit 34f6c1d
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 31 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include README.md LICENSE
4 changes: 2 additions & 2 deletions gen/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

if __name__ == '__main__':

local_spec = SPEC_SRC.split('/')[-1].split('.')[0] + '_retrieved_'+ datetime.now().strftime('%d_%m_%y') + '.txt'
local_spec = SPEC_SRC.split('/')[-1].split('.')[0] + '_retrieved_' + datetime.now().strftime('%d_%m_%y') + '.txt'

if os.path.exists(local_spec):
print('Loading specification from local document', local_spec, '...')
Expand Down Expand Up @@ -168,7 +168,7 @@

# Generate the complete Snirf interface from base.py and the template + data
dst = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
output_path = dst + '/src/' + 'pysnirf2.py'
output_path = dst + '/pysnirf2/' + 'pysnirf2.py'
with open(HEADER, 'r') as f_header:
with open(FOOTER, 'r') as f_footer:
print('Loading base class definitions and file header from', HEADER)
Expand Down
1 change: 1 addition & 0 deletions pysnirf2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .pysnirf2 import *
4 changes: 4 additions & 0 deletions pysnirf2/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

VERSION = (5, 2, 0)

__version__ = '.'.join(map(str, VERSION))
File renamed without changes.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cached-property==1.5.2
h5py==3.6.0
numpy==1.19.5
setuptools==40.8.0
setuptools==40.8.0
pip==21.3.1
21 changes: 0 additions & 21 deletions setup.cfg

This file was deleted.

93 changes: 90 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,94 @@
from setuptools import setup, find_packages
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Based on https://github.com/kennethreitz/setup.py

import io
import os
import sys
from shutil import rmtree

from setuptools import find_packages, setup, Command

NAME = 'pysnirf2'
VERSION = '0.1.0'

here = os.path.abspath(os.path.dirname(__file__))

try:
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = '\n' + f.read()
except FileNotFoundError:
long_description = DESCRIPTION

# Load the package's __version__.py module
about = {}
if not VERSION:
project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
with open(os.path.join(here, project_slug, '__version__.py')) as f:
exec(f.read(), about)
else:
about['__version__'] = VERSION


class UploadCommand(Command):
"""Support setup.py upload."""

description = 'Build and publish the package.'
user_options = []

@staticmethod
def status(s):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(s))

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
try:
self.status('Removing previous builds…')
rmtree(os.path.join(here, 'dist'))
except OSError:
pass

self.status('Building Source and Wheel (universal) distribution…')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))

self.status('Uploading the package to PyPI via Twine…')
os.system('twine upload dist/*')

self.status('Pushing git tags…')
os.system('git tag v{0}'.format(about['__version__']))
os.system('git push --tags')

sys.exit()


setup(
packages=find_packages('src'),
package_dir={'': 'src'},
name=NAME,
version=about['__version__'],
description='Interface and validator for SNIRF files',
long_description=long_description,
long_description_content_type='text/markdown',
author_email='[email protected]',
python_requires='>=3.6.0',
url='https://github.com/BUNPC/pysnirf2',
py_modules=['pysnirf2'],
include_package_data=True,
license='GPLv3',
classifiers=[
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'
],
# $ setup.py publish support.
cmdclass={
'upload': UploadCommand,
},
)
1 change: 0 additions & 1 deletion src/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
import pysnirf2
from pysnirf2 import Snirf, NirsElement, StimElement, MetaDataTags
import src.pysnirf2
from src.pysnirf2 import Snirf, NirsElement, StimElement, MetaDataTags
import h5py
import os
import sys
Expand Down

0 comments on commit 34f6c1d

Please sign in to comment.