From 13b89a03ccec13bed2ea5ba446be68d16778074a Mon Sep 17 00:00:00 2001 From: Zaccharie Ramzi Date: Fri, 7 Jan 2022 09:36:02 +0100 Subject: [PATCH] Initial commit --- .github/workflows/test.yml | 30 ++++++++ .gitignore | 133 ++++++++++++++++++++++++++++++++++ README.md | 11 +++ build_package.sh | 9 +++ my_package/__init__.py | 0 my_package/tests/unit_test.py | 2 + requirements.txt | 1 + setup.py | 27 +++++++ 8 files changed, 213 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 build_package.sh create mode 100644 my_package/__init__.py create mode 100644 my_package/tests/unit_test.py create mode 100644 requirements.txt create mode 100644 setup.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9befda3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +# This workflow will install Python dependencies, run tests with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions +name: Continuous testing + +on: + push: + branches: + - 'master' + + pull_request: + branches: + - 'master' + +jobs: + test: + name: Test Code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + pip install . + - name: Test with pytest + run: pytest -s my_package/tests diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f7f7ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,133 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# My usual private notebooks directory + +personal_experiments/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..d9c98f7 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# My python package template + +![GitHub Workflow Build Status](https://github.com/zaccharieramzi/my-python-package-template/workflows/Continuous%20testing/badge.svg) + +With Readme, gitignore, travis, GitHub workflow, reqs and tree structure + +TODO to make the repo viable: +- [ ] change the name of the `my_package` folder +- [ ] change the name of the package in `setup.py` +- [ ] change the name of the test folder in the GitHub action +- [ ] Updated the Readme diff --git a/build_package.sh b/build_package.sh new file mode 100644 index 0000000..2019bcf --- /dev/null +++ b/build_package.sh @@ -0,0 +1,9 @@ +#!/usr/bin/bash + +rm -f -r build/* +rm -f -r dist/* + +pip install --upgrade setuptools wheel twine + +python setup.py sdist bdist_wheel +twine upload -r testpypi dist/* diff --git a/my_package/__init__.py b/my_package/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/my_package/tests/unit_test.py b/my_package/tests/unit_test.py new file mode 100644 index 0000000..091a336 --- /dev/null +++ b/my_package/tests/unit_test.py @@ -0,0 +1,2 @@ +def test_work(): + assert True diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..408e751 --- /dev/null +++ b/setup.py @@ -0,0 +1,27 @@ +import setuptools + +with open("README.md", "r") as fh: + long_description = fh.read() + +# taken from https://github.com/CEA-COSMIC/ModOpt/blob/master/setup.py +with open('requirements.txt') as open_file: + install_requires = open_file.read() + +setuptools.setup( + name="my-python-package-template", + version="0.0.1", + author="Zaccharie Ramzi", + author_email="zaccharie.ramzi@gmail.com", + description="My Python package template.", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/zaccharieramzi/my-python-package-template", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + install_requires=install_requires, + python_requires='>=3.6', +)