diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f4952ba --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: +- package-ecosystem: pip + directory: "/" + schedule: + interval: daily + time: "10:00" + open-pull-requests-limit: 10 diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..8c61384 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,41 @@ +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '🚀 New Features' + labels: + - 'enhancement' + - 'new feature' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + labels: + - 'refactoring' + - 'dependencies' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + - 'feature' + - 'new feature' + - 'enhancement' + patch: + labels: + - 'fix' + - 'bugfix' + - 'bug' + - 'patch' + - 'refactoring' + - 'documentation' + default: patch +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index c7f5067..e19d5e9 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -1,29 +1,33 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Python application +name: Python package on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8, 3.9] + os: [macos-latest, ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v2 - - name: Set up Python 3.8 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest + python -m pip install flake8 pytest-cov if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | @@ -33,4 +37,12 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest + pytest --cov=energy-pandas --cov-report=xml tests/ + - name: Upload coverage to Codecov + if: ${{ matrix.python-version == 3.7 }} + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + fail_ci_if_error: false + verbose: true diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..8188adc --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,31 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created, edited] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/requirements.txt b/requirements.txt index bdfbb96..1f1c9d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,8 @@ -git+https://github.com/samuelduchesne/archetypal.git#archetypal=archetypal +archetypal numpy mongoengine pycountry pytest geojson mongomock -datapackage -geopandas \ No newline at end of file +datapackage \ No newline at end of file diff --git a/setup.py b/setup.py index 96cca75..717c095 100644 --- a/setup.py +++ b/setup.py @@ -1,21 +1,59 @@ +"""Setup/install the package.""" +# Always prefer setuptools over distutils +import codecs import os +from os import path -from setuptools import setup +from setuptools import find_packages, setup here = os.getcwd() -with open(os.path.join(here, "requirements.txt")) as f: + +def read(*parts): + with codecs.open(path.join(here, *parts), "r") as fp: + return fp.read() + + +# Get the long description from the README file +with codecs.open(path.join(here, "README.md"), encoding="utf-8") as f: + long_description = f.read() + +with open("requirements.txt") as f: requirements_lines = f.readlines() -install_requires = [r.strip() for r in requirements_lines if "git+" not in r] +install_requires = [r.strip() for r in requirements_lines] +package = "umitemplatedb" setup( - name="umitemplatedb", - version="", - packages=["tests", "umitemplatedb"], - url="", - license="", - install_requires=install_requires, + name=package, + use_scm_version=True, + setup_requires=["setuptools_scm"], + packages=find_packages(exclude=["tests"]), + url="https://github.com/MITSustainableDesignLab/{}".format(package), + license="MIT", author="Samuel Letellier-Duchesne", author_email="samueld@mit.edu", - description="Functions to import and query the UmiTemplate DataBase", + description="Building Energy pandas extension", + long_description=long_description, + long_description_content_type="text/markdown", + keywords="archetypal umitemplatelibrary mongo mongoengine", + install_requires=install_requires, + test_suite="tests", + include_package_data=True, + classifiers=[ + # How mature is this project? Common values are + # 3 - Alpha + # 4 - Beta + # 5 - Production/Stable + "Development Status :: 4 - Beta", + # Indicate who your project is intended for + "Intended Audience :: Science/Research", + # Pick your license as you wish (should match "license" above) + "License :: OSI Approved :: MIT License", + # Specify the Python versions you support here. In particular, ensure + # that you indicate whether you support Python 2, Python 3 or both. + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Operating System :: OS Independent", + ], )