Skip to content

Commit

Permalink
Reorganize packaged non-code assets (#351)
Browse files Browse the repository at this point in the history
Updates #314
  • Loading branch information
JWCook committed Dec 6, 2023
2 parents 8ac3a92 + 2d0e841 commit 2c477cb
Show file tree
Hide file tree
Showing 13 changed files with 202 additions and 166 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Naturtag

[![Build status](https://github.com/pyinat/naturtag/workflows/Build/badge.svg?branch=main)](https://github.com/JWCook/naturtag/actions)
[![Build status](https://github.com/pyinat/naturtag/workflows/Build/badge.svg?branch=main)](https://github.com/pyinat/naturtag/actions)
[![Documentation Status](https://readthedocs.org/projects/naturtag/badge/?version=stable)](https://naturtag.readthedocs.io/en/stable/)
[![GitHub issues](https://img.shields.io/github/issues/pyinat/naturtag)](https://github.com/pyinat/naturtag/issues)
[![PyPI](https://img.shields.io/pypi/v/naturtag?color=blue)](https://pypi.org/project/naturtag)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 12 additions & 6 deletions naturtag/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
from platformdirs import user_data_dir
from pyinaturalist.constants import ICONIC_TAXA, RANKS, Dimensions, IntOrStr

# Packaged assets
PKG_DIR = Path(__file__).parent.parent
# Packaged asset directories
PKG_DIR = Path(__file__).parent
ROOT_DIR = PKG_DIR.parent
ASSETS_DIR = PKG_DIR / 'assets'
if not ASSETS_DIR.exists():
ASSETS_DIR = ROOT_DIR / 'assets'
DATA_DIR = ASSETS_DIR / 'data'
ICONS_DIR = ASSETS_DIR / 'icons'

# Packaged asset files
CLI_COMPLETE_DIR = ASSETS_DIR / 'autocomplete'
PACKAGED_TAXON_DB = ASSETS_DIR / 'taxonomy.tar.gz'
LOCALES_PATH = ASSETS_DIR / 'locales.json'
PACKAGED_TAXON_DB = DATA_DIR / 'taxonomy.tar.gz'
LOCALES_PATH = DATA_DIR / 'locales.json'
APP_ICON = ICONS_DIR / 'logo.ico'
APP_LOGO = ICONS_DIR / 'logo.png'
SPINNER = ICONS_DIR / 'spinner_250px.svg'
Expand All @@ -27,7 +33,7 @@
# Project info
DOCS_URL = 'https://naturtag.readthedocs.io/en/latest/app.html'
REPO_URL = 'https://github.com/pyinat/naturtag'
TAXON_DB_URL = 'https://github.com/pyinat/naturtag/raw/main/assets/taxonomy.tar.gz'
TAXON_DB_URL = 'https://github.com/pyinat/naturtag/raw/main/assets/data/taxonomy.tar.gz'

# Thumnbnail settings
IMAGE_FILETYPES = ['*.jpg', '*.jpeg', '*.png', '*.gif', '*.webp']
Expand Down Expand Up @@ -78,7 +84,7 @@
# Theme/window/display settings
DEFAULT_WINDOW_SIZE = (1500, 1024)
MAX_LABEL_CHARS = 80
QSS_PATH = ASSETS_DIR / 'style.qss'
QSS_PATH = DATA_DIR / 'style.qss'
MAX_DISPLAY_HISTORY = 50 # Max number of history items to display at a time
MAX_DISPLAY_OBSERVED = 100 # Max number of observed taxa to display at a time
MAX_DIR_HISTORY = 10
Expand Down
2 changes: 1 addition & 1 deletion packaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This directory contains scripts and config for building Naturtag packages in the
# Release steps
* Locally build full taxonomy FTS database (See: https://pyinaturalist-convert.readthedocs.io/en/stable/modules/fts.html)
* Export subset of db (English language, common species only) with `export_taxa.sh`
* Commit to repo under `assets/taxonomy.tar.gz`
* Commit to repo under `assets/data/taxonomy.tar.gz`
* Update version in `pyproject.toml` and Actual Installer config (`naturtag.aip`)
* Create and push new git tag. This will trigger jobs to build packages and create a new GitHub release.
* Export full db with `export_taxa_full.sh`
Expand Down
2 changes: 1 addition & 1 deletion packaging/build_fpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mkdir -p $PKG_DIR/opt
mkdir -p $PKG_DIR/usr/share/applications
mkdir -p $PKG_DIR/usr/share/icons/hicolor/scalable/apps
cp -r $SRC_DIR $PKG_DIR/opt/
cp $ASSETS_DIR/naturtag.desktop $PKG_DIR/usr/share/applications/
cp naturtag.desktop $PKG_DIR/usr/share/applications/
cp $ASSETS_DIR/icons/logo.svg $PKG_DIR/usr/share/icons/hicolor/scalable/apps/naturtag.svg

# Set file permissions
Expand Down
2 changes: 1 addition & 1 deletion packaging/export_taxa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DATA_DIR=$HOME/.local/share/pyinaturalist/
SRC_DB=$DATA_DIR/observations.db
TAXON_CSV=taxon.csv
TAXON_FTS_CSV=taxon_fts.csv
ARCHIVE=assets/taxonomy.tar.gz
ARCHIVE=assets/data/taxonomy.tar.gz

echo 'Exporting Taxon table...'
sqlite3 -header -csv $SRC_DB \
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions packaging/naturtag.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PROJECT_NAME = 'naturtag'
PROJECT_DIR = Path('.').absolute()
ASSETS_DIR = PROJECT_DIR / 'assets'
ICONS_DIR = ASSETS_DIR / 'icons'
ASSETS_DATA_DIR = ASSETS_DIR / 'data'
PACKAGE_DIR = PROJECT_DIR / 'naturtag'

LOCAL_VENV_DIR = Path('~/.virtualenvs/naturtag').expanduser().absolute()
Expand Down Expand Up @@ -45,8 +46,8 @@ a = Analysis(
datas=[
(str(ICONS_DIR / '*.ico'), 'assets/icons'),
(str(ICONS_DIR / '*.png'), 'assets/icons'),
(str(ASSETS_DIR / '*.qss'), 'assets'),
(str(ASSETS_DIR / '*.tar.gz'), 'assets'),
(str(ASSETS_DATA_DIR / '*.qss'), 'assets/data'),
(str(ASSETS_DATA_DIR / '*.tar.gz'), 'assets/data'),
],
hiddenimports=hiddenimports,
hookspath=[],
Expand Down
311 changes: 164 additions & 147 deletions poetry.lock

Large diffs are not rendered by default.

26 changes: 19 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ description = 'Tag your nature photos with iNat taxonomy and observation metadat
authors = ['Jordan Cook']
license = 'MIT'
readme = 'README.md'
homepage = 'https://github.com/JWCook/naturtag'
repository = 'https://github.com/JWCook/naturtag'
homepage = 'https://github.com/pyinat/naturtag'
repository = 'https://github.com/pyinat/naturtag'
documentation = 'https://naturtag.readthedocs.io'
classifiers = [
'Development Status :: 3 - Alpha',
Expand All @@ -20,12 +20,18 @@ classifiers = [
'Typing :: Typed',
]
include = [
{ path = '*.kv' },
{ path = '*.md' },
{ path = '*.yml' },
{ path = 'assets' },
{ path = 'docs', format = 'sdist' },
{ path = 'test', format = 'sdist' }
{ path = 'test', format = 'sdist' },
]
exclude = [
"assets/demo_images/*",
"assets/screenshots/*",
"assets/icons/*-preview.*",
"assets/icons/*.bmp",
"assets/icons/*.xcf",

]

[tool.poetry.dependencies]
Expand Down Expand Up @@ -69,8 +75,14 @@ pytest-xdist = '>=2.2'
[tool.poetry.extras]
all = []
docs = [
'furo', 'linkify-it-py', 'myst-parser', 'sphinx', 'sphinx-autodoc-typehints',
'sphinx-copybutton', 'sphinx-design','sphinxcontrib-apidoc',
'furo',
'linkify-it-py',
'myst-parser',
'sphinx',
'sphinx-autodoc-typehints',
'sphinx-copybutton',
'sphinx-design',
'sphinxcontrib-apidoc',
]

[tool.poetry.scripts]
Expand Down

0 comments on commit 2c477cb

Please sign in to comment.