Code to perform target selection for BHM/MWM using catalogdb
Project description
target_selection
Code to perform target selection for BHM/MWM using catalogdb.
Installation
To install target_selection
do
pip install sdss-target-selection
or from the GitHub repository
git clone git@github.com:sdss/target_selection
cd target_selection
pip install .
Development
This code adheres to the SDSS Coding Standards.
We use poetry as the PEP517 backend and for dependency specification and resolution. To install poetry
follow these instructions. The you can install the project for development with
cd target_selection
poetry install
Note that as long as you don't need to install or update dependencies you can still install target_selection
in editable mode with
pip install -e .
(this will not install the development packages under the dev
dependencies group, those need to be manually pip-installed in this case). Please, do not add new dependencies without updating the poetry.lock
file. One of the workflows that run on commit will check that the lockfile is still valid.
We use ruff for both linting, import sorting, and code formatting. The configuration is stored in pyproject.toml
and it's mainly the default ruff
configuration (and similar to flake8
) but with a line length of 99 characters for historical reasons and because it simplifies writing long Peewee/SQLAlchemy query statements. The formatting is similar to black, and thus quite opinionated.
A workflow checks for linting and formatting errors on each commit, and pull requests are blocked until the workflow succeeds. The easiest way to fix these problems is by installing ruff
and letting it format the code, and then checking if any linting errors remain. The commands ruff format
and ruff check
are independent and both must be run.
$ pip install ruff
$ ruff format ./python/
1 file reformatted, 46 files left unchanged
$ ruff check ./python/
All checks passed!
Updating the package version can be done directly in the pyproject.toml
file and doesn't require having poetry
installed or otherwise updating the lockfile.
Visual Studio Code configuration
If using Visual Studio Code, it is recommended to install the ruff and prettier extensions. Then you can create a workspace file inside the cloned repo, under .vscode/settings.json
with the following configuration
{
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports.ruff": "explicit"
},
"editor.wordWrap": "off",
"editor.tabSize": 4,
"editor.defaultFormatter": "charliermarsh.ruff"
},
"[markdown]": {
"editor.wordWrapColumn": 88
},
"[restructuredtext]": {
"editor.wordWrapColumn": 88
},
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
},
"[yaml]": {
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.autoIndent": "advanced",
},
"prettier.tabWidth": 2,
"editor.rulers": [99],
"editor.wordWrapColumn": 99,
"python.analysis.typeCheckingMode": "off",
"ruff.nativeServer": true
}
which will apply the formatting and linting automatically on save.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sdss_target_selection-1.3.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cc19dea6a54b450a1707464670f0b1722831120ba763501773000cb25e3de1c |
|
MD5 | 2410e491a27667371ed3f569d4cf03a6 |
|
BLAKE2b-256 | 731fe437f1e37cbecc12cc91726e61b49ce09fce3907d540b3a5a43a0bf47274 |
Hashes for sdss_target_selection-1.3.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c232d00c591f8d7ab0462c75000ccb283d2f3b003cd83fce82f2871ee1751d63 |
|
MD5 | bcecc8e75758e9d19edd3cb0462a6463 |
|
BLAKE2b-256 | 969938762e58981f000196bb446a3b6c906dd242852a692b67ad36cabb6ffdce |