Skip to content

Commit 6f13e85

Browse files
JoshMockpquentin
andauthored
Migrate to pyproject.toml and hatchling (#6)
Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
1 parent 5fea5c1 commit 6f13e85

File tree

14 files changed

+134
-267
lines changed

14 files changed

+134
-267
lines changed

.ci/Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@ ARG BUILDER_GID=1000
88
ENV BUILDER_USER elastic
99
ENV BUILDER_GROUP elastic
1010

11+
WORKDIR /code/elasticsearch-serverless-python
12+
1113
# Create user
1214
RUN groupadd --system -g ${BUILDER_GID} ${BUILDER_GROUP} \
1315
&& useradd --system --shell /bin/bash -u ${BUILDER_UID} -g ${BUILDER_GROUP} -d /var/lib/elastic -m elastic 1>/dev/null 2>/dev/null \
14-
&& mkdir -p /code/elasticsearch-py && mkdir /code/elasticsearch-py/build \
16+
&& mkdir /code/elasticsearch-serverless-python/build \
1517
&& chown -R ${BUILDER_USER}:${BUILDER_GROUP} /code/
16-
COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
17-
WORKDIR /code/elasticsearch-py
1818
USER ${BUILDER_USER}:${BUILDER_GROUP}
19-
COPY dev-requirements.txt .
19+
COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
2020
RUN python -m pip install \
2121
-U --no-cache-dir \
2222
--disable-pip-version-check \
23-
nox -rdev-requirements.txt
24-
COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
25-
RUN python -m pip install -U -e .
23+
.[dev]

.ci/make.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,7 @@ if [[ "$CMD" == "assemble" ]]; then
152152
fi
153153

154154
if [[ "$CMD" == "bump" ]]; then
155-
docker run \
156-
--rm -v $repo:/code/elasticsearch-serverless-python \
157-
$product \
158-
/bin/bash -c "python /code/elasticsearch-serverless-python/utils/bump-version.py $VERSION"
159-
160-
exit 0
155+
echo "TODO"
161156
fi
162157

163158
if [[ "$CMD" == "codegen" ]]; then

.readthedocs.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
---
12
version: 2
23
sphinx:
34
configuration: docs/sphinx/conf.py
45

6+
build:
7+
os: ubuntu-22.04
8+
tools:
9+
python: "3.10"
10+
511
python:
6-
version: "3.7"
712
install:
8-
- requirements: dev-requirements.txt
913
- path: .
14+
extra_requirements:
15+
- "docs"

MANIFEST.in

Lines changed: 0 additions & 14 deletions
This file was deleted.

dev-requirements.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/sphinx/api.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ arguments are required for all
1717
Elasticsearch
1818
-------------
1919

20-
.. py:module:: elasticsearch
20+
.. py:module:: elasticsearch_serverless
2121
2222
.. autoclass:: Elasticsearch
2323
:members:
2424

25-
.. py:module:: elasticsearch.client
25+
.. py:module:: elasticsearch_serverless.client
2626
2727
Async Search
2828
------------

docs/sphinx/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
master_doc = "index"
3636

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

4141
version = elasticsearch_serverless.__versionstr__

docs/sphinx/exceptions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Exceptions & Warnings
44
=====================
55

6-
.. py:module:: elasticsearch
6+
.. py:module:: elasticsearch_serverless
77
88
API Errors
99
----------

docs/sphinx/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Python Elasticsearch Client
2-
===========================
1+
Python Elasticsearch Serverless Client
2+
======================================
33

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

noxfile.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
SOURCE_DIR = os.path.dirname(os.path.abspath(__file__))
2323
SOURCE_FILES = (
2424
"docs/sphinx/conf.py",
25-
"setup.py",
2625
"noxfile.py",
2726
"elasticsearch_serverless/",
2827
"test_elasticsearch_serverless/",
@@ -32,8 +31,7 @@
3231

3332
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
3433
def test(session):
35-
session.install(".")
36-
session.install("-r", "dev-requirements.txt")
34+
session.install(".[dev]")
3735

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

107105
@nox.session()
108106
def docs(session):
109-
session.install(
110-
"-rdev-requirements.txt", "sphinx-rtd-theme", "sphinx-autodoc-typehints"
111-
)
112-
session.install(".")
113-
session.run("python", "-m", "pip", "install", "sphinx-autodoc-typehints")
114-
107+
session.install(".[docs]")
115108
session.run("sphinx-build", "docs/sphinx/", "docs/sphinx/_build", "-b", "html")

pyproject.toml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "elasticsearch-serverless"
7+
version = "0.1.0"
8+
description = "Python client for Elasticsearch Serverless"
9+
readme = "README.rst"
10+
license = "Apache-2.0"
11+
requires-python = ">=3.7, <4"
12+
authors = [
13+
{ name = "Elastic Clients Team", email = "clients-team@elastic.co" },
14+
]
15+
maintainers = [
16+
{ name = "Elastic Clients Team", email = "clients-team@elastic.co" },
17+
]
18+
classifiers = [
19+
"Development Status :: 5 - Production/Stable",
20+
"Intended Audience :: Developers",
21+
"License :: OSI Approved :: Apache Software License",
22+
"Operating System :: OS Independent",
23+
"Programming Language :: Python",
24+
"Programming Language :: Python :: 3",
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: 3.8",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: Implementation :: CPython",
29+
"Programming Language :: Python :: Implementation :: PyPy",
30+
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
]
33+
keywords = [
34+
"elasticsearch",
35+
"elastic",
36+
"kibana",
37+
"mapping",
38+
"REST",
39+
"search",
40+
"client",
41+
"index",
42+
]
43+
dependencies = [
44+
"elastic-transport>=8,<9",
45+
]
46+
47+
[project.optional-dependencies]
48+
async = [
49+
"aiohttp>=3,<4",
50+
]
51+
requests = [
52+
"requests>=2.4.0, <3.0.0",
53+
]
54+
dev = [
55+
"requests>=2, <3",
56+
"aiohttp",
57+
"pytest",
58+
"pytest-cov",
59+
"pytest-asyncio",
60+
"coverage",
61+
"jinja2",
62+
"python-dateutil",
63+
"unasync",
64+
"pyyaml>=5.4",
65+
"isort",
66+
"black",
67+
"twine",
68+
"build",
69+
"nox",
70+
"numpy",
71+
"pandas",
72+
"mapbox-vector-tile",
73+
]
74+
docs = [
75+
"sphinx-rtd-theme>=1.2.2",
76+
"sphinx-autodoc-typehints",
77+
"sphinx==6.2.1",
78+
]
79+
80+
[project.urls]
81+
Documentation = "https://elasticsearch-serverless-python.readthedocs.io"
82+
Homepage = "https://github.com/elastic/elasticsearch-serverless-python"
83+
"Issue Tracker" = "https://github.com/elastic/elasticsearch-serverless-python/issues"
84+
"Source Code" = "https://github.com/elastic/elasticsearch-serverless-python"
85+
86+
[tool.hatch.build.targets.sdist]
87+
include = [
88+
"/elasticsearch_serverless",
89+
"/CHANGELOG.md",
90+
"/CONTRIBUTING.md",
91+
"/LICENSE",
92+
"/NOTICE",
93+
"/README.rst",
94+
"/setup.cfg",
95+
"/docs/sphinx",
96+
]
97+
98+
[tool.pytest]
99+
junit_family = "legacy"
100+
addopts = "-vvv -p no:logging --cov-report=term-missing --cov=elasticsearch_serverless --cov-config=.pyproject.toml"
101+
102+
[tool.isort]
103+
profile = "black"
104+
105+
[tool.coverage.report]
106+
exclude_lines = [
107+
"raise NotImplementedError*",
108+
]
109+
110+
[tool.mypy]
111+
ignore_missing_imports = true

setup.cfg

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,2 @@
11
[flake8]
22
ignore = E203, E266, E501, W503
3-
4-
[tool:pytest]
5-
junit_family=legacy
6-
addopts = -vvv -p no:logging --cov-report=term-missing --cov=elasticsearch --cov-config=.coveragerc
7-
8-
[tool:isort]
9-
profile=black
10-
11-
[report]
12-
exclude_lines=
13-
raise NotImplementedError*
14-
15-
[mypy]
16-
ignore_missing_imports = True

setup.py

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)