diff --git a/.drone.yml b/.drone.yml index d6d839db1..55d1c81ee 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,25 +1,3 @@ ---- -kind: pipeline -name: python-3-6 -type: docker -platform: - os: linux - arch: amd64 - -steps: -- name: test - image: python:3.6 - commands: - - pip install -U setuptools pip - - bash .travis.fuseki_install_optional.sh - - pip install --default-timeout 60 -r requirements.txt - - pip install --default-timeout 60 -r requirements.dev.txt - - pip install --default-timeout 60 coveralls && export HAS_COVERALLS=1 - - python setup.py install - - flake8 --exit-zero rdflib - - PYTHONWARNINGS=default nosetests --with-timer --timer-top-n 42 - - --- kind: pipeline name: python-3-7 @@ -48,6 +26,7 @@ steps: - pip install --default-timeout 60 -r requirements.dev.txt - pip install --default-timeout 60 coveralls && export HAS_COVERALLS=1 - python setup.py install + - black --config black.toml --check ./rdflib | true - flake8 --exit-zero rdflib - PYTHONWARNINGS=default nosetests --with-timer --timer-top-n 42 --with-coverage --cover-tests --cover-package=rdflib - coverage report --skip-covered @@ -68,8 +47,27 @@ steps: - bash .travis.fuseki_install_optional.sh - pip install --default-timeout 60 -r requirements.txt - pip install --default-timeout 60 -r requirements.dev.txt - - pip install --default-timeout 60 coveralls && export HAS_COVERALLS=1 - python setup.py install + - black --config black.toml --check ./rdflib | true - flake8 --exit-zero rdflib - PYTHONWARNINGS=default nosetests --with-timer --timer-top-n 42 +--- +kind: pipeline +name: python-3-9 +type: docker +platform: + os: linux + arch: amd64 + +steps: +- name: test + image: python:3.9 + commands: + - bash .travis.fuseki_install_optional.sh + - pip install --default-timeout 60 -r requirements.txt + - pip install --default-timeout 60 -r requirements.dev.txt + - python setup.py install + - black --config black.toml --check ./rdflib | true + - flake8 --exit-zero rdflib + - PYTHONWARNINGS=default nosetests --with-timer --timer-top-n 42 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..774bb979e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,31 @@ +# EditorConfig is awesome: +# http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +# Leave line endings as-is in Markdown and ReStructuredText files +[*.{md, rst}] +charset = utf-8 +trim_trailing_whitespace = false + +# Matches multiple files with brace expansion notation +# Set default charset +[*.{js, py, pyi, toml, yml, yaml}] +charset = utf-8 + +# 4 space indentation +[*.py] +indent_style = space +indent_size = 4 +max_line_length = 88 + +# tab indentation +[Makefile] +indent_style = tab diff --git a/Makefile b/Makefile index 7c484cfc7..171f76cfd 100644 --- a/Makefile +++ b/Makefile @@ -7,4 +7,10 @@ build: coverage: docker-compose -f docker-compose.tests.yml up test-runner-coverage - docker-compose -f docker-compose.tests.yml down \ No newline at end of file + docker-compose -f docker-compose.tests.yml down + +reformat: + black --config ./black.toml . + +check-format: + black --config ./black.toml --check . diff --git a/black.toml b/black.toml new file mode 100644 index 000000000..abdef9fa0 --- /dev/null +++ b/black.toml @@ -0,0 +1,31 @@ +[tool.black] +required-version = "21.6b0" +line-length = "88" +skip-string-normalization = true +target-version = ['py37'] +include = '\.pyi?$' +exclude = ''' +( + /( + \.eggs # exclude a few common directories in the + | \.git # root of the project + | \.hg + | \.mypy_cache + | \.pytest_cache + | \.tox + | \.venv + | \.github + | _build + | htmlcov + | benchmarks + | examples # No need to Black examples + | test # Tests are a mess, don't black them + | test_reports + | rdflib.egg-info + | buck-out + | build + | dist + | venv + )/ +) +''' diff --git a/docs/developers.rst b/docs/developers.rst index b8c8310c3..56d6761b3 100644 --- a/docs/developers.rst +++ b/docs/developers.rst @@ -12,7 +12,8 @@ developing RDFLib code. Please be as Pythonic as possible (:pep:`8`). Code should be formatted using `black `_. -While not yet mandatory, it will be required in the future (6.0.0+). +While not yet mandatory, it will be required in the future (6.0.0+).1 +Use Black v21.6b1, with the black.toml config file provided. Any new functionality being added to RDFLib should have doc tests and unit tests. Tests should be added for any functionality being changed @@ -22,6 +23,7 @@ did not break anything. If you add a new cool feature, consider also adding an example in ``./examples`` + Running tests ------------- Run tests with `nose `_: @@ -61,9 +63,9 @@ flag them as expecting to fail. Compatibility ------------- -RDFLib 5.x.y tries to be compatible with python versions 2.7, 3.4, 3.5, 3.6, 3.7. +RDFLib 5.0.0 maintained compatibility with python versions 2.7, 3.4, 3.5, 3.6, 3.7. -The current master branch (which will be released as 6.0.0) will only support Python 3.6 and newer. +The latest 6.0.0 release and subsequent will only support Python 3.7 and newer. Releasing diff --git a/requirements.dev.txt b/requirements.dev.txt index 09500eb1d..e0b9cf7af 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -5,4 +5,5 @@ nose-timer coverage flake8 doctest-ignore-unicode==0.1.2 -berkeleydb \ No newline at end of file +berkeleydb +black==21.6b0 diff --git a/setup.py b/setup.py index 8d5a73c12..8f5efe1ba 100644 --- a/setup.py +++ b/setup.py @@ -9,8 +9,12 @@ kwargs["tests_require"] = [ "html5lib", "networkx", - "nose", - "doctest-ignore-unicode", + "nose==1.3.7", + "nose-timer", + "coverage", + "black==21.6b0", + "flake8", + "doctest-ignore-unicode==0.1.2", ] kwargs["test_suite"] = "nose.collector" kwargs["extras_require"] = { @@ -49,13 +53,13 @@ def find_version(filename): url="https://github.com/RDFLib/rdflib", license="BSD-3-Clause", platforms=["any"], - python_requires=">=3.6", + python_requires=">=3.7", classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 3", - "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", "Topic :: Software Development :: Libraries :: Python Modules", "Operating System :: OS Independent",