Skip to main content

target_selection

Versions Documentation Status

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 uv for dependency specification and resolution. To install uv follow these instructions. Then you can install the project for development with

cd target_selection
uv sync --group dev

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 dependency group, those need to be manually pip-installed in this case). Please, do not add new dependencies without updating the uv.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.

$ uv tool install ruff
$ ruff format ./src/
1 file reformatted, 46 files left unchanged
$ ruff check ./src/
All checks passed!

ty is the recommended type checker.

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.tabSize": 2,
    "editor.autoIndent": "advanced",
  },
  "prettier.tabWidth": 2,
  "editor.rulers": [88],
  "editor.wordWrapColumn": 88,
  "ruff.nativeServer": true
}

which will apply the formatting and linting automatically on save.

Working with sdssdb

Often developing target_selection requires concurrent changes to sdssdb. This presents a bit of a challenge to keep everything in sync and provide a convenient developing environment.

The recommended way to develop with target_selection and sdssdb is to install sdssdb in editable mode in the target_selection environment. To do this run

pip install -e <PATH-TO-SDSSDB-ROOT-DIR>

After this if you run

pip list | grep sdssdb

you should see a path next to the version, indicating that sdssdb is being imported from that path. Any local changes in that path will be applied when target_selection imports sdssdb.

Updating sdssdb and other dependencies before tagging

When tagging target_selection please make sure that you've tagged sdssdb (if needed) and that the lockfile reflects the change. First you'll need to install uv (this should only be required once).

Once uv is installed follow these instructions:

  1. If there are changes in sdssdb that affect target_selection, tag sdssdb. Please do update the sdssdb change log adding the header indicating the date in which the release was made. Note that you don't necessarily need to do this every time that target_selection is tagged, only when the new target_selection tag depends on untagged changes in sdssdb.

  2. Update the version in pyproject.toml to the release version.

  3. Update the dependency for sdssdb in pyproject.toml for example if sdssdb 0.14.1 has just been tagged, change

    sdssdb = "0.14.0"
    

    to

    sdssdb = "0.14.1"
    
  4. Recreate the lockfile with

    uv lock
    

    It may take a bit of time for package indexes to detect a recently released version of sdss. You may want to run uv lock --refresh to force a fresh resolution.

    Note that uv lock will not update the version of sdssdb in your virtual environment, only the lockfile. If you do want to update the dependency and the lockfile use uv lock --upgrade-package sdssdb (or uv lock --upgrade to update all the dependencies).

  5. Commit the new changes (including the uv.lock file) and tag the new version of target_selection.

Metadata

Release files for sdss-target-selection 1.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sdss-target-selection 1.5.2
File Size Uploaded
sdss_target_selection-1.5.2.tar.gz 300.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sdss-target-selection 1.5.2
File Interpreter ABI Platform
sdss_target_selection-1.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 645.5 kB

Release files / sdss_target_selection-1.5.2.tar.gz

Download URL sdss_target_selection-1.5.2.tar.gz
Size 300.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6b4dc55716f2a614e22c947bad8ae83db1371d7db3a3395644cfc9b2939ad09d
BLAKE2b-256 checksum
How to use checksums
70c1a9770ed2bb719526072236af59ee902af6e4620658bd9de95724bc124dd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release files / sdss_target_selection-1.5.2-py3-none-any.whl

Download URL sdss_target_selection-1.5.2-py3-none-any.whl
Size 344.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fdc0e556dc7020a47841f085a681a34f39a103a076c2dffdefc6222774a1aa8
BLAKE2b-256 checksum
How to use checksums
c1df7ac67f64d0f1f0f8eb383edb302285964cb1a57907fc14bdb5684231a626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.5.2 This release

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.22

2 release files

1.3.21

2 release files

1.3.20

2 release files

1.3.19

2 release files

1.3.18

2 release files

1.3.17

2 release files

1.3.16

2 release files

1.3.15

2 release files

1.3.14

2 release files

1.3.13

2 release files

1.3.10

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page