Repository: open-reaction-database/ord-schema (language: python)

Issue:
pip install ord-schema



Discussion / hints:

Fix patch:
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
new file mode 100644
index 000000000..d58724f32
--- /dev/null
+++ b/.bumpversion.cfg
@@ -0,0 +1,6 @@
+[bumpversion]
+current_version = 0.3.16
+commit = True
+tag = True
+
+[bumpversion:file:setup.py]
diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml
index 7cecc3a69..70538e005 100644
--- a/.github/workflows/cleanup.yml
+++ b/.github/workflows/cleanup.yml
@@ -20,7 +20,7 @@ jobs:
   check_licenses:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
       - uses: actions/setup-go@v2
         with:
           go-version: '>=1.16'
@@ -35,15 +35,14 @@ jobs:
   check_python:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: s-weigand/setup-conda@v1
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: 3.7
       - name: Install ord-schema
         run: |
-          pip install -r requirements.txt -r test_requirements.txt
-          conda install -c rdkit rdkit
-          python setup.py install
+          cd "${GITHUB_WORKSPACE}"
+          python -m pip install .[rdkit,tests]
       - name: Run black
         run: |
           cd "${GITHUB_WORKSPACE}"
@@ -60,7 +59,7 @@ jobs:
   check_proto:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
       - name: clang-format
         run: |
           cd "${GITHUB_WORKSPACE}"
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 000000000..48b0a9900
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,52 @@
+# Copyright 2022 Open Reaction Database Project Authors
+#
+# 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.
+
+name: Publish
+
+on:
+  push:
+    branches:
+      - main
+
+jobs:
+  publish:
+    if: github.repository == "open-reaction-database/ord-schema"
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          token: ${{ secrets.ACTIONS_PUSH }}
+      - uses: actions/setup-python@v4
+        with:
+          python-version: 3.7
+      - name: Bump patch version
+        run: |
+          cd "${GITHUB_WORKSPACE}"
+          git config user.name github-actions
+          git config user.email github-actions@github.com
+          python -m pip install bump2version
+          bump2version patch
+          git push --tags
+      - name: Push to GitHub
+        run: |
+          cd "${GITHUB_WORKSPACE}"
+      - name: Build distribution
+        run: |
+          cd "${GITHUB_WORKSPACE}"
+          python -m build
+      - name: Upload to PyPI
+        run: |
+          cd "${GITHUB_WORKSPACE}"
+          python -m pip install twine
+          TWINE_USERNAME="__token__" TWINE_PASSWORD="${{ secrets.PYPI_API_TOKEN }}" python -m twine upload dist/*
diff --git a/.pylintrc b/.pylintrc
index d2c19f913..35f266a59 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -260,13 +260,6 @@ max-line-length=120
 # Maximum number of lines in a module.
 max-module-lines=1500
 
-# List of optional constructs for which whitespace checking is disabled. `dict-
-# separator` is used to allow tabulation in dicts, etc.: {1  : 1,\n222: 2}.
-# `trailing-comma` allows a space between comma and closing bracket: (a, ).
-# `empty-line` allows space-only lines.
-no-space-check=trailing-comma,
-               dict-separator
-
 # Allow the body of a class to be on the same line as the declaration if body
 # contains single statement.
 single-line-class-stmt=no
diff --git a/README.md b/README.md
index b7324febd..49f0d42bb 100644
--- a/README.md
+++ b/README.md
@@ -4,45 +4,42 @@
 [![codecov](https://codecov.io/gh/Open-Reaction-Database/ord-schema/branch/main/graph/badge.svg)](https://codecov.io/gh/Open-Reaction-Database/ord-schema)
 
 This repository contains the schema for the Open Reaction Database initiative; please see the documentation
-at http://open-reaction-database.org.
+at https://docs.open-reaction-database.org.
 
 This repository does not contain the database itself; that is stored
 in [ord-data](https://github.com/open-reaction-database/ord-data). Rather, `ord-schema` is
 designed to store the database schema and tools for creating, validating, and submitting data to the database.
 
-Consider joining the [mailing list](https://groups.google.com/forum/#!members/open-reaction-database) to stay up to date
-with announcements and opportunities for providing feedback.
+## Installation
 
-## Examples
+If you have __not__ previously installed rdkit via conda:
 
-The `examples/` directory contains examples of dataset creation and use.
+```shell
+$ pip install ord-schema[rdkit]
+```
 
-Click here to run the examples with
-Binder: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-reaction-database/ord-schema/HEAD?filepath=examples)
+Otherwise:
 
-## Installation
+```shell
+$ pip install ord-schema
+```
 
-Many of the schema validators require [RDKit](https://github.com/rdkit/rdkit), so we recommend that you
-install `ord-schema` in a conda environment.
+To install in editable/development mode:
 
-1. Clone the `ord-schema` repository to your local machine. If you are planning to contribute changes,
-   you should fork the repository first
-   (see [Contributing](https://github.com/Open-Reaction-Database/ord-schema/blob/main/CONTRIBUTING.md)).
-2. Install Anaconda or Miniconda ([instructions](https://docs.conda.io/projects/conda/en/latest/user-guide/install/)).
-3. Run the following commands to install `ord-schema`:
+```shell
+$ git clone https://github.com/open-reaction-database/ord-schema.git
+$ cd ord-schema
+$ python setup.py build  # Compile protocol buffers.
+$ pip install -e .
+```
 
-   ```shell
-   $ pip install -r requirements.txt
-   $ conda install -c rdkit rdkit
-   $ python setup.py install
-   ```
+## Examples
 
-4. After installation, you can run the tests by executing
+The `examples/` directory contains examples of dataset creation and use. To run locally, install with:
 
-   ```shell
-   $ pip install -r test_requirements.txt
-   $ pytest
-   ```
+```shell
+$ pip install "ord-schema[examples]"
+```
 
-   If you are making changes, use `python setup.py build develop` to recompile the protocol buffers and install the
-   package in development mode. You should also be sure to run `format.sh` when committing changes.
+Click here to run the examples with
+Binder: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-reaction-database/ord-schema/HEAD?filepath=examples)
diff --git a/example_requirements.txt b/example_requirements.txt
deleted file mode 100644
index e065ab293..000000000
--- a/example_requirements.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-glob2>=0.7
-matplotlib>=3.3.4
-scikit-learn>=0.24.1
-tensorflow>=2.4.1
-tqdm>=4.61.2
-wget>=3.2
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 0c0f24774..000000000
--- a/requirements.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-docopt>=0.6.2
-flask>=1.1.2
-jinja2>=2.0.0
-joblib>=1.0.0
-numpy>=1.18.1
-openpyxl>=3.0.5
-pandas>=1.0.4
-protobuf>=3.13.0,<3.20.0
-pygithub>=1.51
-python-dateutil>=1.10.0
-xlrd>=2.0.1
-xlwt>=1.3.0
diff --git a/setup.py b/setup.py
index 428f0e156..d18771f71 100644
--- a/setup.py
+++ b/setup.py
@@ -16,22 +16,64 @@
 import setuptools
 
 
-with open("requirements.txt", "r") as f:
-    requirements = f.readlines()
-
+with open("README.md") as f:
+    long_description = f.read()
 
 setuptools.setup(
     name="ord-schema",
+    version="0.3.16",
     description="Schema for the Open Reaction Database",
+    long_description=long_description,
+    long_description_content_type="text/markdown",
     url="https://github.com/Open-Reaction-Database/ord-schema",
-    license="Apache License, Version 2.0",
+    classifiers=[
+        "Programming Language :: Python :: 3",
+        "License :: OSI Approved :: Apache Software License",
+        "Operating System :: OS Independent",
+    ],
     packages=setuptools.find_packages(),
     package_data={
-        "ord_schema.visualization": [
-            "reaction.html",
-            "template.html",
-            "template.txt",
+        "ord_schema.proto": [
+            "dataset.proto",
+            "reaction.proto",
+            "test.proto",
+        ],
+    },
+    python_requires=">=3.7",
+    install_requires=[
+        "docopt>=0.6.2",
+        "flask>=1.1.2",
+        "jinja2>=2.0.0",
+        "joblib>=1.0.0",
+        "numpy>=1.18.1",
+        "openpyxl>=3.0.5",
+        "pandas>=1.0.4",
+        "protobuf<3.20,>=3.13.0",
+        "pygithub>=1.51",
+        "python-dateutil>=1.10.0",
+        "xlrd>=2.0.1",
+        "xlwt>=1.3.0",
+    ],
+    extras_require={
+        "examples": [
+            "glob2>=0.7",
+            "matplotlib>=3.3.4",
+            "scikit-learn>=0.24.1",
+            "tensorflow>=2.4.1",
+            "tqdm>=4.61.2",
+            "wget>=3.2",
+        ],
+        "rdkit": [
+            "rdkit-pypi>=2021.9.5",
+        ],
+        "tests": [
+            "black[jupyter]>=22.3.0",
+            "coverage>=5.2.1",
+            "pylint>=2.13.9",
+            "pytest>=7.1.1",
+            "pytest-cov>=3.0.0",
+            "pytype>=2022.5.19",
+            "treon>=0.1.3",
         ],
     },
-    install_requires=requirements,
 )


Test patch:
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml
index de10d2751..4a0c3a8b3 100644
--- a/.github/workflows/run_tests.yml
+++ b/.github/workflows/run_tests.yml
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-name: CI
+name: Tests
 
 on: [ pull_request, push ]
 
@@ -20,16 +20,14 @@ jobs:
   test_ord_schema:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: s-weigand/setup-conda@v1
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: 3.7
       - name: Install ord_schema
         run: |
           cd "${GITHUB_WORKSPACE}"
-          pip install -r requirements.txt -r test_requirements.txt
-          conda install -c rdkit rdkit
-          python setup.py install
+          python -m pip install .[rdkit,tests]
       - name: Run tests
         run: |
           cd "${GITHUB_WORKSPACE}"
@@ -41,19 +39,14 @@ jobs:
   test_notebooks:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: s-weigand/setup-conda@v1
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: 3.7
       - name: Install ord_schema
         run: |
           cd "${GITHUB_WORKSPACE}"
-          pip install -r requirements.txt -r example_requirements.txt -r test_requirements.txt
-          # Fix TensorFlow protobuf version mismatch.
-          PROTOBUF="$(pip show protobuf | grep Version | awk '{ print $2; }')"
-          pip install protoc-wheel-0=="${PROTOBUF}"
-          conda install -c rdkit rdkit
-          python setup.py install
+          python -m pip install .[examples,rdkit,tests]
       - name: Test notebooks
         run: |
           cd "${GITHUB_WORKSPACE}"
diff --git a/test_requirements.txt b/test_requirements.txt
deleted file mode 100644
index cebb859f6..000000000
--- a/test_requirements.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-black[jupyter]>=22.3.0
-coverage>=5.2.1
-pylint>=2.13.9
-pytest>=7.1.1
-pytest-cov>=3.0.0
-pytype>=2022.5.19
-treon>=0.1.3