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

feat(databases): create CACHE structure to ftp Directories & add CNES database #152

Merged
merged 35 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6bfb404
chore(Databases): explicity require load() content on Databases
luabida Sep 4, 2023
85fcbc3
Finish CNES
luabida Sep 5, 2023
d7375d4
remove lru_cache; returning [] when it should return content
luabida Sep 5, 2023
f6ecaee
Include download and async download methods on Databases
luabida Sep 5, 2023
e8e4439
test
luabida Sep 5, 2023
f7f0c18
return the database when loading
luabida Sep 5, 2023
de12ebf
Update SINAN Notebook
luabida Sep 6, 2023
e5aaedc
Update SIM Notebook
luabida Sep 6, 2023
2e50ec0
Improving Directory class
luabida Sep 6, 2023
5b255df
Rebase
luabida Sep 13, 2023
71c5b4c
fix poetry lock
luabida Sep 13, 2023
aa75ec5
add tomli
luabida Sep 13, 2023
359c217
Recursive Directory instantiation
luabida Sep 13, 2023
f36cfbe
Refining Dirs CACHE and navigation
luabida Sep 13, 2023
0f534b6
Minor changes
luabida Sep 13, 2023
5cd575b
Remove requirements.txt
luabida Sep 14, 2023
eca250f
Move databases to their own modules, reducing the initial load time
luabida Sep 14, 2023
104feeb
Poetry lock
luabida Sep 14, 2023
5c88d39
fix(docs): remove unecessary steps to build notebooks container
luabida Sep 14, 2023
8cff7cc
fix(databases): fix CNES.get_files and make Database.__content__ a di…
luabida Sep 14, 2023
e594d78
fix(Directory): fix wrong __content__ ref on directory loading
luabida Sep 15, 2023
92b9094
fix(File): fix File __info__ & info properties
luabida Sep 15, 2023
bbc2df6
fix(ftp): closing all possible opened ftp connections
luabida Sep 15, 2023
968d589
docs(dbs): move CNES & SIM notebooks to databases docs
luabida Sep 15, 2023
6c30fbf
fix(sphinx): sphinx needs nbsphinx to be installed by conda
luabida Sep 15, 2023
d750ebf
fix(ftp): loading directories when loading dbs
luabida Sep 15, 2023
0f8d111
docs(dbs): move SINAN notebook to databases docs
luabida Sep 15, 2023
cf630a8
docs(dbs): move SINASC notebook to databases docs
luabida Sep 15, 2023
2ba3729
docs(dbs): Include Databases on sphinx index
luabida Sep 15, 2023
ee0f9b4
fix(online_data): fix references on online_data for databases usage
luabida Sep 15, 2023
5fb4323
fix(Directory): remove unnecessary root loading
luabida Sep 15, 2023
370f9d1
docs(dbs): create SIA notebook on databases docs & minor changes
luabida Sep 15, 2023
a4d3e19
docs(dbs): create SIH notebook on databases docs & rerun database not…
luabida Sep 15, 2023
14094d8
docs(all): comment broken notebooks to fix in next PR, move documenta…
luabida Sep 15, 2023
3c5e57d
fix(dockerfile): fix notebooks paths on container
luabida Sep 15, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
mamba-version: "*"
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: env-pysus
activate-environment: pysus
use-mamba: true
miniforge-variant: Mambaforge

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
mamba-version: "*"
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: env-pysus
activate-environment: pysus
use-mamba: true
miniforge-variant: Mambaforge

Expand Down
18 changes: 2 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,6 @@ SEMANTIC_RELEASE = npx --yes \
semantic-release


#* Poetry
.PHONY: poetry-download
poetry-download:
curl -sSL https://install.python-poetry.org | $(PYTHON) -

.PHONY: poetry-remove
poetry-remove:
curl -sSL https://install.python-poetry.org | $(PYTHON) - --uninstall

#* Installation
.PHONY: install
install:
poetry lock -n && poetry export --without-hashes > requirements.txt
poetry build && poetry install

.PHONY: pre-commit-install
pre-commit-install:
poetry run pre-commit install
Expand Down Expand Up @@ -79,8 +64,9 @@ test-jupyter-pysus: ## run pytest for notebooks inside jupyter container

.PHONY: test
test: ## run tests quickly with the default Python
cp docs/source/**/*.ipynb pysus/Notebooks
poetry run pytest -vv pysus/tests/
poetry run pytest --nbmake --nbmake-timeout=800 docs/source/*.ipynb pysus/Notebooks/*.ipynb
poetry run pytest --nbmake --nbmake-timeout=800 pysus/Notebooks/*.ipynb

coverage: ## check code coverage quickly with the default Python
coverage run --source pysus/tests/ -m pytest
Expand Down
12 changes: 3 additions & 9 deletions conda/dev.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
name: env-pysus
name: pysus
channels:
- conda-forge
- nodefaults
dependencies:
- python >= 3.11
- cffi
- docker-compose
- gcc
- make
- nbsphinx
- pip
- psycopg2
- python 3.9.*
- poetry >= 1.3.2
- pip:
- urllib3 ==1.26.15
- requests
- pandas
- sqlalchemy
24 changes: 9 additions & 15 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ ENV PATH "/opt/poetry/bin:$PATH"

RUN apt-get -qq update --yes \
&& apt-get -qq install --yes --no-install-recommends \
build-essential firefox\
ca-certificates sudo curl \
build-essential \
firefox \
ca-certificates \
sudo \
curl \
&& rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash pysus \
Expand All @@ -29,27 +32,18 @@ RUN useradd -ms /bin/bash pysus \

COPY --chown=pysus:pysus conda/dev.yaml /tmp/dev.yaml
COPY --chown=pysus:pysus docker/scripts/entrypoint.sh /entrypoint.sh
COPY --chown=pysus:pysus docker/scripts/poetry_install.sh /tmp/poetry_install.sh
COPY --chown=pysus:pysus docker/scripts/poetry-install.sh /tmp/poetry-install.sh
COPY --chown=pysus:pysus pyproject.toml poetry.lock LICENSE README.md /usr/src/
COPY --chown=pysus:pysus pysus /usr/src/pysus
COPY --chown=pysus:pysus docs/source/*.ipynb /home/pysus/Notebooks/

RUN curl -sSL https://install.python-poetry.org/ | POETRY_HOME=/opt/poetry python && \
cd /usr/local/bin && \
ln -s /opt/poetry/bin/poetry && \
poetry config virtualenvs.create false

RUN chmod -R a+rwx /home/pysus/.config/pypoetry/ \
&& chown -R pysus:pysus /opt/conda/bin/
COPY --chown=pysus:pysus docs/source/**/*.ipynb /home/pysus/Notebooks/

USER pysus

RUN mamba env create -n $ENV_NAME --file /tmp/dev.yaml \
&& cd /usr/src \
&& poetry build \
&& poetry install \
&& mamba clean -afy

RUN cd /usr/src/ && bash /tmp/poetry-install.sh

WORKDIR /home/pysus/Notebooks

ENTRYPOINT ["bash", "/activate.sh"]
6 changes: 6 additions & 0 deletions docker/scripts/poetry-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -ex

poetry config virtualenvs.create false
poetry install --all-extras --with docs
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nbsphinx
sphinx
sphinx
Loading