Skip to content

Commit

Permalink
chore: VERSION file to have it at a single place
Browse files Browse the repository at this point in the history
The aim of this commit is to have the package version at a single place, and
not across multiple files.

The VERSION file contains the version number. It is now the only place where
it is set. The setup.py and the Sphinx conf.py read this file.
It is now possible to get the version number directly from the package:
  import deel.lip
  print(deel.lip.__version__)

Note that to add non-Python files to the sdist package, it is required to add
`include_package_data=True` in setup.py and a MANIFEST.in file containing the
non-Python files to add in package.
  • Loading branch information
cofri committed Nov 3, 2022
1 parent f38b857 commit 341bae2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include deel/lip/VERSION
include LICENSE
1 change: 1 addition & 0 deletions deel/lip/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.3.0
6 changes: 6 additions & 0 deletions deel/lip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# rights reserved. DEEL is a research program operated by IVADO, IRT Saint Exupéry,
# CRIAQ and ANITI - https://www.deel.ai/
# =====================================================================================

from os import path

with open(path.join(path.dirname(__file__), "VERSION")) as f:
__version__ = f.read().strip()

from . import activations
from . import callbacks
from . import constraints
Expand Down
6 changes: 4 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# import guzzle_sphinx_theme
import sphinx_rtd_theme
# import sphinx_rtd_theme
from deel.lip import __version__

# -- Project information -----------------------------------------------------

Expand All @@ -31,7 +32,8 @@
)

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

# -- General configuration ---------------------------------------------------

Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()

with open(path.join(this_directory, "deel/lip/VERSION")) as f:
version = f.read().strip()

dev_requires = [
"tox",
"black",
Expand All @@ -30,7 +33,7 @@

setuptools.setup(
name="deel-lip",
version="1.3.0",
version=version,
author=", ".join(["Mathieu SERRURIER", "Franck MAMALET", "Thibaut BOISSIN"]),
author_email=", ".join(
[
Expand All @@ -44,6 +47,7 @@
long_description_content_type="text/markdown",
url="https://github.com/deel-ai/deel-lip",
packages=setuptools.find_namespace_packages(include=["deel.*"]),
include_package_data=True,
install_requires=["numpy", "tensorflow~=2.2"],
license="MIT",
extras_require={"dev": dev_requires, "docs": docs_requires},
Expand Down

0 comments on commit 341bae2

Please sign in to comment.