From dede37df91ba58e1875b0ab0d5e6ebaeef28fe47 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sun, 16 Jan 2022 15:33:26 +0100 Subject: [PATCH] setup repo --- .../workflows/test-and-upload-to-testpypi.yml | 58 ++++++++++++++ .github/workflows/upload-to-pip.yml | 43 +++++++++++ .gitignore | 7 ++ pydash/__init__.py | 0 {src => pydash}/trueupdate.py | 0 setup.py | 77 +++++++++++++++++++ tests/__init__.py | 0 tests/test_string.py | 7 ++ 8 files changed, 192 insertions(+) create mode 100644 .github/workflows/test-and-upload-to-testpypi.yml create mode 100644 .github/workflows/upload-to-pip.yml create mode 100644 .gitignore create mode 100644 pydash/__init__.py rename {src => pydash}/trueupdate.py (100%) create mode 100644 setup.py create mode 100644 tests/__init__.py create mode 100644 tests/test_string.py diff --git a/.github/workflows/test-and-upload-to-testpypi.yml b/.github/workflows/test-and-upload-to-testpypi.yml new file mode 100644 index 00000000..e9312463 --- /dev/null +++ b/.github/workflows/test-and-upload-to-testpypi.yml @@ -0,0 +1,58 @@ +# This is a basic workflow to help you get started with Actions + +name: Test & Upload to TestPyPI + +# Controls when the action will run. +on: + # Triggers the workflow on push to the master branch + push: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Sets up python3 + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + + # Installs and upgrades pip, installs other dependencies and installs the package from setup.py + - name: "Installs and upgrades pip, installs other dependencies and installs the package from setup.py" + run: | + # Upgrade pip + python3 -m pip install --upgrade pip + # Install build deps + python3 -m pip install setuptools wheel twine + # If requirements.txt exists, install from it + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + # Install the package from setup.py + python3 setup.py install + + # Tests with unittest + - name: Test with unittest + run: | + cd tests + python3 -m unittest discover + cd .. + + # Upload to TestPyPI + - name: Build and Upload to TestPyPI + run: | + python3 setup.py sdist bdist_wheel + python3 -m twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_TEST_TOKEN }} + TWINE_REPOSITORY: testpypi diff --git a/.github/workflows/upload-to-pip.yml b/.github/workflows/upload-to-pip.yml new file mode 100644 index 00000000..ddd77d85 --- /dev/null +++ b/.github/workflows/upload-to-pip.yml @@ -0,0 +1,43 @@ +# This is a basic workflow to help you get started with Actions + +name: Upload to PIP + +# Controls when the action will run. +on: + # Triggers the workflow when a release is created + release: + types: [created] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "upload" + upload: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Sets up python + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + + # Install dependencies + - name: "Installs dependencies" + run: | + python3 -m pip install --upgrade pip + python3 -m pip install setuptools wheel twine + + # Build and upload to PyPI + - name: "Builds and uploads to PyPI" + run: | + python3 setup.py sdist bdist_wheel + python3 -m twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..f17f07b3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +__pycache__/ +build/ +dist/ +*.egg-info/ +*.egg +venv/ +.env diff --git a/pydash/__init__.py b/pydash/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/trueupdate.py b/pydash/trueupdate.py similarity index 100% rename from src/trueupdate.py rename to pydash/trueupdate.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..125391f5 --- /dev/null +++ b/setup.py @@ -0,0 +1,77 @@ +from setuptools import setup, find_packages +from os.path import abspath, dirname, join + +# Fetches the content from README.md +# This will be used for the "long_description" field. +README_MD = open(join(dirname(abspath(__file__)), "README.md")).read() + +setup( + # The name of your project that we discussed earlier. + # This name will decide what users will type when they install your package. + # In my case it will be: + # pip install pydash-arnu515 + # This field is REQUIRED + name="pydash-arnu515", + + # The version of your project. + # Usually, it would be in the form of: + # major.minor.patch + # eg: 1.0.0, 1.0.1, 3.0.2, 5.0-beta, etc. + # You CANNOT upload two versions of your package with the same version number + # This field is REQUIRED + version="1.0.1", + + # The packages that constitute your project. + # For my project, I have only one - "pydash". + # Either you could write the name of the package, or + # alternatively use setuptools.findpackages() + # + # If you only have one file, instead of a package, + # you can instead use the py_modules field instead. + # EITHER py_modules OR packages should be present. + packages=find_packages(exclude="tests"), + + # The description that will be shown on PyPI. + # Keep it short and concise + # This field is OPTIONAL + description="A small clone of lodash", + + # The content that will be shown on your project page. + # In this case, we're displaying whatever is there in our README.md file + # This field is OPTIONAL + long_description=README_MD, + + # Now, we'll tell PyPI what language our README file is in. + # In my case it is in Markdown, so I'll write "text/markdown" + # Some people use reStructuredText instead, so you should write "text/x-rst" + # If your README is just a text file, you have to write "text/plain" + # This field is OPTIONAL + long_description_content_type="text/markdown", + + # The url field should contain a link to a git repository, the project's website + # or the project's documentation. I'll leave a link to this project's Github repository. + # This field is OPTIONAL + url="https://github.com/arnu515/pydash", + + # The author name and email fields are self explanatory. + # These fields are OPTIONAL + author_name="arnu515", + author_email="arnu5152@gmail.com", + + # Classifiers help categorize your project. + # For a complete list of classifiers, visit: + # https://pypi.org/classifiers + # This is OPTIONAL + classifiers=[ + "License :: OSI Approved :: MIT License", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3 :: Only" + ], + + # Keywords are tags that identify your project and help searching for it + # This field is OPTIONAL + keywords="lodash, string, manipulation", + + # For additional fields, check: + # https://github.com/pypa/sampleproject/blob/master/setup.py +) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_string.py b/tests/test_string.py new file mode 100644 index 00000000..66b5f4a9 --- /dev/null +++ b/tests/test_string.py @@ -0,0 +1,7 @@ +import unittest + +from pydash import PyDash + + +class Test(unittest.TestCase): +