Skip to content

Commit

Permalink
v0.1.1 add requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhakk-mw committed Nov 24, 2023
1 parent cb2626e commit 3d83c30
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 67 deletions.
113 changes: 73 additions & 40 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,56 +36,89 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
#. MINOR version when you add functionality in a backward compatible manner
#. PATCH version when you make backward compatible bug fixes

APIs
-----

#. High Level API

.. code-block:: python
def get_update_notification(pkg_name: str, severity_level: int = 2) -> str:
#. Low Level API

.. code-block:: python
def query(pkg_name: str) -> dict[str, str]:
How to use version-tracker
--------------------------
.. code-block:: python

import version_tracker
# Get the name of your own package
package_name = str(__name__).split(".")[0]
# Returns a pre-formatted string for use with any logging information, that can be used to warn users of available updates.
logger.info("HIGH SEVERITY LEVEL log:")
logger.info(
version_tracker.get_update_notification(
package_name, version_tracker.HIGH_SEVERITY_LEVEL
)
)
#. Add version-tracker to the list of your package's dependencies.

logger.info("MEDIUM SEVERITY LEVEL log:")
logger.info(
version_tracker.get_update_notification(
package_name, version_tracker.MEDIUM_SEVERITY_LEVEL
)
)
.. code-block:: python
logger.info("LOW SEVERITY LEVEL log:")
logger.info(
version_tracker.get_update_notification(
package_name, version_tracker.LOW_SEVERITY_LEVEL
)
# Low Level API:
# Update your SETUP.PY to include version-tracker as shown:
INSTALL_REQUIRES = [
"aiohttp>=3.7.4",
"psutil",
"aiohttp_session[secure]",
"version-tracker",
]
# Returns version information about the current package.
version_info = version_tracker.query(package_name)
#. Include the module from your source code and use the APIs provided. See example below:

# version_info is a Dictionary with the following information:
# "latest": latest_version,
# "is_major": str(major_update),
# "is_minor": str(minor_update),
# "is_patch": str(patch_update),
# "commit_messages": commit_msg,
.. code-block:: python
import version_tracker
# Get the name of your own package
package_name = str(__name__).split(".")[0]
# Returns a pre-formatted string for use with any logging information, that can be used to warn users of available updates.
logger.info("HIGH SEVERITY LEVEL log:")
logger.info(
version_tracker.get_update_notification(
package_name, version_tracker.HIGH_SEVERITY_LEVEL
)
)
logger.info("MEDIUM SEVERITY LEVEL log:")
logger.info(
version_tracker.get_update_notification(
package_name, version_tracker.MEDIUM_SEVERITY_LEVEL
)
)
# Shows the latest version of your package that is available on PyPI
print(version_info['latest'])
logger.info("LOW SEVERITY LEVEL log:")
logger.info(
version_tracker.get_update_notification(
package_name, version_tracker.LOW_SEVERITY_LEVEL
)
# Low Level API:
# Shows whether the updates on PyPI are major in Nature. ie: Update found in the MAJOR portion of the Semantic version.
print(version_info['is_major'])
# Returns version information about the current package.
version_info = version_tracker.query(package_name)
# Shows any available commit messages related the updates between installed version and latest version.
print(version_info['commit_messages'])
# version_info is a Dictionary with the following information:
# "latest": latest_version,
# "is_major": str(major_update),
# "is_minor": str(minor_update),
# "is_patch": str(patch_update),
# "commit_messages": commit_msg,
# Shows the latest version of your package that is available on PyPI
print(version_info['latest'])
# Shows whether the updates on PyPI are major in Nature. ie: Update found in the MAJOR portion of the Semantic version.
print(version_info['is_major'])
# Shows any available commit messages related the updates between installed version and latest version.
print(version_info['commit_messages'])
#. Sample output from a package that is using the Above APIs and run on an installation which has version 0.1.0, but PyPI has version 0.10.0 installed
* Free software: MIT license
* Documentation: https://version-tracker.readthedocs.io.
Expand Down
46 changes: 23 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,46 @@

from setuptools import setup, find_packages

with open('README.rst') as readme_file:
with open("README.rst") as readme_file:
readme = readme_file.read()

with open('HISTORY.rst') as history_file:
with open("HISTORY.rst") as history_file:
history = history_file.read()

requirements = [ ]
requirements = ["requests"]

test_requirements = [ ]
test_requirements = []

setup(
author="Prabhakar Kumar",
author_email='[email protected]',
python_requires='>=3.6',
author_email="[email protected]",
python_requires=">=3.6",
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
description="Query PyPI for critical updates available available for your users installation of your package.",
entry_points={
'console_scripts': [
'version_tracker=version_tracker.cli:main',
"console_scripts": [
"version_tracker=version_tracker.cli:main",
],
},
install_requires=requirements,
license="MIT license",
long_description=readme + '\n\n' + history,
long_description=readme + "\n\n" + history,
include_package_data=True,
keywords='version_tracker',
name='version_tracker',
packages=find_packages(include=['version_tracker', 'version_tracker.*']),
test_suite='tests',
keywords="version_tracker",
name="version_tracker",
packages=find_packages(include=["version_tracker", "version_tracker.*"]),
test_suite="tests",
tests_require=test_requirements,
url='https://github.com/prabhakk-mw/version_tracker',
version='0.1.0',
url="https://github.com/prabhakk-mw/version_tracker",
version="0.1.1",
zip_safe=False,
)
4 changes: 0 additions & 4 deletions version_tracker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
"""Top-level package for version-tracker."""

__author__ = """Prabhakar Kumar"""
__email__ = "[email protected]"
__version__ = "0.1.0"

from .version_tracker import *

0 comments on commit 3d83c30

Please sign in to comment.