-
Notifications
You must be signed in to change notification settings - Fork 48
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
Manage dependencies #113
Manage dependencies #113
Changes from 12 commits
46cdeef
f1279ab
bf8c9c0
0f7c8bd
f8f18b9
0a673d5
eb70401
474b1b6
074178e
c19783d
00598a2
00638ae
ef16bf9
e9a67a3
8010886
bfc44b0
63573c7
d6440e0
3c0fbfb
b1a1e4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,17 +16,10 @@ license = {file = "LICENSE"} | |
requires-python = ">=3.7" | ||
dependencies = [ | ||
"apache-airflow >=2.0", | ||
"apache-airflow-providers-postgres", | ||
"apache-airflow-providers-snowflake", | ||
"apache-airflow-providers-google", | ||
"python-frontmatter", | ||
"pandas >=1.3.4", | ||
"s3fs", | ||
"snowflake-sqlalchemy ==1.2.0", | ||
"snowflake-connector-python[pandas]", | ||
"smart-open[all]>=5.2.1", | ||
"SQLAlchemy==1.3.24", | ||
"sqlalchemy-bigquery==1.3.0", | ||
"apache-airflow-providers-postgres", | ||
"markupsafe>=1.1.1,<2.1.0" | ||
] | ||
|
||
|
@@ -47,6 +40,46 @@ tests = [ | |
"pytest >=6.0", | ||
"pytest-dotenv", | ||
"requests-mock", | ||
"apache-airflow-providers-google", | ||
"sqlalchemy-bigquery==1.3.0", | ||
"smart-open[all]>=5.2.1", | ||
"apache-airflow-providers-snowflake", | ||
"snowflake-sqlalchemy ==1.2.0", | ||
"snowflake-connector-python[pandas]", | ||
"apache-airflow-providers-postgres", | ||
"s3fs", | ||
"smart-open[s3]>=5.2.1", | ||
] | ||
google = [ | ||
"apache-airflow-providers-google", | ||
"sqlalchemy-bigquery==1.3.0", | ||
"smart-open[gcs]>=5.2.1", | ||
] | ||
snowflake = [ | ||
"apache-airflow-providers-snowflake", | ||
"snowflake-sqlalchemy ==1.2.0", | ||
"snowflake-connector-python[pandas]", | ||
] | ||
postgres = [ | ||
"apache-airflow-providers-postgres", | ||
] | ||
amazon = [ | ||
"s3fs", | ||
"smart-open[s3]>=5.2.1", | ||
] | ||
all = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @uranusjr Does I wanted to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The keys here can be arbitrary, everything should work. (Well, if it is a valid extra name.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flit currently only puts license information in trove classifiers. The license field is pending standardisation. (If we really want to we can probably extend Flit to add that field to the wheel, but the value wouldn’t be very useful due to its lack of standardisation.) The second issue you linked is requesting a “magic” extra that’s added automatically without declaring. IMO that’s not that good an idea, but manually declaring There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"pytest >=6.0", | ||
"pytest-dotenv", | ||
"requests-mock", | ||
"apache-airflow-providers-google", | ||
"sqlalchemy-bigquery==1.3.0", | ||
"smart-open[all]>=5.2.1", | ||
"apache-airflow-providers-snowflake", | ||
"snowflake-sqlalchemy ==1.2.0", | ||
"snowflake-connector-python[pandas]", | ||
"apache-airflow-providers-postgres", | ||
"s3fs", | ||
"smart-open[s3]>=5.2.1", | ||
] | ||
|
||
[project.urls] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
DEFAULT_CHUNK_SIZE = 1000000 | ||
PYPI_PROJECT_NAME = "astro-projects" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
Copyright Astronomer, Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
from astro import constants | ||
|
||
|
||
class MissingPackage(object): | ||
def __init__(self, module_name, related_extras): | ||
self.module_name = module_name | ||
self.related_extras = related_extras | ||
|
||
def __getattr__(self, item): | ||
raise RuntimeError( | ||
f"Error loading the module {self.module_name}," | ||
f" please make sure all the dependencies are installed." | ||
f" try - pip install {constants.PYPI_PROJECT_NAME}[{self.related_extras}]" | ||
) | ||
|
||
|
||
try: | ||
from airflow.providers.google.cloud.hooks.bigquery import BigQueryHook | ||
except ModuleNotFoundError: | ||
BigQueryHook = MissingPackage( | ||
"airflow.providers.google.cloud.hooks.bigquery", "google" | ||
) | ||
|
||
try: | ||
from airflow.providers.postgres.hooks.postgres import PostgresHook | ||
except ModuleNotFoundError: | ||
PostgresHook = MissingPackage( | ||
"airflow.providers.postgres.hooks.postgres", "postgres" | ||
) | ||
|
||
try: | ||
from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook | ||
except ModuleNotFoundError: | ||
SnowflakeHook = MissingPackage( | ||
"airflow.providers.snowflake.hooks.snowflake", "snowflake" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user needs Postgres support, they’d install
astro[postgres]
and pick up the Postgres provider from the extra, so this line shouldn’t be needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So Postgre is default DB until we have support for sqlite.