Skip to content

Commit 853206c

Browse files
committed
Add codemeta and release setup.py
1 parent 4780c6d commit 853206c

File tree

3 files changed

+159
-9
lines changed

3 files changed

+159
-9
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build/
2+
dist/
3+
caltechdata_api.egg-info/
4+
caltechdata_api/__pycache__/

codemeta.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
3+
"@type": "SoftwareSourceCode",
4+
"description": "Python wrapper for CaltechDATA API.",
5+
"name": "caltechdata_api",
6+
"codeRepository": "https://github.com/caltechlibrary/caltechdata_api",
7+
"issueTracker": "https://github.com/caltechlibrary/caltechdata_api/issues",
8+
"license": "https://data.caltech.edu/license",
9+
"version": "0.1.0",
10+
"author": [
11+
{
12+
"@type": "Person",
13+
"givenName": "Thomas E",
14+
"familyName": "Morrell",
15+
"affiliation": "Caltech Library",
16+
"email": "[email protected]",
17+
"@id": "https://orcid.org/0000-0001-9266-5146"
18+
}],
19+
"developmentStatus": "active",
20+
"downloadUrl":
21+
"https://github.com/caltechlibrary/caltechdata_api/archive/0.1.0.zip",
22+
"keywords": [
23+
"GitHub",
24+
"metadata",
25+
"software",
26+
"Invenio"
27+
],
28+
"maintainer": "https://orcid.org/0000-0001-9266-5146",
29+
"programmingLanguage": "Python"
30+
}

setup.py

Lines changed: 125 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,126 @@
1-
from setuptools import setup, find_packages
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
# Note: To use the 'upload' functionality of this file, you must:
5+
# $ pip install twine
6+
7+
import io
8+
import os
9+
import sys
10+
from shutil import rmtree
11+
12+
from setuptools import find_packages, setup, Command
13+
14+
# Package meta-data.
15+
NAME = 'caltechdata_api'
16+
DESCRIPTION = "Python wrapper for the CaltechDATA API."
17+
URL = 'https://github.com/caltechlibrary/caltechdata_api'
18+
19+
AUTHOR = 'Tom Morrell'
20+
REQUIRES_PYTHON = '>=3.7.0'
21+
VERSION = '0.1.0'
22+
23+
# What packages are required for this module to be executed?
24+
REQUIRED = [
25+
'requests','datacite'
26+
]
27+
28+
# What packages are optional?
29+
EXTRAS = {
30+
# 'fancy feature': ['django'],
31+
}
32+
33+
# The rest you shouldn't have to touch too much :)
34+
# ------------------------------------------------
35+
# Except, perhaps the License and Trove Classifiers!
36+
# If you do change the License, remember to change the Trove Classifier for that!
37+
38+
here = os.path.abspath(os.path.dirname(__file__))
39+
40+
# Import the README and use it as the long-description.
41+
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
42+
try:
43+
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
44+
long_description = '\n' + f.read()
45+
except FileNotFoundError:
46+
long_description = DESCRIPTION
47+
48+
# Load the package's __version__.py module as a dictionary.
49+
about = {}
50+
if not VERSION:
51+
with open(os.path.join(here, NAME, '__version__.py')) as f:
52+
exec(f.read(), about)
53+
else:
54+
about['__version__'] = VERSION
55+
56+
57+
class UploadCommand(Command):
58+
"""Support setup.py upload."""
59+
60+
description = 'Build and publish the package.'
61+
user_options = []
62+
63+
@staticmethod
64+
def status(s):
65+
"""Prints things in bold."""
66+
print('\033[1m{0}\033[0m'.format(s))
67+
68+
def initialize_options(self):
69+
pass
70+
71+
def finalize_options(self):
72+
pass
73+
74+
def run(self):
75+
try:
76+
self.status('Removing previous builds…')
77+
rmtree(os.path.join(here, 'dist'))
78+
except OSError:
79+
pass
80+
81+
self.status('Building Source and Wheel (universal) distribution…')
82+
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
83+
84+
self.status('Uploading the package to PyPI via Twine…')
85+
os.system('twine upload dist/*')
86+
87+
sys.exit()
88+
89+
90+
# Where the magic happens:
291
setup(
3-
name = 'caltechdata_api',
4-
version ='0.1.0',
5-
packages = find_packages(),
6-
install_requires=[
7-
'requests',
8-
'datacite'
9-
]
10-
)
92+
name=NAME,
93+
version=about['__version__'],
94+
description=DESCRIPTION,
95+
long_description=long_description,
96+
long_description_content_type='text/markdown',
97+
author=AUTHOR,
98+
author_email=EMAIL,
99+
python_requires=REQUIRES_PYTHON,
100+
url=URL,
101+
packages=find_packages(exclude=('tests',)),
102+
# If your package is a single module, use this instead of 'packages':
103+
# py_modules=['mypackage'],
104+
105+
# entry_points={
106+
# 'console_scripts': ['mycli=mymodule:cli'],
107+
# },
108+
install_requires=REQUIRED,
109+
extras_require=EXTRAS,
110+
include_package_data=True,
111+
license='BSD',
112+
classifiers=[
113+
# Trove classifiers
114+
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
115+
'License :: OSI Approved :: BSD License',
116+
'Programming Language :: Python',
117+
'Programming Language :: Python :: 3',
118+
'Programming Language :: Python :: 3.7',
119+
'Programming Language :: Python :: Implementation :: CPython',
120+
'Programming Language :: Python :: Implementation :: PyPy'
121+
],
122+
# $ setup.py publish support.
123+
cmdclass={
124+
'upload': UploadCommand,
125+
},
126+
)

0 commit comments

Comments
 (0)