From 593019b2c1617c5333808a583c1b0c43c2446a1c Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Wed, 12 Jun 2024 09:33:51 -0400 Subject: [PATCH] Create requirements.txt file (#504) * Create requirements.txt file * Removing old files and updating documentation * Updating tests to use requirements.txt * add explicit python vs command line * fix numbering. --------- Co-authored-by: Kelle Cruz --- .devcontainer/devcontainer.json | 2 +- .github/workflows/python-app.yml | 4 +- .github/workflows/scheduled-tests.yml | 4 +- README.md | 16 +++--- environment.yml | 78 --------------------------- requirements.txt | 5 ++ 6 files changed, 16 insertions(+), 93 deletions(-) delete mode 100644 environment.yml create mode 100644 requirements.txt diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 791651152..ec689f0c1 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 astrodbkit2 pytest psycopg2 ads git+https://github.com/astrodbtoolkit/astrodb_utils.git@main", + "postCreateCommand": "pip install -r requirements.txt", // 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 05cbf5514..b9c1bf92d 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -24,9 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest ads matplotlib - pip install astrodbkit2 - pip install git+https://github.com/astrodbtoolkit/astrodb_utils.git@main + pip install -r requirements.txt - name: Test with pytest run: | diff --git a/.github/workflows/scheduled-tests.yml b/.github/workflows/scheduled-tests.yml index 8473c7230..40d53094d 100644 --- a/.github/workflows/scheduled-tests.yml +++ b/.github/workflows/scheduled-tests.yml @@ -24,9 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest ads - pip install astrodbkit2 - pip install git+https://github.com/astrodbtoolkit/astrodb_utils.git@main + pip install -r requirements.txt - name: Test with pytest run: | diff --git a/README.md b/README.md index 836c89822..5d2a20ebd 100644 --- a/README.md +++ b/README.md @@ -26,16 +26,15 @@ If you'd like to set up your own copy of the SIMPLE database, here's what we rec 1. Clone or download a copy of this repo locally onto your computer. 2. Set up an environment for the Python code and install dependencies. -A conda environment file `environment.yml` exists for convenience. The following commands will use that file to create and activate an - environment called `simple-db`: - +We recommend using a conda environment to handle python dependencies. The following commands will use that file to create and activate an + environment called `simple-db`. Run these commands at the terminal command prompt ```bash - conda env create -f environment.yml + conda create -n "simple-db" python=3.10 conda activate simple-db + pip install -r requirements.txt ``` -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. - +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. ```python from astrodb_utils import load_astrodb from simple.schema import * @@ -49,15 +48,16 @@ A conda environment file `environment.yml` exists for convenience. The following 4. Use `astrodbkit2` to [explore](https://astrodbkit2.readthedocs.io/en/latest/#exploring-the-schema), [query](https://astrodbkit2.readthedocs.io/en/latest/#querying-the-database), and/or [modify](https://astrodbkit2.readthedocs.io/en/latest/#modifying-data) the database. For example: - Find all objects in the database with "0141" in the name - ``` + ```python db.search_object('0141', fmt='astropy') ``` - See all the data in the database for 2MASS J01415823-4633574 - ``` + ```python db.inventory('2MASS J01415823-4633574', pretty_print=True) ``` + 5. The database can also be modified using helper scripts found in [`simple/utils`](simple/utils) and in the [`astrodb_utils`](https://github.com/astrodbtoolkit/astrodb_utils) package. Previously used scripts to modify and/or update the database are stored in the [`scripts/`](scripts) directory and can be used for inspiration. ## Contributor Instructions diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 017ecb35e..000000000 --- a/environment.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: simple-db -channels: - - conda-forge - - defaults -dependencies: - - bzip2=1.0.8=h0d85af4_4 - - ca-certificates=2022.12.7=h033912b_0 - - libffi=3.4.2=h0d85af4_5 - - libsqlite=3.40.0=ha978bb4_0 - - libzlib=1.2.13=hfd90126_4 - - ncurses=6.3=h96cf925_1 - - openssl=3.0.8=hfd90126_0 - - pip=23.0=pyhd8ed1ab_0 - - python=3.10.9=he7542f4_0_cpython - - readline=8.1.2=h3899abd_0 - - setuptools=67.1.0=pyhd8ed1ab_0 - - tk=8.6.12=h5dbffcc_0 - - tzdata=2022g=h191b570_0 - - wheel=0.38.4=pyhd8ed1ab_0 - - xz=5.2.6=h775f41a_0 - - pip: - - ads==0.12.3 - - asdf==2.14.3 - - asdf-astropy==0.3.0 - - asdf-coordinates-schemas==0.1.0 - - asdf-standard==1.0.3 - - asdf-transform-schemas==0.3.0 - - asdf-unit-schemas==0.1.0 - - asdf-wcs-schemas==0.1.1 - - astrodbkit2==0.5.1 - - astropy==5.2.1 - - astroquery==0.4.6 - - attrs==22.2.0 - - beautifulsoup4==4.11.2 - - certifi==2022.12.7 - - charset-normalizer==3.0.1 - - exceptiongroup==1.1.0 - - greenlet==2.0.2 - - gwcs==0.18.3 - - html5lib==1.1 - - httpretty==0.8.10 - - idna==3.4 - - importlib-metadata==6.0.0 - - iniconfig==2.0.0 - - jaraco-classes==3.2.3 - - jmespath==1.0.1 - - jsonschema==4.17.3 - - keyring==23.13.1 - - markupsafe==2.1.2 - - mock==5.0.1 - - more-itertools==9.0.0 - - ndcube==2.0.3 - - numpy==1.24.2 - - packaging==23.0 - - pandas==1.5.3 - - pluggy==1.0.0 - - pyerfa==2.0.0.1 - - pyrsistent==0.19.3 - - pytest==7.2.1 - - python-dateutil==2.8.2 - - pytz==2022.7.1 - - pyvo==1.4 - - pyyaml==6.0 - - requests==2.28.2 - - scipy==1.10.0 - - semantic-version==2.10.0 - - six==1.16.0 - - soupsieve==2.3.2.post1 - - specutils==1.9.1 - - sqlalchemy==2.0.3 - - tomli==2.0.1 - - tqdm==4.64.1 - - typing-extensions==4.4.0 - - urllib3==1.26.14 - - webencodings==0.5.1 - - werkzeug==2.2.2 - - zipp==3.13.0 - - git+https://github.com/astrodbtoolkit/astrodb_utils.git@main \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..52fbf3f5d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +pytest +ads +matplotlib +astrodbkit2 +git+https://github.com/astrodbtoolkit/astrodb_utils.git@main