Skip to content

Various housekeeping updates #128

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

Merged
merged 15 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 11 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
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,39 @@ This is the repository for the NSLS-II Facility API codebase.

## Developer Notes

In order to develop locally you will need to have a local MongoDB running.
This can be installed using your preferred method, a native install or [running a container](https://hub.docker.com/_/mongo) work perfectly fine.

Once you have MongoDB up and running you then need to 'seed' the facility and beamline information that
does not get pulled from any other source.

The files for the collections can be found within the `/nsls2/software/dssi/nsls2core/nsls2core-development.tgz`

1. Copy and unpack the archive into a directory (e.g. `nsls2core-development`) to your development machine

2. Import facility information into the local mongodb```
```bash
mongorestore --uri="mongodb://localhost:27017" --nsFrom=nsls2core-development.facilities --nsTo=nsls2core-development.facilities ./nsls2core-development/facilities.bson
```
3. Import beamline information into the local mongodb
```bash
mongorestore --uri="mongodb://localhost:27017" --nsFrom=nsls2core-development.beamlines --nsTo=nsls2core-development.beamlines ./nsls2core-development/beamlines.bson
```

You will then need to create a `.env` file that contains the configuration (an example can also be found in the same
directory as the json files).

1. Copy `/nsls2/software/dssi/nsls2core/.env.development` to your local machine
2. Rename to `.env` and place in the `src/nsls2api` directory in your cloned repo (in the same folder as `main.py`)

### Updating Dependencies

The project uses `pip-compile` to manage the `requirements.txt` and `requirements-dev.txt`.
In order to upgrade the packages you will need to install `pip-tools`. Then to upgrade simply run
The project uses `uv pip compile` to manage the `requirements.txt` and `requirements-dev.txt` files.

In order to upgrade the packages you will need to simply run

```
pip-compile requirements-dev.in --upgrade
pip-compile requirements.in --upgrade
uv pip compile requirements-dev.in --upgrade -o requirements-dev.txt
uv pip compile requirements.in --upgrade -o requirements.txt
Comment on lines +48 to +49
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a uv sync required after compile?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry no, it would just be a uv pip install -r requirements.txt - I will explicitly add that...

```

104 changes: 48 additions & 56 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# This file was autogenerated by uv via the following command:
# uv pip compile requirements-dev.in -o requirements-dev.txt
aiohappyeyeballs==2.4.3
aiohappyeyeballs==2.4.4
# via aiohttp
aiohttp==3.10.11
aiohttp==3.11.11
# via
# aiohttp-jinja2
# textual-dev
# textual-serve
aiohttp-jinja2==1.6
# via textual-serve
aiosignal==1.3.1
aiosignal==1.3.2
# via aiohttp
annotated-types==0.7.0
# via pydantic
anyio==4.6.2.post1
anyio==4.8.0
# via
# asyncer
# httpx
asgi-lifespan==2.1.0
# via -r requirements-dev.in
asttokens==2.4.1
asttokens==3.0.0
# via stack-data
asyncer==0.0.8
# via -r requirements-dev.in
attrs==24.2.0
attrs==24.3.0
# via aiohttp
black==24.10.0
# via -r requirements-dev.in
Expand All @@ -33,17 +33,15 @@ brotli==1.1.0
# via geventhttpclient
bunnet==1.3.0
# via -r requirements-dev.in
certifi==2024.8.30
certifi==2024.12.14
# via
# geventhttpclient
# httpcore
# httpx
# requests
cffi==1.17.1
# via cryptography
charset-normalizer==3.4.0
charset-normalizer==3.4.1
# via requests
click==8.1.7
click==8.1.8
# via
# black
# bunnet
Expand All @@ -53,10 +51,8 @@ click==8.1.7
# userpath
configargparse==1.7
# via locust
coverage==7.6.4
coverage==7.6.10
# via -r requirements-dev.in
cryptography==43.0.3
# via secretstorage
decorator==5.1.1
# via ipython
distlib==0.3.9
Expand All @@ -67,7 +63,7 @@ executing==2.1.0
# via stack-data
filelock==3.16.1
# via virtualenv
flask==3.0.3
flask==3.1.0
# via
# flask-cors
# flask-login
Expand All @@ -81,30 +77,28 @@ frozenlist==1.5.0
# aiohttp
# aiosignal
gevent==24.11.1
# via
# geventhttpclient
# locust
geventhttpclient==2.3.1
# via geventhttpclient
geventhttpclient==2.3.3
# via locust
greenlet==3.1.1
# via gevent
h11==0.14.0
# via httpcore
hatch==1.13.0
hatch==1.14.0
# via -r requirements-dev.in
hatch-requirements-txt==0.4.1
# via -r requirements-dev.in
hatch-vcs==0.4.0
# via -r requirements-dev.in
hatchling==1.26.3
hatchling==1.27.0
# via
# -r requirements-dev.in
# hatch
# hatch-requirements-txt
# hatch-vcs
httpcore==1.0.6
httpcore==1.0.7
# via httpx
httpx==0.27.2
httpx==0.28.1
# via hatch
hyperlink==21.0.0
# via hatch
Expand All @@ -117,7 +111,7 @@ idna==3.10
# yarl
iniconfig==2.0.0
# via pytest
ipython==8.29.0
ipython==8.31.0
# via -r requirements-dev.in
itsdangerous==2.2.0
# via flask
Expand All @@ -129,24 +123,20 @@ jaraco-functools==4.1.0
# via keyring
jedi==0.19.2
# via ipython
jeepney==0.8.0
# via
# keyring
# secretstorage
jinja2==3.1.5
# via
# aiohttp-jinja2
# flask
# textual-serve
keyring==25.5.0
keyring==25.6.0
# via hatch
lazy-model==0.2.0
# via bunnet
linkify-it-py==2.0.3
# via markdown-it-py
locust==2.32.2
locust==2.32.5
# via -r requirements-dev.in
markdown-it-py[linkify,plugins]==3.0.0
markdown-it-py==3.0.0
# via
# mdit-py-plugins
# rich
Expand Down Expand Up @@ -207,35 +197,35 @@ pluggy==1.5.0
# pytest
prompt-toolkit==3.0.48
# via ipython
propcache==0.2.0
# via yarl
psutil==6.1.0
propcache==0.2.1
# via
# aiohttp
# yarl
psutil==6.1.1
# via locust
ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.3
# via stack-data
pycparser==2.22
# via cffi
pydantic==2.9.2
pydantic==2.10.5
# via
# bunnet
# lazy-model
pydantic-core==2.23.4
pydantic-core==2.27.2
# via pydantic
pygments==2.18.0
pygments==2.19.1
# via
# ipython
# rich
pymongo==4.10.1
# via bunnet
pyright==1.1.388
pyright==1.1.391
# via -r requirements-dev.in
pytest==8.3.3
pytest==8.3.4
# via
# -r requirements-dev.in
# pytest-asyncio
pytest-asyncio==0.24.0
pytest-asyncio==0.25.2
# via -r requirements-dev.in
pyzmq==26.2.0
# via locust
Expand All @@ -246,28 +236,29 @@ rich==13.9.4
# hatch
# textual
# textual-serve
ruff==0.7.3
ruff==0.9.0
# via -r requirements-dev.in
secretstorage==3.3.3
# via keyring
setuptools==75.8.0
# via
# locust
# setuptools-scm
# zope-event
# zope-interface
setuptools-scm==8.1.0
# via hatch-vcs
shellingham==1.5.4
# via hatch
six==1.16.0
# via asttokens
sniffio==1.3.1
# via
# anyio
# asgi-lifespan
# httpx
stack-data==0.6.3
# via ipython
textual==0.85.2
textual==1.0.0
# via
# textual-dev
# textual-serve
textual-dev==1.6.1
textual-dev==1.7.0
# via -r requirements-dev.in
textual-serve==1.1.1
# via textual-dev
Expand All @@ -281,28 +272,29 @@ traitlets==5.14.3
# via
# ipython
# matplotlib-inline
trove-classifiers==2024.10.21.16
trove-classifiers==2025.1.7.14
# via hatchling
typing-extensions==4.12.2
# via
# anyio
# pydantic
# pydantic-core
# pyright
# textual
# textual-dev
uc-micro-py==1.0.3
# via linkify-it-py
urllib3==2.2.3
urllib3==2.3.0
# via
# geventhttpclient
# requests
userpath==1.9.2
# via hatch
uv==0.5.1
uv==0.5.16
# via
# -r requirements-dev.in
# hatch
virtualenv==20.27.1
virtualenv==20.28.1
# via hatch
wcwidth==0.2.13
# via prompt-toolkit
Expand All @@ -311,11 +303,11 @@ werkzeug==3.1.3
# flask
# flask-login
# locust
yarl==1.17.1
yarl==1.18.3
# via aiohttp
zope-event==5.0
# via gevent
zope-interface==7.1.1
zope-interface==7.2
# via gevent
zstandard==0.23.0
# via hatch
Loading
Loading