From 7c036a98e9a74b050652cf8818051e657e73a8d3 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Tue, 15 Oct 2024 20:24:38 +0000 Subject: [PATCH 1/3] Preparing package for SIMPLE Archive --- .devcontainer/devcontainer.json | 2 +- .github/workflows/python-app.yml | 2 +- .github/workflows/scheduled-tests.yml | 2 +- .gitignore | 3 +- pyproject.toml | 42 +++++++++++++++++++++++++++ requirements.txt | 5 ---- simple/__init__.py | 3 ++ 7 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ec689f0c1..a1a5cf73d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,7 +13,7 @@ "forwardPorts": [5432], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "pip install -r requirements.txt", + "postCreateCommand": "pip install -e .", // python scripts/tutorials/generate_database.py sqlite // python scripts/tutorials/generate_database.py postgres postgres://postgres@localhost:5432 diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index b9c1bf92d..45fc3f64f 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install . - name: Test with pytest run: | diff --git a/.github/workflows/scheduled-tests.yml b/.github/workflows/scheduled-tests.yml index 40d53094d..003e82335 100644 --- a/.github/workflows/scheduled-tests.yml +++ b/.github/workflows/scheduled-tests.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install . - name: Test with pytest run: | diff --git a/.gitignore b/.gitignore index eb9083205..3974077a9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,6 @@ .ds_store *.code-workspace .ipynb_checkpoints - +*.egg-info +simple/version.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..7d7e162fc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,42 @@ +[build-system] +requires = [ + "setuptools>=75", + "setuptools_scm", + ] +build-backend = "setuptools.build_meta" + + +[project] +name = "simple" +description = "SIMPLE Archive Software" +dynamic = ["version"] +readme = "README.md" +license = {file = "LICENSE"} +authors = [ + {name = "Kelle Cruz", email = "kellecruz@gmail.com"}, + {name = "David Rodriguez", email = "drodriguez@stsci.edu"}, +] +requires-python = ">= 3.10" +dependencies = [ + "astrodbkit", + "astrodb_utils", + "ads", + "matplotlib", +] + +[project.optional-dependencies] +test = [ + "pytest", +] +all = ["simple[test]"] + +[project.urls] +Repository = "https://github.com/SIMPLE-AstroDB/SIMPLE-db" +Documentation = "https://github.com/SIMPLE-AstroDB/SIMPLE-db/documentation" + + +[tool.setuptools] +packages = ["simple"] + +[tool.setuptools_scm] +write_to = "simple/version.py" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 21a111600..000000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -pytest -ads -matplotlib -astrodbkit -astrodb_utils \ No newline at end of file diff --git a/simple/__init__.py b/simple/__init__.py index e69de29bb..43efbbb57 100644 --- a/simple/__init__.py +++ b/simple/__init__.py @@ -0,0 +1,3 @@ +from .version import version as __version__ + +__all__ = ["__version__"] From be30780e096a80e0abd09c52832f723a54fdfbba Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Tue, 15 Oct 2024 20:28:18 +0000 Subject: [PATCH 2/3] Fixing to include test, updates to toml and gitignore --- .github/workflows/python-app.yml | 2 +- .github/workflows/scheduled-tests.yml | 2 +- .gitignore | 1 + pyproject.toml | 1 - 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 45fc3f64f..075854726 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install . + pip install .[test] - name: Test with pytest run: | diff --git a/.github/workflows/scheduled-tests.yml b/.github/workflows/scheduled-tests.yml index 003e82335..b4a213208 100644 --- a/.github/workflows/scheduled-tests.yml +++ b/.github/workflows/scheduled-tests.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install . + pip install .[test] - name: Test with pytest run: | diff --git a/.gitignore b/.gitignore index 3974077a9..8980eee45 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,6 @@ *.code-workspace .ipynb_checkpoints *.egg-info +build/ simple/version.py diff --git a/pyproject.toml b/pyproject.toml index 7d7e162fc..092f5f8d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,6 @@ dependencies = [ test = [ "pytest", ] -all = ["simple[test]"] [project.urls] Repository = "https://github.com/SIMPLE-AstroDB/SIMPLE-db" From 7dbaa12e8e349bbb7c4d691e7125a6f2c57e8194 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Tue, 15 Oct 2024 20:38:46 +0000 Subject: [PATCH 3/3] Documentation update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d151626f..21d7dbed3 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ We recommend using a conda environment to handle python dependencies. The follow ```bash conda create -n "simple-db" python=3.10 conda activate simple-db - pip install -r requirements.txt + pip install -e . ``` 3. In Python, connect a database file `SIMPLE.sqlite` as a Database object called `db` and recreate the database using the JSON files in the `data/` directory. Run these commands from within Python.