Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioning #236

Merged
merged 4 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,15 @@ How to contribute code, documentation, etc.
6. Commit your changes and submit a pull request referencing the corresponding issue
7. Respond to discussion/feedback about the pull request, make changes as necessary

Code Standards
--------------
Versioning
----------

We use `semantic versioning`_. The version is tracked in ``pathml/_version.py`` and should be updated there as required.
When new code is merged to the master branch on GitHub, the version should be incremented and the commit should
be tagged in version format (e.g., "v1.0.0" for version 1.0.0).

Code Quality
^^^^^^^^^^^^
------------

We want PathML to be built on high-quality code. However, the idea of "code quality" is somewhat subjective.
If the code works perfectly but cannot be read and understood by someone else, then it can't be maintained,
Expand All @@ -108,7 +112,7 @@ All code should be reviewed by someone else before merging.
We use `Black`_ to enforce consistency of code style.

Documentation Standards
^^^^^^^^^^^^^^^^^^^^^^^^
-----------------------

All code should be documented, including docstrings for users AND inline comments for
other developers whenever possible! Both are crucial for ensuring long-term usability and maintainability.
Expand All @@ -118,7 +122,7 @@ All documentation (including docstrings) is written in `reStructuredText`_ forma
See this `docstring example`_ to get started.

Testing Standards
^^^^^^^^^^^^^^^^^^
-----------------

All code should be accompanied by tests, whenever possible, to ensure that everything is working as intended.

Expand Down Expand Up @@ -158,3 +162,4 @@ Thank you for helping make ``PathML`` better!
.. _docstring example: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
.. _napoleon: https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
.. _Black: https://black.readthedocs.io/en/stable
.. _semantic versioning: https://semver.org/
6 changes: 5 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
copyright = '2021, Dana-Farber Cancer Institute and Weill Cornell Medicine'
author = 'Jacob Rosenthal et al.'

version = '1.0.3'
about = {}
with open('../../pathml/_version.py') as f:
exec(f.read(), about)
version = about["__version__"]

# The full version, including alpha/beta/rc tags
release = version

Expand Down
1 change: 1 addition & 0 deletions pathml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
from . import datasets as ds
from . import ml
from . import preprocessing as pp
from ._version import __version__
6 changes: 6 additions & 0 deletions pathml/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
Copyright 2021, Dana-Farber Cancer Institute and Weill Cornell Medicine
License: GNU GPL 2.0
"""

__version__ = "1.0.3"
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
with open("README.md", "r") as fh:
long_description = fh.read()

about = {}
with open('pathml/_version.py') as f:
exec(f.read(), about)
version = about["__version__"]

setuptools.setup(
name="pathml",
version="1.0.3",
version=version,
author="Jacob Rosenthal, Ryan Carelli et al.",
author_email="PathML@dfci.harvard.edu",
description="Tools for computational pathology",
Expand Down
12 changes: 12 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
Copyright 2021, Dana-Farber Cancer Institute and Weill Cornell Medicine
License: GNU GPL 2.0
"""

import re
import pathml


def test_version_format():
# semantic versioning format: major.minor.patch
assert re.match("^[\d]+.[\d]+.[\d]+$", pathml.__version__)