-
Notifications
You must be signed in to change notification settings - Fork 13
modern python #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
modern python #65
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6f22fa6
modern python
chayim 2e4bca1
adding nighties
chayim 6cf5bc5
adding docker file skeleton that builds
chayim ef3d224
linter cleanup
chayim 34c46b5
docs update
chayim e5893e2
sample docker, linters, tox updates
chayim 3ca1c7e
snyk added to the README, poetry pypi workflow
chayim 044fa97
tox, with poetry
chayim 24e0fef
ai, from bloom
chayim d71fe62
latest
chayim b9b31e3
linter comments
chayim fbc5cda
lifting dockers
chayim db860f6
unifying the pypi settings
chayim a313a28
merging master
chayim 5bf1426
linters
chayim 0509bda
Fix bug - return the missing postprocess arg in Dag constructor.
alonre24 98fdac3
linter fix: postprocess now sets the default on the Dag class
chayim 4649986
docker fix, still need password
chayim ce54a7f
docker removal - comments
chayim e335fff
code review comments
chayim ec89579
docs fix
chayim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| poetry>=1.1.6 | ||
| tox>=3.23.1 | ||
| tox-poetry>=0.3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,97 +1,139 @@ | ||
| version: 2.1 | ||
|
|
||
| # Python CircleCI 2.0 configuration file | ||
| # | ||
| # Check https://circleci.com/docs/2.0/language-python/ for more details | ||
| # | ||
| version: 2 | ||
| jobs: | ||
| build: | ||
| docker: | ||
| - image: circleci/python:3.6.9 | ||
| - image: redislabs/redisai:edge-cpu-bionic | ||
|
|
||
| working_directory: ~/repo | ||
| commands: | ||
|
|
||
| abort_for_docs: | ||
| steps: | ||
| - checkout | ||
|
|
||
| - restore_cache: # Download and cache dependencies | ||
| keys: | ||
| - v1-dependencies-{{ checksum "test-requirements.txt" }} | ||
| # fallback to using the latest cache if no exact match is found | ||
| - v1-dependencies- | ||
|
|
||
| - run: | ||
| name: install dependencies | ||
| name: Avoid tests for docs | ||
| command: | | ||
| virtualenv --no-site-packages venv | ||
| . venv/bin/activate | ||
| pip install -r test-requirements.txt | ||
| - save_cache: | ||
| paths: | ||
| - ./venv | ||
| key: v1-dependencies-{{ checksum "test-requirements.txt" }} | ||
| if [[ $CIRCLE_BRANCH == *docs ]]; then | ||
| echo "Identifies as documents PR, no testing required" | ||
| circleci step halt | ||
| fi | ||
| abort_for_noci: | ||
| steps: | ||
| - run: | ||
| name: run tests | ||
| name: Ignore CI for specific branches | ||
| command: | | ||
| . venv/bin/activate | ||
| nosetests --with-coverage -vsx test | ||
| codecov | ||
| - store_artifacts: | ||
| path: test-reports | ||
| destination: test-reports | ||
| if [[ $CIRCLE_BRANCH == *noci ]]; then | ||
| echo "Identifies as actively ignoring CI, no testing required." | ||
| circleci step halt | ||
| fi | ||
| build_nightly: | ||
| docker: | ||
| - image: circleci/python:3.6.9 | ||
| - image: redislabs/redisai:edge-cpu-bionic | ||
| working_directory: ~/repo | ||
| early_return_for_forked_pull_requests: | ||
| description: >- | ||
| If this build is from a fork, stop executing the current job and return success. | ||
| This is useful to avoid steps that will fail due to missing credentials. | ||
| steps: | ||
| - run: | ||
| name: Early return if this build is from a forked PR | ||
| command: | | ||
| if [[ -n "$CIRCLE_PR_NUMBER" ]]; then | ||
| echo "Nothing to do for forked PRs, so marking this step successful" | ||
| circleci step halt | ||
| fi | ||
| build_and_test: | ||
| steps: | ||
| - checkout | ||
|
|
||
| - restore_cache: # Download and cache dependencies | ||
| keys: | ||
| - v1-dependencies-{{ checksum "test-requirements.txt" }} | ||
| - v1-dependencies-{{ checksum "pyproject.toml" }} | ||
| # fallback to using the latest cache if no exact match is found | ||
| - v1-dependencies- | ||
|
|
||
| - run: | ||
| name: install dependencies | ||
| name: install tox dependencies | ||
| command: | | ||
| virtualenv --no-site-packages venv | ||
| . venv/bin/activate | ||
| pip install -r test-requirements.txt | ||
| pip install --user --quiet -r .circleci/circle_requirements.txt | ||
| - save_cache: | ||
| paths: | ||
| - ./venv | ||
| key: v1-dependencies-{{ checksum "test-requirements.txt" }} | ||
| - run: | ||
| name: build sdist and wheels | ||
| command: | | ||
| poetry build | ||
| - run: | ||
| name: run tests | ||
| name: lint | ||
| command: | | ||
| . venv/bin/activate | ||
| nosetests -vsx test | ||
| tox -e linters | ||
| - run: | ||
| name: run tests | ||
| command: | ||
| tox -e tests | ||
|
|
||
| # no need for store_artifacts on nightly builds | ||
| - save_cache: | ||
| paths: | ||
| - ./.tox | ||
| - ~/.cache/pip | ||
| key: v1-dependencies-{{ checksum "pyproject.toml" }} | ||
|
|
||
| jobs: | ||
| build: | ||
| parameters: | ||
| python_version: | ||
| type: string | ||
| default: "latest" | ||
| docker: | ||
| - image: circleci/python:<<parameters.python_version>> | ||
| - image: redislabs/redisai:edge-cpu-bionic | ||
|
|
||
| steps: | ||
| - build_and_test | ||
| - store_artifacts: | ||
| path: test-reports | ||
| destination: test-reports | ||
|
|
||
| nightly: | ||
| parameters: | ||
| python_version: | ||
| type: string | ||
| docker: | ||
| - image: circleci/python:<<parameters.python_version>> | ||
| - image: redislabs/redisai:edge-cpu-bionic | ||
| steps: | ||
| - build_and_test | ||
| - dockerize | ||
|
|
||
| on-any-branch: &on-any-branch | ||
| filters: | ||
| branches: | ||
| only: | ||
| - /.*/ | ||
| tags: | ||
| ignore: /.*/ | ||
|
|
||
| on-master: &on-master | ||
| filters: | ||
| branches: | ||
| only: | ||
| - master | ||
|
|
||
| python-versions: &python-versions | ||
| matrix: | ||
| parameters: | ||
| python_version: | ||
| - "3.6.9" | ||
| - "3.7.9" | ||
| - "3.8.9" | ||
| - "3.9.4" | ||
| - "latest" | ||
|
|
||
| workflows: | ||
| version: 2 | ||
| commit: | ||
| jobs: | ||
| - build | ||
| - build: | ||
| <<: *on-any-branch | ||
| <<: *python-versions | ||
|
|
||
| nightly: | ||
| triggers: | ||
| - schedule: | ||
| cron: "0 0 * * *" | ||
| filters: | ||
| branches: | ||
| only: | ||
| - master | ||
| <<: *on-master | ||
| jobs: | ||
| - build_nightly | ||
| - build | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,43 @@ | ||
| name: Publish Pypi | ||
| on: | ||
| release: | ||
| types: [published] | ||
| types: [ published ] | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: publish | ||
| pytest: | ||
| name: Publish to PyPi | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
| steps: | ||
| - uses: actions/checkout@master | ||
| - name: Set up Python 3.6 | ||
| - name: Set up Python 3.7 | ||
| uses: actions/setup-python@v1 | ||
| with: | ||
| python-version: 3.6 | ||
| python-version: 3.7 | ||
|
|
||
| - name: Install twine | ||
| run: | | ||
| pip install twine | ||
|
|
||
| - name: Install wheel | ||
| run: | | ||
| pip install wheel | ||
|
|
||
| - name: Create a source distribution | ||
| run: | | ||
| python setup.py sdist | ||
| - name: Install Poetry | ||
| uses: dschep/[email protected] | ||
|
|
||
| - name: Create a wheel | ||
| run: | | ||
| python setup.py bdist_wheel | ||
| - name: Cache Poetry virtualenv | ||
| uses: actions/cache@v1 | ||
| id: cache | ||
| with: | ||
| path: ~/.virtualenvs | ||
| key: poetry-${{ hashFiles('**/poetry.lock') }} | ||
| restore-keys: | | ||
| poetry-${{ hashFiles('**/poetry.lock') }} | ||
|
|
||
| - name: Create a .pypirc | ||
| - name: Set Poetry config | ||
| run: | | ||
| echo -e "[pypi]" >> ~/.pypirc | ||
| echo -e "username = __token__" >> ~/.pypirc | ||
| echo -e "password = ${{ secrets.PYPI_TOKEN }}" >> ~/.pypirc | ||
| echo -e "[testpypi]" >> ~/.pypirc | ||
| echo -e "username = __token__" >> ~/.pypirc | ||
| echo -e "password = ${{ secrets.TESTPYPI_TOKEN }}" >> ~/.pypirc | ||
| poetry config virtualenvs.in-project false | ||
| poetry config virtualenvs.path ~/.virtualenvs | ||
|
|
||
| - name: Publish to Test PyPI | ||
| if: github.event_name == 'release' | ||
| run: | | ||
| twine upload --skip-existing -r testpypi dist/* | ||
| - name: Install Dependencies | ||
| run: poetry install | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
|
|
||
| - name: Publish to PyPI | ||
| if: github.event_name == 'release' | ||
| run: | | ||
| twine upload -r pypi dist/* | ||
| poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} --build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| ARG OSNICK=bionic | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this file?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A future goal - I'd like to build dockers out of these, and given people a one stop shop. We are not currently using it. |
||
| ARG TARGET=cpu | ||
|
|
||
| FROM redislabs/redisai:edge-${TARGET}-${OSNICK} as builder | ||
|
|
||
| RUN apt update && apt install -y python3 python3-pip | ||
| ADD . /build | ||
| WORKDIR /build | ||
| RUN pip3 install poetry | ||
| RUN poetry config virtualenvs.create false | ||
| RUN poetry build | ||
|
|
||
| ### clean docker stage | ||
| FROM redislabs/redisai:edge-${TARGET}-${OSNICK} as runner | ||
|
|
||
| RUN apt update && apt install -y python3 python3-pip | ||
| RUN rm -rf /var/cache/apt/ | ||
|
|
||
| COPY --from=builder /build/dist/redisai*.tar.gz /tmp/ | ||
| RUN pip3 install /tmp/redisai*.tar.gz | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| [tool.poetry] | ||
| name = "redisai" | ||
| version = "1.0.2" | ||
| description = "RedisAI Python Client" | ||
| authors = ["RedisLabs <[email protected]>"] | ||
| license = "BSD-3-Clause" | ||
| readme = "README.rst" | ||
|
|
||
| packages = [ | ||
| { include = 'redisai' }, | ||
| ] | ||
|
|
||
| classifiers = [ | ||
| 'Topic :: Database', | ||
| 'Programming Language :: Python', | ||
| 'Intended Audience :: Developers', | ||
| 'Programming Language :: Python :: 3.6', | ||
| 'Programming Language :: Python :: 3.7', | ||
| 'Programming Language :: Python :: 3.8', | ||
| 'Programming Language :: Python :: 3.9', | ||
| 'License :: OSI Approved :: BSD License', | ||
| 'Development Status :: 5 - Production/Stable' | ||
| ] | ||
|
|
||
| [tool.poetry.dependencies] | ||
| python = "^3.6" | ||
| redis = ">=2.10" | ||
| hiredis = ">=0.20" | ||
| numpy = ">=1.19.5" | ||
| six = ">=1.10.0" | ||
| Deprecated = "^1.2.12" | ||
|
|
||
| [tool.poetry.dev-dependencies] | ||
| codecov = "^2.1.11" | ||
| flake8 = "^3.9.2" | ||
| rmtest = "^0.7.0" | ||
| nose = "^1.3.7" | ||
| ml2rt = "^0.2.0" | ||
| tox = ">=3.23.1" | ||
| tox-poetry = "^0.3.0" | ||
| bandit = "^1.7.0" | ||
| pylint = "^2.8.2" | ||
| vulture = "^2.3" | ||
|
|
||
| [tool.poetry.urls] | ||
| url = "https://redisai.io" | ||
| repository = "https://github.com/RedisAI/redisai-py" | ||
|
|
||
|
|
||
| [build-system] | ||
| requires = ["poetry-core>=1.0.0"] | ||
| build-backend = "poetry.core.masonry.api" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a generic name across all the clients? if not can we rename to
abort_tests?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the generic name currently in use in all clients.