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 fully to pyproject.toml #1737

Merged
merged 7 commits into from
Aug 10, 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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:

services:
mongo:
image: mongo:4
image: mongo:6
ports:
- 27017:27017
postgres:
Expand Down Expand Up @@ -349,4 +349,4 @@ jobs:
pip install -e .[all]

- name: Build source distribution
run: python ./setup.py sdist
run: python -m build
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV PYTHONUNBUFFERED 1
WORKDIR /app

# Copy repo contents
COPY setup.py pyproject.toml requirements.txt requirements-server.txt LICENSE MANIFEST.in README.md .docker/run.sh ./
COPY pyproject.toml requirements.txt requirements-server.txt LICENSE README.md .docker/run.sh ./
COPY optimade ./optimade
COPY providers/src/links/v1/providers.json ./optimade/server/data/
RUN apt-get purge -y --auto-remove \
Expand Down
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

2 changes: 0 additions & 2 deletions optimade/validator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ def validate(): # pragma: no cover
)
parser.add_argument(
"base_url",
nargs="?",
default="http://localhost:5000/v0",
help=(
"The base URL of the OPTIMADE implementation to point at, "
"e.g. 'http://example.com/optimade/v1' or 'http://localhost:5000/v1'"
Expand Down
118 changes: 118 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,121 @@
[build-system]
requires = ["setuptools >= 61.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "optimade"
description = "Tools for implementing and consuming OPTIMADE APIs."
readme = "README.md"
keywords = ["optimade", "jsonapi", "materials"]
license = { text = "MIT" }
authors = [{ name = "OPTIMADE development team", email = "[email protected]" }]
dynamic = ["version"]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Database",
"Topic :: Scientific/Engineering",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Database :: Front-Ends",
]
requires-python = ">=3.9"
dependencies = [
"lark~=1.1",
"pydantic~=1.10,>=1.10.2,!=1.10.7",
"email_validator>=1.2",
"requests~=2.28",
]

[project.scripts]
optimade-validator = "optimade.validator:validate"
optimade-get = "optimade.client.cli:get"


[project.urls]
"Homepage" = "https://github.com/Materials-Consortia/optimade-python-tools"
"Bug Tracker" = "https://github.com/Materials-Consortia/optimade-python-tools/issues"
"Documentation" = "https://optimade.org/optimade-python-tools"

[tools.setuptools]
license-files = ["LICENSE"]
include-package-data = true

[tool.setuptools.dynamic]
version = {attr = "optimade.__version__"}

[tool.setuptools.packages.find]
namespaces = false

[tool.setuptools.package-data]
optimade = ["py.typed"]
"optimade.server" = ["*.json"]
"optimade.server.data" = ["*.json"]
"optimade.server.routers" = ["static/*.html"]
"optimade.grammar" = ["*.lark"]



[project.optional-dependencies]
elastic = ["elasticsearch-dsl~=7.4,<8.0", "elasticsearch~=7.17"]
mongo = ["pymongo~=4.0", "mongomock~=4.1"]
server = [
"uvicorn[standard]~=0.19",
"fastapi~=0.86,<0.99",
"pyyaml~=6.0",
"optimade[mongo]",
]

# Client minded
aiida = ["aiida-core~=2.1"]

http_client = [
"httpx~=0.23",
"rich~=13.0",
"click~=8.1",
]

ase = ["ase~=3.22"]
cif = ["numpy>=1.20"]
pymatgen = ["pymatgen>=2022"]
jarvis = ["jarvis-tools>=2023.1.8"]
client = ["optimade[cif]"]

# General
docs = [
"mike~=1.1",
"mkdocs~=1.4",
"mkdocs-awesome-pages-plugin~=2.8",
"mkdocs-material~=9.0",
"mkdocstrings[python-legacy]~=0.20",
]

testing = [
"build~=0.9.0",
"jsondiff~=2.0",
"pytest~=7.2",
"pytest-cov~=4.0",
"optimade[server]",
]

dev = [
"black~=23.1",
"isort~=5.12",
"mypy~=1.0",
"pre-commit~=3.0",
"invoke~=2.0",
"types-all==1.0.0",
"ruff~=0.0",
"optimade[docs,testing,client,http_client]"
]

all = ["optimade[dev,elastic,aiida,ase,pymatgen,jarvis,http_client,client]"]


[tool.ruff]
select = ["E", "F", "I", "W", "Q"]
ignore = ["E501", "E402"]
Expand Down
147 changes: 0 additions & 147 deletions setup.py

This file was deleted.

6 changes: 3 additions & 3 deletions tests/adapters/structures/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

def get_min_ver(dependency: str) -> str:
"""Retrieve version of `dependency` from setup.py, raise if not found."""
setup_py = Path(__file__).parent.joinpath("../../../setup.py")
with open(setup_py, "r") as setup_file:
pyproject_toml = Path(__file__).parent.joinpath("../../../pyproject.toml")
with open(pyproject_toml, "r") as setup_file:
for line in setup_file.readlines():
min_ver = re.findall(rf'"{dependency}((=|!|<|>|~)=|>|<)(.+)"', line)
if min_ver:
return min_ver[0][2].split(";")[0].split(",")[0]
else:
raise RuntimeError(f"Cannot find {dependency} dependency in setup.py")
raise RuntimeError(f"Cannot find {dependency} dependency in pyproject.toml")
2 changes: 1 addition & 1 deletion tests/validator/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def monkey_patched_get_endpoint(
expected_status_code=200,
content=b"version\n1",
content_type="text/csv;header=present",
**kwargs
**kwargs,
):
r = Response()
if expected_status_code == 200:
Expand Down