Skip to content

Commit f3402f0

Browse files
committed
updating MANIFEST, docs for semantic versioning
1 parent 0252b14 commit f3402f0

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

MANIFEST.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# description
22
include README.rst
33

4-
# version
5-
include intro_to_wc_modeling/VERSION
6-
74
# license
85
include LICENSE
96

docs/concepts_skills/software_engineering/distributing_python.rst

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@ Execute the following commands to install the packages required for this tutoria
1919
Prepare your package for distribution
2020
-------------------------------------
2121

22-
Annotate the version number of your package in ``VERSION`` and ``__init__.py``
23-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24-
Save the following to the ``VERSION`` file of your package, e.g. ``/path/to/intro_to_wc_modeling/intro_to_wc_modeling/VERSION``::
22+
Annotate the version number of your package in ``_version.py`` and ``__init__.py``
23+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
Save the following to the ``_version.py`` file of your package, e.g. ``/path/to/intro_to_wc_modeling/intro_to_wc_modeling/_version.py``::
2525

26-
0.0.1
26+
__version__ = '0.0.1'y
2727

2828
Save the following to the ``__init__.py`` file of your package, e.g. ``/path/to/package/intro_to_wc_modeling/__init__.py``::
2929

3030
import pkg_resources
3131

32-
with open(pkg_resources.resource_filename('intro_to_wc_modeling', 'VERSION'), 'r') as file:
33-
__version__ = file.read().strip()
32+
from ._version.py import __version__
3433
# :obj:`str`: version
3534

3635

@@ -127,9 +126,6 @@ For example, save the following to ``/path/to/package/MANIFEST.in``::
127126
# documentation
128127
include README.rst
129128

130-
# version
131-
include package/VERSION
132-
133129
# license
134130
include LICENSE
135131

@@ -144,18 +140,20 @@ You can use the ``setuptools`` package to build a install script for your packag
144140

145141
import setuptools
146142
try:
147-
import setuptools_utils
143+
import pkg_utils
148144
except ImportError:
149-
import pip
150-
pip.main(['install', 'git+https://github.com/KarrLab/setuptools_utils.git#egg=setuptools_utils'])
151-
import setuptools_utils
145+
import subprocess
146+
import sys
147+
subprocess.check_call(
148+
[sys.executable, "-m", "pip", "install", "pkg_utils"])
149+
import pkg_utils
152150
import os
153151

154152
name = 'intro_to_wc_modeling'
155153
dirname = os.path.dirname(__file__)
156154

157155
# get package metadata
158-
md = setuptools_utils.get_package_metadata(dirname, name)
156+
md = pkg_utils.get_package_metadata(dirname, name)
159157

160158
# install package
161159
setup(
@@ -187,11 +185,6 @@ You can use the ``setuptools`` package to build a install script for your packag
187185

188186
# packages not prepared yet
189187
packages=setuptools.find_packages(exclude=['tests', 'tests.*']),
190-
package_data={
191-
name: [
192-
'VERSION',
193-
],
194-
},
195188
entry_points={
196189
'console_scripts': [
197190
'intro-to-wc-modeling = intro_to_wc_modeling.__main__:main',

docs/concepts_skills/software_engineering/structuring_python_projects.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We recommend using the following principles to organize Python projects:
1111
repository_name/ # source code directory (1)
1212
__init__.py # each source code directory must contain an __init__.py file
1313
__main__.py # optional, for command line programs
14-
VERSION # text file with version number
14+
_version.py # file with version number
1515
data/ # directory for data files needed by the code
1616
tests/ # directory for test code
1717
fixtures/ # fixtures for tests

0 commit comments

Comments
 (0)