Skip to content

Commit 4e3937b

Browse files
committed
Add a __version__, don't make object methods accessible in the module
1 parent 94c64e3 commit 4e3937b

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ python:
55
- "3.3"
66
- "3.4"
77
- "3.5"
8+
- "3.6"
89
install: python ./setup.py install
910
script: nosetests -sv

py2bit.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ PyMODINIT_FUNC PyInit_py2bit(void) {
283283

284284
Py_INCREF(&pyTwoBit);
285285
PyModule_AddObject(res, "py2bit", (PyObject *) &pyTwoBit);
286+
PyModule_AddStringConstant(res, "__version__", pyTwoBitVersion);
286287

287288
return res;
288289
}
@@ -291,5 +292,7 @@ PyMODINIT_FUNC PyInit_py2bit(void) {
291292
PyMODINIT_FUNC initpy2bit(void) {
292293
if(PyType_Ready(&pyTwoBit) < 0) return;
293294
Py_InitModule3("py2bit", tbMethods, "A module for handling 2bit files");
295+
PyModule_AddObject(res, "py2bit", (PyObject *) &pyTwoBit);
296+
PyModule_AddStringConstant(res, "__version__", pyTwoBitVersion);
294297
}
295298
#endif

py2bit.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include <Python.h>
22
#include "2bit.h"
33

4+
#define pyTwoBitVersion 0.2.2
5+
46
typedef struct {
57
PyObject_HEAD
68
TwoBit *tb;
@@ -37,6 +39,10 @@ will result in soft-masked bases being lower case if the sequence is fetched\n\
3739
\n\
3840
To store soft-masking information:\n\
3941
>>> tb = py2bit.open(\"some_file.2bit\", True)"},
42+
{NULL, NULL, 0, NULL}
43+
}
44+
45+
static PyMethodDef tbObjMethods[] = {
4046
{"info", (PyCFunction)py2bitInfo, METH_VARARGS,
4147
"Returns a dictionary containing the following key:value pairs: \n\
4248
\n\
@@ -196,7 +202,7 @@ static PyTypeObject pyTwoBit = {
196202
0, /*tp_weaklistoffset*/
197203
0, /*tp_iter*/
198204
0, /*tp_iternext*/
199-
tbMethods, /*tp_methods*/
205+
tbObjMethods, /*tp_methods*/
200206
0, /*tp_members*/
201207
0, /*tp_getset*/
202208
0, /*tp_base*/

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,27 @@
1717
include_dirs = ['lib2bit', sysconfig.get_config_var("INCLUDEPY")])
1818

1919
setup(name = 'py2bit',
20-
version = '0.2.1',
20+
version = '0.2.2',
2121
description = 'A package for accessing 2bit files using lib2bit',
2222
author = "Devon P. Ryan",
2323
author_email = "ryan@ie-freiburg.mpg.de",
2424
url = "https://github.com/dpryan79/py2bit",
2525
license = "MIT",
26-
download_url = "https://github.com/dpryan79/py2bit/tarball/0.2.1",
26+
download_url = "https://github.com/dpryan79/py2bit/tarball/0.2.2",
2727
keywords = ["bioinformatics", "2bit"],
2828
classifier = ["Development Status :: 5 - Production/Stable",
2929
"Intended Audience :: Developers",
3030
"License :: OSI Approved",
3131
"Programming Language :: C",
3232
"Programming Language :: Python",
3333
"Programming Language :: Python :: 2",
34+
"Programming Language :: Python :: 2.6",
3435
"Programming Language :: Python :: 2.7",
3536
"Programming Language :: Python :: 3",
3637
"Programming Language :: Python :: 3.3",
3738
"Programming Language :: Python :: 3.4",
3839
"Programming Language :: Python :: 3.5",
40+
"Programming Language :: Python :: 3.6",
3941
"Programming Language :: Python :: Implementation :: CPython",
4042
"Operating System :: POSIX",
4143
"Operating System :: Unix",

0 commit comments

Comments
 (0)