Skip to content
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

Migrate to pyproject.toml and hatchling #6

Merged
merged 16 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ ARG BUILDER_GID=1000
ENV BUILDER_USER elastic
ENV BUILDER_GROUP elastic

WORKDIR /code/elasticsearch-serverless-python

# Create user
RUN groupadd --system -g ${BUILDER_GID} ${BUILDER_GROUP} \
&& useradd --system --shell /bin/bash -u ${BUILDER_UID} -g ${BUILDER_GROUP} -d /var/lib/elastic -m elastic 1>/dev/null 2>/dev/null \
&& mkdir -p /code/elasticsearch-py && mkdir /code/elasticsearch-py/build \
&& mkdir /code/elasticsearch-serverless-python/build \
&& chown -R ${BUILDER_USER}:${BUILDER_GROUP} /code/
COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
WORKDIR /code/elasticsearch-py
USER ${BUILDER_USER}:${BUILDER_GROUP}
COPY dev-requirements.txt .
COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
RUN python -m pip install \
-U --no-cache-dir \
--disable-pip-version-check \
nox -rdev-requirements.txt
COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
RUN python -m pip install -U -e .
.[dev]
7 changes: 1 addition & 6 deletions .ci/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,7 @@ if [[ "$CMD" == "assemble" ]]; then
fi

if [[ "$CMD" == "bump" ]]; then
docker run \
--rm -v $repo:/code/elasticsearch-serverless-python \
$product \
/bin/bash -c "python /code/elasticsearch-serverless-python/utils/bump-version.py $VERSION"

exit 0
echo "TODO"
pquentin marked this conversation as resolved.
Show resolved Hide resolved
fi

if [[ "$CMD" == "codegen" ]]; then
Expand Down
10 changes: 8 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
---
version: 2
sphinx:
configuration: docs/sphinx/conf.py

build:
os: ubuntu-22.04
tools:
python: "3.10"

python:
version: "3.7"
install:
- requirements: dev-requirements.txt
- path: .
extra_requirements:
- "docs"
14 changes: 0 additions & 14 deletions MANIFEST.in

This file was deleted.

24 changes: 0 additions & 24 deletions dev-requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions docs/sphinx/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ arguments are required for all
Elasticsearch
-------------

.. py:module:: elasticsearch
.. py:module:: elasticsearch_serverless

.. autoclass:: Elasticsearch
:members:

.. py:module:: elasticsearch.client
.. py:module:: elasticsearch_serverless.client

Async Search
------------
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
master_doc = "index"

# General information about the project.
project = "Python Elasticsearch client"
project = "Python Elasticsearch Serverless client"
copyright = "%d, Elasticsearch B.V" % datetime.date.today().year

version = elasticsearch_serverless.__versionstr__
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Exceptions & Warnings
=====================

.. py:module:: elasticsearch
.. py:module:: elasticsearch_serverless

API Errors
----------
Expand Down
6 changes: 3 additions & 3 deletions docs/sphinx/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Python Elasticsearch Client
===========================
Python Elasticsearch Serverless Client
======================================

Official low-level client for Elasticsearch. Its goal is to provide common
Official low-level client for Elasticsearch Serverless. Its goal is to provide common
ground for all Elasticsearch-related code in Python; because of this it tries
to be opinion-free and very extendable.

Expand Down
11 changes: 2 additions & 9 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
SOURCE_DIR = os.path.dirname(os.path.abspath(__file__))
SOURCE_FILES = (
"docs/sphinx/conf.py",
"setup.py",
"noxfile.py",
"elasticsearch_serverless/",
"test_elasticsearch_serverless/",
Expand All @@ -32,8 +31,7 @@

@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
def test(session):
session.install(".")
session.install("-r", "dev-requirements.txt")
session.install(".[dev]")

junit_xml = os.path.join(
SOURCE_DIR, "junit", "elasticsearch-serverless-python-junit.xml"
Expand Down Expand Up @@ -106,10 +104,5 @@ def lint(session):

@nox.session()
def docs(session):
session.install(
"-rdev-requirements.txt", "sphinx-rtd-theme", "sphinx-autodoc-typehints"
)
session.install(".")
session.run("python", "-m", "pip", "install", "sphinx-autodoc-typehints")

session.install(".[docs]")
session.run("sphinx-build", "docs/sphinx/", "docs/sphinx/_build", "-b", "html")
111 changes: 111 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "elasticsearch-serverless"
version = "0.1.0"
description = "Python client for Elasticsearch Serverless"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.7, <4"
authors = [
{ name = "Elastic Clients Team", email = "clients-team@elastic.co" },
]
maintainers = [
{ name = "Elastic Clients Team", email = "clients-team@elastic.co" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
keywords = [
"elasticsearch",
"elastic",
"kibana",
"mapping",
"REST",
"search",
"client",
"index",
]
dependencies = [
"elastic-transport>=8,<9",
]

[project.optional-dependencies]
async = [
"aiohttp>=3,<4",
]
requests = [
"requests>=2.4.0, <3.0.0",
]
dev = [
"requests>=2, <3",
"aiohttp",
"pytest",
"pytest-cov",
"pytest-asyncio",
"coverage",
"jinja2",
"python-dateutil",
"unasync",
"pyyaml>=5.4",
"isort",
"black",
"twine",
"build",
"nox",
"numpy",
"pandas",
"mapbox-vector-tile",
]
docs = [
"sphinx-rtd-theme>=1.2.2",
"sphinx-autodoc-typehints",
"sphinx==6.2.1",
]

[project.urls]
Documentation = "https://elasticsearch-serverless-python.readthedocs.io"
Homepage = "https://github.com/elastic/elasticsearch-serverless-python"
"Issue Tracker" = "https://github.com/elastic/elasticsearch-serverless-python/issues"
"Source Code" = "https://github.com/elastic/elasticsearch-serverless-python"

[tool.hatch.build.targets.sdist]
include = [
"/elasticsearch_serverless",
"/CHANGELOG.md",
"/CONTRIBUTING.md",
"/LICENSE",
"/NOTICE",
"/README.rst",
"/setup.cfg",
"/docs/sphinx",
]

[tool.pytest]
junit_family = "legacy"
addopts = "-vvv -p no:logging --cov-report=term-missing --cov=elasticsearch_serverless --cov-config=.pyproject.toml"

[tool.isort]
profile = "black"

[tool.coverage.report]
exclude_lines = [
"raise NotImplementedError*",
]

[tool.mypy]
ignore_missing_imports = true
14 changes: 0 additions & 14 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
[flake8]
ignore = E203, E266, E501, W503

[tool:pytest]
junit_family=legacy
addopts = -vvv -p no:logging --cov-report=term-missing --cov=elasticsearch --cov-config=.coveragerc

[tool:isort]
profile=black

[report]
exclude_lines=
raise NotImplementedError*

[mypy]
ignore_missing_imports = True
99 changes: 0 additions & 99 deletions setup.py

This file was deleted.

Loading