diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index b6c0d1e..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,63 +0,0 @@ -pipeline { - agent any - - stages { - stage('Checkout') { - steps { - // Checkout the repository - git url: 'https://github.com/deepak7376/robustbase.git', branch: 'master' - } - } - - stage('Install Dependencies') { - steps { - // Install Python dependencies - sh ''' - # Create a virtual environment - python3 -m venv venv - - # Activate virtual environment - source venv/bin/activate - - # Install dependencies - pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements-dev.txt - ''' - } - } - - stage('Run Tests') { - steps { - // Run tests using pytest - sh ''' - # Activate virtual environment - source venv/bin/activate - - # Run pytest - pytest tests/ - ''' - } - } - - stage('Cleanup') { - steps { - // Clean up the workspace - cleanWs() - } - } - } - - post { - always { - // Clean up the virtual environment if it exists - sh 'rm -rf venv' - } - success { - echo 'Build completed successfully!' - } - failure { - echo 'Build failed!' - } - } -} diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..8afbefe --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include README.md +include requirements.txt diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000..74f7a6a --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,4 @@ +pytest>=6.0.0 +pytest-cov>=2.10.0 +coverage>=5.0 +flake8>=3.8.0 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b2f7c39 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=42", "wheel", "numpy"] +build-backend = "setuptools.build_meta" diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index b0ae1a0..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1 +0,0 @@ -pytest>=8.1.1 \ No newline at end of file diff --git a/robustbase/version.py b/robustbase/version.py new file mode 100644 index 0000000..71ec82d --- /dev/null +++ b/robustbase/version.py @@ -0,0 +1 @@ +__version__ = '3.0.4+5.git.gb0a0657' diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..59334aa --- /dev/null +++ b/setup.cfg @@ -0,0 +1,56 @@ +[metadata] +name = robustbase +version = attr: robustbase.version.__version__ +description = A Python Based Library to Calculate Estimators (Sn, Qn, MAD, IQR) +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/deepak7376/robustbase +author = Deepak Yadav +author_email = dky.united@gmail.com +license = MIT +classifiers = + Development Status :: 3 - Alpha + Intended Audience :: Developers + Topic :: Scientific/Engineering :: Mathematics + License :: OSI Approved :: MIT License + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 +keywords = robust statistics robustness Sn Qn MAD IQR + +[options] +packages = find: +include_package_data = true +python_requires = >=3.0 +install_requires = + certifi>=2019.11.28 + docutils>=0.15.2 + numpy>=1.18.0 + statistics>=1.0.3.5 + +[options.packages.find] +where = robustbase + +[options.extras_require] +dev = + pytest>=6.0.0 + pytest-cov>=2.10.0 + coverage>=5.0 + flake8>=3.8.0 + +[flake8] +max-line-length = 88 +exclude = + .git, + __pycache__, + dist, + build, + .tox + +[tool:pytest] +addopts = --cov=robustbase --cov-report=term-missing + +[aliases] +test = pytest diff --git a/setup.py b/setup.py index d23e497..2148d6c 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ -from setuptools import setup, find_packages +from setuptools import setup import subprocess import os +# Get version from git version = ( subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE) .stdout.decode("utf-8") @@ -13,59 +14,14 @@ # pip has gotten strict with version numbers # so change it to: "1.3.3+22.git.gdf81228" # See: https://peps.python.org/pep-0440/#local-version-segments - v,i,s = version.split("-") + v, i, s = version.split("-") version = v + "+" + i + ".git." + s assert "-" not in version assert "." in version -assert os.path.isfile("version.py") -with open("VERSION", "w", encoding="utf-8") as fh: - fh.write("%s\n" % version) +# Write the version to a file (this can be used in your package) +with open(os.path.join("robustbase", "version.py"), "w", encoding="utf-8") as fh: + fh.write("__version__ = '{}'\n".format(version)) - -# reading long description from file -with open('README.md', encoding='utf-8') as f: - long_description = f.read() - - -# some more details -CLASSIFIERS = [ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'Topic :: Scientific/Engineering :: Mathematics', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3', - ] - -# calling the setup function -setup( - name='robustbase', - version=version, - description='A Python Based Library to Calculate Estimators (Sn, Qn, MAD, IQR)', - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/deepak7376/robustbase', - author='Deepak Yadav', - author_email='dky.united@gmail.com', - license='MIT', - packages=find_packages('robustbase'), # Include all packages in the new version - include_package_data=True, - package_dir={'': 'robustbase'}, - project_urls={ - 'Source': 'https://github.com/deepak7376/robustbase', - 'Tracker': 'https://github.com/deepak7376/robustbase/issues', - }, - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - ], - keywords='robust statistics robustness Sn Qn MAD IQR', - python_requires='>=3.0', -) +setup() diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..665bde9 --- /dev/null +++ b/tox.ini @@ -0,0 +1,24 @@ +[tox] +envlist = py37, py38, py39, flake8 + +[testenv] +deps = + -rrequirements.txt + -rdev-requirements.txt +setenv = + PYTHONPATH = {toxinidir} +commands = + pytest --cov=robustbase --cov-report=term-missing + +[testenv:flake8] +deps = flake8 +commands = flake8 robustbase tests + +[flake8] +max-line-length = 88 +exclude = + .git, + __pycache__, + dist, + build, + .tox diff --git a/version.py b/version.py index d8d87e9..1344f24 100644 --- a/version.py +++ b/version.py @@ -1,6 +1,5 @@ import os - def string(): try: with open(os.path.dirname(__file__) + "/VERSION", "r", encoding="utf-8") as fh: