From 99ca18774a2a6c10de1b3237e08b3abcd448b412 Mon Sep 17 00:00:00 2001 From: c056091 Date: Mon, 9 Mar 2020 18:12:38 -0300 Subject: [PATCH] initial import - empty project --- .appveyor.yml | 28 +++ .coveragerc | 9 + .gitignore | 59 +++++ .idea/.gitignore | 2 + .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 4 + .idea/modules.xml | 8 + .idea/trio-ftplib.iml | 10 + .idea/vcs.xml | 6 + .readthedocs.yml | 16 ++ .travis.yml | 33 +++ CHEATSHEET.rst | 82 +++++++ LICENSE | 3 + LICENSE.APACHE2 | 202 ++++++++++++++++++ LICENSE.MIT | 20 ++ MANIFEST.in | 5 + README.rst | 11 + ci/rtd-requirements.txt | 4 + ci/travis.sh | 93 ++++++++ docs/Makefile | 20 ++ docs/make.bat | 36 ++++ docs/source/_static/.gitkeep | 0 docs/source/conf.py | 194 +++++++++++++++++ docs/source/history.rst | 6 + docs/source/index.rst | 23 ++ newsfragments/.gitkeep | 0 newsfragments/README.rst | 40 ++++ pyproject.toml | 7 + setup.py | 46 ++++ test-requirements.txt | 3 + trio_ftplib/__init__.py | 3 + trio_ftplib/_tests/__init__.py | 0 trio_ftplib/_tests/conftest.py | 1 + trio_ftplib/_tests/test_example.py | 15 ++ trio_ftplib/_version.py | 3 + 35 files changed, 998 insertions(+) create mode 100644 .appveyor.yml create mode 100644 .coveragerc create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/trio-ftplib.iml create mode 100644 .idea/vcs.xml create mode 100644 .readthedocs.yml create mode 100644 .travis.yml create mode 100644 CHEATSHEET.rst create mode 100644 LICENSE create mode 100644 LICENSE.APACHE2 create mode 100644 LICENSE.MIT create mode 100644 MANIFEST.in create mode 100644 README.rst create mode 100644 ci/rtd-requirements.txt create mode 100644 ci/travis.sh create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/source/_static/.gitkeep create mode 100644 docs/source/conf.py create mode 100644 docs/source/history.rst create mode 100644 docs/source/index.rst create mode 100644 newsfragments/.gitkeep create mode 100644 newsfragments/README.rst create mode 100644 pyproject.toml create mode 100644 setup.py create mode 100644 test-requirements.txt create mode 100644 trio_ftplib/__init__.py create mode 100644 trio_ftplib/_tests/__init__.py create mode 100644 trio_ftplib/_tests/conftest.py create mode 100644 trio_ftplib/_tests/test_example.py create mode 100644 trio_ftplib/_version.py diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..cbf56ab --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,28 @@ +skip_tags: true + +os: Visual Studio 2015 + +environment: + matrix: + - PYTHON: "C:\\Python36" + - PYTHON: "C:\\Python36-x64" + - PYTHON: "C:\\Python37" + - PYTHON: "C:\\Python37-x64" + +build_script: + - "git --no-pager log -n2" + - "echo %APPVEYOR_REPO_COMMIT%" + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;;%PATH%" + - "python --version" + - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + - "pip install ." + - "pip install -Ur test-requirements.txt" + - "pip install codecov" + +test_script: + - "mkdir empty" + - "cd empty" + # Make sure it's being imported from where we expect + - "python -c \"import os, trio_ftplib; print(os.path.dirname(trio_ftplib.__file__))\"" + - "python -u -m pytest -W error -ra -v -s --pyargs trio_ftplib --cov=trio_ftplib --cov-config=../.coveragerc" + - "codecov" diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..521b839 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,9 @@ +[run] +branch=True +source=trio_ftplib + +[report] +precision = 1 +exclude_lines = + pragma: no cover + abc.abstractmethod diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22d5f80 --- /dev/null +++ b/.gitignore @@ -0,0 +1,59 @@ +# Add any project-specific files here: + + +# Sphinx docs +docs/build/ + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*~ +\#* +.#* + +# C extensions +*.so + +# Distribution / packaging +.Python +/build/ +/develop-eggs/ +/dist/ +/eggs/ +/lib/ +/lib64/ +/parts/ +/sdist/ +/var/ +/venv/ +*.egg-info/ +.installed.cfg +*.egg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +.pytest_cache +nosetests.xml +coverage.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Rope +.ropeproject + +# Django stuff: +*.log +*.pot diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..c272180 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..65104a1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/trio-ftplib.iml b/.idea/trio-ftplib.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/.idea/trio-ftplib.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..31c3c9c --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,16 @@ +# https://docs.readthedocs.io/en/latest/yaml-config.html +formats: + - htmlzip + - epub + +requirements_file: ci/rtd-requirements.txt + +# Currently RTD's default image only has 3.5 +# This gets us 3.6 (and hopefully 3.7 in the future) +# https://docs.readthedocs.io/en/latest/yaml-config.html#build-image +build: + image: latest + +python: + version: 3 + pip_install: True diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..92bde40 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +language: python +sudo: false +dist: trusty + +matrix: + include: + # These are quick and often catch errors, so list them first + - python: 3.6 + env: CHECK_DOCS=1 + - python: 3.6 + env: CHECK_FORMATTING=1 + # Uncomment if you want to test on pypy nightly: + # - language: generic + # env: USE_PYPY_NIGHTLY=1 + - python: 3.6 + # As of 2018-07-05, Travis's 3.7 and 3.8 builds only work if you + # use dist: xenial AND sudo: required + # See: https://github.com/python-trio/trio/pull/556#issuecomment-402879391 + - python: 3.7 + dist: xenial + sudo: required + - python: 3.8-dev + dist: xenial + sudo: required + - os: osx + language: generic + env: MACPYTHON=3.6.6 + - os: osx + language: generic + env: MACPYTHON=3.7.0 + +script: + - ci/travis.sh diff --git a/CHEATSHEET.rst b/CHEATSHEET.rst new file mode 100644 index 0000000..b6809bf --- /dev/null +++ b/CHEATSHEET.rst @@ -0,0 +1,82 @@ +Finishing setting up your project +================================= + +Thanks for using cookiecutter-trio! This is your project now; you can +customize it however you like. Here's some reminders of things you +might want to do to get started: + +* Check this into source control (``git init .; git add .; git + commit -m "Initial commit"``) + +* Add a CODE_OF_CONDUCT.md + +* Add a CONTRIBUTING.md + +* Search the source tree for COOKIECUTTER-TRIO-TODO to find other + places to fill in. + +* Enable `Read the Docs `__. (Note: this + project contains a ``.readthedocs.yml`` file that should be enough + to get things working.) + +* Set up continuous integration: Currently, this project is set up to + test on Linux and MacOS using Travis, on Windows using Appveyor, and + to test on PyPy. + + If that's what you want, then go to Travis and Appveyor and enable + testing for your repo. + + If that's not what you want, then you can trim the list by modifying + (or deleting) ``.travis.yml``, ``.appveyor.yml``, ``ci/travis.sh``. + +* Enable `Codecov `__ for your repo. + +* File bugs or pull requests on `cookiecutter-trio + `__ reporting any + problems or awkwardness you ran into (no matter how small!) + +* Delete this checklist once it's no longer useful + + +Tips +==== + +To run tests +------------ + +* Install requirements: ``pip install -r test-requirements.txt`` + (possibly in a virtualenv) + +* Actually run the tests: ``pytest trio_ftplib`` + + +To run black +------------ + +* Show what changes black wants to make: ``black --diff setup.py + trio_ftplib`` + +* Apply all changes directly to the source tree: ``black setup.py + trio_ftplib`` + + +To make a release +----------------- + +* Update the version in ``trio_ftplib/_version.py`` + +* Run ``towncrier`` to collect your release notes. + +* Review your release notes. + +* Check everything in. + +* Double-check it all works, docs build, etc. + +* Build your sdist and wheel: ``python setup.py sdist bdist_wheel`` + +* Upload to PyPI: ``twine upload dist/*`` + +* Use ``git tag`` to tag your version. + +* Don't forget to ``git push --tags``. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..51f3442 --- /dev/null +++ b/LICENSE @@ -0,0 +1,3 @@ +This software is made available under the terms of *either* of the +licenses found in LICENSE.APACHE2 or LICENSE.MIT. Contributions to are +made under the terms of *both* these licenses. diff --git a/LICENSE.APACHE2 b/LICENSE.APACHE2 new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE.APACHE2 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSE.MIT b/LICENSE.MIT new file mode 100644 index 0000000..b8bb971 --- /dev/null +++ b/LICENSE.MIT @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..afc90e2 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,5 @@ +include README.rst CHEATSHEET.rst LICENSE* CODE_OF_CONDUCT* CONTRIBUTING* +include .coveragerc +include test-requirements.txt +recursive-include docs * +prune docs/build diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..444e199 --- /dev/null +++ b/README.rst @@ -0,0 +1,11 @@ +Trio FTPLIB +=========== + +Welcome to `Trio FTPLIB `__! + +Trionic async version of stdlib's ftplib + +License: Your choice of MIT or Apache License 2.0 + +COOKIECUTTER-TRIO-TODO: finish filling in your README! +Must be valid ReST; also used as the PyPI description. diff --git a/ci/rtd-requirements.txt b/ci/rtd-requirements.txt new file mode 100644 index 0000000..67898ba --- /dev/null +++ b/ci/rtd-requirements.txt @@ -0,0 +1,4 @@ +# RTD is currently installing 1.5.3, which has a bug in :lineno-match: +sphinx >= 1.6.1 +sphinx_rtd_theme +sphinxcontrib-trio diff --git a/ci/travis.sh b/ci/travis.sh new file mode 100644 index 0000000..a70f3ad --- /dev/null +++ b/ci/travis.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +set -ex + +if [ "$TRAVIS_OS_NAME" = "osx" ]; then + curl -Lo macpython.pkg https://www.python.org/ftp/python/${MACPYTHON}/python-${MACPYTHON}-macosx10.6.pkg + sudo installer -pkg macpython.pkg -target / + ls /Library/Frameworks/Python.framework/Versions/*/bin/ + PYTHON_EXE=/Library/Frameworks/Python.framework/Versions/*/bin/python3 + # The pip in older MacPython releases doesn't support a new enough TLS + curl https://bootstrap.pypa.io/get-pip.py | sudo $PYTHON_EXE + sudo $PYTHON_EXE -m pip install virtualenv + $PYTHON_EXE -m virtualenv testenv + source testenv/bin/activate +fi + +if [ "$USE_PYPY_NIGHTLY" = "1" ]; then + curl -fLo pypy.tar.bz2 http://buildbot.pypy.org/nightly/py3.5/pypy-c-jit-latest-linux64.tar.bz2 + if [ ! -s pypy.tar.bz2 ]; then + # We know: + # - curl succeeded (200 response code; -f means "exit with error if + # server returns 4xx or 5xx") + # - nonetheless, pypy.tar.bz2 does not exist, or contains no data + # This isn't going to work, and the failure is not informative of + # anything involving this package. + ls -l + echo "PyPy3 nightly build failed to download – something is wrong on their end." + echo "Skipping testing against the nightly build for right now." + exit 0 + fi + tar xaf pypy.tar.bz2 + # something like "pypy-c-jit-89963-748aa3022295-linux64" + PYPY_DIR=$(echo pypy-c-jit-*) + PYTHON_EXE=$PYPY_DIR/bin/pypy3 + ($PYTHON_EXE -m ensurepip \ + && $PYTHON_EXE -m pip install virtualenv \ + && $PYTHON_EXE -m virtualenv testenv) \ + || (echo "pypy nightly is broken; skipping tests"; exit 0) + source testenv/bin/activate +fi + +if [ "$USE_PYPY_RELEASE_VERSION" != "" ]; then + curl -fLo pypy.tar.bz2 https://bitbucket.org/squeaky/portable-pypy/downloads/pypy3.5-${USE_PYPY_RELEASE_VERSION}-linux_x86_64-portable.tar.bz2 + tar xaf pypy.tar.bz2 + # something like "pypy3.5-5.7.1-beta-linux_x86_64-portable" + PYPY_DIR=$(echo pypy3.5-*) + PYTHON_EXE=$PYPY_DIR/bin/pypy3 + $PYTHON_EXE -m ensurepip + $PYTHON_EXE -m pip install virtualenv + $PYTHON_EXE -m virtualenv testenv + source testenv/bin/activate +fi + +pip install -U pip setuptools wheel + +if [ "$CHECK_FORMATTING" = "1" ]; then + pip install black + if ! black --diff --check setup.py trio_ftplib; then + cat <NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/docs/source/_static/.gitkeep b/docs/source/_static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..c9ad714 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,194 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Documentation build configuration file, created by +# sphinx-quickstart on Sat Jan 21 19:11:14 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +# So autodoc can import our package +sys.path.insert(0, os.path.abspath('../..')) + +# Warn about all references to unknown targets +nitpicky = True +# Except for these ones, which we expect to point to unknown targets: +nitpick_ignore = [ + # Format is ("sphinx reference type", "string"), e.g.: + ("py:obj", "bytes-like"), +] + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.coverage', + 'sphinx.ext.napoleon', + 'sphinxcontrib_trio', +] + +intersphinx_mapping = { + "python": ('https://docs.python.org/3', None), + "trio": ('https://trio.readthedocs.io/en/stable', None), +} + +autodoc_member_order = "bysource" + +# Add any paths that contain templates here, relative to this directory. +templates_path = [] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = 'Trio FTPLIB' +copyright = 'The Trio FTPLIB authors' +author = 'The Trio FTPLIB authors' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +import trio_ftplib +version = trio_ftplib.__version__ +# The full version, including alpha/beta/rc tags. +release = version + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# The default language for :: blocks +highlight_language = 'python3' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +#html_theme = 'alabaster' + +# We have to set this ourselves, not only because it's useful for local +# testing, but also because if we don't then RTD will throw away our +# html_theme_options. +import sphinx_rtd_theme +html_theme = 'sphinx_rtd_theme' +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +html_theme_options = { + # default is 2 + # show deeper nesting in the RTD theme's sidebar TOC + # https://stackoverflow.com/questions/27669376/ + # I'm not 100% sure this actually does anything with our current + # versions/settings... + "navigation_depth": 4, + "logo_only": True, +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'trio-ftplibdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'trio-ftplib.tex', 'Trio Documentation', + author, 'manual'), +] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'trio-ftplib', 'Trio FTPLIB Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'trio-ftplib', 'Trio FTPLIB Documentation', + author, 'Trio FTPLIB', 'Trionic async version of stdlib's ftplib', + 'Miscellaneous'), +] diff --git a/docs/source/history.rst b/docs/source/history.rst new file mode 100644 index 0000000..cdfa915 --- /dev/null +++ b/docs/source/history.rst @@ -0,0 +1,6 @@ +Release history +=============== + +.. currentmodule:: trio_ftplib + +.. towncrier release notes start diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..9f45d07 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,23 @@ +.. documentation master file, created by + sphinx-quickstart on Sat Jan 21 19:11:14 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + + +===================================================== +Trio FTPLIB: Trionic async version of stdlib's ftplib +===================================================== + +.. toctree:: + :maxdepth: 2 + + history.rst + +==================== + Indices and tables +==================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` +* :ref:`glossary` diff --git a/newsfragments/.gitkeep b/newsfragments/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/newsfragments/README.rst b/newsfragments/README.rst new file mode 100644 index 0000000..291bfea --- /dev/null +++ b/newsfragments/README.rst @@ -0,0 +1,40 @@ +Adding newsfragments +==================== + +This directory collects "newsfragments": short files that each contain +a snippet of ReST-formatted text that will be added to the next +release notes. This should be a description of aspects of the change +(if any) that are relevant to users. (This contrasts with your commit +message and PR description, which are a description of the change as +relevant to people working on the code itself.) + +Each file should be named like ``..rst``, where +```` is an issue numbers, and ```` is one of: + +* ``feature`` +* ``bugfix`` +* ``doc`` +* ``removal`` +* ``misc`` + +So for example: ``123.feature.rst``, ``456.bugfix.rst`` + +If your PR fixes an issue, use that number here. If there is no issue, +then after you submit the PR and get the PR number you can add a +newsfragment using that instead. + +Note that the ``towncrier`` tool will automatically +reflow your text, so don't try to do any fancy formatting. You can +install ``towncrier`` and then run ``towncrier --draft`` if you want +to get a preview of how your change will look in the final release +notes. + + +Making releases +=============== + +``pip install towncrier``, then run ``towncrier``. (You can use +``towncrier --draft`` to get a preview of what this will do.) + +You can configure ``towncrier`` (for example: customizing the +different types of changes) by modifying ``pyproject.toml``. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..04ba4a3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[tool.towncrier] +package = "trio_ftplib" +filename = "docs/source/history.rst" +directory = "newsfragments" +underlines = ["-", "~", "^"] +# COOKIECUTTER-TRIO-TODO: fill in the URL below to point to your issue tracker: +issue_format = "`#{issue} `__" diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1961e5e --- /dev/null +++ b/setup.py @@ -0,0 +1,46 @@ +from setuptools import setup, find_packages + +exec(open("trio_ftplib/_version.py", encoding="utf-8").read()) + +LONG_DESC = open("README.rst", encoding="utf-8").read() + +setup( + name="trio-ftplib", + version=__version__, + description="Trionic async version of stdlib's ftplib", + url="Project URL (for setup.py metadata)", + long_description=LONG_DESC, + author="Clovis Fabricio Costa", + author_email="python.nosklo@0sg.net", + license="MIT -or- Apache License 2.0", + packages=find_packages(), + install_requires=[ + "trio", + ], + keywords=[ + # COOKIECUTTER-TRIO-TODO: add some keywords + # "async", "io", "networking", ... + ], + python_requires=">=3.6", + classifiers=[ + "License :: OSI Approved :: MIT License", + "License :: OSI Approved :: Apache Software License", + "Framework :: Trio", + # COOKIECUTTER-TRIO-TODO: Remove any of these classifiers that don't + # apply: + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + # COOKIECUTTER-TRIO-TODO: Consider adding trove classifiers for: + # + # - Development Status + # - Intended Audience + # - Topic + # + # For the full list of options, see: + # https://pypi.org/classifiers/ + ], +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..875b940 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,3 @@ +pytest +pytest-cov +pytest-trio diff --git a/trio_ftplib/__init__.py b/trio_ftplib/__init__.py new file mode 100644 index 0000000..cb1d74a --- /dev/null +++ b/trio_ftplib/__init__.py @@ -0,0 +1,3 @@ +"""Top-level package for Trio FTPLIB.""" + +from ._version import __version__ diff --git a/trio_ftplib/_tests/__init__.py b/trio_ftplib/_tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/trio_ftplib/_tests/conftest.py b/trio_ftplib/_tests/conftest.py new file mode 100644 index 0000000..9dbd454 --- /dev/null +++ b/trio_ftplib/_tests/conftest.py @@ -0,0 +1 @@ +from pytest_trio.enable_trio_mode import * diff --git a/trio_ftplib/_tests/test_example.py b/trio_ftplib/_tests/test_example.py new file mode 100644 index 0000000..ce10f92 --- /dev/null +++ b/trio_ftplib/_tests/test_example.py @@ -0,0 +1,15 @@ +import trio + +# We can just use 'async def test_*' to define async tests. +# This also uses a virtual clock fixture, so time passes quickly and +# predictably. +async def test_sleep_with_autojump_clock(autojump_clock): + assert trio.current_time() == 0 + + for i in range(10): + print("Sleeping {} seconds".format(i)) + start_time = trio.current_time() + await trio.sleep(i) + end_time = trio.current_time() + + assert end_time - start_time == i diff --git a/trio_ftplib/_version.py b/trio_ftplib/_version.py new file mode 100644 index 0000000..490c03a --- /dev/null +++ b/trio_ftplib/_version.py @@ -0,0 +1,3 @@ +# This file is imported from __init__.py and exec'd from setup.py + +__version__ = "0.0.0"